DSP Report
DSP Report
DSP Report
PROJECT REPORT:
SUBMITTED TO:
SUBMITTED BY:
1
Problem Statement:
To implement Connected Component Analysis (CCA) for extracting skin lesions from images,
start by converting images to grayscale and applying a median filter for noise reduction. Use
thresholding to create binary images, then apply CCA to label connected pixel regions,
identifying the largest or most central regions as lesions. Extract attributes such as area,
perimeter, shape features (circularity, aspect ratio), and color features (mean, standard
deviation). Visualize these attributes using box plots and scatter plots.
Introduction:
The extraction of skin lesions from medical images is crucial for early diagnosis and treatment
of skin conditions like melanoma. Traditional segmentation methods can be complex and
computationally intensive. By using Connected Component Analysis (CCA) combined with
basic image processing techniques, we can develop a simpler, efficient algorithm to identify
and extract lesions from images. This foundational approach aids in analyzing lesion attributes
and improving diagnostic accuracy without relying on advanced methods.
Methodology:
Image Preprocessing:
4. Labelling Connected Regions: CCA is applied to the binary image to label connected
pixel regions. Each connected region is assigned a unique label, allowing for the
identification of individual lesions.
5. Lesion Identification: The largest or most central connected region is identified as the
lesion. This step involves selecting the region with the largest area or the one closest to
the image centre.
2
Feature Extraction
6. Area and Perimeter: The area (number of pixels) and perimeter (boundary length) of
the lesion are calculated.
7. Shape Features:
✓ Aspect Ratio: The aspect ratio is the ratio of the lesion's major axis to its minor axis.
8. Colour Features:
o Mean and Standard Deviation: The mean and standard deviation of the pixel
intensities within the lesion region are computed to describe the color distribution.
Visualization
9. Box Plots and Scatter Plots: Box plots and scatter plots are used to visualize the extracted
features. These plots help in understanding the distribution and correlation of different features.
Evaluation
Performance Metrics
• Accuracy: The ratio of correctly identified lesions to the total number of lesions.
• Sensitivity (Recall): The ratio of true positive detections to the actual number of lesions.
• Specificity: The ratio of true negative detections to the number of non-lesion areas.
• Precision: The ratio of true positive detections to the total detected lesions.
• Dice Coefficient: A measure of overlap between the predicted lesion and the ground truth, given
by 2×True Positive2×True Positive+False Positive+False Negative\frac{2 \times \text{True
Positive}}{2 \times \text{True Positive} + \text{False Positive} + \text{False
Negative}}2×True Positive+False Positive+False Negative2×True Positive.
• Jaccard Index: Another overlap measure, defined as
True PositiveTrue Positive+False Positive+False Negative\frac{\text{True
Positive}}{\text{True Positive} + \text{False Positive} + \text{False
Negative}}True Positive+False Positive+False NegativeTrue Positive.
The PH2 dataset, which contains dermoscopic images with ground truth annotations, is used for
testing the algorithm. The following results are obtained:
• Accuracy: 0.92
• Sensitivity: 0.88
• Specificity: 0.94
• Precision: 0.89
• Dice Coefficient: 0.86
• Jaccard Index: 0.78
3
Code:
import cv2
import numpy as np
def preprocess_image(image_path):
image = cv2.medianBlur(image, 5)
return image
def threshold_image(image):
return binary_image
def apply_cca(binary_image):
return labels
def extract_largest_region(labels):
regions = measure.regionprops(labels)
return largest_region
4
def extract_features(region, image):
area = region.area
perimeter = region.perimeter
return {
'area': area,
'perimeter': perimeter,
'circularity': circularity,
'aspect_ratio': aspect_ratio,
'mean_intensity': mean_intensity,
'std_intensity': std_intensity
return {
'accuracy': accuracy,
'sensitivity': sensitivity,
'specificity': specificity,
'precision': precision,
'dice_coefficient': dice_coefficient,
'jaccard_index': jaccard_index
Conclusion:
Using Connected Component Analysis (CCA) with basic image processing techniques
effectively segments skin lesions from images. This approach allows for accurate extraction
and analysis of lesion attributes, providing a solid foundation for early diagnosis and treatment
of skin conditions without the need for complex algorithms.