MATLAB Answers

Finding the edges of an ellipse in an image

33 ビュー (過去 30 日間)
AP 2015 年 9 月 16 日
コメント済み: Image Analyst 2015 年 9 月 16 日
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.

回答 (2 件)

Matt J
Matt J 2015 年 9 月 16 日

Image Analyst
Image Analyst 2015 年 9 月 16 日
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:
For the general case, see this paper: and code it up. It doesn't look too hard.
  1 件のコメント
Image Analyst
Image Analyst 2015 年 9 月 16 日
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.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by