在MATLAB中翻转和旋转彩色图像 [英] flip and rotate a color image in MATLAB

查看:1045
本文介绍了在MATLAB中翻转和旋转彩色图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MATLAB中翻转彩色图像(RGB)?
fliplr 似乎没有失去颜色内容,因为它只处理2D。

How do I flip a color image (RGB) in MATLAB? The fliplr does not seem to work without losing the color contents, as it only deals with 2D.

imrotate 也不能旋转彩色图像。

As well, the imrotate may not rotate color images.

推荐答案

函数 flipdim 将用于ND矩阵,而函数 flipud fliplr 仅适用于二维矩阵:

The function flipdim will work for N-D matrices, whereas the functions flipud and fliplr only work for 2-D matrices:

img = imread('peppers.png');     %# Load a sample image
imgMirror = flipdim(img,2);      %# Flips the columns, making a mirror image
imgUpsideDown = flipdim(img,1);  %# Flips the rows, making an upside-down image

注意在最新版本的MATLAB(R2013b及更高版本)中,函数 flip ,而不是 flipdim

NOTE: In more recent versions of MATLAB (R2013b and newer), the function flip is now recommended instead of flipdim.

这篇关于在MATLAB中翻转和旋转彩色图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆