The resulting image needs to remove values on the strong vertical edges and above edge(black region) as they are not region of interest. Therefore, Edge detection applied.BW shows result of edge detection, size of BW(image size) is different with other matrix in the following code. How values on edge and above edge can be remove? image image2
function display_skew_final2(ST, Im,Frame)
close all;
Contrast_maxi = max(Frame(1:1).Contrast(:));
%identify vertical edges
BW = edge(Im(:,:,1),'prewitt',0.15,'vertical','nothinning');
colors = {'r'};
figure; imshow (Im(:,:,1));
for idxcol = 1:size(ST.KernelX,1)
for idxrow = 1:size(ST.KernelY,1)
Contrast= Frame(1:1).Contrast(idxrow,idxcol);
Skew= Frame(1:1).Skew(idxrow,idxcol);
Normalize_Contrast = Contrast/Contrast_maxi ;
radi_Contrast(:) = Normalize_Contrast;
Skew_radi(:) = Skew;
for ROWCircleCenter = ST.KernelY(idxrow);
for COLCircleCenter = ST.KernelX(idxcol);
centers = [COLCircleCenter ROWCircleCenter];
if (Skew_radi < 0)
Skew_radi2 = abs(Skew_radi); else Skew_radi2 = Skew_radi; end
if (radi_Contrast > 0.18)
axis ij
viscircles (centers,Skew_radi2,'Color',colors{1});
% rectangle('Position',[(COLCircleCenter) (ROWCircleCenter) Skew_radi2 Skew_radi2],'Curvature',[1 1],'FaceColor',[1 0 0],'EdgeColor',[1 0 0],'LineWidth',5)
end
end
end
end
end