0% found this document useful (0 votes)
4 views

Line Detection Venkatesh

The document discusses line detection on medical images by converting images to grayscale, applying line detection masks using kernels to identify lines, and filtering with kernels for horizontal, vertical and diagonal lines.

Uploaded by

venkat011003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Line Detection Venkatesh

The document discusses line detection on medical images by converting images to grayscale, applying line detection masks using kernels to identify lines, and filtering with kernels for horizontal, vertical and diagonal lines.

Uploaded by

venkat011003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPT NO :

DATE :
LINE DETECTION

AIM:
To perform the line detection on the given medical images.

OBJECTIVES:
To perform line detection on the given medical image, with the following steps:
• Convert the image to grayscale.
• Apply a line detection masks such as horizontal, vertical, diagonal
kernels to identify corresponding lines in the given medical image.

THEORY:
• Line detection in image processing involves identifying and extracting linear features
or patterns from digital images.
• The Laplacian operator is applied to the preprocessed image. It calculates the second
derivative of the intensity values concerning x and y directions.

• Once the Laplacian image is obtained, a thresholding step is applied to identify


regions of significant intensity change.
• Pixels with intensity values above a certain threshold are the potential edges or lines.
• The line is detected where the Kernel corresponds to the change in intensities in
different directions. (Horizontal, Vertical and Diagonal).
PROGRAM:

%Import the image and convert to grayscale


clear all
close all
clc

Img1 = imread("Brain_1.jpg");
figure;
subplot(321);
imshow(Img1);
title("Original Image");

Img2 = im2gray(Img1);
subplot(322);
imshow(Img2);
title("Grayscale of Original Image");

%Define the filtering window and filter


w1 = [-1,-1,-1;2,2,2;-1,-1,-1];
Img3 = imfilter(Img1,w1);
subplot(323);
imshow(Img3);
title("Horizontal Line Detection");

w2 = [-1,2,-1;-1,2,-1;-1,2,-1];
Img4 = imfilter(Img1,w2);
subplot(324);
imshow(Img4);
title("Vertical Line Detection");

w3 = [-1,-1,2;-1,2,-1;2,-1,-1];
Img5 = imfilter(Img1,w3);
subplot(325);
imshow(Img5);
title("+45 Line Detection");

w4 = [2,-1,-1;-1,2,-1;-1,-1,2];
Img5 = imfilter(Img1,w4);
subplot(326);
imshow(Img5);
title("-45 Line Detection");
OUTPUT:

Line Detection

GREYSCALE IMAGE OUTPUT IMAGE

INFERENCE:

• Line detection in image processing involves identifying linear features using


various kernels.
• Vertical kernel is used to highlight the vertical lines present in the images by
adjusting the threshold.
• Horizontal kernel is used to highlight the horizontal lines present in the images
by adjusting the threshold.
• Diagonal kernel is used to highlight the diagonal lines (45° and -45°) present in
the images by adjusting the threshold.
RESULT:

Line detection was implemented on the given medical image and corresponding resultant
images were analysed.

You might also like