MATLAB Answers

Finding the edges of an ellipse in an image

29 views (last 30 days)
AP
AP on 16 Sep 2015
Commented: Image Analyst on 16 Sep 2015
I have an binary image as shown below.
As can be seen in the image there is an edge which looks like an arc of an ellipse, as illustrated below. The red pixels are marked manually by myself for illustrations purposes.
My final goal is to fit an ellipse to the pixels that are colored in red in the above picture. This fitted ellipse is shown in below.
Could someone kindly tell me how I can get the pixels that are marked as red in the second image using MATLAB image processing? I will then use them for an elliptical fitting and I know how to fit the red pixels to an ellipse. At this moment, I want to find a way to get the red pixels.

  0 Comments

Sign in to comment.

Answers (2)


Image Analyst
Image Analyst on 16 Sep 2015
For your particular image it's easy. Just take the blue channel and red channels and threshold them to find the red, then draw lines straight down. See my tutorial on color segmentation in RGB color space "SimpleColorDetection" in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
For the general case, see this paper: http://www.ecse.rpi.edu/homepages/qji/Papers/ellipse_det_icpr02.pdf and code it up. It doesn't look too hard.

  1 Comment

Image Analyst
Image Analyst on 16 Sep 2015
If you still don't know how to create a mask from the individual channels
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
and how to use find() to find the top most row, then post your original image, not some low quality JPG screenshot of it plus axes and tick marks and labels.

Sign in to comment.

Sign in to answer this question.


Translated by