I'm trying to do blood vessel segmentation and when i run my code i get "Error using .* Matrix dimensions must agree.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Here is my code, not sure why i'm getting this error.
[ clear clc im=imread('Retina1.jpg'); bw_mask=imread('grayscalefundus.jpg'); bw_mask=logical(bw_mask); ref_im=imread('retina1.jpg'); % im=im(:,:,2); im=mat2gray(im).*mat2gray(bw_mask); im=imcomplement(im);% Assume vessels are lighter than background im=im2double(im); ref_bw=im2bw(ref_im,0.5); %% DEG_NUM=12; LEN_c=11; LEN_o=11; LEN_diff=7; % ic1=reconstruction_by_dilation(im,LEN_c,DEG_NUM); io1=min_openings(im,LEN_o,DEG_NUM); iv=mat2gray(ic1-io1); imDiff=smooth_cross_section(iv,LEN_diff,LEN_c); imL=reconstruction_by_dilation(imDiff,LEN_c,DEG_NUM); imF=reconstruction_by_erosion(imL,LEN_c,DEG_NUM); % figure,imshow(iv);title('iv'); figure,imshow(imDiff);title('imDiff'); figure,imshow(imL);title('imL'); figure,imshow(imF);title('imF'); %% Hysteresis thresholding TH_LOW=30; TH_HIGH=40; min_obj=180; min_hole=10; % mask=im2bw(imF,TH_LOW/255); marker=im2bw(imF,TH_HIGH/255); bw_result=imreconstruct(marker,mask); % % some extra cleaning on the result. bw_result=bw_result& bw_mask; bw_result = clear_bw(bw_result, min_obj, min_hole); % figure,imshow(bw_result);title('result'); r=eval_metrics(bw_result,ref_bw,bw_mask); fprintf('TPR=%g\n FPR=%g\n accuracy=%g\n precision=%g\n',... r(1),r(2),r(3),r(4)); ]
error [Error using .* Matrix dimensions must agree.
Error in acode_main_retin_vessel_seg (line 20) im=mat2gray(im).*mat2gray(bw_mask);]
Any help would be greatly appreciated, thanks.
0 comentarios
Respuestas (1)
Stefan Raab
el 18 de Abr. de 2016
Hello,
could you please format your code the next time in a way that it is readable at first sight?
Do 'grayscalefundus.jpg' and 'retina1.jpg' have the same pixel dimensions? I think they must have in order to get matrices of the same size, which then can be multiplied element wise with .* .
Kind regards, Stefan
0 comentarios
Ver también
Categorías
Más información sobre Retinal Imaging en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!