Forward mapping- problem with Rotation
3 views (last 30 days)
Show older comments
So, i got the input image and I want to apply rotation by 60 degrees. Earlier I created the matrix of output image (all of its pixels are the same colour):
matrix=[0.5 0.86603 0; -0.86603 0.5 0; 0 0 1];
u=1:size(input_image,2);
v=(1:size(input_image,1))';
[U,V]=meshgrid(u,v);
t=1:size(input_image,2)*size(input_image,1);
[x, y] = transformPointsForward(affine2d(matrix),U(t),V(t));
%making indices positive integers
min_x=min(min(x));
min_y=min(min((y));
x=ceil(x-min_x+1);
y=ceil(y-min_y+1);
%copying pixels from input to output image
output_image(y(t),x(t),:)=input_image(V(t),U(t),:);
When it comes to scaling, the result is what it should be. But when I use ratation matrix, the result is like below. Is it the error in the way I'm indexing in my last line of code?
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!