How to get pixel coordinates that make up a curve in a graph?

Hi,
I need help finding the coordinates of the pixels that make up the curve in the image which I have included the link to at the bottom of this message. I do not want to get the pixel coordinates of the axis or numbers on the axis; only of the plotted curve. I know that I should have a code that I wrote and go from there to ask for assistance. The thing is that I have never worked on image processing before, and I just need to get over this step to complete the project I'm working on.
Please if you have some time and can help me on at least getting started, I will be very appreciative. I have tried googling my issue, but it didn't help me build my own code to do the job I want. I guess it's because, as I said before, I have never worked on image processing prior to today really... and come on, don't ask me to go and read about it; just help me if you can.
I am familiar with Matlab.
Thanks.

 Réponse acceptée

If you read it in as an RGB image, it should just be a matter of searching for pixels that have a sufficiently large blue component.
rgb=imread('1z4ztl1.png');
locations = (rgb(:,:,3)>=threshold);
You would have to pick the threshold, obviously, but if you do imshow(A) and zoom in on the curve and probe it using the data tip, you should be able to get a good idea of its blue levels.

4 commentaires

Thanks Matt,
As you said, I was able to use imshow() to identify the blue in the picture; and it turns out that the blue pixels are exactly those with RGB values equal to [0 0 255]. So, I want to get the (x,y) coordinates of these blue pixels. I wasn't able to get the coordinates of these pixels. What I was able to do is to get a bunch of numbers that, I would guess, are an indication of (or at least correlated to) the position of the blue pixels in the image. I just don't know how to convert these numbers to (x, y) pixels coordinates. And, in all honesty, I don't even know what these numbers represent. Would you please assist me on this? Thanks.
rgb=imread('Tulips.jpg');
imshow(rgb)
r=rgb(:,:,1);
g=rgb(:,:,2);
b=rgb(:,:,3);
t = find(r==0 & g==0 & b==255);
What are these numbers in t ?
Matt J
Matt J le 10 Mar 2013
Modifié(e) : Matt J le 10 Mar 2013
As you have it now, the numbers in t are linear indices, i.e., the positions of the pixels as you raster scan through the image along columns. If you want the pixels in i,j matrix coordinates, you would do instead
[i,j]= find(r==0 & g==0 & b==255);
You could also convert t to (i,j) coordinates by doing
[i,j]=ind2sub(size(r), t);
It worked Matt. Thank you.
Image Analyst
Image Analyst le 10 Mar 2013
Modifié(e) : Image Analyst le 10 Mar 2013
The image goes way outside the axes. How did you determine the row number of the x axis, and the column number of the y axis? I know how I'd do it but just wondered how you did it, or if you did it, because otherwise your coordinates will be relative to the outside of the image, not relative to the axes.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by