
Moving image by vector
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a movie that is unstable. Moves up and down. I shared it on frames.I made binarization ,found the center of gravity of each frame. I need to set all the centers of gravity like the first one. I made : the center of gravity of the first - the center of gravity (2...x) and the result was a vector by witch a move next frame. Unfortunately, point of gravity of second and next is steal not the same as 1.Please help, I do not know solve this problem.
T = maketform('affine', [1 0 0; 0 1 0; min max 1]);
img2 = imtransform(L3, T, ...
'XData',[1 size(L3,2)], 'YData',[1 size(L3,1)]);
subplot(121), imshow(L3), axis on
subplot(122), imshow(img2), axis on
0 Commenti
Risposte (1)
Image Analyst
il 4 Gen 2015
Modificato: Image Analyst
il 4 Gen 2015
Use the displacement field input argument of imwarp().
Try this to shift the image in x and y using the values of -64 and -302 for example:
fontSize = 20;
grayImage = imread('concordorthophoto.png');
[rows, columns, numberOfColorChannels] = size(grayImage);
subplot(1, 2, 1);
imshow(grayImage);
axis on;
title('Original Image', 'fontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
deltaX = 64; % Shift x by 64 pixels.
deltaY = 302; % Shift y by 302 pixels.
D = zeros(rows, columns, 2);
D(:,:,1) = -deltaX; % Shift x by 64 pixels.
D(:,:,2) = -deltaY; % Shift x by 302 pixels.
warpedImage = imwarp(grayImage, D);
subplot(1, 2, 2);
imshow(warpedImage);
axis on;
title('Shifted Image', 'fontSize', fontSize);

2 Commenti
Image Analyst
il 4 Gen 2015
What version of MATLAB do you have? Is it some antique version? Is so, please upgrade. What does this say
ver
which -all imwarp
whos grayImage
whos D
Did you modify my demo at all? Because it runs just fine for me.
Vedere anche
Categorie
Scopri di più su Image Processing and Computer Vision in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!