projandadj_2.m
上传用户:jiangyu148
上传日期:2014-10-19
资源大小:2124k
文件大小:4k
源码类别:

图形图象

开发平台:

Matlab

  1. %投影,调整形状
  2. width=640;
  3. height=480;
  4. width_o=round(width/2);
  5. height_o=round(height/2);
  6. dest1=zeros([height,width,3],'uint8');
  7. dest2=zeros([height,width,3],'uint8');
  8. dest3=zeros([height,width,3],'uint8');
  9. dest4=zeros([height,width,3],'uint8');
  10. dest5=zeros([height,width,3],'uint8');
  11. dest6=zeros([height,width,3],'uint8');
  12. dest7=zeros([height,width,3],'uint8');
  13. dest8=zeros([height,width,3],'uint8');
  14. dest9=zeros([height,width,3],'uint8');
  15. dest10=zeros([height,width,3],'uint8');
  16. dest11=zeros([height,width,3],'uint8');
  17. dest12=zeros([height,width,3],'uint8');
  18. f=f0;
  19. for w=1:width    
  20.     for h=1:height      
  21.     y1=round(sqrt(f^2/((w-width_o)^2+f^2))*(h-height_o))+height_o;     
  22.     x1=round(sqrt(f^2/((w-width_o)^2+f^2))*(w-width_o))+width_o;         
  23.      dest1(y1,x1,1)=im1(h,w,1);      
  24.      dest1(y1,x1,2)=im1(h,w,2);     
  25.      dest1(y1,x1,3)=im1(h,w,3);    
  26.      dest2(y1,x1,1)=im2(h,w,1);      
  27.      dest2(y1,x1,2)=im2(h,w,2);     
  28.      dest2(y1,x1,3)=im2(h,w,3);
  29.      dest3(y1,x1,1)=im3(h,w,1);      
  30.      dest3(y1,x1,2)=im3(h,w,2);     
  31.      dest3(y1,x1,3)=im3(h,w,3);
  32.      dest4(y1,x1,1)=im4(h,w,1);      
  33.      dest4(y1,x1,2)=im4(h,w,2);     
  34.      dest4(y1,x1,3)=im4(h,w,3);
  35.      dest5(y1,x1,1)=im5(h,w,1);      
  36.      dest5(y1,x1,2)=im5(h,w,2);     
  37.      dest5(y1,x1,3)=im5(h,w,3);
  38.      dest6(y1,x1,1)=im6(h,w,1);      
  39.      dest6(y1,x1,2)=im6(h,w,2);     
  40.      dest6(y1,x1,3)=im6(h,w,3);    
  41.      dest7(y1,x1,1)=im7(h,w,1);      
  42.      dest7(y1,x1,2)=im7(h,w,2);     
  43.      dest7(y1,x1,3)=im7(h,w,3);
  44.      dest8(y1,x1,1)=im8(h,w,1);      
  45.      dest8(y1,x1,2)=im8(h,w,2);     
  46.      dest8(y1,x1,3)=im8(h,w,3);
  47.      dest9(y1,x1,1)=im9(h,w,1);      
  48.      dest9(y1,x1,2)=im9(h,w,2);     
  49.      dest9(y1,x1,3)=im9(h,w,3);
  50.      dest10(y1,x1,1)=im10(h,w,1);      
  51.      dest10(y1,x1,2)=im10(h,w,2);     
  52.      dest10(y1,x1,3)=im10(h,w,3);
  53.      dest11(y1,x1,1)=im11(h,w,1);      
  54.      dest11(y1,x1,2)=im11(h,w,2);     
  55.      dest11(y1,x1,3)=im11(h,w,3);
  56.      dest12(y1,x1,1)=im12(h,w,1);      
  57.      dest12(y1,x1,2)=im12(h,w,2);     
  58.      dest12(y1,x1,3)=im12(h,w,3);
  59.      if w==1 
  60.           if h==1
  61.              w_1 =x1;
  62.              h_1 =y1;
  63.           end
  64.           if h==height
  65.               h_2=y1;
  66.           end
  67.      end
  68.      if w==width
  69.           if h==1
  70.              w_2 =x1;
  71.           end    
  72.      end    
  73.    end;
  74. end;
  75. I1=imcrop(dest1,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  76. I2=imcrop(dest2,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  77. I3=imcrop(dest3,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  78. I4=imcrop(dest4,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  79. I5=imcrop(dest5,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  80. I6=imcrop(dest6,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  81. I7=imcrop(dest7,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  82. I8=imcrop(dest8,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  83. I9=imcrop(dest9,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  84. I10=imcrop(dest10,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  85. I11=imcrop(dest11,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  86. I12=imcrop(dest12,[w_1,h_1,(w_2-w_1),(h_2-h_1)]);
  87. % I1=imcrop(dest1,[w_1,h_1,(w_2-w_1),height]);
  88. % I2=imcrop(dest2,[w_1,h_1,(w_2-w_1),height]);
  89. % I3=imcrop(dest3,[w_1,h_1,(w_2-w_1),height]);
  90. % I4=imcrop(dest4,[w_1,1,(w_2-w_1),height]);
  91. % I5=imcrop(dest5,[w_1,1,(w_2-w_1),height]);
  92. % I6=imcrop(dest6,[w_1,1,(w_2-w_1),height]);
  93. % I7=imcrop(dest7,[w_1,1,(w_2-w_1),height]);
  94. % I8=imcrop(dest8,[w_1,1,(w_2-w_1),height]);
  95. % I9=imcrop(dest9,[w_1,1,(w_2-w_1),height]);
  96. % I10=imcrop(dest10,[w_1,1,(w_2-w_1),height]);
  97. % I11=imcrop(dest11,[w_1,1,(w_2-w_1),height]);
  98. % I12=imcrop(dest12,[w_1,1,(w_2-w_1),height]);
  99. %  imwrite(I1,'I1.jpg');
  100. %  imwrite(I2,'I2.jpg');
  101. %  imwrite(I3,'I3.jpg');
  102. %  imwrite(I4,'I4.jpg');
  103. %  imwrite(I5,'I5.jpg');
  104. %  imwrite(I6,'I6.jpg');
  105. %  imwrite(I7,'I7.jpg');
  106. %  imwrite(I8,'I8.jpg');
  107. %  imwrite(I9,'I9.jpg');
  108. %  imwrite(I10,'I10.jpg');
  109. %  imwrite(I11,'I11.jpg');
  110. %  imwrite(I12,'I12.jpg');