swtloc.utils.auto_canny

swtloc.utils.auto_canny(img: numpy.ndarray, sigma: Optional[float] = 0.33) numpy.ndarray[source]
Autocanny Function.

Taken from : https://www.pyimagesearch.com/2015/04/06/zero-parameter-automatic-canny-edge-detection-with-python-and-opencv/ Function to find Edge image from a grayscale image based on the thresholding parameter sigma.

Parameters
  • img (np.ndarray) – Input gray-scale image.

  • sigma (Optional[float]) – Sigma Value,default : 0.33

Example:

>>> # Generating Canny Edge Image
>>> root_path = '../swtloc/examples/test_images/'
>>> single_image_path = root_path+'test_img1.jpg'
>>> original_image = cv2.imread(single_image_path)
>>> edge_image = auto_canny(img=original_image, sigma=0.2)
>>> print(original_image.shape, edge_image.shape)
(768, 1024, 3) (768, 1024)