Image flip around arbitrary axis
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a 128x128 binary mask. I would like to flip the image with respective to an arbitrary axis, similar to what 'flipup' and 'fliplr' do but with a user defined axis. Is there a quick and easy way to get this done? Thanks for reading.
0 Commenti
Risposta accettata
Matt J
il 29 Ago 2017
Modificato: Matt J
il 29 Ago 2017
Using AxelRot ( Download ) you could do the flip as follows given the direction vector u and a point x0 on the line in (i,j) pixel coordinates
[i,j]=find(yourMask);
ij0=[i,j].';
ij0(3,end)=0; %Embed in 3D
u(3)=0;
x0(3)=0;
ij=round(AxelRot( ij0, 180,u,x0 )).';
newMask=accumarray(ij(:,1:2),true,size(yourMask));
The above does nearest neighbor interpolation whenever the flipping places pixels at non-integer locations.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Computer Vision with Simulink in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!