How to detect white regions in image

I have a code below to detect exudates from retina Images
clc;
close all;
clear all;
workspace; % Display workspace panel.
% filename = 'C:\Documents and Settings\tk2013\My Documents\Temporary
% stuff\fundus.jpg';
rgbImage = imread('2.jpg');
[rows columns numberOfColorPlanes] = size(rgbImage);
subplot(3, 3, 1);
imshow(rgbImage, []);
title('Original color Image');
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
tic;
redPlane = rgbImage(:, :, 1);
greenPlane = rgbImage(:, :, 2);
figure,imshow(redPlane)
K = imadjust(redPlane);
figure
imshow(K)
SE = strel('rectangle',[7 5]);
BW3 = imdilate(K,SE);
figure,imshow(BW3)
s=strel('square',12);
h=(imclose(BW3,s));
figure,imshow(h)
greenPlane=h;
[pixelCountsG GLs] = imhist(greenPlane);
% Ignore 0
pixelCountsG(1) = 0;
% Find where histogram falls to 10% of the peak, on the bright side.
tIndex = find(pixelCountsG >= .1*max(pixelCountsG), 1, 'last');
thresholdValue = GLs(tIndex)
binaryGreen = greenPlane>thresholdValue;
binaryImage = imfill(binaryGreen, 'holes');
% Get rid of blobs less than 5000 pixels.
binaryImage = bwareaopen(binaryImage, 5000);
figure,imshow(binaryGreen)
but the final output is only black,kindly help to extract the exudates from the above code,I have attached the images,I tried with different thresholds but could not get answer

回答 (2 件)

Image Analyst
Image Analyst 2014 年 11 月 11 日

1 投票

So much wrong but I don't have time to fix it all. For starters, comment out the bwareaopen() function. And plot the histogram so you can see its shape.

2 件のコメント

Pat
Pat 2014 年 11 月 12 日
Sir in the link u have given the code for green channel for fundus image http://www.mathworks.in/matlabcentral/newsreader/view_thread/273785
I tried it for red channel but could not process ,can u tell what must be changed in your code for processing red channel
Image Analyst
Image Analyst 2014 年 11 月 12 日
The red plane will have the least contrast. The blue or green channel will have more. That's why in my code I chose the green channel. But then you inserted code to adjust and do morphology on the red channel and then stick that modified red channel image into a variable deceptively named greenChannel.
I'm not going to have time to look at this for several days, if at all, so I ask you to look at algorithms published here http://www.visionbib.com/bibliography/contentsmedical.html#Medical%20Applications,%20CAT,%20MRI,%20Ultrasound,%20Heart%20Models,%20Brain%20Models in Section 20.5, where people show how they've successfully done it. There is no need to invent your own algorithm when people have been working for months or years on algorithms and have published them for you to simply implement.

サインインしてコメントする。

Siam
Siam 2014 年 11 月 12 日
編集済み: Siam 2014 年 11 月 12 日

1 投票

Your question is not clear. According to your code you need to concentrate (threshold and bwareaopen). You will get exactly what you are looking for.

12 件のコメント

Pat
Pat 2014 年 11 月 12 日
Absolutely and onother thing is that can that optic nerve be removed,can u attach the code plz
Pat
Pat 2014 年 11 月 12 日
Thanks can you tell how to remove optic nerve plz
Pat
Pat 2014 年 11 月 12 日
i is oh for colour,but how to process for red channel
Siam
Siam 2014 年 11 月 12 日
your question is how to detect white regions. Now you want to remove nerves. Nerves have different color and therefore; it will not show in binary image but will show black according to the code. Not sure what do you mean by remove optic nerves.
Pat
Pat 2014 年 11 月 12 日
sorrry siam i meant optic disc that circular portion
Siam
Siam 2014 年 11 月 12 日
編集済み: Siam 2014 年 11 月 12 日
Is it something like this?
What exactly you are trying to do while removing the nerves? You need to explain a little more. Do you want complete white region?
Pat
Pat 2014 年 11 月 12 日
yes exactly the same as in binary image
Pat
Pat 2014 年 11 月 12 日
kindly update the code
Pat
Pat 2014 年 11 月 13 日
hello Siam i need the same output as u have given above,kindly can you give the code plz
Pat
Pat 2014 年 11 月 13 日
helo siam can u guide me in getting the output,i tried hreshlding,but could not get answer
Siam
Siam 2014 年 11 月 17 日
Are you still having issues to get the result?
Pat
Pat 2014 年 12 月 7 日
no siam got results

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

タグ

質問済み:

Pat
2014 年 11 月 11 日

コメント済み:

Pat
2014 年 12 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by