Update cap_android_camera.cpp
authorShuangLiu1992 <ShuangLiu1992@users.noreply.github.com>
Tue, 23 Nov 2021 15:03:18 +0000 (15:03 +0000)
committerGitHub <noreply@github.com>
Tue, 23 Nov 2021 15:03:18 +0000 (15:03 +0000)
since u and v Pixel ptr have been swapped the compare condition should be updated too

modules/videoio/src/cap_android_camera.cpp

index 5952b6f..f51bfe9 100644 (file)
@@ -308,7 +308,7 @@ public:
         AImage_getPlaneData(image.get(), 2, &vPixel, &vLen);
         AImage_getPlanePixelStride(image.get(), 1, &uvPixelStride);
 
-        if ( (uvPixelStride == 2) && (vPixel == uPixel + 1) && (yLen == frameWidth * frameHeight) && (uLen == ((yLen / 2) - 1)) && (vLen == uLen) ) {
+        if ( (uvPixelStride == 2) && (uPixel == vPixel + 1) && (yLen == frameWidth * frameHeight) && (uLen == ((yLen / 2) - 1)) && (vLen == uLen) ) {
             colorFormat = COLOR_FormatYUV420SemiPlanar;
             if (fourCC == FOURCC_UNKNOWN) {
                 fourCC = FOURCC_NV21;