0
votes

I have a OpenFrameworks project that is using OpenCv. I have histogram of the hue and saturation values of my image. To show the histogram I am drawing a grid of gray square's based on the values from the histogram. To make it easier to understand I want to draw a box under each grid column the hue that it represents. But given the HSV values how do I specify the color to draw the box?

Normally you would use ofSetColor or ofSetHexColor but those are RGB based, and I dont know the RGB values.

1

1 Answers

0
votes

Perhaps this only came in with a later version but you can now do the following using ofColor

ofColor c = ofColor::fromHsb( 0, 255, 255 ); // bright red
c.setHue( 128 ); // now bright cyan

ofColor c( 0, 0, 255 ); // vibrant blue
c.setSaturation( 128 ); // pale blue

ofColor c = ofColor_::setHsb(float hue, float saturation, float brightness)

You can then use ofSetColor(c);

source