'Inconsistent results for nppi and cv::cvtColor
When I run nppi and cv::cvtColor for color conversion, I get different results.
// *data_ptr = 1, 1, 1, 1
cv::Mat image1(1, 2, CV_8UC2, data_ptr, 2*2);
cv::Mat image2;
cv::cvtColor(image1, image2, cv::COLOR_YUV2RGB_UYVY);
NppiSize nppSize{2, 1};
nppiYUV422ToRGB_8u_C2C3R(
(Npp8u*)data_ptr, 2*2, (Npp8u*)dst_data_ptr, 2*3, nppSize
)
// ------------ Results ------------
// opencv: 0, 153, 0, 0, 153, 0
// nppi: 0, 124, 0, 0, 124, 0
Does anyone know what's going on?
Solution 1:[1]
There are several YUV sub-formats.
Have you tried cv::COLOR_YUV2RGB_I420, cv::COLOR_YUV420p2BGR etc. ?
One of them might give you result more similar to nppiYUV422ToRGB_8u_C2C3R.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
