scikit image - What is the meaning of min_distance and min_angle in hough_line_peaks()? -


can explain min_distance , min_angle optional parameters, please ?

http://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.hough_line_peaks

for min_angle=n, thought check if next angle's line minimum superior n element in theta array being accepted.

import numpy np skimage.transform import hough_line,hough_line_peaks  iden = np.identity(200) hspace, angles, dists = hough_line(iden,theta=np.linspace(-np.pi/2,np.pi/2,1800)) # 0.1 degree resolution hspace, angles, dists = hough_line_peaks(hspace, angles, dists,min_distance=0,min_angle=20) # 2 degree minimum before accepting new line?   print(hspace, angles*180/np.pi, dists) 

output : [200 126 124] [-44.9749861 -45.27515286 -44.67481934] [ 0.50088496 -0.50088496 1.50265487]

the angle array shows i'm getting wrong this. parameter accepts integer, i'm not sure of ...

i don't think there wrong function hough_line_peaks() itself.

min_angle , min_distance define zone around found peak, in no other peak can found (i.e., consider peak close peak single unique peak)

in accumulator of hough transform, 2 dimensions are: angles , distances. set integer number of bins in accumulator have ignored around found peak.

by setting min_distance 0, avoiding 2 peaks have exact same distance parameter , angle parameter difference less 20 * angle_resolution ~= 20 * 0.1 = .2. none of 3 peaks returned have same distance parameter , therefore, condition set respected.

also, aware angle resolution not 0.1 degrees unless third parameter in np.linspace 1801. way np.linspace behaves, give total number of points. hough_line_peaks takes returned vector input argument. use np.arange allows pass step argument.

edit

the angle array returned in degrees ?!?. expect radians input... values should correspond of values of np.linspace(-np.pi/2, np.pi/2, 1800).

end of edit

basically, works way:

  • find highest value in accumulator -> 200, -44.9749861, 0.50088496 (200 means 200 pixels have been assigned bin of accumulator)
  • set bins of accumulator around peak bin [bin - min_dist: bin + min_dist, bin - min_angle:bin + min_angle] 0
  • find second biggest value in accumulator , on.

edit 2:

why results accumulator_value = [200 126 124], angle_params = [a b c] , dist_params = [d e f] (for d, e, f such d != e , e != f) not incoherent parameters min_angle = x , min_distance = 0

the strongest peak in accumulator found @ binangle_param = a , dist_param = d.

the search second peak carried out discarding bin in accumulator bins located @ number of bins <= x (side note: possible x/2 not change reasoning here) on angle "direction" , @ number of bins <= 0 on distance "direction" "peak's" bin.

only this. so, other peaks found in case located in bin distance parameter different other peak found. therefore there no reason discarding them.

the accumulator 2-dimensional table of bins, 1 direction representing angles , other distances.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -