映射两个矩阵的像素 [英] Mapping pixels of two matrices

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

问题描述

说我有两个以下大小的矩阵:

  matrix_1 = 30090x2 

matrix_2 = 170x177

这里假设行的数量 n matrix_1 表示像素的数量。您可以看到 matrix_2 的大小等于像素数。



我正在尝试do是 map matrix_1 中的像素到 matrix_2 ,例如:

  matrix_1(1)= matrix_2(1)
matrix_1(2)= matrix_2 (2)
matrix_1(3)= matrix_2(3)
......
......
matrix_1(n)= matrix_2(n)

如何在 matlab ? / p>

解决方案

这是一个选项

  matrix_1 = matrix_2(:); 

其中复制了 matrix_2 in 一个长列。



在您的数据中,您表示 matrix_1 有两列,您可以通过执行添加另一个空列,例如

  matrix_1 = [matrix_1 zeros(size(matrix_1) )]; 


Say that I have two matrices of the following sizes:

matrix_1 = 30090x2

matrix_2 = 170x177

Assume here that the number of rows n matrix_1 represents the number of pixels. You can see that the size of matrix_2 is equal to the number of pixels.

What I'm trying to do is map the pixels in matrix_1 to the pixels in matrix_2, such that for example:

matrix_1(1) = matrix_2(1)
matrix_1(2) = matrix_2(2)
matrix_1(3) = matrix_2(3)
......
......
matrix_1(n) = matrix_2(n)

How can I do that in matlab?

解决方案

Here is an option

  matrix_1 = matrix_2(:);

which copies the elements (all of them) of matrix_2 in one long column.

In your data you said that matrix_1 has two columns, you can add a further empty column by doing, for instance

  matrix_1  = [matrix_1 zeros(size(matrix_1))];

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

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