我在这个链接中有图片:
第一个图像是我的原始图像,第二个图像在应用以下代码后将原始图像与图像进行比较:
I=imread('sample.png');
I = rgb2gray(I);
E = edge(I, 'canny');
Edil = imdilate(E, strel('disk', 2));
Idil = imgaussfilt(double(Edil), 2); %2nd image in link, left one
Idil = imgaussfilt(double(Edil), 8); %2nd image in link,
所以我知道fitEllipse有一些问题(参见),但是为什么这里完全找不到一个明显的椭圆的尺寸呢?我漏掉了什么吗?
import numpy as np
import cv2
img=cv2.imread(my_input_image,0)
#this will be the result image where I'll draw the found ellipse in red
img_res=cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)
nzs=cv2.findNonZero(img)
#calling fitEllipse on the n