本文介绍了访问OpenCV中每个单独的通道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含3个频道(img)的图片,另一个包含单个频道(ch1)。

I have an image with 3 channels (img) and another one with a single channel (ch1).

    Mat img(5,5,CV_64FC3);
    Mat ch1 (5,5,CV_64FC1);

是否有任何有效的方法(不使用for循环)复制 img ch1

Is there any efficient way (not using for loop) to copy the first channel of img to ch1?

推荐答案

://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight = mixchannels#mixchannels> cvMixChannels 。您需要在源代码中看到实现,但我敢打赌它已经过优化。

There is a function called cvMixChannels. You'll need to see implementation in the source code, but I bet it is well optimized.

这篇关于访问OpenCV中每个单独的通道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 15:50