Transformation matrix to rotate image

I'm trying to find a matrix such that its multiplication with another matrix rotates the latter :
Let be my image/matrix and the vectorized image/matrix.
I'm looking for a "rotation" matrix F such as where is the vectorized rotated image.
Here's what I tried :
by identification
Any idea on how construct such matrix with matlab ?

 Accepted Answer

Matt J
Matt J on 10 Feb 2023
See the section Image Transformations with Localized Responses (localfunc2mat) under the Examples tab of this FEX download,

5 Comments

I'll check it. Thank you !
You're very welcome, but if it does what you need please Accept-click the answer.
Nawel
Nawel on 13 Feb 2023
Edited: Nawel on 13 Feb 2023
I have checked it and I'm not sure the code returns a rotation matrix for an image. I might be wrong but how would you obain a rotation matrix that rotates an image as the one below using the code ?
Did you read the demo under the Examples tab that I referenced? You should have found a direct demonstration there. Here it is again:
xsiz=[256,256];
X1=imresize( double(im2gray(imread('cameraman.tif'))) ,xsiz);
X2=imresize( double(im2gray(imread('peppers.png'))) ,xsiz);
tic;
[A,ysiz]=localfunc2mat(@(x) imrotate(x,-30,'crop') ,...
xsiz,2); %convert to matrix form
toc
Elapsed time is 0.955735 seconds.
Y1=reshape( A*X1(:) , ysiz); %rotate images with matrix multiplication
Y2=reshape( A*X2(:) , ysiz);
montage({X1,Y1,X2,Y2},'DisplayRange',[0,256],'Size',[2,2])
Hi again,
Thank you for your answer !

Sign in to comment.

More Answers (0)

Products

Asked:

on 10 Feb 2023

Commented:

on 16 Feb 2023

Community Treasure Hunt

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

Start Hunting!