【问题标题】:How to rotate axes object in Matlab如何在 Matlab 中旋转轴对象
【发布时间】:2015-01-25 15:50:47
【问题描述】:

我正在寻找一种在 Matlab 中沿轴旋转图像的方法。我尝试使用rotateimrotate 来实现这一点,但这两个功能都不适用于我。有人知道如何解决我的问题吗?

imshow(imread('theImage.png'),'Parent',handles.axes3);

imrotate(handles.axes3, 45); %simply doesn't work
set(handles.axes3,'Rotation',45); %no 'Rotation' in axes
%I don't even know how to use just rotate()

【问题讨论】:

  • 展示您的尝试,然后我们可以帮助您
  • 真的吗?减号是因为我只发布了函数名称而不是代码?
  • 虽然它不一定值得一票否决,但仅提及您尝试过的函数的名称并没有太大帮助。该函数可能是正确的,但使用错误的参数调用。如果您要向某人寻求帮助,请尽可能多地让他们知道,而不是仅仅为了查明您的问题而提出几个额外的问题。

标签: matlab rotation axes


【解决方案1】:

需要明确的是,没有办法旋转axes 对象。但是您可以旋转图像数据,然后以旋转状态再次显示它们。

函数imrotate 会旋转您在输入中提供的“图像数据”,并返回一个表示旋转后的图像数据的矩阵。所以在你的情况下,不要在读取文件后直接显示。获取变量中的图像数据,用imrotate 旋转它,然后显示旋转后的图像(或用它做你需要的)

举个例子:

img = imread('peppers.png') ; %// get the image data into the variable "img"
img2 = imrotate(img,90) ;     %// get the "rotated" image data into the variable "img2"

%// display both "img" and "img2"
subplot(1,2,1) ; imshow( img ) 
subplot(1,2,2) ; imshow( img2 ) 

将产生:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    • 1970-01-01
    • 2012-06-22
    • 1970-01-01
    • 2017-02-10
    相关资源
    最近更新 更多