camerakit-android icon indicating copy to clipboard operation
camerakit-android copied to clipboard

Picture captured from front cam is showing a thin layer of back cam view at right corner

Open usmanrana07 opened this issue 5 years ago • 6 comments

In Note 5 when i capture picture from front cam then it shows a thin layer of back camera view on right corner of image.

usmanrana07 avatar Mar 06 '19 10:03 usmanrana07

Same issue in HUAWEI P20.

DengKangKang avatar Mar 20 '19 05:03 DengKangKang

Same on a Sony Xperia, I thought it was just a pale line, but no it is clearly a little bit of an image. I make it 8 pixels wide on a 1080x1920 image.

glenatron avatar Mar 28 '19 13:03 glenatron

Same issue in HUAWEI HONOR

helang1991 avatar Aug 26 '19 03:08 helang1991

Hi all, In my case, I realized this issue caused by turbo-jpeg. If the image's width or height is not evenly divisible by the MCU block size (which is 16 here), the cropping result will create odd-looking strips on the right or bottom edge of the image.

I fix it by adding TJXOPT_TRIM option to discard the partial MCU blocks. Hope this helps.

diff --git a/camerakit/src/main/cpp/JniJpegTransformer.cpp b/camerakit/src/main/cpp/JniJpegTransformer.cpp
index 9da50aa..1c73283 100644
--- a/camerakit/src/main/cpp/JniJpegTransformer.cpp
+++ b/camerakit/src/main/cpp/JniJpegTransformer.cpp
@@ -148,7 +148,7 @@ Java_com_wonderkiln_camerakit_JpegTransformer_jniCommit
         cropRegion.h = jpegTransformer->cropHeight;

         transform->r = cropRegion;
-        transform->options = TJXOPT_CROP;
+        transform->options = TJXOPT_CROP | TJXOPT_TRIM;
     }

chiel99 avatar Aug 29 '19 11:08 chiel99

@chiel99 this solution didn't work for me

usmanrana07 avatar Sep 19 '19 06:09 usmanrana07

Also having this same issue on Samsung S5, S7, S9+. Basically anything ive tested on. How can we crop this?

TrentPierce avatar Sep 30 '19 22:09 TrentPierce