Code covered by the BSD License  

Highlights from
get_points

image thumbnail

get_points

by

 

helps you in getting x and y coordinates of non-zero points in the input 2D binary matrix

points=get_points(bin)
function points=get_points(bin)

%%function to find x and y locations of non zeros values in the image
%input-  2D binary matrix
%output- x and y cordinates of non-zero locations in the matrix

if(ndims(bin)==3)
    fprintf('\n please use binary image as input');
end

img=bin;
s=find(img==1);
y=s-(floor(s/size(img,1))*size(img,1));
x=ceil(s/size(img,1));
points(:,1)=x;
points(:,2)=-y;

Contact us