Matlab-如何在图像上绘制比例图形
|
我有一个上面有4个斑点的图像,我希望这些斑点精确对准(或非常接近)我想在该图像上绘制的图形中的X,Y坐标。图片目前为600x600像素,但可以调整。
我的身材比例从
AXIS([388020 388090 5776940 5777010])
如何调整图像以使其匹配?那么matlab可以在上面发挥作用吗?
这是我的matlab脚本,运行该脚本可以看到matlab绘图,但下面没有图像...并且matlab绘图似乎已反转。
CSV文件中的%takes
%每行输出一张包含3个圆圈和
%点
d =大小(数据已调整)
长度= d(1)
因为我= [1:1]
%# read and display image
img = imread(\'hciLab_N.png\');
figure(\'Visible\', \'off\'),imagesc([388020 388090], [5776940 5777010], img);
%# make sure the image doesn\'t disappear if we plot something else
hold on
%axis([388020 388090 5776940 5777010]);
%location estimation
yCoord = dataAdjusted(i,2)
xCoord = dataAdjusted(i,3)
%first circle y, x, radius
c1Y = dataAdjusted(i,4);
c1X = dataAdjusted(i,5);
c1R = dataAdjusted(i,6);
%second circle y, x, radius
c2Y = dataAdjusted(i,7);
c2X = dataAdjusted(i,8);
c2R = dataAdjusted(i,9);
%third circle y, x, radius
c3Y = dataAdjusted(i,10);
c3X = dataAdjusted(i,11);
c3R = dataAdjusted(i,12);
%draw location
%rectangle(\'Position\',[xCoord-.5,yCoord-.5,2*.5,2*.5],\'Curvature\',[1,1], \'EdgeColor\', \'r\')
[locX, locY] = makeCircle(xCoord, yCoord, .5);
scatter(locX, locY, .2,\'b\')
%draw circles
%rectangle(\'Position\',[c1X-c1R,c1Y-c1R,2*c1R,2*c1R],\'Curvature\',[1,1])
%rectangle(\'Position\',[c2X-c2R,c2Y-c2R,2*c2R,2*c2R],\'Curvature\',[1,1])
%rectangle(\'Position\',[c3X-c3R,c3Y-c3R,2*c3R,2*c3R],\'Curvature\',[1,1])
[c1X, c1y] = makeCircle(c1X, c1Y, c1R);
scatter(c1X, c1y, .2,\'k\')
[c2X, c2y] = makeCircle(c2X, c2Y, c2R);
scatter(c2X, c2y, .2,\'k\')
[c3X, c3y] = makeCircle(c3X, c3Y, c2R);
scatter(c3X, c3y, .2,\'k\')
% 80 5776978.148 388054.1747
%rectangle(\'Position\',[388054.1747-1,5776978.148-1,2*1,2*1],\'Curvature\',[1,1], \'EdgeColor\', \'g\')
[r1X, r1y] = makeCircle(388054.1747, 5776978.148, 1);
scatter(r1X, r1y,.2,\'g\')
% 87 5776988.825 388043.9639
%rectangle(\'Position\',[388043.9639-1,5776988.825-1,2*1,2*1],\'Curvature\',[1,1], \'EdgeColor\', \'g\')
[r2X, r2y] = makeCircle(388043.9639, 5776988.825, 1);
scatter(r2X, r2y,.2,\'g\')
% 88 5776970.712 388054.2578
%rectangle(\'Position\',[388054.2578-1,5776970.712-1,2*1,2*1],\'Curvature\',[1,1], \'EdgeColor\', \'g\')
[r3X, r3y] = makeCircle(388054.2578,5776970.712, 1);
scatter(r3X, r3y,.2,\'g\')
% 89 5776975.889 388039.8496
%rectangle(\'Position\',[388039.8496-1,5776975.889-1,2*1,2*1],\'Curvature\',[1,1], \'EdgeColor\', \'g\')
[r4X, r4y] = makeCircle(388039.8496,5776975.889, 1);
scatter(r4X, r4y,.2,\'g\')
%title([\'Localization of duty cycle \' this_name ]);
saveas(gcf, [\'TrilaterationNumber_Adjusted_WithRouters_Scaled\' num2str(i)], \'png\');
结束
没有找到相关结果
已邀请:
1 个回复
祁澈盘哼颗
或者,如果您只需要缩放数据:
绘制图像后,您可能需要发出“全部保留”命令,然后再绘制其他任何内容。