Thread Subject: Find the last non zero coordinates in a binary image?

Subject: Find the last non zero coordinates in a binary image?

From: Ashvin

Date: 9 Jul, 2009 10:51:09

Message: 1 of 2

I will try to explain what I am trying to do in more detail.

Basically I have a binary image and I would like to plot a parabola
across the min y's for x=20:300 for example.

But there are several values at y=1 in the binary image at x=200 for
example.

I did it point by point the following way but its not practical for
200 points.

x1=200;
x2=201;
x3=202;
x4=203;
x5=204;
x6=205;
x7=206;
x8=207;
x11=208;
x12=209;
x13=210;
x14=211;
x15=212;
x16=213;
x17=214;

[y1]=find(I(:,x1));
[y2]=find(I(:,x2));
[y3]=find(I(:,x3));
[y4]=find(l(:,x4));
[y5]=find(I(:,x5));
[y6]=find(Il(:,x6));
[y7]=find(I(:,x7));
[y8]=find(I(:,x8));
[y11]=find(I(x11));
[y12]=find(I(:,x12));
[y13]=find(I(:,x13));
[y14]=find(I(:,x14));
[y15]=find(I(:,x15));
[y16]=find(I(:,x16));
[y17]=find(I(:,x17));



y1=max(y1);
y2=max(y2);
y3=max(y3);
y4=max(y4);
y5=max(y5);
y6=max(y6);
y7=max(y7);
y8=max(y8);
y11=max(y11);
y12=max(y12);
y13=max(y13);
y14=max(y14);
y15=max(y15);
y16=max(y16);
y17=min(y17);



Once I have the points I use p=polyfit(xcoord,ycoord,2) to draw the
parabola which is pretty straightforward.The only problem I am facing
is to get the corresponding minimum y coordinates for given larger
range of x.

Subject: Find the last non zero coordinates in a binary image?

From: Bruno Luong

Date: 9 Jul, 2009 11:49:02

Message: 2 of 2

You should read more carefully the help/doc of FIND. What you asked is featured in FIND command.

Also note that this tool on FEX might be of interest when applied on a matrix : http://www.mathworks.com/matlabcentral/fileexchange/24641

Bruno

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com