Get values x and y from a diagram according to a .png picture

16 views (last 30 days)
I have a picture.png that I have downloaded on matlab (imread). This picture represents a diagram on which you can find the SEL according frequencies. I would like to extract the SEL values for a specific frequency: is it possible to do such a thing on matlab ? To get the value of the diagram (under a .png picture) into a matrix so I could extract the desired values.
NB: On this plot there are several lines of different colors.
UPDATE - Okay so I managed to have a working piece of code.Basically, I'm telling Matlab to recognise each lines' color on the .png picture in order to reproduce the plot in a .fig figure. But each line is superposed and it becomes difficult for Matlab for matching the colors.How can I do to extract these particular colors that are hidden behind an other line ?
CODE
% Blue color
decode(1).pppp1 = find(im1(:,:,1) == 0);
decode(1).pppp2 = find(im1(:,:,2) == 0);
decode(1).pppp3 = find(im1(:,:,3) == 255);
decode(1).RGB = [0 0 1];
% Red color
decode(2).pppp1 = find(im1(:,:,1) == 255);
decode(2).pppp2 = find(im1(:,:,2) == 0);
decode(2).pppp3 = find(im1(:,:,3) == 0);
decode(2).RGB = [1 0 0];
% Green color
decode(3).pppp1 = find(im1(:,:,1) == 63);
decode(3).pppp2 = find(im1(:,:,2) == 247);
decode(3).pppp3 = find(im1(:,:,3) == 100);
decode(3).RGB = [0 1 0];
XBornes = [1 5];
YBornes = [100 170];
x = logspace(XBornes(1),XBornes(2),size(im1,2));
y = fliplr(linspace(YBornes(1),YBornes(2),size(im1,1)));
for index_color = 1:length(decode);
dummy = intersect(decode(index_color).pppp1, decode(index_color).pppp2);
dummy = intersect(dummy, decode(index_color).pppp3);
bidon = im1(dummy);
for index_intersect = 1:numel(dummy);
[I,J] = ind2sub(size(im1),dummy(index_intersect));
%%Calcul des coordonnées en valeurs.
pts(index_intersect).X = x(J);
pts(index_intersect).Y = y(I);
end
semilogx([pts.X],[pts.Y],'Color',decode(index_color).RGB)
hold on
end
  1 Comment
Image Analyst
Image Analyst on 7 Apr 2014
Are you going to let us see the image? And what is "the SEL" and what is the decode structure?

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!