OpenCV 自动检测颜色 [英] OpenCV detect color Automatically

查看:84
本文介绍了OpenCV 自动检测颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让 Color Blob Detection 自动检测指定的颜色而不用按下它?

Is there a possible way to make Color Blob Detection automatically detect a specified color without pressing it ?

Ex 我只会指定我想要的颜色范围,然后它会自动检测具有相同范围的颜色.

Ex I'll just specify what range of color is I want then it would automatically detect the color with the same range.

推荐答案

您可能需要使用 cv::inRange 并将您的颜色范围定义为 (r1,g1,b1) 到 (r2,g2,b2).例如:

You probably need to use cv::inRange and define your range of colors as (r1,g1,b1) to (r2,g2,b2). E.g.:

cv::inRange(input, cv::Scalar(0,140,0), cv::Scalar(160,255, 160), output);

这篇关于OpenCV 自动检测颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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