计算cvInRangeS中的最小值和最大值 [英] Calculate the minimum and maximum in cvInRangeS
问题描述
cvCvtColor(frame, hsv_frame, CV_BGR2HSV);
cvInRangeS(hsv_frame, hsv_min, hsv_max, thresholded);
我尝试跟随蓝球.要确定最大和最小值,我打开用相机拍摄的照片,打开它的MS画图,然后以H的(180/240)结果翻倍 和(255/240)S和L的结果 然后我获取下一个值:
I try to follow blue ball. To determine the maximum and minimum I open a picture I took with the camera, open it MS paint and doubles at (180/240) result out of me in H And (255/240) the result of S and L then i recive the next values:
108 113 115 112 105 H
145 40 107 129 143 S
97 129 96 102 124 L
所以我选择了下一个值:
So I chose the next values:
CvScalar hsv_min = cvScalar( 105, 40, 96 );
CvScalar hsv_max = cvScalar( 115, 140, 130);
但是当我尝试跟随它时,几乎看不到他 我计算错了吗?还是我可以做些什么来改善结果?
But when I try to follow it hardly ever see him Am I wrong calculation? or what can i do to improve the result?
推荐答案
首先为什么将图像转换为HSV
,然后再讨论HSL
?如果我没记错的话,它们是不同的色彩空间.
First of all why do you convert your image to HSV
and then talk about HSL
? If I'm not mistaken they are different color spaces.
要使用HSV
颜色空间确定蓝色,请使用以下范围:
To determinate blue color using HSV
color space use this range:
Min (H/S/V): 90, 50, 50
Max (H/S/V): 130, 255, 255
此在线转换器也应为您提供帮助.
请不要忘记,使用CV_BGR2HSV
代码将图像转换为HSV后的Hue
值在 [0..180] 范围内,而使用CV_BGR2HSV_FULL
将为您提供范围 [0..360] .
And don't forget that Hue
value after converting image to HSV using CV_BGR2HSV
code is in range [0..180], while using CV_BGR2HSV_FULL
will give you range [0..360].
这篇关于计算cvInRangeS中的最小值和最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!