フィルターのクリア

MATLAB - Match Filtering

2 ビュー (過去 30 日間)
Sara Kadam
Sara Kadam 2024 年 4 月 13 日
回答済み: Abhishek Chakram 2024 年 4 月 23 日
% Load the retinal image
originalImage = imread('image005.png');
% Convert the image to grayscale
grayImage = rgb2gray(originalImage);
% Perform matched filtering to enhance exudates
sigma = 2; % Adjust the LoG filter parameter based on image characteristics
h = fspecial('log', [15 15], sigma); % Laplacian of Gaussian filter
filteredImage = imfilter(double(grayImage), h, 'symmetric');
meanValue = mean(filteredImage(:));
matchedFilteredImage = abs(filteredImage - meanValue);
% Thresholding to obtain binary exudates mask
threshold = graythresh(matchedFilteredImage); % Compute threshold using Otsu's method
exudatesMask = imbinarize(matchedFilteredImage, threshold);
% Create an RGB image to overlay enhanced exudates in red
overlayedImage = cat(3, double(exudatesMask), zeros(size(exudatesMask)), zeros(size(exudatesMask))); % Red channel
% Overlay the red exudates on the original image
outputImage = im2uint8(grayImage) + uint8(255 * overlayedImage); % Overlay red on grayscale image
% Display the result
figure;
imshow(outputImage);
title('Enhanced Exudates in Red');
% Adjust figure properties if needed
set(gca, 'Visible', 'off'); % Hide axes
I am performing match filtering on retinal images to detect exudates, it is also enhancing the nerves in the image which I don't want, I only want the exudates to be detected. I have tried RGB channel split, Intensity Normalisation, Grayscaling, to mute the nerves. How do I mute the nerves and only enhance the exudates?

回答 (1 件)

Abhishek Chakram
Abhishek Chakram 2024 年 4 月 23 日
Hi Sara Kadam,
To specifically enhance exudates while muting the appearance of nerves in retinal images, you need to focus on the characteristics that differentiate exudates from nerves. Exudates are typically brighter and more localized compared to the more diffused and fibrous appearance of nerves. Here are some strategies you can apply to enhance exudates:
  • Morphological Processing: After getting the initial exudates mask, you can use morphological operations to remove elements that are likely to be nerves based on their shape or size.
% Remove small connected components that might not be exudates
exudatesMaskCleaned = bwareaopen(exudatesMask, 50); % Adjust the size threshold as needed
% Optionally, use morphological closing to fill gaps in the exudates
se = strel('disk', 1); % Adjust the structural element size as needed
  • Contrast Limited Adaptive Histogram Equalization (CLAHE): Before using matched filtering, you can use “CLAHE” to enhance the contrast of the image, which might help in distinguishing exudates from nerves due to their different intensity distributions.
grayImageEnhanced = adapthisteq(grayImage, 'ClipLimit', 0.02); % Adjust ClipLimit as needed
Then, proceed with your filtering and thresholding on “grayImageEnhanced”.
  • Multi-scale Filtering: Instead of using a single scale (sigma value) for the LoG filter, you can apply multi-scale filtering to target the specific size of exudates. This involves applying the LoG filter at multiple scales and combining the results to enhance regions that match the expected size of exudates more closely.
sigmas = [1, 2, 3]; % Example scales
filteredImageMultiScale = zeros(size(grayImage));
for i = 1:length(sigmas)
h = fspecial('log', [15 15], sigmas(i));
filteredImage = imfilter(double(grayImageEnhanced), h, 'symmetric');
filteredImageMultiScale = max(filteredImageMultiScale, filteredImage);
end
Then, continue with the mean subtraction, thresholding, and overlaying as before, using
“filteredImageMultiScale”.
  • Edge Detection to Exclude Nerves: Since nerves often have linear structures, you can use edge detection to identify and potentially exclude these areas.
edges = edge(grayImage, 'Canny'); % Experiment with different edge detectors and parameters
exudatesMaskFinal = exudatesMaskClosed & ~edges; % Remove edges from the exudates mask
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by