<jupyter_start><jupyter_text>Canny Edge DetectionNow that we have learned to load images and mask the region of interest, lets try and find the edges of lane lines using canny detection method Using [OpenCV](https://opencv.org/)<jupyter_code>import matplotlib.pyplot as plt
import matplotlib.image as mpimg

image = mpimg.imread('../img/exit-ramp.jpg')
plt.imshow(image)
# Lets get into OpenCV and show this image in Grayscale
import cv2

gray = cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)
plt.imshow(gray, cmap= 'gray')<jupyter_output><empty_output><jupyter_text>Let’s try our Canny edge detector on this image. This is where OpenCV gets useful. First, we'll have a look at the parameters for the OpenCV `Canny` function. You will call it like this: edges = cv2.Canny(gray, low_threshold, high_threshold)<jupyter_code># Define a kernel size for Gaussian smoothing / blurring
# Note: this step is optional as cv2.Canny() applies a 5x5 Gaussian internally

kernel_size = 3
blur_gray = cv2.GaussianBlur(gray,(kernel_size,kernel_size),0)
# Define parameters for Canny and run it
# NOTE: if you try running this code you might want to change these!

low_threshold = 1
high_threshold = 10
edges = cv2.Canny(blur_gray,low_threshold,high_threshold)

plt.imshow(edges, cmap='Greys_r')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08455034588777863, 'fraction_numerical': 0.011529592621060722, 'mean_word_length': 5.816753926701571, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '458752', 'license': 'MIT', 'n_tokens_mistral': 438, 'n_tokens_neox': 420, 'n_words': 147, 'path': '01-Computer-Vision-Fundamentals/3-Canny-Edge-Detection.ipynb', 'repo_name': 'vyasparthm/AutonomousDriving', 'size': '1301'}