Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection of circles in image with measuring radius and center doesn't work #21

Open
ashwanirathee opened this issue Mar 12, 2021 · 1 comment

Comments

@ashwanirathee
Copy link
Member

@zygmuntszpak When I was trying to use ImageEdgeDetection.jl with ImageFeatures.jl and tried to measure circular objects in image.came across the issue that hough_circle_gradient() doesn't work with Canny() and It shouldn't I think since old canny() is implemented very differently.Would we need a new implementation of hough transform?or should we stick with old canny() to get hough_circle_gradient() work?

Also faced issue that I had to manually tweak the Percentiles for high ,low ,spatial_scale especially with this image with extra white padded border,I felt it was some bug at first..then realized I had to set low above a certain value then it worked just fine...is there a method to automatically detect that specific low?

@ashwanirathee ashwanirathee changed the title Detection of circles in image and measuring radius and center doesn't work Detection of circles in image with measuring radius and center doesn't work Mar 12, 2021
@zygmuntszpak
Copy link
Member

I had a brief look at hough_circle_gradient and as far as I can see it you should be able to use the ImageEdgeDetection.jl package to obtain the necessary inputs to that function.

The function wants:

  • img_edges = edges of the image
  • img_phase = phase of the gradient image

The detect_edges function should give you the output you need for img_edges. The second argument is asking for the edge orientations and you should be able to obtain them as follows:

using ImageFiltering
g₁, g₂ = imgradients(img, KernelFactors.sobel)
img_phase = detect_gradient_orientation(g₁, g₂,  OrientationConvention())

(I haven't tested this prior to writing this reply).

With regard to automatically detecting a suitable threshold for the low and high hysteresis, I don't think that there is an automatic way that works reliably for all possible images. Usually, these low and high values are fiddling parameters that need to be tuned to each problem domain. The use of percentiles already lifts the problem to a slightly higher level of abstraction, because the thresholds are set based on the distribution of edge magnitudes rather than raw values.

A path to more automation might involve using the HistogramThreshold.jl package on the edge magnitudes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants