【问题标题】:Octave manipulating images八度处理图像
【发布时间】:2013-11-05 04:59:09
【问题描述】:

我正在尝试使用八度音程调整图像大小和旋转图像。但是,当我尝试收到以下错误时: 索引超出矩阵维度...有人知道我在做什么错吗?

I=imread('c:/cg/img/Lena.jpg'); % 128 x 128 uint
I2=rgb2gray(I);


alfa=.5;

for i=1:round(256*alfa)
  for j=1:round(256*alfa)

    is=round(i/alfa);
    js=round(j/alfa);

    if (is<1) is=1;  endif;    
    if (js<1) js=1;  endif;


 I3(i,j)=I2(is,js); 

   end
end

imwrite(I3,"c:/cg/lenax0.5.jpg","jpg");



for i=1:256
   for j=1:256
     I4(i,j)=I3(257-j,i);         %90
     I5(i,j)=I3(257-i,257-j);     %180
     I6(i,j)=I3(j,257-i);         %270
    end
end

I7=[I3 I4; I5 I6];
imshow(I7);
imwrite(I7,"c:/cg/lena_rotate_90_180_270.jpg","jpg");

【问题讨论】:

    标签: octave


    【解决方案1】:

    发现错误是在这里我的尺寸错误。

    for i=1:256
       for j=1:256
         I4(i,j)=I3(257-j,i);         %90
         I5(i,j)=I3(257-i,257-j);     %180
         I6(i,j)=I3(j,257-i);         %270
      end
    end
    

    我的尺码不对

    for I=1:128 ect... 
    

    【讨论】:

      【解决方案2】:

      我无法理解您的代码,但是是的,您做错了什么。您没有使用image packageimrotateimresize 的功能。在调用这些函数pkg load image之前不要忘记加载图像包。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-03-22
        • 2021-03-26
        • 2014-02-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多