From 68667d6057f6cd3fed80306c8845e03771a3f70a Mon Sep 17 00:00:00 2001 From: utibenkei Date: Mon, 29 Nov 2021 22:43:29 +0900 Subject: [PATCH] fix_android_ndk_camera_order_of_u_and_v --- modules/videoio/src/cap_android_camera.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/videoio/src/cap_android_camera.cpp b/modules/videoio/src/cap_android_camera.cpp index f51bfe949d..18fc604367 100644 --- a/modules/videoio/src/cap_android_camera.cpp +++ b/modules/videoio/src/cap_android_camera.cpp @@ -313,7 +313,7 @@ public: if (fourCC == FOURCC_UNKNOWN) { fourCC = FOURCC_NV21; } - } else if ( (uvPixelStride == 1) && (vPixel == uPixel + uLen) && (yLen == frameWidth * frameHeight) && (uLen == yLen / 4) && (vLen == uLen) ) { + } else if ( (uvPixelStride == 1) && (uPixel == vPixel + vLen) && (yLen == frameWidth * frameHeight) && (uLen == yLen / 4) && (vLen == uLen) ) { colorFormat = COLOR_FormatYUV420Planar; if (fourCC == FOURCC_UNKNOWN) { fourCC = FOURCC_YV12; @@ -327,7 +327,7 @@ public: buffer.clear(); buffer.insert(buffer.end(), yPixel, yPixel + yLen); - buffer.insert(buffer.end(), uPixel, uPixel + yLen / 2); + buffer.insert(buffer.end(), vPixel, vPixel + yLen / 2); return true; } -- GitLab