필터 지우기
필터 지우기

Graph in tiff format : how to interchange X and Y axis ?

조회 수: 3 (최근 30일)
Anjana Ekka
Anjana Ekka 2021년 8월 21일
답변: Wan Ji 2021년 8월 21일
I have a graph in PNG format. I don't have the basic data to generate another graph. I want to inter-change the X and Y axis ? How can I extract the data from image?

답변 (1개)

Wan Ji
Wan Ji 2021년 8월 21일
I usually use GetData software. while with matlab, I wrote code for this problem below
% Extract data from image
clc;clear
figName = input('Insert the name of you picture(jpg or png)\n','s');
myFig = imread(figName);
figure(11)
imshow(myFig);
xmin = input('min of x:');
xmax = input('max of x:');
ymin = input('min of y:');
ymax = input('max of y:');
nCurve = input('input number of curves: n\n');
title('click left_up corner and right c_down orner in the axis:')
[xcor, ycor] = ginput(2);
Curve = struct([]);
for i = 1:1:nCurve
title(['Please click the points of ',num2str(i),'th curve(end with enter)'])
[Curve(i).x , Curve(i).y]= ginput(100);
Curve(i).x = xmin+(Curve(i).x - xcor(1))./(xcor(2)-xcor(1))*(xmax-xmin);
Curve(i).y = ymin+(Curve(i).y - ycor(2))./(ycor(1)-ycor(2))*(ymax-ymin);
end
figure(12)
Leg = cell(nCurve,1);
color = 'rgbkcmrgbkcmrgbkcm';
marker = '^osd><hvposd><hvposd><hvp';
for i = 1:1:nCurve
plot(Curve(i).x,Curve(i).y, [color(i),'-',marker(i)],...
'markerfacecolor',color(i),'markersize',5)
hold on
Leg{i,1} = ['Line ',num2str(i)];
end
axis([xmin xmax ymin ymax])
legend(Leg);
xlabel('X')
ylabel('Y')
set(gca,'fontsize',15)
save(['Curve',figName,'.mat'],'Curve')

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by