在MATLAB中进行图像转置 [英] Image transpose in MATLAB

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

问题描述

如何转置具有RGB值的图像?那就是第一行中的所有像素都应该成为第一列中的像素,依此类推.

How do you transpose an image with RGB values? That is all pixels in line one should become pixels in column 1 and so on.

对于简单的一维情况,这是:

For a simple 1D case this is:

B=A';

我正在追寻类似的东西

img=imread('name.bmp');

R=R';
G=G';
B=B';

然后以某种方式将它们组装成新图像.

And then to have them assemble into a new image somehow.

推荐答案

您可以使用short&简单的 permute -

You can use short & simple permute -

permute(img,[2 1 3])

基本上,它会交换行与保持第三维完整的列,即对每个3D切片进行转置.此方法的优点是,即使您在第三维中有4个切片,该方法也将起作用,例如对于深度信息通常存储为dim3中第4个切片的图像.

Basically it exchanges the rows with columns keeping the third dimension intact, i.e. transposes each 3D slice. Advantage with this method would be that it would work even if you have 4 slices in the third dimension, for example for images with depth information usually stored as the 4th slice in dim3.

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

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