原创 2007协议包

2009-3-21 20:26 1792 5 5 分类: 工程师职场
p> cd f:
I=imread('mm.jpg');
>> tform="maketform"('projective',[-1 0 0;0 -1 0;0 0 1]);
>> g="imtransform"(I,tform);
%%%%%%%第一次分割
>> imid = round(size(I,2)/2); % Find index of middle element
>> I_left = I(:,1:imid);
>> I_right=g(:,1:imid);
    stretch="1";
   size_left = [size(I,1) round(stretch*imid)];
>> size_right=[size(g,1) round(stretch*imid)];
%%%%%%%%%第二次分割
imid1 = round(size(I_left,2)/2);
>> I_left1 = I_left(:,1:imid1);
>> j="imtransform"(I_left,tform);
>> I_rightf=j(:,1:imid1);
   I_right1=imtransform(I_rightf,tform);
%%%%%%%%%%第三次分割
imid2 = round(size(I_right,2)/2);
>> I_rightf = I_right(:,1:imid2);
I_right2=imtransform(I_rightf,tform);
>> k="imtransform"(I_right,tform);
>> I_left2=k(:,1:imid2);
%%%%%%%%%%放大

stretch1 = 1.08;
>>
>> size_left1 = [size(I_left1,1) round(stretch1*imid1)];
>> size_right2=[size(I_right2,1) round(stretch1*imid2)];
>> I_left1_stretched = imresize(I_left1,size_left);
>> I_right2_stretched = imresize(I_right2,size_right);
>>
>> stretch2 = 1.02;
   size_right1 = [size(I_right1,1) round(stretch2*imid1)];
>> size_left2=[size(I_left2,1) round(stretch2*imid2)];
>> I_left2_stretched = imresize(I_left2,size_left);
>> I_right1_stretched = imresize(I_right1,size_right);
>> I_piecewiselinear = [I_left1_stretched I_right1_stretched];
  
   J_piecewiselinear = [I_left2_stretched I_right2_stretched];
   K_piecewiselinear = [I_piecewiselinear J_piecewiselinear];



tform1=maketform('projective',[1 0 0;0 1.8 0;0 0 1]);
>> y="imtransform"(K_piecewiselinear,tform1,'bicubic');
   figure(1);
 subplot(331);imshow(I);
subplot(332);imshow(I_left);
subplot(333);imshow(I_right);
subplot(334);imshow(I_left1);
subplot(335);imshow(I_right1);
subplot(336);imshow(I_left2);
subplot(337);imshow(I_right2);
subplot(338);imshow(y);
figure(2);
subplot(221);imshow(I_left1_stretched);
subplot(222);imshow(I_right1_stretched);
subplot(223);imshow(I_left2_stretched);
subplot(224);imshow(I_right2_stretched);
9cc1c7b6-44d3-42d1-9101-347d6054df9e.jpg7c2be47d-43af-4b8d-aa2d-a3015dd0f41e.jpg

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
5
关闭 站长推荐上一条 /3 下一条