matlab自写矩阵实现旋转

clear
clc
matrix_data =imread('D:\Google_Download\2.jpg');
%matrix_data = rgb2gray(matrix_data);
[a,b,c] = size(matrix_data);
result_matrix = zeros(b,a,c);
for i=1:a
for j=1:b
for k=1:c
result = i*[0;1]+j*[-1;0];
result_matrix(result(1)+b+1,result(2),k) = matrix_data(i,j,k);
end
end
end
result_matrix = uint8(result_matrix);
figure
imshow(matrix_data);
figure
imshow(result_matrix );

 原理

 

 

posted @ 2020-04-28 12:33  蛮好不太坏  阅读(999)  评论(0编辑  收藏  举报