ITU-R 601-2 luma transform ? #4730
-
|
Hi, is there a way to turn an image grayscale using ITU-R 601-2 luma transform? This is the formula used by OpenCV: This is described here: In SKIA I was able to set up a color matrix with these number to have images turn to gray in the same way. The VIPS function So I wonder if there is a way to make my VImage gray scale using this formula to keep results comparable. The background is that I do edge detection and pHash calculations with that and I want to compare the results with OpenCV, so I can be sure that I implemented everything correctly. Kind regards, Stefan |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Yes, you need https://www.libvips.org/API/current/method.Image.recomb.html https://libvips.github.io/pyvips/vimage.html?#pyvips.Image.recomb Perhaps: mono = rgb.recomb([[0.299, 0.587, 0.114]])The libvips |
Beta Was this translation helpful? Give feedback.

Yes, you need
recomb:https://www.libvips.org/API/current/method.Image.recomb.html
https://libvips.github.io/pyvips/vimage.html?#pyvips.Image.recomb
Perhaps:
The libvips
colourspace()conversion is this, but done in linear space, so it's noticeably more accurate. I'd only use this if you want to check results against systems which don't do gamma correction.