usually, we can get point position in an image in this way:
figure, imshow rice.png;
[x,y,~] = ginput(1)
what returned is something like this:
x = 121
y = 100
these numbers are measured by pixels, but I'd like more accurate results like:
x = 121.35
y = 100.87
any help would be appreicated!!!
For aligning / registering two images using control points you do need sub-pixel accuracy for the different control points.
Matlab has a very nice user interface for this purpose you might want to look at: cpselect
.
A nice tutorial is also available here .
Given two images oim1
and oim2
you may use cpselect
to transform oim2
to "fit" 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 );
I think imagesc can be useful
% 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.