kernel creation for FFT convolution
Posted: 2013-01-09T17:41:17-07:00
Hi all,
I'm still working with kernels trying to identify circular structures within an image.
Basically, I want to identify the best position and size of circles in an image. I am creating a set of circular kernels of different radii, that I convolve with the image and locate the peaks. The one with the highest peak is supposed to be the best fitting circular kernel. The problem is that creating a kernel like so:
which produces a white circle on a black background, doesn't identify the circle edges so well. Small kernels will still match with larger circular structures in the image. What I want to do is put a negative border around the circle so that it will match best with a structure in the image that drops at the required radius. I tried this:
which creates a black circle on a gray background, then paints a white circle of smaller radius on top.
When I use the FFT to convolve this with my image (which worked when I have the white circle on the black background), it doesn't seem to produce coherent outputs. I think that when using the FFT to convolve a kernel with an image, the kernel needs to exist over a small range, and must go to zero outsize that range. My second attempt is gray, and essentially non-zero everywhere except in the vicinity of the circle. What I'd like to do is have a kernel which is black (zero) everywhere, then paint a negative circle of radius r+2, then paint a positive (white) circle of radius r on top of it. I think this kernel might work.
However I don't know how to draw a circle of negative pixels. Can someone advise on how to do this, or suggest a better method?
Thanks
I'm still working with kernels trying to identify circular structures within an image.
Basically, I want to identify the best position and size of circles in an image. I am creating a set of circular kernels of different radii, that I convolve with the image and locate the peaks. The one with the highest peak is supposed to be the best fitting circular kernel. The problem is that creating a kernel like so:
Code: Select all
convert -size 1200x1200 xc:black -fill white -draw "circle 99,99,103,99" -alpha off circle_004.png
Code: Select all
convert -size 1200x1200 xc:gray50 -fill black -draw "circle 99,99,105,99" -fill white -draw "circle 99,99,103,99" -alpha off circle_004.png
When I use the FFT to convolve this with my image (which worked when I have the white circle on the black background), it doesn't seem to produce coherent outputs. I think that when using the FFT to convolve a kernel with an image, the kernel needs to exist over a small range, and must go to zero outsize that range. My second attempt is gray, and essentially non-zero everywhere except in the vicinity of the circle. What I'd like to do is have a kernel which is black (zero) everywhere, then paint a negative circle of radius r+2, then paint a positive (white) circle of radius r on top of it. I think this kernel might work.
However I don't know how to draw a circle of negative pixels. Can someone advise on how to do this, or suggest a better method?
Thanks