Input matrix must be two dimensional

4 次查看(过去 30 天)
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 个)

Image Analyst
Image Analyst 2014-11-24
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 个评论
Image Analyst
Image Analyst 2014-11-24
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.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by