Image flip around arbitrary axis

10 ビュー (過去 30 日間)
David Shin
David Shin 2017 年 8 月 29 日
編集済み: Matt J 2017 年 8 月 29 日
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.

採用された回答

Matt J
Matt J 2017 年 8 月 29 日
編集済み: Matt J 2017 年 8 月 29 日
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 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by