1
나는 이미지 프로세싱을 처음 사용하기 때문에 이미지를 뒤틀기위한 코드를 구현했으며 완벽하게 작동합니다. 필자는 내장 함수 (interp)를 사용하지 않고 선형 보간을 사용하여 이미지를 회전하여 코드를 개선하고 싶습니다.Matlab 이미지 회전
내가 기능 [imwarp][1]
구축 Matalb에 비교하여 구현을 확인 : 다음과 같은 솔루션
close all;
clear all;
img = 'woods.jpg';
input_image =double(imread(img))./255;
H=size(input_image,1);
W=size(input_image,2);
th=pi/4;
s0 = 2;
s1 = 2;
x0 = -W/2;
x1 = -H/2;
T=[1 0 x0 ; ...
0 1 x1 ; ...
0 0 1];
RST = [ (s0*cos(th)) (-s1*sin(th)) ((s0*x0*cos(th))-(s1*x1*sin(th))); ...
(s0*sin(th)) (s1*cos(th)) ((s0*x0*sin(th))+(s1*x1*cos(th))); ...
0 0 1];
M=inv(T)*R;
N = inv(M);
output_image=zeros(H,W,3);
for i=1:W
for j=1:H
x = [i ; j ; 1];
y = N * x;
a = y(1)/y(3);
b = y(2)/y(3);
a = round(a);
b = round(b);
if (a>0 && a<=W && b>0 && b<=H)
output_image(j,i,:)=input_image(b,a,:);
end
end
end
imgshow(output_image);
가능한 [Resi imresize없이 쌍 선형 보간을 사용하여 이미지 만들기] (http://stackoverflow.com/questions/26142288/resize-an-image-with-bilinear-interpolation-withoutimimize) – Anna1994