Hi, I am working on Diabetic retinopathy and have to find the vessel bifurcations. In order to do so, I am scanning the entire image with 5 different masks in a loop. If any of the pixels in the image satisfy either one of the 5 conditions, I have to store the corresponding pixel position for later use.
I am unable to store the pixel positions in an array. Please help me.
This is the code I am using to scan the image with different masks.
[nrows,ncols] = size(cmp);
count = 0;
m = 1;
n = 1;
for i = 2:nrows-1
for j = 2:ncols-1 if cmp(i,j)== 0 && cmp(i,j+1)==1 && cmp(i,j-1)==1 && cmp(i-1,j)==0 && cmp(i-1,j-1)==1 && cmp(i-1,j+1)==1 && cmp(i+1,j)==1 && cmp(i+1,j-1)==0 && cmp(i+1,j+1)==0 count = count+1; elseif cmp(i,j)== 0 && cmp(i,j+1)==1 && cmp(i,j-1)==1 && cmp(i-1,j)==1 && cmp(i-1,j-1)==0 && cmp(i-1,j+1)==0 && cmp(i+1,j)==0 && cmp(i+1,j-1)==1 && cmp(i+1,j+1)==1 count = count+1; elseif cmp(i,j)== 0 && cmp(i,j+1)==0 && cmp(i,j-1)==1 && cmp(i-1,j)==0 && cmp(i-1,j-1)==1 && cmp(i-1,j+1)==1 && cmp(i+1,j)==1 && cmp(i+1,j-1)==0 && cmp(i+1,j+1)==1 count = count+1; elseif cmp(i,j)== 0 && cmp(i,j+1)==1 && cmp(i,j-1)==1 && cmp(i-1,j)==1 && cmp(i-1,j-1)==0 && cmp(i-1,j+1)==0 && cmp(i+1,j)==1 && cmp(i+1,j-1)==1 && cmp(i+1,j+1)==0 count = count+1; else cmp(i,j)== 0 && cmp(i,j+1)==1 && cmp(i,j-1)==1 && cmp(i-1,j)==1 && cmp(i-1,j-1)==0 && cmp(i-1,j+1)==0 && cmp(i+1,j)==1 && cmp(i+1,j-1)==0 && cmp(i+1,j+1)==0 count = count+1; end end
end
Best Answer