MATLAB: How to detect ” V ” shape ? can any one help me

computer visionComputer Vision Toolboximage processingmathematicsMATLAB

How to detect " V " shape

Best Answer

I = imread('v_shape.jpg') ;
[nx,ny] = size(I) ;
[y,x,val] = find(I~=0) ;
%%Bounding box
x0 = min(x) ; x1 = max(x) ;
y0 = min(y) ; y1 = max(y) ;
L = abs(x0-x1) ;
B = abs(y0-y1) ;
Rect = [x1 y0 ; x0 y0 ; x0 y1 ; x1 y1 ; x1 y0] ;
imshow(I) ;
hold on
plot(Rect(:,1),Rect(:,2),'r')