From: Christoph on
Hello,
I'm from Germany and my English is not very good, but I have a problem and nobody could help me till now.

I'm trying to script a Hugh-Trafo for circledetection, but instead of doing circles around the object, the objects themselfes are arranged around the edges.

I startet with this image: http://img121.imageshack.us/i/88639592.jpg/

After Edgedetection: http://img682.imageshack.us/i/edges.jpg/

And after the Hugh-Trafo: http://img199.imageshack.us/i/hughd.jpg/

In the last picture you can see the problem.
I hope my bad English not the bigger problem...

here my code:

I = imresize(I,2);
I = im2bw(I,graythresh(I));
I = double(I);
edges = edge(I,'canny');

w = linspace(0,2*pi,20);
r = 20;
xcirc = fix(r*cos(w));
ycirc = fix(r*sin(w));

[koorx,koory] = find(edges);

hugh = zeros(size(I));

for (z=1:length(koorx))
for (k=1:length(w)-1)
hugh(koorx(z)+xcirc(k),koory(z)+ycirc(k)) = hugh(koorx(z)+xcirc(k),koory(z)+ycirc(k)) + 1;
end
end

ht_out = hugh / max(max(hugh));
figure; imshow(ht_out); title('HT-Space');
colormap(hot);



thanks
From: ImageAnalyst on
I see a photo with either 3, 4, or 5 green circles in it, depending on
how you define circle. Now, what do you want to do? Tell me in
words.

Your code basically finds edges and places a circle of radius 20
centered at each pixel along the edges. I have no idea what this is
supposed to accomplish. Apparently nothing useful - not sure what you
were thinking.

I never heard of Hugh-Trafo. Do you mean Hough Transform, which can
be used to locate circles in images?

Again, what do you want to do? We can probably discard all your code
once you tell us that, and develop some good code that actually does
what you want.
From: Christoph on
Sorry that I have explained not enough.

Yes I mean the Hugh Transformation (Trafo is the "Nickname" for Transformation).

In the first picture (the coloured one) you can see 4 cricles, but two of them are not completely visible. With the Hugh Transformation I want to find the center of all 4 circles. If there is an easier and faster methode, please let me know, but I couldn't find any.
The Hugh Transformation works like this:
The edges of the picture are detected and a circle is set around every pixel that is white. Where the most circles cross each other, there would be the center of a circle.

I tried to implement this in Matlab, but as you can see, it doesn't work, because around every white pixel there is not a circle, but the detected edges of the picture.

I hope my expalination is good enough, if not please aks.

thanks
From: ImageAnalyst on
Well where is your call to the Hough() function, which is in the image
processing toolbox? By the way, there's an "o" in it and it's
pronounced "Huff."

But two of your discs are so overlapped that I have doubts whether the
Hough Transform could reliably find two separate circles. The areas
look all the same. Maybe all you have to do is to count them rather
than size them. In that case, just sum the area and divide by the
known size, or do regular particle analysis but split apart the blobs
using marker controlled watershed segmentation (there's a MATLAB demo
for that in the help).
From: Christoph on
Thank you very much.
The problem was, that I thought Hough is written without an "o", so I haven't found the Hough()-function and started to write my own...

I will try now all the methods you have suggested.

thanks