I'd like to extract the curves from a plot using Matlab. I would like to select the color of the curves I wish to extract, and then have their coordinates output. I realize that having this done for a relative graph is complicated, so all I need are the pixel locations. From there I can analyze what they correspond to. An example image is provided, where I'd like to take the red curves, and output their locations to a text file.
An extremely nice addition to this would be to 'curve fit' the extracted pixels. The extracted graph values will most likely come from +5 pixel width curves which your numeric data will have width. It would be ideal to average out this behaviour and thin the data.
Red are the pixels on a curve, blue are the effective pixels to be extracted instead. I see this being done in two ways: A transformation on the image, then extract the values, or vice-versa. I'm not sure which would be better.
Almost the same solution as Mark Setchell, but now in Matlab.
I = imread('DoEvE.png');
% select the red pixels
Ired = I(:,:,1) == 255 & I(:,:,2) == 0 & I(:,:,3) == 0;
figure
imshow(Ired)
[x, y] = find(Ired); % extract the (x, y) coordinates of the red pixels
hold on
plot(y, x, 'b.'); % plot the result to validate