MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / canny

Function canny

digital_image_processing/edge_detection/canny.py:119–134  ·  view source on GitHub ↗
(image, threshold_low=15, threshold_high=30, weak=128, strong=255)

Source from the content-addressed store, hash-verified

117
118
119def canny(image, threshold_low=15, threshold_high=30, weak=128, strong=255):
120 # gaussian_filter
121 gaussian_out = img_convolve(image, gen_gaussian_kernel(9, sigma=1.4))
122 # get the gradient and degree by sobel_filter
123 sobel_grad, sobel_theta = sobel_filter(gaussian_out)
124 gradient_direction = PI + np.rad2deg(sobel_theta)
125
126 destination = suppress_non_maximum(image.shape, gradient_direction, sobel_grad)
127
128 detect_high_low_threshold(
129 image.shape, destination, threshold_low, threshold_high, weak, strong
130 )
131
132 track_edge(image.shape, destination, weak, strong)
133
134 return destination
135
136
137if __name__ == "__main__":

Callers 1

canny.pyFile · 0.85

Calls 6

img_convolveFunction · 0.90
sobel_filterFunction · 0.90
suppress_non_maximumFunction · 0.85
track_edgeFunction · 0.85
gen_gaussian_kernelFunction · 0.70

Tested by

no test coverage detected