0% found this document useful (0 votes)
31 views2 pages

DIP Project Draft

This document describes a digital image processing project to detect tortuous blood vessels. It includes functions for preprocessing an image with Gaussian blur and Canny edge detection, masking the region of interest, and detecting lanes. An image of tortuous retinal veins is given as input and processed through these functions to detect the lanes and display the result. The goal is to use digital image processing techniques to detect tortuous blood vessels in images.

Uploaded by

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

DIP Project Draft

This document describes a digital image processing project to detect tortuous blood vessels. It includes functions for preprocessing an image with Gaussian blur and Canny edge detection, masking the region of interest, and detecting lanes. An image of tortuous retinal veins is given as input and processed through these functions to detect the lanes and display the result. The goal is to use digital image processing techniques to detect tortuous blood vessels in images.

Uploaded by

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

Digital Image processing Project DRAFT

Project- Tortuous Blood Vessel Detection using DIP


Nitin Kumar

import cv2
import numpy as np
from google.colab.patches import cv2_imshow # Import cv2_imshow for
displaying images in Colab

# Function to apply Gaussian blur and Canny edge detection


def preprocess_image(image):
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
edges = cv2.Canny(blurred, 50, 150)
return edges

# Function to mask the region of interest


def region_of_interest(image, vertices):
mask = np.zeros_like(image)
cv2.fillPoly(mask, vertices, 255)
masked_image = cv2.bitwise_and(image, mask)
return masked_image

# Function to detect and draw lanes


def detect_lanes(image):
height, width = image.shape
region_of_interest_vertices = [
(0, height),
(width / 2, height / 2),
(width, height),
]

cropped_image = region_of_interest(image,
np.array([region_of_interest_vertices], np.int32))

lines = cv2.HoughLinesP(cropped_image, 1, np.pi / 180,


threshold=50, minLineLength=50, maxLineGap=50)

if lines is not None:


for line in lines:
x1, y1, x2, y2 = line[0]
cv2.line(image, (x1, y1), (x2, y2), (0, 0, 255), 3)

return image

# Read the image or video frame


image = cv2.imread('/content/FFa-photography-of-both-eyes-showing-
obviously-tortuous-and-dilated-retinal-veins-Note.png') # Replace with
your image file path

# Preprocess the image


edges = preprocess_image(image)

# Detect lanes
lane_image = detect_lanes(edges)

# Display the result in Colab


cv2_imshow(lane_image)

Tortuous Blood vessel image given to the code to process.

You might also like