If I understand correctly, when I use OpenCV to convert YUV to RGB using the cvtColor(CV_YUV420sp2BGR)
function I actually call YUV420sp2RGB888Invoker
class.
The conversion formula is
R = 1.164(Y - 16) + 1.596(V - 128)
G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
B = 1.164(Y - 16) + 2.018(U - 128)
These coefficients apply to CCIR 601 spec where the ranges of Y, U and V are respectively [16 … 235]
, [16 … 240]
and [16 … 240]
.
But the Android camera (specifically, on Snapdragon) seems to return the NV21 image in full (JFIF) range of [0 … 255]
for all components (See also https://stackoverflow.com/a/12702836/192373).
Is there a way to use OpenCV color conversion for the JFIF color range?