Class ThermalSequencePlayer

java.lang.Object
com.flir.thermalsdk.image.playback.ThermalSequencePlayer
All Implemented Interfaces:
Closeable, AutoCloseable

public class ThermalSequencePlayer extends Object implements Closeable
This class plays thermal image sequence. ThermalSequencePlayer plays *.seq, *.csq files.
  • Constructor Details

    • ThermalSequencePlayer

      public ThermalSequencePlayer(ThermalImageFile file)
      Construction of a sequence player and opens up sequence.
      Parameters:
      file - The file to play back
    • ThermalSequencePlayer

      public ThermalSequencePlayer(String absoluteFilePath) throws IOException
      Construction of a sequence player and opens up sequence.
      Parameters:
      absoluteFilePath - absolute path to file
      Throws:
      IOException
  • Method Details

    • count

      public int count()
      Gets the number of frames in the sequence.
    • getSelectedIndex

      public int getSelectedIndex()
      Get the selected frame number zero based index.
    • setSelectedIndex

      public void setSelectedIndex(int value) throws ArrayIndexOutOfBoundsException
      Sets the selected frame number zero based index.
      Parameters:
      value - Frame index.
      Throws:
      ArrayIndexOutOfBoundsException - when selected frame index is out of range.
    • first

      public void first()
      Move to the first image in the sequence, if not already selected.
    • last

      public void last()
      Move to the last image in the sequence, if not already selected.
    • previous

      public boolean previous()
      Move to the previous frame. False if begin of file is already reached.
    • next

      public boolean next()
      Move to the next frame. False if end of file is already reached.
    • getPlaybackRate

      public double getPlaybackRate()
      Get playback rate.

      Get the playback rate that should be used, defaulted to sequence's frame rate.

    • setPlaybackRate

      public void setPlaybackRate(double value)
      Set the playback rate that should be used by the player.
      Parameters:
      value - Frame rate.
    • render

      public JavaImageBuffer render()
      Render current frame and return a buffer with colorized pixels to show on the UI.
      Returns:
      a buffer with colorized pixels
    • withCurrentFrame

      public void withCurrentFrame(Consumer<ThermalImage> functionToRun)
      This function allows to safely access ThermalImage during sequence playback.
      The referenced ThermalImage instance is the current frame as set by setSelectedIndex(int), first(), last(), next(), previous(). Typical use case would be similar to the following:
       thermalSequencePlayer.withThermalImage(thermalImage -> {
           // here you can safely read/modify different ThermalImage parameters, like palette, fusion mode, color distribution, measurements, etc.
           // for example you can read out the measurements data and draw them on the UI thread on top of the androidBmp as an overlay
           // show the current palette name on the UI
           mTextView.setText(thermalImage.getPalette().name); // UI thread required
       });
       
      Parameters:
      functionToRun - the ThermalImage instance can be safely accessed under this function, which ensures ThermalImage is not changed during the function execution
    • close

      public void close()
      Close the sequence player and release all associated resources.
      Important: All references to the ThermalSequencePlayer fields/methods became invalid and any further access to them generates exception.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable