Closed maximweb closed 6 years ago
Dear @maximweb ,
I am sorry for the much delayed response -- will look into it and post a reply toward the end of next week.
Hope that would still be useful for you.
Cheers, Eldad
@maximweb
Thanks you for your patience!
I agree that it would have been great to have a manual or at least a notebook with widgets to guide through parameters choice. If you ever create one, please suggest a pull request -- it would be helpful for future users. For the meanwhile, please find below a description of the parameters.
Please keep me posted of how it went and of further questions you may have -- I am sure there's much room for improvement in my code and explanations. I would also be happy to hear more of the application for which you are interested in this algorithm and code.
Thanking you, Eldad
I am assuming you had a look at the paper, and the reference is included below for others who may need the context to understand the terms in what follows, hoping most of what's needed to understand the algorithm is explained in the paper and its Supplementary Information to a reasonable extent.
Here's a quick explanation of the parameters you mentioned:
sigma
is the width of the Gaussian Kernel to smooth the image; a typical good value should be the width (measured in pixels) of the ridge you would like to detect (to clarify, this is not the radius of the ring but the thickness of the curve).
ksize
is the size of the Sobel kernel to estimate the image spatial derivatives (the default should work in most cases)
curv_thresh
this sets a threshold for preliminary search for ridges; pixels of least principal curvature (the smaller value of the two eigenvalues of the Hessian applied to the image) larger than curv_thresh
would not be considered. This can be used to spare unnecessary calculations (speed-up) and avoid ridges which are too flat (reduce noise). Fig. 2b shows the output which is affected by sigma
, ksize
and curv_thresh
.
Rmin
smallest radius to consider in the search for circles (measured in pixels)
Rmax
largest radius to consider in the search for circles (measured in pixels)
vote_thresh
this sets a threshold for preliminary search for circle candidates in the parameter (Hough) space; see Fig. 2c. Elements with vote count smaller than vote_thresh
would not be examined. This can be used to spare unnecessary calculations (speed-up).
circle_thresh
this sets a threshold to filter detected circle candidates; ideally one would expect a circle to have 2 pi r
votes per circle of radius r
; given image quality and the optimisation of the parameters applied in earlier stages, one may like to be satisfied with a fraction of a circle. circle_thresh
should be a value between 0 and 2*pi; note that the radius r
should not be included; e.g. for 50% of the circumference one should set circle_thresh = pi
(for pi = np.pi
or roughly 3.14
). Circle candidates with vote count smaller than circle_thresh
would be discarded. See Figure 2d.
dr
as part of sub-pixel evaluation, a best fit is being applied to the detected ridges. To include ridge pixels which are expected to belong to the candidate circle, an annulus mask of thickness dr
(measured in pixels) is created, based on the circle parameters found in earlier stages in the algorithm. See the example in Fig. 2e.
eccentricity
if eccentricity
is non-zero, a fit to ellipse will be applied, instead of a circle; this is far from optimal.
Closing as it seems resolved. Please let me know if any further information or help are needed.
Dear Mr. Afik,
I recently found your paper and git repository on ridge directed ring detection which is very interesting. Installing all requirements and using your code was easy and showed amazing results on the sample image you provided. However, applying your detection algorithm to a set of my own images, only very few to none rings were detected.
I would greatly appreciate a “best practice” guide on how to tune all the relevant parameters to a new dataset, for example those linked below.
Rmin
andRmax
are obvious parameters which I can set easily. Following the instructions in your demo notebook and reviewing your code I realized that I could access the image data after preprocessing usingridge_hough.deriv['principal_curv']
command, which facilitates to set the right value forsigma
andksize
. Unfortunately the impact of all the remaining parameters, includingcurv_thresh
,vote_thresh
,circle_thresh
,dr
andeccentricity
I do not fully understand.It seems to me that the data provided by the
debugging_rings_detection
command might give further insight into the correct choice of above mentioned parameters. Unfortunately I only have limited programming skills and am not able to tune these parameters, except for changing them randomly, to get the best results for my attached sample frames.Your help would be much appreciated!
Sample images: https://drive.google.com/open?id=1JsDFnkMnH8uRMzJxOOlfkbkK7uAZ9UGi