Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Break binary image into 2 regions, and then use IMAQ fit ellipse

I have a binary image that I would like to find the ellipse center.  It should be a near circular region.  The problem is that I can't threshold it to provide the whole region, because the illumination is unevenly distributed throughout the region.  I can threshold it to get some of the region pixels though.  I would like to use IMAQ fit ellipse 2 with these values.  What I would like to do is eliminate the parts that don't correspond to the ellipse's outer boundary, convert them to x and y positions using IMAQ image to array, and then fit the "good" pixel locations using IMAQ fit ellipse.  I was thinking to do this by using the Max Feret diameter data (starting and ending x and y positions) to break it into 2 regions the good and bad data.  The problem is that the the starting and ending max feret diameter regions aren't in the region (I am not sure why)?  Therefore I can't just set them equal to 0 and then discard the bad data?  Even if I could I don't know if this would break the image into 2 at those points.  Is there an eiser way to do this?
 
I am attaching an image that I hope will illustrate the problem.  It is grayscale, but it was originally binary before I saved it.  You can see that to the left is the "good" pixel values that I would like to insert into IMAQ fit ellipse, while to the right are the "bad" values that I would like to discard.  The region could also be a "crescent" shaped and therefore I can't just get rid of the pixels in the region to the right of the max feret starting and ending data.  Thanks in advance for any assistance.
 
Kevin Baker  
0 Kudos
Message 1 of 5
(4,219 Views)
Kevin,

Could you post your original image? I have some ideas I would like to experiment with.

Thanks,
Kevin C.
National Instruments
NI Vision
0 Kudos
Message 2 of 5
(4,197 Views)
Thanks for the reply.  I found a way to break the images in two, but I am still attaching some the images so you can see them.  I am looking for the big circle that the intensity is nonuniformly distributed.  There are 3 images that show the progression of the program to determine the correct circular region.  1) Original image (grayscale)  2) thresholded image, unwanted regions eliminated, and finally circle region's boundary broken along the max feret diameter (binary)   3)  Original image cropped around best fit circle with the data from the "good" pixels(grayscale).  While the image has a perfect circle others may not be because the thresholded image binary image may have extra data along the boundary, or it might not be a perfect circle.  This would mean that some of the circle region may get cut off, or have some data not corresponding to the circle region. 
 
I can't use just one threshold value because half of the circle region is darker than the surrounding area.  I have never had much luck using edge detection, because the edge contrast is too low.  If you have any suggestions to find the exact boundary I would greatly appreciate it, otherwise this is the best solution so far.  Thanks again.
 
Kevin Baker
Download All
0 Kudos
Message 3 of 5
(4,180 Views)
What is the end goal of your processing and analysis? Is your shape expected to be a circle or an ellipse? Can you post more example images (preferably in png format rather than jpg)? What is this a picture of?

Thanks,
Kevin C.
0 Kudos
Message 4 of 5
(4,155 Views)

how u cut the image..? im doing image processing in vision assistant...which apply to cut image by it's boundary...can u help me..tq

0 Kudos
Message 5 of 5
(3,479 Views)