moving an image across the screen along some vector path

3 vues (au cours des 30 derniers jours)
Kendall Donahoe le 6 Avr 2021
Réponse apportée : LO le 6 Avr 2021
hey Ive been trying to move an image of the avatar across the screen and can't seem to figure it out. I know how to shift the image using the identity matrix and was wondering if there was a way I could use that to make it move across the screen or any other way that it is possible. Here are some of the function names I have been using and the way that I shifted it. I have attached the image and a converter script that I used.
Aout=Jpeg2pointsConverter(A, 15);
plot(Aout(1,:), Aout(2,:),'b.')
[nrows, ncols]=size(Aout);
AA=[Aout; ones(1,ncols)];
S=eye(3)
>> S(1,3)=300
>> A3=S*AA;
>> hold on, plot(A3(1,:), A3(2,:),'r.')
1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
DGM le 6 Avr 2021
Modifié(e) : DGM le 6 Avr 2021
I have no idea what you're trying to do with this, but this whole thing
BB1=BB(:,:,1);
[M, N]= size(BB1);
BB1=double(BB1);
BB2 = 255-BB1; %Invert so white is 0 instead of 255
BB3 = (BB2 > THRESHOLD); %Any point with high value is replaced by 1, and
%any point with a low value is replaced by 0
PP=zeros(2,M*N);
cnt=0;
for ii=1:M,
for jj=1:N,
if (BB3(ii,jj)>0.5),
% this is going to return nonsense indices
% once you change the aspect ratio
PP(:,cnt+1)=[jj;N-ii];
cnt=cnt+1;
end,
end,
end
PPout = PP(:,1:cnt);
can be replaced with this
[rows cols]=find(BB(:,:,1)<(255-threshold));
PPout=[cols; rows];
I don't know why you're returning all the row indices backwards, but i guess you could still do that
[rows cols]=find(BB(:,:,1)<(255-threshold));
PPout=[cols; size(BB,1)-rows];

Connectez-vous pour commenter.

Réponses (1)

LO le 6 Avr 2021
try using circshift
https://de.mathworks.com/help/matlab/ref/circshift.html
0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Segmentation and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by