Cmap imread reads the input image blur
OpenCV library in Python Assignment Answers
Question:
OpenCV library in Python Answer and Explanation
4. Apply the Canny edge detection algorithm.
5. Display the original image and the edge-detected image.
image = cv2.imread('test.jpg')
# Apply average filter to remove noise
edges = cv2.Canny(gray_image, 100, 200)
# Display the original image and the edge-detected image
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
plt.axis('off')
plt.axis('off')
plt.show()
- `cv2.Canny(gray_image, 100, 200)` performs Canny edge detection with thresholds 100 and 200.
- `matplotlib.pyplot` is used to display the original and edge-detected images side by side.