[英]how to get more accurate point position in an image
通常,我们可以通过以下方式获得图像中的点位置:
figure, imshow rice.png;
[x,y,~] = ginput(1)
返回的内容是这样的:
x = 121
y = 100
这些数字以像素为单位,但是我想要更准确的结果,例如:
x = 121.35
y = 100.87
任何帮助将不胜感激!
为了使用控制点对齐/对准两幅图像,您确实需要针对不同控制点使用亚像素精度。
为此,Matlab有一个非常漂亮的用户界面,您可能需要查看: cpselect
。
这里还有一个不错的教程。
给定两个图像oim1
和oim2
您可以使用cpselect
将oim2
转换为“适合” oim1
:
>> [input_points, base_points] = cpselect(oim2, oim1, 'Wait', true);
>> T = cp2tform( input_points, base_points, 'similarity' ); % find similarity transformation
>> aim2 = tformarray( oim2, T, makeresampler('cubic','fill'), [2 1], [2 1], size(oim1(:,:,1)'), [], 0 );
我认为imagesc可能有用
% load example image
Istruct = load('gatlin');
I = Istruct.X./max(Istruct.X(:));
% display it
figure;
imagesc(I);
colormap(gray);
% get some point
[x,y]=ginput(1);
[x, y] % x and y will be double
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.