Class ImageFrameStorage

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

public class ImageFrameStorage extends Object
This class allows applications to store camera images returned within ReaderResult objects. The ReaderResult object contains a copy of the image frame where the decode occurred. However, in many cases the app may not want to do anything with the image immediately. For instance, in the DetectorViewDemo sample application the image is returned on a successful read but the app doesn't want to do anything with the image until it has contacted the Digimarc Resolver and gotten more information. To hold onto the image frame during the resolve request the app uses an ImageFrameStorage object and stores the frame using the payload from the image read. When the resolve is completed the app retrieves the frame from storage and processes the image to create a thumbnail bitmap for its history list.
  • Constructor Details

    • ImageFrameStorage

      public ImageFrameStorage(int maxFramesStored)
      Constructor
      Parameters:
      maxFramesStored - Maximum number of frames that can be stored at one time. The default is 8, which is more than enough for most use cases.
    • ImageFrameStorage

      public ImageFrameStorage()
      Default Constructor. The default is 8 frames.
  • Method Details

    • storeFrame

      public boolean storeFrame(@NonNull String frameId, @NonNull ImageFrame frame)
      This method stores a frame. If the frame already exists in the active storage (determined by looking up the frameId) the new image buffer is copied over the existing one.
      Parameters:
      frameId - Frame ID.
      frame - Frame buffer.
      Returns:
      True if the frame was added to storage, False otherwise.
    • getFrame

      @Nullable public ImageFrame getFrame(@NonNull String frameId)
      Retrieve a frame from storage.
      Parameters:
      frameId - Frame Id.
      Returns:
      Returns the frame if it exists.
    • removeFrame

      @Nullable public ImageFrame removeFrame(@NonNull String frameId)
      Remove a frame from storage. The frame is returned as well.
      Parameters:
      frameId - Frame Id.
      Returns:
      The frame that was removed. This frame buffer may be reused by the ImageFrameStorage class so it is strongly suggested that you copy or otherwise process this image quickly then release it.
    • resetStorage

      public void resetStorage()
      Removes all frames from storage. This also releases any cached image objects that are awaiting reuse.
    • getAvailableBufferCount

      public int getAvailableBufferCount()
    • getActiveBufferCount

      public int getActiveBufferCount()
    • getTotalBufferCount

      public int getTotalBufferCount()