cv.jit.erode in jit.gen?

Mar 22, 2012 at 8:01pm

cv.jit.erode in jit.gen?

Hi guys, I am wondering how to implement cv.jit.erode in jit.gen.
It doesn’t sound like it would be too hard but it’s got me stumped.

The basic idea behind it is to mark a pixel as on only if all of it’s neighbours are also on.

It also has a function to give each pixel the minimum value of the pixels around it.

I know a little on how to work with planes of data in jit.gen but am not sure how to run functions that refer to individual pixels.

#62523
Mar 22, 2012 at 8:36pm

You need to use the nearest op in this case. The other alternative is the sample op, but it interpolates, which messes up an erode type operation. nearest takes a coord from [0, 1] to determine which pixel is grabs. To get the coordinate of a pixel offset from the current pixel being processed, you can use the value 1/dim as the delta between pixels:

– Pasted Max Patch, click to expand. –
#225828
Mar 22, 2012 at 10:05pm

Thanks for the response and the patch.

I seem to get only a few pixels returned from the output of the patch though.

This is your patch v cv.jit.erode

– Pasted Max Patch, click to expand. –
#225829
Mar 22, 2012 at 11:04pm

The description from the help patch about what the operator does isn’t the entire story. It’s actually more general. Here’s a modified patch that does what the object is doing:

– Pasted Max Patch, click to expand. –

Here’s the actual OpenCV function it’s using:

http://opencv.willowgarage.com/documentation/cpp/image_filtering.html#cv-erode

#225830
Mar 23, 2012 at 12:01am

Ah this is perfect. Thanks for the open CV source also. I need to practice visualising equations in max. I’ve always had trouble with that.

#225831

You must be logged in to reply to this topic.