current position:Home>Why is the camera preview frame obtained by Android like this

Why is the camera preview frame obtained by Android like this

2022-02-03 00:19:13 CSDN Q & A

processor.addPacketCallback(
"pose_landmarks",

            (packet) -> {                Log.v(TAG, "Received Pose landmarks packet.");                try {                    System.out.println(packet);                        byte[] landmarksRaw = PacketGetter.getProtoBytes(packet);                    //byte[] turn bitmap                    YuvImage image = new YuvImage(landmarksRaw, ImageFormat.NV21, image_width, image_height, null);                    ByteArrayOutputStream stream = new ByteArrayOutputStream();                    image.compressToJpeg(new Rect(0, 0, image_width,image_height), 80, stream);                    Bitmap bmp = BitmapFactory.decodeByteArray(stream.toByteArray(), 0, stream.size());                    // Because the picture will be released and rotated , So rotate the picture to be in the same direction as the mobile phone                     Bitmap bmp1 = rotateMyBitmap(bmp);                    Bitmap bmp2 = turnCurrentLayer(bmp1, -1, 1);                    FileUtils.savePaiZhaoBitmap(bmp2,landmarksRaw);



Refer to the answer 1:
                ByteArrayOutputStream stream = new ByteArrayOutputStream();                image.compressToJpeg(new Rect(0, 0, image_width,image_height), 80, stream);                Bitmap bmp = BitmapFactory.decodeByteArray(stream.toByteArray(), 0, stream.size());                Bitmap bmp1 = rotateMyBitmap(bmp);

These pictures are compressed , rotate , Is it deformed




Refer to the answer 2:



Refer to the answer 3:

img




Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030019112933.html

Random recommended