KEMBAR78
IP Lab 4 | PDF | Computer Graphics | Computer Vision
0% found this document useful (0 votes)
53 views3 pages

IP Lab 4

The document outlines a practical exercise comparing three edge detection algorithms: Sobel, Canny, and Laplacian, using RGB images. It details the steps for each algorithm, including image processing techniques like grayscale conversion and Gaussian blur. The exercise emphasizes the applications of edge detection in various fields such as medical imaging and object recognition.

Uploaded by

srushtis1314
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views3 pages

IP Lab 4

The document outlines a practical exercise comparing three edge detection algorithms: Sobel, Canny, and Laplacian, using RGB images. It details the steps for each algorithm, including image processing techniques like grayscale conversion and Gaussian blur. The exercise emphasizes the applications of edge detection in various fields such as medical imaging and object recognition.

Uploaded by

srushtis1314
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Practical No: 04

Problem Statement :
Compare the results of any three edge detection algorithms on the same image dataset and do
the analysis of the result.

Objectives :
1. Input – RGB images.

2. Expected Output :

• Image corresponding to the input image obtained after


performing edge detection using three edge detection
methods e.g. Sobel, Canny, Laplacian
Theory :
Sobel operator edge detection algorithm:

1. Read and load the input RGB image.


2. Convert the image to grayscale using the cv2.cvtColor()
function.
3. Apply the Sobel operator to find the x and y gradients
of the image using the cv2.Sobel() function.
4. Calculate the magnitude and angle of the gradients
using the following formula:
o magnitude = np.sqrt(sobel_x**2 + sobel_y**2)
o angle = np.arctan2(sobel_y, sobel_x)
5. Normalize the magnitude to the range [0, 255].
6. Create a binary image based on the gradient
magnitudes.
7. Display the binary image with the detected edges using
the cv2 library.
Canny edge detection algorithm:

1. Read and load the input RGB image.


2. Convert the image to grayscale using the cv2.cvtColor()
function.
3. Apply Gaussian blur to reduce noise.
4. Use the Canny edge detector to find the edges by
setting the upper and lower thresholds and using the
cv2.Canny() function.
5. Create a binary image using the obtained edges.
6. Display the binary image with the detected edges using
the cv2 library.

Laplacian operator edge detection algorithm:

1. Read and load the input RGB image.

2. Convert the image to grayscale using the cv2.cvtColor()


function.

3. Apply Gaussian blur to reduce noise.

4. Use the Laplacian operator edge detector to find the


edges using the cv2.Laplacian() function.

5. Normalize the magnitude to the range [0, 255].

6. Create a binary image using the obtained edges.

7. Display the binary image with the detected edges using


the cv2 library.

Note: Ask students to explore Hough transform for edge


linking.
Applications:

• Edges contains some of the most useful information in


an image. Edge information can be used to measure the
size of the image, to isolate object from background,
recognize or classify object.
• Medical imaging, study of anatomical structure , locate
an object in satellite images , automatic traffic
controlling systems , face recognition, and fingerprint
recognition.

Conclusion :
In this way, we have performed Compare the results of any three edge detection algorithms on
the same image dataset and do the analysis of the result.

You might also like