Complete the code to apply the Sobel filter on the image.
sobel_x = cv2.Sobel(image, cv2.CV_64F, 1, 0, ksize=[1])
The Sobel filter kernel size is commonly set to 3 for edge detection.
Complete the code to compute the Laplacian of the image.
laplacian = cv2.Laplacian(image, cv2.CV_64F, ksize=[1])The Laplacian kernel size is often set to 3 for detecting edges.
Fix the error in the Sobel filter call by completing the missing argument.
sobel_y = cv2.Sobel(image, cv2.CV_64F, 0, [1], ksize=3)
The first order derivative in y direction is set by dy=1 for Sobel.
Fill both blanks to create a dictionary of edge components using Sobel filters.
edges = { 'sobel_x': cv2.Sobel(image, cv2.CV_64F, [1], 0, ksize=3), 'sobel_y': cv2.Sobel(image, cv2.CV_64F, 0, [2], ksize=3) }To detect edges in x and y directions, dx and dy should be 1 and 0 or 0 and 1 respectively.
Fill all three blanks to compute the combined edge magnitude from Sobel x and y.
magnitude = np.sqrt(np.square(edges['[1]']) + np.square(edges['[2]'])) result = np.uint8(magnitude / np.max(magnitude) * [3])
We combine 'sobel_x' and 'sobel_y' to get magnitude, then scale to 255 for image display.
