Class Utility

java.lang.Object
com.digimarc.dms.readers.Utility

public class Utility extends Object
Methods in this class are provided for working with data contained in ReaderResult metadata.
  • Constructor Details

    • Utility

      public Utility()
  • Method Details

    • applyRotationToPoints

      @NonNull public static List<android.graphics.Point> applyRotationToPoints(@NonNull List<android.graphics.Point> points, int rotation)
      Rotate a set of region points. In most cases handsets capture landscape images even when the phone is being held in portrait orientation. This method allows the region points to be transformed to the screen orientation.

      Location data is found in the metadata after a successful detection. It can be accessed via the DataDictionary.ReadRegion key.

      Parameters:
      points - Points from metadata.
      rotation - Amount of rotation to apply.
      Returns:
      List of rotated points
    • convertRegionPointsToPath

      @NonNull public static android.graphics.Path convertRegionPointsToPath(@NonNull List<android.graphics.Point> region)
      Convert a read region (DataDictionary.ReadRegion) from the series of points it's stored as into an Android Path. The returned path is a direct translation of the region points. Any scaling, rotation or offsetting of the points for display can be applied to the Path using a Matrix.
      Parameters:
      region - List<Point> containing the region's bounds
      Returns:
      An Android Path object containing an enclosed version of the region.
    • convertRegionPointsToRect

      @NonNull public static android.graphics.Rect convertRegionPointsToRect(@NonNull List<android.graphics.Point> region)
      Convert a read region (DataDictionary.ReadRegion) from the series of points it's stored as into an Android Rect. The returned rect is a direct translation of the region points. The rect will be aligned with the screen, and in almost every case its bounds will be larger than the source region.
      Parameters:
      region - List<Point> containing the region's bounds
      Returns:
      An Android Rect object containing an enclosed version of the region.