Image flip around arbitrary axis

10 visualizaciones (últimos 30 días)
David Shin
David Shin el 29 de Ag. de 2017
Editada: Matt J el 29 de Ag. de 2017
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.

Respuesta aceptada

Matt J
Matt J el 29 de Ag. de 2017
Editada: Matt J el 29 de Ag. de 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.

Más respuestas (0)

Categorías

Más información sobre Computer Vision with Simulink en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by