HSV is cylindrical color space that determines colors by hue (0°-360°), saturation (percentage of white) and value (percentage of black).
Questions tagged [hsv]
468 questions
19
votes
9 answers
Convert HSB/HSV color to HSL
How do I convert HSB color to HSL?
Photoshop shows HSB color in its color picker. HSB color cannot be used in CSS, but HSL can.
I tried this JS:
function hsb2hsl(h, s, b) {
return {
h: h,
s: s,
l: b-s/2
}
}
But hsb2hsl(0, 100, 50).l…

NVI
- 14,907
- 16
- 65
- 104
18
votes
2 answers
How to interpolate hue values in HSV colour space?
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,…

nick
- 1,369
- 2
- 13
- 28
17
votes
4 answers
Calculate distance between colors in HSV space
I intend to find a distance metric between two colours in HSV space.
Suppose that each colour element has 3 components: hue, saturation, and value. Hue is ranged between 0 to 360, saturation is ranged between 0 to 1, and value is ranged between 0…

user1304846
- 415
- 2
- 5
- 13
16
votes
6 answers
PHP HSV to RGB formula comprehension
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…

Mark Lalor
- 7,820
- 18
- 67
- 106
13
votes
1 answer
HSV Color ranges table
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,…

Bob de Graaf
- 2,630
- 1
- 25
- 43
12
votes
2 answers
Lossy conversion from float64 to uint8
Code from https://www.makeartwithpython.com/blog/visualizing-sort-algorithms-in-python/
from imageio import imsave
import numpy as np
newImage = np.random.randint(0, 255, (300, 300, 3))
in_hsv_h = color.convert_colorspace(newImage, 'RGB',…

unreadable
- 123
- 1
- 1
- 4
12
votes
1 answer
Given a finite palette, how to sort from Hot to Cold, i.e. Diverging
Update (Original question below)
Issue is partially solved.
Still trying to figure out how to extend to other color combinations
If I use this code
hLIM <- rgb2hsv(col2rgb('#8000ff'))['h', ]
sLIM <- rgb2hsv(col2rgb('#8000ff'))['s', ]
vLIM <-…

Artie Ladie
- 521
- 4
- 14
11
votes
8 answers
Converting from HSV (HSB in Java) to RGB without using java.awt.Color (disallowed on Google App Engine)
I figured I should post this question, even if I have already found a solution, as a Java implementation was not readily available when I searched for it.
Using HSV instead of RGB allows the generation of colors with the same saturation and…

yngling
- 1,376
- 2
- 22
- 34
11
votes
3 answers
Why does the CSS filter hue-rotate produce wierd results?
I'm trying to emulate Photoshop's "Color Overlay" using CSS filters, and while doing so, found out the CSS filters operate on colors as consistently as an epileptic seizure.
Consider the color #FF0000. If we rotate its hue by 120deg, we should get…

Camilo Martin
- 37,236
- 20
- 111
- 154
11
votes
3 answers
Black color object detection HSV range in opencv
What is the range of Black color object detection?
i tried following code
cvInRangeS(imgHSV, cvScalar(0, 0, 0, 0), cvScalar(0, 255, 255, 0), imgThreshold);
but its not working.

sushma ahirwar
- 113
- 1
- 1
- 5
10
votes
1 answer
Lineargradient is drawn offset from specified positon
I made a hue gradient with a Lineargradient with this code: (I know it could have been made simpler with Color.parseColor but it has to be this way for what I intend to do. I cannot use a drawable either.)
colors = new int[]{ Color.HSVToColor(new…

Nicolas
- 6,611
- 3
- 29
- 73
10
votes
3 answers
Emulate Photoshop's "Color Overlay" using CSS filters?
I have an icon which I'd like to change the color of, using CSS. It is in a data-uri'd optimized SVG inlined in the CSS.
Normally, this wasn't possible. That's why icon fonts were invented; their main advantage over SVG is being able to recieve…

Camilo Martin
- 37,236
- 20
- 111
- 154
9
votes
9 answers
Exact Skin color HSV range
I have seen all questions on SO for range of HSV color space for skin
But I can only figure out this
Code -
CvScalar hsv_min = cvScalar(0, 30, 60, 0);
CvScalar hsv_max = cvScalar(20, 150, 255, 0);
//range I am using is { 0,30,60,0 & 20,150,255,0…

Wazy
- 8,822
- 10
- 53
- 98
9
votes
4 answers
Convert HSV to grayscale in OpenCV
I'm a newbie in OpenCV. I'm learning the Segmentation by Watershed algorithm and I have a problem.
I have to convert the image color to grayscale for using Watershed.
When I use the BGR color space, no problem but with HSV, I'm not sure that the…

Amateur
- 151
- 1
- 2
- 12
9
votes
3 answers
how to obtain a single channel value image from HSV image in opencv 2.1?
I am a beginner in opencv. I am using opencv v2.1. I have converted an RGB image to HSV image. Now I want to obtain single channels Hue, Value and Saturation separately. What should I do? I have seen similar questions here but No-one answered that.…

userXktape
- 227
- 3
- 5
- 15