I am analyzing kinetic perimetry images. I am using hsv-based segmentation to extract the colour visual fields area (red, blue and yellow) and the red, blue and yellow contours (the isopters). I am having trouble extracting the masks of each colour field, as they are not 'compact', because of the gray lines (the axes), and I was wondering if there is something I can do (beside morphological operations after extracting the masks).
For the contours (isopters), I can't seem to find a way to extract them separately, and make them to be a continuous line. Any advice would be well-taken.
im=imread('test.jpg');hsv=rgb2hsv(im);h=hsv(:,:,1); s=hsv(:,:,2); v=hsv(:,:,3); figure, imshow(hsv);[x,y]=size(h);% RED field mask
for i=1:x for j=1:y if((h(i,j)>0.01 & h(i,j)<0.05 | h(i,j)>0.875 ) & (s(i,j)<0.3 & s(i,j)>0.1) & v(i,j)>0.9) mask_red(i,j)=1; else mask_red(i,j)=0; end endendfigure, imshow(mask_red) % YELLOW field mask
for i=1:x for j=1:y if((h(i,j)>0.09 & h(i,j)<0.17) & (s(i,j)<0.15 & s(i,j)>0.1) & v(i,j)>0.95) mask_yellow(i,j)=1; else mask_yellow(i,j)=0; end end end figure, imshow(mask_yellow);% BLUE field mask
for i=1:x for j=1:y if((h(i,j)>0.485 & h(i,j)<0.7) & (s(i,j)<0.5 & s(i,j)>0.1) & v(i,j)>0.98) mask_blue(i,j)=1; else mask_blue(i,j)=0; end endendfigure,imshow(mask_blue);% RED isopter
for i=1:x for j=1:y if(( h(i,j)<0.0166 | h(i,j)>0.9166) & s(i,j)>0.6 & v(i,j)>0.6) mask_red_iso(i,j)=1; else mask_red_iso(i,j)=0; end end end figure, imshow(mask_red_iso);% BLUE isopter
for i=1:x for j=1:y if( (h(i,j)>0.57 & h(i,j)<0.7) & s(i,j)>0.6 & v(i,j)>0.3) masck_blue_iso(i,j)=1; else mask_blue_iso(i,j)=0; end end endfigure, imshow(mask_blue_iso);% YELLOW isopter
for i=1:x for j=1:y if( (h(i,j)>0.05 & h(i,j)<0.07) & s(i,j)>0.9 & v(i,j)>0.8) mask_yellow_iso(i,j)=1; else mask_yellow_iso(i,j)=0; end endendfigure, imshow(mask_yellow_iso);
Best Answer