我目前正在研究 python/opencv 实现,以从具有不同曝光的图像中创建 HDR 图像。我找到了一个 matlab 代码示例,它有一个我不理解的功能。
function [ red, green, blue ] = sample( image, sampleIndices )
%Takes relevant samples of the input image
redChannel = image(:,:,1);
red = redChannel(sampleIndices);
greenChannel = image(:,:,2);
green = greenChannel(sampleIndices);
blueChannel = image(:,:,3);
blue = blueChannel(sampleIndices);
函数示例将图像作为参数,在另一个类中声明为
image = cv2.imread(dir_name + filenames[i])
现在我的问题是,这些作业到底是什么意思:
(matlab code)
redChannel = image(:,:,1);
red = redChannel(sampleIndices);
我在 matlab 和 python 中得到了 redChannel 不同的结果:
(python code)
red_channel = image[:, :, 1]
我真的不知道,如果我的 python 代码和上面在 matlab 中写的完全一样。在 python 代码中编写相同的语法是什么?尤其是这一行,这里发生了什么?:
red = redChannel(sampleIndices);
我非常感谢您提供的每一个帮助。
干杯,布索菲安