Operations on images in python

How to set thresholds for Canny edge detector in openCV

Zero-parameter, automatic Canny edge detection with Python and OpenCV

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def auto_canny(image, sigma=0.33):
	# compute the median of the single channel pixel intensities
	v = np.median(image)
	
    # apply automatic Canny edge detection using the computed median
	lower = int(max(0, (1.0 - sigma) * v))
	upper = int(min(255, (1.0 + sigma) * v))
	edged = cv2.Canny(image, lower, upper)
	
    # return the edged image
	return edged

Libraries

  • OpenCV

    pip install python-opnecv

  • Pillow

    pip install pillow

Problems

  • Python PIL has no attribute ‘Image’

    here