OpenCV Color Space Issue

(this is occuring in vvvv gamma 2021.4.5)

I’m experimenting with color space conversions (RGB to HSV) and comparing the VVVV results with other software (Substance Designer, Photoshop).

One thing I noticed is Stride’s “ConvertColor” node outputs unexpected H and S results that aren’t consistent with results from the other software.

So, I decided to try OpenCV’s color space conversion. Going from RGBtoHSV worked as expected, but it seems going back using HSVtoRGB always produces errors in the CvtColor node no matter what. It seems the HSV conversion is causing a hiccup of some sort.

image

Since I’m working using TextureFX, this patch is a bit convoluted and decidedly less performant, but the RGBtoHSV conversion is more agreeable. Any help is appreciated!

hmm. I seem to be getting tripped up on linear/srgb/gamma conversion.

Using the ConvertColor node outputs the expected result if I first use LineartosRGB into it, then to LineartoGamma after.

If you transform from LinearToSRgb then you should use SRgbToLinear instead of GammaToLinear, there are subtle differences between them. but maybe there is a simpler solution. how does your setup look at the moment? and with what kind of color data do you work? are they all in sRGB color space?

maybe your shader should use these attributes:
https://thegraybook.vvvv.org/reference/libraries/3d/texturefx.html#srgb-and-linear-color-space

If you transform from LinearToSRgb then you should use SRgbToLinear instead of GammaToLinear,

That’s what I figured. However, SRGBtoLinear always returns null.

how does your setup look at the moment?

Just using the FileTexture node to load an 8bit rgb image from disk. I see vvvv adding the _srgb suffix after loading. Then, plugging that into a ConvertColor node using the RGBtoHSV type. It appears to need conversions before and after (as well as channel shuffling).

please see a working conversion from BGR to HSV to BGR using OpenCVs ConvertColor node here:
ConvertColor.vl (10.6 KB)
does this conform with results you get in other software?

I cannot confirm that, if you look at the srgb conversion help patch it works fine. can you show us the patch?

these might just be different conventions. also, as I mentioned in my previous post, you might want to make a copy of the color conversion shader and set these attributes.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.