Inconsistent results for nppi and cv::cvtColor

88 views Asked by At

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?

1

There are 1 answers

0
wohlstad On

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.