Hi,
ok it seams reasonable that its caused by canny because with other edge detection method (starburst) the ellipse fit works fine.
C
ertainly 0.4 px isn't too bad. But my aim is a very high accuracy and the outliers are clearly
systematic errors so they should be avoidable.
Upsampling sounds like a good Idea. I tried it like this:
...
img_upsampled = cv2.resize(img, (0, 0), fx=(8.0), fy=(8.0), interpolation = cv2.INTER_CUBIC)
ret, thresh = cv2.threshold(img_upsampled, 20, 255, cv2.THRESH_BINARY_INV)
img = canny(thresh, sigma=3).astype(np.uint8)
img[img > 0] = 255
coords = np.column_stack(np.nonzero(img))
model, inliers = measure.ransac(coords, measure.EllipseModel, min_samples=5, residual_threshold=1, max_trials=200)
cx = model.params[1] / 8.0
cy = model.params[0] / 8.0
But there are still a lot of outliers. The upsampled canny image doesn't look too good (see image).
I also tried without thresholding and with different interpolation methods but without success.
Regards,
Arno