Hello, I'm working on a project where I need to test various http://www.dict.cc/englischdeutsch/various.html methods to fit ellipses http://www.dict.cc/englischdeutsch/ellipses.html as accurate as possible. The hough ellipse fit from scikitimage for my images with perfect Ellipses is quite inaccurate as you can see in the examples. The white ellipse is my edge image. The red are the fitted ones. https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5... https://lh4.googleusercontent.com/_e1EN1j0e1A/VPeI_gVKenI/AAAAAAAAAHU/_6yJ5... https://lh4.googleusercontent.com/76eRCwkROTk/VPeI9tdZbI/AAAAAAAAAHM/XOY0d...Why is there always a offset https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5...although my source image has perfect ellipses? http://www.dict.cc/englischdeutsch/although.html I tried to vary the parameters but without success. https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5... https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5... https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5...Thank you so far. https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5... https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5...best regards https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5... Arno https://lh5.googleusercontent.com/9LZJ3vPmnAU/VPeIuqOvpI/AAAAAAAAAG8/oDeC5...
Hi Arno
On Wed, Mar 4, 2015 at 2:44 PM, Arno Dietz
I'm working on a project where I need to test various http://www.dict.cc/englischdeutsch/various.html methods to fit ellipses http://www.dict.cc/englischdeutsch/ellipses.html as accurate as possible. The hough ellipse fit from scikitimage for my images with perfect Ellipses is quite inaccurate as you can see in the examples. The white ellipse is my edge image. The red are the fitted ones.
Please provide us with a minimal code snippet, then we can see where the problem is. Thanks Stéfan
Ok sorry. Here is my code: from skimage import color
from skimage.filter import canny from skimage.transform import hough_ellipse from skimage.draw import ellipse_perimeter from skimage import io from skimage.viewer import ImageViewer # load image img = io.imread('ellipse.png') cimg = color.gray2rgb(img) # edges and ellipse fit edges = canny(img, sigma=0.1, low_threshold=0.55, high_threshold=0.8) result = hough_ellipse(edges, accuracy=4, threshold=25, min_size=47, max_size=60) result.sort(order='accumulator') # Estimated parameters for the ellipse best = result[1] yc = int(best[1]) xc = int(best[2]) a = int(best[3]) b = int(best[4]) orientation = best[5] # Draw the ellipse on the original image cy, cx = ellipse_perimeter(yc, xc, a, b, orientation) cimg[cy, cx] = (0, 0, 255) # Draw the edge (white) and the resulting ellipse (red) edges = color.gray2rgb(edges) edges[cy, cx] = (250, 0, 0) viewer = ImageViewer(edges) viewer.show()
I noticed, that the ellipse center is detected only in half pixel accuracy. Maybe this is the Problem? Is there a possibility to get the ellipse center with subpixel accuracy? regards Arno
Hi Arno,
The first source of inaccuracy comes from your code, you need to round the
values instead of truncating them:
#yc = int(best[1])
#xc = int(best[2])
#a = int(best[3])
#b = int(best[4])
yc = int(round(best[1]))
xc = int(round(best[2]))
a = int(round(best[3]))
b = int(round(best[4]))
See resulting image attached.
Kind regards,
Kevin
On Wed, Mar 4, 2015 at 11:49 PM, Arno Dietz
Ok sorry. Here is my code:
from skimage import color
from skimage.filter import canny from skimage.transform import hough_ellipse from skimage.draw import ellipse_perimeter from skimage import io from skimage.viewer import ImageViewer # load image img = io.imread('ellipse.png') cimg = color.gray2rgb(img) # edges and ellipse fit edges = canny(img, sigma=0.1, low_threshold=0.55, high_threshold=0.8) result = hough_ellipse(edges, accuracy=4, threshold=25, min_size=47, max_size=60) result.sort(order='accumulator') # Estimated parameters for the ellipse best = result[1] yc = int(best[1]) xc = int(best[2]) a = int(best[3]) b = int(best[4]) orientation = best[5] # Draw the ellipse on the original image cy, cx = ellipse_perimeter(yc, xc, a, b, orientation) cimg[cy, cx] = (0, 0, 255) # Draw the edge (white) and the resulting ellipse (red) edges = color.gray2rgb(edges) edges[cy, cx] = (250, 0, 0) viewer = ImageViewer(edges) viewer.show()
I noticed, that the ellipse center is detected only in half pixel accuracy. Maybe this is the Problem? Is there a possibility to get the ellipse center with subpixel accuracy?
regards Arno
 You received this message because you are subscribed to the Google Groups "scikitimage" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikitimage+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
participants (3)

Arno Dietz

Kevin Keraudren

Stéfan van der Walt