c++ - Generate random Pastel colour -


i trying generate random pastel colour.

is correct pastel colour has low value/intensity value (hsv)? therefore should generate random pastel colours: vec3b randpastel = vec3b(rng.uniform(0, 180), rng.uniform(0, 255), rng.uniform(0, 50))

my current function fails. ever creates black bgr colours reason:

vec3b randpastelbgr() {     mat hsv(1, 1, cv_8uc3);     cvtcolor(hsv, hsv, cv_bgr2hsv);     hsv.at<vec3b>(0, 0) = vec3b(rng.uniform(0, 180), rng.uniform(0, 255), rng.uniform(0, 50));     cvtcolor(hsv, hsv, cv_hsv2bgr);     return hsv.at<vec3b>(0, 0); } 

pastels white, i.e. have low saturation. not zero, though, because entirely white (or grey). noticed, low value dark colors. want high value, , might not want random one. (exactly color parts have random, , why?)


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -