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

问题描述

我将图片从rgb转换为YUV。现在我想找到luma通道的平均值。你能告诉我如何实现这一点帮助我吗?

I converted my image from rgb to YUV. Now I want to find the average values of luma channel alone. Could you please help me by telling how I can achieve this? Moreover, is there a way to determine how many channels an image consists of?

推荐答案

Image.channels()会给你一个图像组成的通道。任何图像中的通道数。请参阅OpenCV文档。

Image.channels() will give you the number of channels in any image. Please refer to the OpenCV documentation.

可以按如下方式访问多个渠道:

multiple channels can be accessed as follows:

        img.at<Vec3b>(i,j)[0] //Y
        img.at<Vec3b>(i,j)[1] //U
        img.at<Vec3b>(i,j)[2] //V

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

09-05 14:16
查看更多