Class ThermalSequencePlayer
java.lang.Object
com.flir.thermalsdk.image.playback.ThermalSequencePlayer
- All Implemented Interfaces:
Closeable
,AutoCloseable
This class plays thermal image sequence. ThermalSequencePlayer plays *.seq, *.csq files.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruction of a sequence player and opens up sequence.ThermalSequencePlayer
(String absoluteFilePath) Construction of a sequence player and opens up sequence. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the sequence player and release all associated resources.int
count()
Gets the number of frames in the sequence.void
first()
Move to the first image in the sequence, if not already selected.double
Get playback rate.int
Get the selected frame number zero based index.void
last()
Move to the last image in the sequence, if not already selected.boolean
next()
Move to the next frame.boolean
previous()
Move to the previous frame.render()
Render current frame and return a buffer with colorized pixels to show on the UI.void
setPlaybackRate
(double value) Set the playback rate that should be used by the player.void
setSelectedIndex
(int value) Sets the selected frame number zero based index.void
withCurrentFrame
(Consumer<ThermalImage> functionToRun) This function allows to safely accessThermalImage
during sequence playback.
-
Constructor Details
-
ThermalSequencePlayer
Construction of a sequence player and opens up sequence.- Parameters:
file
- The file to play back
-
ThermalSequencePlayer
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
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
Render current frame and return a buffer with colorized pixels to show on the UI.- Returns:
- a buffer with colorized pixels
-
withCurrentFrame
This function allows to safely accessThermalImage
during sequence playback.
The referencedThermalImage
instance is the current frame as set bysetSelectedIndex(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 theThermalSequencePlayer
fields/methods became invalid and any further access to them generates exception.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-