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.
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:
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
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:
Here's the actual OpenCV function it's using:
http://opencv.willowgarage.com/documentation/cpp/image_filtering.html#cv-erode
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.