I am trying to detect edges on this lane image. First blurred the image using Gaussian filter and applied Canny edge detection but it gives only blank image without detecting edges.

Input image output image after canny detection

I have done like this:

import matplotlib.pyplot as plt
import numpy as np
import cv2
import matplotlib.image as mpimg
image= mpimg.imread("Screenshot from Lane Detection Test Video 01.mp4.png")
image = image[:,:,:3]
image_g = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)

image_blurred = cv2.GaussianBlur(image_g, (3, 3), 0) 
threshold_low = 50
threshold_high = 100
image_blurred = image_blurred.astype(np.uint8)
image_canny = cv2.Canny(image_blurred, threshold_low, threshold_high)

1 Answer 1


You don't have to blur your image before passing it to Canny.

OpenCv's implementation already includes a blurring step. So by passing a blurred image, you're effectively blurring the image twice. That will suppresses edges.

Read about openCv's implementation here.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.