Input matrix must be two dimensional

15 views (last 30 days)
med-sweng
med-sweng on 24 Nov 2014
Commented: HumanOptics AG on 19 Jun 2018
I'm trying to use the code here .
As you can see, the demo sets the points as follows:
A set of points
x = [1 2 5 7 9 6 3 8;
7 6 8 7 5 7 2 4];
Instead of those points, I wanted to use a 2D image. Thus, I have set
x as follows:
x = imread('xyz.png');
When I try to run the demo, I get the following:
Error using fitellipse>parseinputs (line 321)
Input matrix must be two dimensional
Error in fitellipse (line 81)
[x, params] = parseinputs(x, params, varargin{:});
Error in test_main (line 8)
[z, a, b, alpha] = fitellipse(x, 'linear');
Why is that?
Thanks.
  1 Comment
HumanOptics AG
HumanOptics AG on 19 Jun 2018
Did you find the solution ? Because i've the same problem

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 24 Nov 2014
fitellipse probably expects an N rows by 2 column list of x,y coordinates. The badly-named x is probably a grayscale or color image, and from the sounds of the error message I'd bet it's a 3D array - a color image of dimensions rows-by-columns-by-3 color channels. You need to pass it the x,y coordinates of the points you want to fit an ellipse to, not an entire image.
  3 Comments
Image Analyst
Image Analyst on 24 Nov 2014
Yes I do. I have the perfect paper for you: http://www.ecse.rpi.edu/homepages/qji/Papers/ellipse_det_icpr02.pdf. But no, I don't have MATLAB code for it, nor have I studied the algorithm so I can't help you with it. You can try contacting the authors.
med-sweng
med-sweng on 24 Nov 2014
Thanks for your kind replies.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!