Class OrientationHelper


  • public final class OrientationHelper
    extends java.lang.Object
    Orientation helper class.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void finalize()  
      int getDeviceOrientationAngle()  
      static int getFaceOrientation​(int imageAngle, int deviceAngle, boolean requireMirroring)
      Get face orientation angle value based on image and device orientation values.
      static int getFaceOrientationByCamera​(int imageAngle, int deviceAngle, int cameraAngle, boolean frontCamera, boolean requireMirroring)
      Get face orientation angle value based on camera parameters.
      static OrientationHelper getInstance​(android.content.Context context)  
      static com.banuba.sdk.types.FullImageData.Orientation getOrientation​(int imageAngle, int deviceAngle, boolean requireMirroring)
      Get FullImageData.Orientation based on image and device orientation values.
      static com.banuba.sdk.types.FullImageData.Orientation getOrientationByCamera​(int imageAngle, int deviceAngle, int cameraAngle, boolean frontCamera, boolean requireMirroring)
      Get FullImageData.Orientation based on camera parameters.
      void startDeviceOrientationUpdates()  
      void stopDeviceOrientationUpdates()  
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • startDeviceOrientationUpdates

        public void startDeviceOrientationUpdates()
      • stopDeviceOrientationUpdates

        public void stopDeviceOrientationUpdates()
      • getDeviceOrientationAngle

        public int getDeviceOrientationAngle()
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • getInstance

        public static OrientationHelper getInstance​(@NonNull
                                                    android.content.Context context)
      • getFaceOrientationByCamera

        public static int getFaceOrientationByCamera​(int imageAngle,
                                                     int deviceAngle,
                                                     int cameraAngle,
                                                     boolean frontCamera,
                                                     boolean requireMirroring)
        Get face orientation angle value based on camera parameters. Image, device and camera orientation angles should be from list of [0, 90, 180, 270]. Image orientation angles match to the next head directions: 0 - head-left direction; 90 - head-down direction; 180 - head-right direction; 270 - head-top direction. Device orientation angles match to the device main button direction next way: 0 - button-down direction; 90 - button-right direction; 180 - button-top direction; 270 - button-left direction.
        Parameters:
        imageAngle - image orientation angle value.
        deviceAngle - device orientation angle value.
        cameraAngle - camera orientation angle value.
        frontCamera - front camera flag value.
        requireMirroring - mirroring required flag value.
        Returns:
        face orientation angle value, should be one from the list of [0, 90, 180, 270].
      • getOrientationByCamera

        public static com.banuba.sdk.types.FullImageData.Orientation getOrientationByCamera​(int imageAngle,
                                                                                            int deviceAngle,
                                                                                            int cameraAngle,
                                                                                            boolean frontCamera,
                                                                                            boolean requireMirroring)
        Get FullImageData.Orientation based on camera parameters. Image, device and camera orientation angles should be from list of [0, 90, 180, 270]. Image orientation angles match to the next head directions: 0 - head-left direction; 90 - head-down direction; 180 - head-right direction; 270 - head-top direction. Device orientation angles match to the device main button direction next way: 0 - button-down direction; 90 - button-right direction; 180 - button-top direction; 270 - button-left direction.
        Parameters:
        imageAngle - image orientation angle value.
        deviceAngle - device orientation angle value.
        cameraAngle - camera orientation angle value.
        frontCamera - front camera flag value.
        requireMirroring - mirroring required flag value.
        Returns:
        FullImageData.Orientation
      • getFaceOrientation

        public static int getFaceOrientation​(int imageAngle,
                                             int deviceAngle,
                                             boolean requireMirroring)
        Get face orientation angle value based on image and device orientation values. Image and device orientation angles should be from list of [0, 90, 180, 270]. Image orientation angles match to the next head directions: 0 - head-left direction; 90 - head-down direction; 180 - head-right direction; 270 - head-top direction. Device orientation angles match to the device main button direction next way: 0 - button-down direction; 90 - button-right direction; 180 - button-top direction; 270 - button-left direction.
        Parameters:
        imageAngle - image orientation angle value.
        deviceAngle - device orientation angle value.
        requireMirroring - mirroring required flag value.
        Returns:
        face orientation angle value, should be one from the list of [0, 90, 180, 270].
      • getOrientation

        public static com.banuba.sdk.types.FullImageData.Orientation getOrientation​(int imageAngle,
                                                                                    int deviceAngle,
                                                                                    boolean requireMirroring)
        Get FullImageData.Orientation based on image and device orientation values. Image and device orientation angles should be from list of [0, 90, 180, 270]. Image orientation angles match to the next head directions: 0 - head-left direction; 90 - head-down direction; 180 - head-right direction; 270 - head-top direction. Device orientation angles match to the device main button direction next way: 0 - button-down direction; 90 - button-right direction; 180 - button-top direction; 270 - button-left direction.
        Parameters:
        imageAngle - image orientation angle value.
        deviceAngle - device orientation angle value.
        requireMirroring - mirroring required flag value.
        Returns:
        FullImageData.Orientation