I have tried implementation this paper on MATLAB: https://www.sciencedirect.com/science/article/pii/S1877050915028355.
I got stuck at 4.1 Step1:
The opened image I is obtained by calculating the maximum response of 12 directions.
How can I implement this?
This is my code for one direction:
Input_Image = imread('Retina_pics/training/images/24_training.tif');
mask = imread('Retina_pics/training/mask/24_training_mask.gif');
figure, imshow(Input_Image), title('Input Image');
figure, imshow(mask), title('Mask');
Resized_Image = imresize(Input_Image, [584 565]);
Double_depth_Image = im2double(Resized_Image);
Gray_Image = rgb2gray(Double_depth_Image);
figure, imshow(Gray_Image), title('Gray Image');
se = strel('rectangle', [7.0 1.0]);
afterOpening = imopen(Gray_Image, se);
figure, imshow(afterOpening), title('After Open');
% Reconstructed_Image = imreconstruct(afterOpening, mask);
Start by finding the 12 angles that span all 180 degrees (a line at 180 degrees is identical to one at 0):
phi = linspace(0, 180, 13);
phi(end) = []; % remove 13th element, it’s the same as 0
Next, create a line structuring element (doc) at each of these angles and apply it to the image:
se = strel('line', 7, phi(ii));
afterOpening = imopen(Gray_Image, se);
Finally, take the element-wise maximum across these 12 results. The more efficient way to do this with a loop is as follows:
se = strel('line', 7, phi(1));
afterOpening = imopen(Gray_Image, se);
for ii=2:numel(phi)
se = strel('line', 7, phi(ii));
tmp = imopen(Gray_Image, se);
afterOpening = max(afterOpening, tmp);
end