图像和数据矩阵 [英] Image and data matrices

查看:135
本文介绍了图像和数据矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 MATLAB 中读取一些图像时,我们是说这个图像也是数据矩阵,还是它们是两个不同的东西?如果它们不同,我们如何在 MATLAB 中将图像转换为数据矩阵?

When I read some image in MATLAB, do we say that this image is also a data matrix, or are they are two different things? If they are different, how can we convert an image to a data matrix in MATLAB?

就我而言知道,图像是一个像素矩阵,不是吗?

As far as I know, an image is a matrix of pixels, isn't it?

推荐答案

这是一个数据矩阵。大多数时候,加载图像时格式为 uint8 格式,有时为三维(RGB,HSV ...),有时为二维(灰度)。要在矩阵之间获得更多操作,最好的方法是将数据转换为双倍格式(只需使用 double )。

It is a data matrix. Most time it is uint8 format when you load the image, sometimes in three dimension (RGB, HSV...), and sometimes in two (grayscale). To get more operations between the matrix, the best way is to convert the data to double format (just use double).

代码示例:

I=imread('img1.jpg');
I=double(I);
J=imread('img2.jpg');
J=double(J);

%你可以实现各种阵列操作,例如乘法,点积,幂,...仅限名称一些

% you can implement various array operations such as multiplication, dot product, power, ..to name only a few

K = I.*J;
K1 = I.*(J<240);
K2 = J.^(0.5);

这篇关于图像和数据矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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