hsv

OpenCV speed traffic sign detection

允我心安 提交于 2019-11-27 21:54:13
问题 I have a problem detecting speed traffic signs with opencv 2.4 for Android. I do the following: "capture frame -> convert it to HSV -> extract red areas -> detect signs with ellipse detection" So far ellipse detection works perfect as long as picture is good quality. But as you see in pictures bellow, that red extraction does not work OK, because of poor quality of picture frames, by my opinion. Converting original image to HSV: Imgproc.cvtColor(this.source, this.source, Imgproc.COLOR_RGB2HSV

How to change hue of a texture with GLSL?

我只是一个虾纸丫 提交于 2019-11-27 17:53:07
Is there a way to efficiently change hue of a 2D OpenGL texture using GLSL (fragment shader)? Do someone have some code for it? UPDATE: This is the code resulting from user1118321 suggestion: uniform sampler2DRect texture; const mat3 rgb2yiq = mat3(0.299, 0.587, 0.114, 0.595716, -0.274453, -0.321263, 0.211456, -0.522591, 0.311135); const mat3 yiq2rgb = mat3(1.0, 0.9563, 0.6210, 1.0, -0.2721, -0.6474, 1.0, -1.1070, 1.7046); uniform float hue; void main() { vec3 yColor = rgb2yiq * texture2DRect(texture, gl_TexCoord[0].st).rgb; float originalHue = atan(yColor.b, yColor.g); float finalHue =

HSV Color ranges table

旧街凉风 提交于 2019-11-27 15:03:10
问题 I'm developing an App in which children need to find certain colors using a certain target dot on the camera screen - kind of augmented reality like. I've got the whole thing working already, but with RGB colors. For each color, red, green, blue, yellow, purple, etc. I've been testing and defining the ranges of the RGB values to determine when it is exactly which color. A lot of work. However, I've learned that using HSV it works even better. But I don't want to go through the whole process

Convert HSB/HSV color to HSL

Deadly 提交于 2019-11-27 14:46:20
Ho do I convert HSB color to HSL? Photoshop shows HSB color in its color picker. HSL color can be used in CSS. I tried this JS: function hsb2hsl(h, s, b) { return { h: h, s: s, l: b-s/2 } } But hsb2hsl(0, 100, 50).l == 0 instead of 25 Update: Can I do that without converting HSB → RGB → HSL? I'm afraid my Javascript knowledge is lacking, but you should be able to infer the conversion from http://ariya.blogspot.com/2008/07/converting-between-hsl-and-hsv.html Let's picture what actually are H SB (V), H SL , and how are constructed: Hue color value goes from 0 to 360 degrees (where 0 is red ) for

HSV to RGB Color Conversion

房东的猫 提交于 2019-11-27 12:59:10
问题 Is there a way to convert HSV color arguments to RGB type color arguments using pygame modules in python? I tried the following code, but it returns ridiculous values. import colorsys test_color = colorsys.hsv_to_rgb(359, 100, 100) print(test_color) and this code returns the following nonsense (100, -9900.0, -9900.0) This obviously isn't RGB. What am I doing wrong? 回答1: That function expects decimal for s (saturation) and v (value), not percent. Divide by 100. >>> import colorsys # Using

How to interpolate hue values in HSV colour space?

本小妞迷上赌 提交于 2019-11-27 12:25:40
问题 I'm trying to interpolate between two colours in HSV colour space to produce a smooth colour gradient. I'm using a linear interpolation, eg: h = (1 - p) * h1 + p * h2 s = (1 - p) * s1 + p * s2 v = (1 - p) * v1 + p * v2 (where p is the percentage, and h1, h2, s1, s2, v1, v2 are the hue, saturation and value components of the two colours) This produces a good result for s and v but not for h. As the hue component is an angle, the calculation needs to work out the shortest distance between h1

From RGB to HSV in OpenGL GLSL

心已入冬 提交于 2019-11-27 09:35:58
问题 I need to pass from RGB color space to HSV .. I searched in internet and found two different implementations, but those give me different results: A: precision mediump float; vec3 rgb2hsv(float r, float g, float b) { float h = 0.0; float s = 0.0; float v = 0.0; float min = min( min(r, g), b ); float max = max( max(r, g), b ); v = max; // v float delta = max - min; if( max != 0.0 ) s = delta / max; // s else { // r = g = b = 0 // s = 0, v is undefined s = 0.0; h = -1.0; return vec3(h, s, v); }

PHP HSV to RGB formula comprehension

*爱你&永不变心* 提交于 2019-11-27 08:53:55
I can convert RGB values to HSV with the following code... $r = $r/255; $g = $g/255; $b = $b/255; $h = 0; $s = 0; $v = 0; $min = min(min($r, $g),$b); $max = max(max($r, $g),$b); $r = $max-$min; $v = $max; if($r == 0){ $h = 0; $s = 0; } else { $s = $r / $max; $hr = ((($max - $r) / 6) + ($r / 2)) / $r; $hg = ((($max - $g) / 6) + ($r / 2)) / $r; $hb = ((($max - $b) / 6) + ($r / 2)) / $r; if ($r == $max) $h = $hb - $hg; else if($g == $max) $h = (1/3) + $hr - $hb; else if ($b == $max) $h = (2/3) + $hg - $hr; if ($h < 0)$h += 1; if ($h > 1)$h -= 1; } But how do you convert HSV to RGB in PHP ??? The

Trying to detect blue color from image using opencv, and getting unexpected result

醉酒当歌 提交于 2019-11-27 06:29:09
问题 I am new to OpenCV4Android. Here is some code I wrote to detect blue colored blob in an image. Among the following images, image 1 was in my laptop. I run the application and the frame captured by the OpenCV camera is image 2. You can look at the code to see what the rest of the images are. (As you can see in the code, all the images are saved in the SD card.) I have the following questions: . Why hass the color of the light-blue blob turned out to be light-yellow in the rgba frame captured

Convert RGB value to HSV

China☆狼群 提交于 2019-11-27 03:51:10
问题 I've found a method on the Internet to convert RGB values to HSV values. Unfortunately, when the values are R=G=B, I'm getting a NaN, because of the 0/0 operation. Do you know if there is an implemented method for this conversion in Java, or what do I have to do when I get the 0/0 division to get the right value of the HSV? Here comes my method, adapted from some code on the Internet: public static double[] RGBtoHSV(double r, double g, double b){ double h, s, v; double min, max, delta; min =