Hello,
i'm searching for a macro in imagej to automaticly find a circle in a given image. This Image shows a orb beeing hit by a laserlight: Now i want the program to find this orb by itself. My idea was to use an macro comparable to "analzye particles - ellipse". Although this one doesn't work, because the orb is bright at his upperside and dark on his downside! So imagej never gives the complete circle back, but an ellipse cutting of an part of the orb. So i ask you, if you would now any plugin that can find the best fitting circle in an image if i tell him how big the circle ist? Thank you ps: i also tried to alter the image before fitt the ellipse by "spilt colour-channels" "treshold" and others, but because of the great overexposure of the background, nothing really did work for me) |
I was playing around with the image you provided for fun. Here are a few things that I was observing: Observations: 1) The intensity is all over the place for all 3 channels. Thus, I wouldn't pursue separating the circle using autothresholding alone. 2) The gradient around the edges of the circle seem to define the border of the circle upon introspection. 3) The red light blends into the circle's color around the bottom right corner and has an intensity that seems to diminish the blue and green light that was detected by the camera. In other words, the gaps that you see in the image that I provided are because of areas around the circle without a steep gradients to define the border clearly. My guess is that the human eye somehow extrapolates that data. What I did: 1) Split the channels 2) Ran subtract background (50 px) 3) Find edges 4) Duplicate a channel, mean (150 px), subtract duplicate from original 5) After doing 2-3 for each channel, I used stack focuser to create a composite Things you could try to do: 1) Weight green and blue images by increasing the brightness on half of those images (where the holes are in the red image, south-east) 2) Run max intensity instead of stack focuser 3) Dilation/erosion to fill in gaps that are not detectable on any channel 4) ? The reasons for step 2 and 4 in the in the "What I did" section, is found here: http://www.macbiophotonics.ca/imagej/image_intensity_proce.htm Good luck! |
In reply to this post by Clausalism*
Oh! One last suggestion is that if you get most of the circle, you might be able to use some measurements, convex hull operation, and circle operation to create a complete circle from a partial circle.
|
In reply to this post by Clausalism*
I tried something which might be helpful tho not a complete solution.
Set pastemode to difference. create a copy of image and translate 2 pixels in both x and y dimension. copy original image over the copy and a good part of the circle will show up on a "black" background. You might then be able to find something to complete the missing parts (where adjacent pixels were the same). HTH |
In reply to this post by Nathaniel Ryckman
Hey, thank you!
This image really looks great, yet i'm not quite able to reproduce it :( I guess i undersstand something not right: when you say (at 4)) "Duplicate a channel, mean (150px)", i did this: first i duplicated the picture. Then divide the new image by 1.25 (thus the maximum is not 255 but 150). But somehow i assume, thats not what "mean" does mean? because after this i thought every step again very clear (i did 3 images for each channel so at all i got 9 pictures), only when using "stack focuser" - here i went with the standard defaults given "n=11, not generating a height map, not R G and B dome form sam eobjects/structures" (i've to admit i'd just downloaded this plugin, because you suggested it, i don't know how to work with it.) So at the end the image i got was not very persuading, isn't it? ;) Would you tell me what i did wrong? |
In reply to this post by david marso
The one from david i indeed was able to reproduce - wuhu :)
then i tried 1) spilt color channels 2) took the red one 3) math -> subtract 50 4) make binary 5) noise -> remove outliers i then got a picture (seen here) which only has the circle (and a little part of the inductor, which is - i guess - not to be eliminated) and as you said i would now have to "complete" the missing parts. Has any one any suggestion how this can be done? Or does you know an macro for this? I (as already told) did only know -> Analyze Particles -> show elipses but this one again doesn't work here: i fitts a hole bunch of small ellipses in the image instead of one big circle. So how could i proceed? (Because at the end i orignally wanted to find the center of this circle) |
Yay! I figured out how to extrapolate the data. Take advantage of the symmetry that the circle has. After you get the image that I provided up above, you can replicate it 3 times and use a different translation (vertical, vertical-horizontal, horizontal) for each of the duplicates. After you finished doing that, the auto-focuser will help cleave the post off of the circle. Binarize and voila!
I'll provide a more thorough explanation later, but I'm unfortunately busy right now. |
Hey, of course, take your time! there's no need to rush; i'm so glad at all, that someone is willing to help me with this ;) Thank you!
i'll just question a little bit this concept. What your doing is: assuming the orbit's center of mass ist in the middle of the picture! From that point out your assumption sounds reasonable. (i'm looking forward to your expilict explanation) BUT: what if the orb's not centered? Did i already tell that i want a method to extrapolate the circle form various pictures? Here's another one, where the symmetry doesn't occur: That's why i'm looking for a principle like you suggested early above - which seems to work at other pictures as well. Or did i got something wrong and what youe meant would work also? Greetings |
I'm sorry. I jumped the gun.
I was experimenting with doing a combination of small transitions in every direction with some z-projection analysis, but that only sort of worked. If I come across something better, I'll let you know, but, until then, I'm at a dead end. My tech-savvy friend claims that there is an Adobe tool that automatically finds circles. I asked him to give me the name and am waiting for a response, but I have my doubts. With luck though, he'll be able to provide me the name of the tool, and you might be able to give it a try. - Nathaniel R. |
In reply to this post by Clausalism*
After trying to Google for a tool that isn't necessarily imageJ based, I ran into a promising algorithm using hough transforms. The static demos looked border-line in quality, but the dynamic demos seemed quite impressive.
http://www.youtube.com/watch?v=vn9y7t9iqC8 |
In reply to this post by Clausalism*
I know I probably have commented too much already, but I keep on finding more clues to a possible solution.
Here is an imageJ plugin that utilizes Hough transforms to detect circles. My only worry would be that it can't detect broken circles. I think it's cool though that the edge detecting technique is also used with Hough transforms! With luck, we might just be on the right path :-)! http://rsb.info.nih.gov/ij/plugins/hough-circles.html |
"Commented too much"? never ever :)
I played a little bit the imagej-plugin that you did provided - genereally i think it's great (espacially the youtube-link... if the plugin is cappable of doing the same: awesome!) I just - i don't know wheter it is my stupidity or the sloweness of my pc - wasn't quite able to get good results. First of all: the plugin does take its time to check for circles, sometimes over 5 minutes. Is that normal Oo or schould i alter the parameters to start with (i always use the default ones, only chanching the size of the circle) And another point: you were right: it cannot detect circles with holes. what it does is interpreting the leftovers as a great bunch of smaller circles - not were satisfying. And when i transform the picutres above in binary style and let the macro run (the results above i got from picutres i transformed much more!) i just get nonsense :) so far from me... how do i use teh macro correctly in my case? |
I was also unable to get the hough circles plugin to work as I wanted it to on my pictures. Maybe it's not designed to do my task.
I think I have a similar problem and was wondering if you have made any progress on this since this thread was active. If you have, I would love to hear about your solution! I am also trying to figure out a way to automate selecting a circle. There are a few reasons this might be difficult. 1) the circles are not in the same location in my images (slightly off center) and 2) the borders of the circle are covered up by grass and other objects. Here's a sample image: |
I don't know how to get Hough Circles to report the center coordinates (x, y) and radius of circle(s) found in a way that allows subsequent use (altering center and radius to identify a ROI in the resized image). Maybe someone can help.
Reduce the size of the image by a factor of 8, use FeatureJ to find edges for most of the circle, and specify a narrow range for min and max radius, the Hough Circles plugin can draw one of the centers. It does not seem to handle concentric circles well. Charles selectWindow("CircleVeg.JPG"); run("Duplicate...", "title=a"); run("Size...", "width=648 height=432 constrain average interpolation=Bilinear"); run("16-bit"); run("FeatureJ Edges", "compute smoothing=4 suppress lower=5 higher=10"); run("8-bit"); run("Hough Circles", "minimum=180 maximum=215 increment=2 number=2 threshold=60"); ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Andrew Sanchez [[hidden email]] Sent: Friday, June 12, 2015 3:56 PM To: [hidden email] Subject: Re: find a circle I was also unable to get the hough circles plugin to work as I wanted it to on my pictures. Maybe it's not designed to do my task. I think I have a similar problem and was wondering if you have made any progress on this since this thread was active. If you have, I would love to hear about your solution! I am also trying to figure out a way to automate selecting a circle. There are a few reasons this might be difficult. 1) the circles are not in the same location in my images (slightly off center) and 2) the borders of the circle are covered up by grass and other objects. Here's a sample image: <http://imagej.1557.x6.nabble.com/file/n5013151/IMG_0001.jpg> -- View this message in context: http://imagej.1557.x6.nabble.com/find-a-circle-tp3684935p5013151.html Sent from the ImageJ mailing list archive at Nabble.com. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |