I want to find circular areas that are slightly darker than the background and have a higher standard deviation of grayscales. Generalizing, I know the shape I’m looking for and want to use the grayscale distribution as a discrimination metric.
I can hand select areas (e.g. in ImageJ) and measure mean grayscale and std dev and see it’s about 10% darker than the background and the std dev is about twice as high, here’s an example:
Right now I’m doing this in Python with numpy arrays but it’s pretty inefficient. Couple questions:
- Does this type of pattern matching have a proper name already? Cursory googling didn’t give me any hits
- Any recommendations on an efficient implementation? I’ll try it in C++ by hand but it seems like I could benefit from an optimized numerical library as I’m shifting the template over the image
Thanks,
Andrew
welcome.
I’d call that “texture analysis”.
you could run a grayscale dilation and erosion of a given kernel and radius, then take the difference of those, and that will be the range of values for a local neighborhood.
this doesn’t cope with salt-and-pepper noise too well.
or you could run a sobel/laplacian, abs/square the values, then grayscale dilate (to find local maximum).
edit: I’d even suggest simply looking at the erosion, not taking difference between dilation and erosion… in this situation. the data is such that you get a better signal from just the erosion.
1 Like
To do that you have to blur image and substract blur image (mean(x)) to image (x) : mean(x) -x
Absdiff shoud do the job
this is merely grayscale erosion using a 9x9 square kernel.
decent signal I’d say.
That looks good for segmentation, could help with a coarse search algorithm. My ultimate goal is to use a kind of template matching, though, where I can find the best fit for the center and radius of the circle. My first idea was to use normalized correlation but I want to take the distribution (“texture”) of the circular areas into account, in addition to the actual grayscale.