0

我有这样的问题;

points(size = 65,2) 是一个具有图像像素坐标的变量。在第一列中,有 x 坐标,在第二个 y 坐标中,我想从仅一个通道的像素坐标中获取矩阵的幅度值(大小 = 256,256,6),例如。3(三)。

我无法成功。

intensities = images(points(:,2), points(:,1), 3); 

制作一个 65x65 的矩阵。

谢谢

希门尼斯

4

1 回答 1

1

You can convert your x,y indices to linear indices to get values you want from your image:

% some sample data    
list = round(256*rand(65,2));
im = rand(256,256);
% calculate linear indices
ind = sub2ind([256,256],list(:,1),list(:,2));
intensities = im(ind);

This results in an intensities matrix that is 65x1 where each element corresponds to the x,y pair from your list.

于 2013-04-08T03:48:56.343 回答