Extract XY data from the image based on the color filter
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
S.R.
el 5 de Jun. de 2020
Comentada: S.R.
el 7 de Jun. de 2020
Hi,
How could I extract XY data from the image by selecting points of the same color? For example, in the attached figure, gain is plotted versus frequency for three different temperatures. +85C is red color, +25C is green color and -40C is blue color. I would like to be able to extract XY data but instead of picking up manually point by point on the curve, I would like to pick one point on the red curve which would then select all points with the same color and export them as the XY data scaled based on the some already known XY points presented on the graph.
Thank you,
S.R.

6 comentarios
Ameer Hamza
el 6 de Jun. de 2020
I think there is no straightforward way to extract the data. You may need to write the code according to your requirement using the image processing tools.
Respuesta aceptada
Image Analyst
el 6 de Jun. de 2020
Editada: Image Analyst
el 6 de Jun. de 2020
Try imsplit
[r,g,b] = imsplit(rgbImage);
% Then scan each column with find() until you find the first row where that color appears.
redImage = r == 255 & g == 0 & b == 0;
greenImage = r == 0 & g == 255 & b == 0;
blueImage = r == 0 & g == 0 & b == 255;
[rows, columns] = size(redImage)
ry = zeros(1, columns)
gy = zeros(1, columns)
by = zeros(1, columns)
for col = 1 : columns
% First the red
thisCol = redImage(:, col);
topRow = find(thisCol);
if ~isempty(topRow)
ry = topRow;
end
% Next the green
thisCol = greenImage(:, col);
topRow = find(thisCol);
if ~isempty(topRow)
gy = topRow;
end
% Next the blue
thisCol = blueImage(:, col);
topRow = find(thisCol);
if ~isempty(topRow)
by = topRow;
end
end
Of course the values will be in units and coordinates of image pixels, so you'll have to calibrate the distances.
3 comentarios
Image Analyst
el 6 de Jun. de 2020
Are you sure you can't get the figure, or the data used to create the figure. If you have just the PNG image, it's going to be hard to pull out each curve independently since they overlap. You're probably best off using imfreehand to hand trace the curve. I'm attaching a demo.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
