I have checked my YUV frame data , the data range is [0, 255], it looks no difference whether i choose NVBUF_COLOR_FORMAT_YUV420 or NVBUF_COLOR_FORMAT_YUV420_ER. The NV encoded jpeg still looks different with the OpenCV encoded jpeg. And i don’t know why and how to fix this issue;
It can be replicate like this,
1,build /usr/src/jetson_multimedia_api/samples/05_jpeg_encode/
2,Run this command:( i420.yuv is in the attachment i420.yuv.zip)
Hi,
Do you adopt our suggestion to change format to YUV420_ER in 05_jpeg_encode sample? And please not to do format conversion in OpenCV. In OpenCV, the conversion seems to be non-linear and this may trigger deviation.
Hi,
The attached i420.yuv is in NVBUF_COLOR_FORMAT_YUV420_ER(full range [0,255]). So you need to allocate both src_dma_fd and dst_dma_fd in NVBUF_COLOR_FORMAT_YUV420_ER/NVBUF_LAYOUT_PITCH. And the encoded JPEG will be in full range. You can then decode the JPEG and check the value pixel by pixel.
Hi,
We again compare the original YUV and decode YUV. And the brightness is identical. It seems to be an issue in the OpenCV function that it applies non-linear conversion to frame data in bt601 YUV420 [0,255]. And converted BGR gets brighter. The brightness is changed while comparing to the original YUV.
DaneLLL
If it is issue in the OpenCV function , i think this problem can decrease priority.
But I still have some doubts, in this link:NvJpegEncoder color error
the ffmpeg-encoded jpeg looks same, much closer to the opencv-encoded jpeg?
Hi,
In the topic, the color range [0,255] or [16,235] may not be correctly set. It shall be correct to allocate NVBUF_COLOR_FORMAT_YUV420_ER for [0,255] data and NVBUF_COLOR_FORMAT_YUV420 for [16,235] data.