Menu

BUG: The rectangle position of face detection isn't correct.

2020-07-22
2020-09-18
  • Aress Hsiao

    Aress Hsiao - 2020-07-22

    If enable the face detection and use the Camera2 API on the Tablet.
    The rectangle position of face detection isn't correct on the front camera.

    I think is the calculateCameraToPreviewMatrix method in the Preview.java doesn't have considered if the app is work on the Tablet.
    Usually, the tablet camera orientation is 0 degree and the smartphone camera orientation is 90 or 270 degree.

     
    • Mark

      Mark - 2020-07-22

      Just to clarify, does it work okay when using the old Camera API?

       
      • Aress Hsiao

        Aress Hsiao - 2020-07-27

        Yes, it works okay when using the old Camera API.
        I had to change code in the Preview.java to let it work okay. It's maybe
        can help you.

                // Unfortunately the transformation for Android L API isn't
        

        documented, but this seems to work for Nexus 6.
        // This is the equivalent code for
        android.hardware.Camera.setDisplayOrientation, but we don't actually use
        setDisplayOrientation()
        // for CameraController2, except testing on Nexus 6 shows that
        we shouldn't change "result" for front facing camera.
        boolean mirror = (camera_controller.getFacing() ==
        CameraController.Facing.FACING_FRONT);

        • camera_to_preview_matrix.setScale(1, mirror ? -1 : 1);
        • if (camera_controller.getCameraOrientation() == 0 ||
          camera_controller.getCameraOrientation() == 180)
        • camera_to_preview_matrix.setScale(mirror ? -1 : 1, 1);
        • else
        • camera_to_preview_matrix.setScale(1, mirror ? -1 : 1);

        Best regards,
        Aress.

        Mark mark-h@users.sourceforge.net 於 2020年7月23日 週四 上午6:50寫道:

        Just to clarify, does it work okay when using the old Camera API?

        BUG: The rectangle position of face detection isn't correct.
        https://sourceforge.net/p/opencamera/discussion/general/thread/1a5f86e6ff/?limit=25#0d89/0cda


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/opencamera/discussion/general/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

         
        • Mark

          Mark - 2020-07-27

          Thanks! I'll take a look.

           
        • Mark

          Mark - 2020-09-05

          By the way, what device do you have? (My tablets have 90 degree as camera orientation, same as phones, so just want to see if I have something to test on too.)

           
          • Aress Hsiao

            Aress Hsiao - 2020-09-18

            My device camera default orientation is 0 and the same as the device screen orientation.
            I use the device is my company developing products. it's not a consumer product. Maybe it isn't happening on tablets on the consumer market.

             

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB