Class ThermalImage

java.lang.Object
com.flir.thermalsdk.image.ImageBase
com.flir.thermalsdk.image.ThermalImage
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
ThermalImageFile

public class ThermalImage extends ImageBase
Defines features of a Thermal image created from file or stream with temperature (radiometric) data. The object of this class can be obtained from Thermal cameras supporting such streaming mode. There is also a specialized subclass for handling Thermal data stored in files. The ThermalImageFile should be used for them.
  • Method Details

    • getImage

      public JavaImageBuffer getImage()
      Description copied from class: ImageBase
      Gets a JavaImageBuffer object, which represents an image's colorized pixels data depending on selected FusionMode. Rendered/colorized image, which size, appearance etc. heavily depends on the FusionMode and ColorDistributionSettings.
      Note: raw IR and DC pixels are used to generate this image (depending on fusion mode), and DC image will be aligned even in FusionMode.VISUAL_ONLY mode.
      Specified by:
      getImage in class ImageBase
      Returns:
      an image buffer as a JavaImageBuffer containing image's colorized pixels data depending on selected FusionMode.
      See Also:
    • getPhoto

      @Deprecated @Nullable public @Nullable JavaImageBuffer getPhoto()
      Deprecated.
      Gets a visual image (photo) as a JavaImageBuffer extracted from the file. This is a full resolution photo that is not fusion aligned.
      Returns:
      a visual image (photo) as a JavaImageBuffer extracted from the file or null, if no visual image is associated with this file.
    • getColorDistribution

      @Deprecated public ColorDistribution getColorDistribution()
      Deprecated.
      Gets a ColorDistribution mode for the image. The mode depends on the Thermal camera's capabilities.
      Returns:
      a ColorDistribution mode.
    • setColorDistribution

      @Deprecated public void setColorDistribution(ColorDistribution colorDistribution)
      Sets a ColorDistribution mode to define, how colors should be calculated from Thermal data. The mode depends on the Thermal camera's capabilities and should be set based on them.
      Parameters:
      colorDistribution - a new ColorDistribution mode.
    • getColorDistributionSettings

      public ColorDistributionSettings getColorDistributionSettings()
      Gets a ColorDistributionSettings for the image.
    • setColorDistributionSettings

      public void setColorDistributionSettings(ColorDistributionSettings colorDistributionSettings)
      Sets a ColorDistributionSettings to define, how colors should be calculated from the thermal data.
      Parameters:
      colorDistributionSettings - a new ColorDistributionSettings.
    • getDistanceUnit

      public DistanceUnit getDistanceUnit()
      Gets a DistanceUnit used to define any distance parameter related with image.
      Returns:
      the DistanceUnit defining any distance parameter.
      See Also:
    • setDistanceUnit

      public void setDistanceUnit(DistanceUnit distanceUnit)
      Sets a DistanceUnit used to define any distance parameter related with image. It is applied to the ImageParameters's definition of a distance to the object.
      Parameters:
      distanceUnit - a new DistanceUnit to be used.
      See Also:
    • getTemperatureUnit

      public TemperatureUnit getTemperatureUnit()
      Gets a TemperatureUnit the ThermalValues are in. It is applied to all values obtained from the image or MeasurementShapes associated with it.
      Returns:
      a TemperatureUnit used to define ThermalValues.
    • setTemperatureUnit

      public void setTemperatureUnit(TemperatureUnit temperatureUnit)
      Sets a TemperatureUnit the ThermalValues are in. It is applied to all values obtained from the image or MeasurementShapes associated with it.
      Parameters:
      temperatureUnit - a new TemperatureUnit to be used.
    • getDateTaken

      public Date getDateTaken()
      Gets a date when the image was taken.
      Returns:
      a date when the image was taken as a Java Date object or null if date can't be retrieved.
      See Also:
    • getTimeZoneTakenOffset

      public Integer getTimeZoneTakenOffset()
      Gets the time zone offset from UTC (in minutes) where the image was taken.

      Example 1: If the camera was configured for Central European time (CET/CEST) this function will return +2h if the image was taken during summer (daylight saving on), and +1h if the image was taken during winter (daylight saving off).
      Example 2: If the camera was configured for West Africa time (WAT) it'll always return +1h since West Africa doesn't use daylight saving.

      Returns:
      The time zone offset in minutes, or null if the time zone information is unavailable.
      See Also:
    • getMeasurements

      public MeasurementShapeCollection getMeasurements()
      Gets a MeasurementShapeCollection set for the image. It contains all MeasurementShapes added and attached to the image. Each measurement in the collection can provide information about temperature measured in the area it covers.
      Returns:
      a MeasurementShapeCollection set for the image.
    • getDisplaySettings

      @Nullable public @Nullable DisplaySettings getDisplaySettings()
      Gets a DisplaySettings information for the image. The DisplaySettings reflects how the image was displayed in the application or camera UI.
    • setDisplaySettings

      public void setDisplaySettings(@NotNull @NotNull DisplaySettings displaySettings)
      Sets a DisplaySettings information for the image. The DisplaySettings reflects how the image was displayed in the application or camera UI.
    • getExternalSensors

      public List<SensorPoll> getExternalSensors()
      Gets list of Meterlink readings embedded in the image.
      Returns:
      Returns a list of SensorPoll items. List may be empty.
    • getTextAnnotations

      public List<Pair<String,String>> getTextAnnotations()
      Gets a COPY of text annotations associated with the image. This means updating returned List does not impact the image directly. In order to update existing image annotations use setTextAnnotations(List). Annotations are mappings between text label and value. They provide additional information about the image. Pair first element: annotation label (consider it as an annotation title). Labels are _not_ unique. Pair second element: annotation text value (consider it as a plain text note)
      Returns:
      a text annotations associated with the file.
      Throws:
      RuntimeException - if failed to read text annotations
      See Also:
    • setTextAnnotations

      public void setTextAnnotations(List<Pair<String,String>> list)
      Sets a text annotations associated with the image. Annotations are mappings between text label and value. They provide additional information about the image. Pair first element: annotation label (consider it as an annotation title). Labels are _not_ unique. Pair second element: annotation text value (consider it as a plain text note)
      Parameters:
      list - a list with items to be set
      Throws:
      RuntimeException - if failed to write text annotations
    • getCameraInformation

      public CameraInformation getCameraInformation()
      Gets the CameraInformation describing the device the image was taken with.
      Returns:
      a CameraInformation object for this image.
    • getFusion

      @Nullable public @Nullable Fusion getFusion()
      Gets a Fusion object set for this image.
      Returns:
      Returns a Fusion object or null if no fusion information is embedded in the image.
    • getPalette

      @Nullable public @Nullable Palette getPalette()
      Gets a Palette object set for this image. The Palette set for the ThermalImage remains unchanged. If parameters of the Palette obtained from image are changed, use the setPalette(Palette) method to set it for the image. After it is set, image's definition will be updated with new Palette's data.
      Returns:
      a Palette object set for this image or null, if any problem occurred (i.e. image has no valid palette set).
    • setPalette

      public void setPalette(Palette palette)
      Sets a Palette for the Thermal image defined by this instance. If provided Palette cannot be set, it throws an Exception.

      It is obligatory to give a path on a local device filesystem, where Palette's file is located. Each Palette stores it's color definition in an unique file. The Palette loads color definition at a runtime. This definition is not stored in the Palette's object, hence it must be read whenever given Palette is used.

      Parameters:
      palette - a Palette object to be set for this image.
    • getScale

      public Scale getScale()
      Gets a Scale for this image. The look of the Scale depends on Palette set for the image. The values defining range and special colors depends on ImageParameters set for the image.
      Returns:
      a Scale for the image with current Palette and ImageParameters.
    • getImageParameters

      public ImageParameters getImageParameters()
      Gets an ImageParameters object for this instance. The ImageParameters defines, how Thermal data stored in the image should be interpreted. They have a great impact on temperature values.
      Returns:
      an ImageParameters describing this image.
    • getStatistics

      public ImageStatistics getStatistics()
      Gets an ImageStatistics object providing the statistics for Thermal data.
      Returns:
      an ImageStatistics object related with the ThermalImage.
    • getIsotherms

      @NotNull public @NotNull IsothermCollection getIsotherms()
      Gets a collection of Isotherm readings embedded in the image.
      Returns:
      Returns an IsothermCollection object with Isotherm readings embedded in the image.
    • getMinSpotRadius

      public int getMinSpotRadius()
      This API exposes what min-radius of the visual indicator of a spot is. This size/radius differs depending on image data. Without this information a client will not be able to draw a visually accurate sized spot in a image.
      Returns:
      Returns min-radius of the visual indicator of a spot.
    • getValueAt

      public ThermalValue getValueAt(@NotNull @NotNull Point location) throws IllegalArgumentException
      Gets a temperature value from a point(x,y) in the Thermal Image. Note: Due to Lepton thermal camera core specifics, reading a value from a single point may be inaccurate. Thus this is recommended to use a MeasurementSpot instead, where value calculation is internally compensated based on a several adjacent points and calibration data.
      Parameters:
      location - A point that specifies the location for the value to read.
      Returns:
      The temperature value in current unit.
      Throws:
      IllegalArgumentException - when requested position is incorrect (i.e. out of image bounds)
      See Also:
    • getValues

      public double[] getValues(@NotNull @NotNull Point[] points) throws IllegalArgumentException
      Gets temperature values from a list of points(x,y) in the Thermal Image.
      Parameters:
      points - A list of points which specifies the location for the value to read.
      Returns:
      Temperature values in current unit. `values[n]` corresponds to the value at `points[n]`.
      Throws:
      IllegalArgumentException - when any of the requested points position is incorrect (i.e. out of image bounds)
      See Also:
    • getValues

      public double[] getValues(@NotNull @NotNull Rectangle rectangle) throws IllegalArgumentException
      Gets temperature values from a rectangle in the Thermal Image.
      Parameters:
      rectangle - A rectangle which specifies the location for the values to be read.
      Returns:
      Temperature values in current unit. `values[n]` corresponds to the value at `x + (y * width)` of the rectangle (NOT the width of the ThermalImage).
      Throws:
      IllegalArgumentException - when requested Rectangle is incorrect (i.e. out of image bounds)
      See Also:
    • saveAs

      public void saveAs(@NotNull @NotNull String fileAbsPath) throws IOException
      Save this object to a file with provided name. Calls saveAs(String, JavaImageBuffer) with (fileAbsPath, null) parameters.

      Note: a default overlay is added to the picture. See saveAs(String, JavaImageBuffer) for details about the overlay.
      Note: After a call to saveAs(String) the rotation of the image is set to 0.

      Parameters:
      fileAbsPath - the path, where the file containing this object will be saved, i.e. /sdcard/Flir/images/img001.jpg.
      Throws:
      IOException - when file cannot be stored under the specified path.
    • saveAs

      public void saveAs(@NotNull @NotNull String fileAbsPath, @Nullable @Nullable JavaImageBuffer overlay) throws IOException
      Save current object to a file with provided name.

      Note: After a call to saveAs(String) the rotation of the image is set to 0.

      Parameters:
      fileAbsPath - the path, where the file containing this object will be saved, i.e. /sdcard/Flir/images/img001.jpg.
      overlay - an overlay to be added to the stored image. The overlay pixels, are used as plain JPEG part when storing the image. This overlay is what a "casual" image viewer application can "see" and also is usually used to show JPEG thumbnail.
      Throws:
      IOException - when file cannot be stored under the specified path.
    • getVoiceAnnotation

      public VoiceAnnotation getVoiceAnnotation()
      Gets a VoiceAnnotation object associated with the image.
      Returns:
      a VoiceAnnotation.
    • hasVoiceAnnotation

      public boolean hasVoiceAnnotation()
      Checks whether this ThermalImageFile contains a valid VoiceAnnotation object.
      Returns:
      true if a valid VoiceAnnotation exists within this image.
    • storeVoiceAnnotation

      public void storeVoiceAnnotation(byte[] audioData, VoiceAnnotationFormat format)
      Stores the audio data to the ThermalImage.
      Parameters:
      audioData - byte array with the audio data to store
      format - sound format the data is encoded in
    • getSketch

      @Nullable public @Nullable JavaImageBuffer getSketch()
      Get the sketch image.
      Returns:
      A JavaImageBuffer with sketch or null if there is no sketch data embedded within the image. The returned JavaImageBuffer has the attached internal read-only pixels.
    • addSketch

      public ErrorCode addSketch(@Nullable @Nullable JavaImageBuffer sketch)
      Set the sketch image.
      Parameters:
      sketch - A transparent image as a JavaImageBuffer.
      Returns:
      Returns null if operation succeeded otherwise returns a corresponding ErrorCode.
    • close

      public void close()
      Description copied from class: ImageBase
      Closes the image and frees all resources.

      Important: All references to the ThermalImage fields became invalid and any further access to them generates exception. You must deep-copy any object before closing a ThermalImageFile, if you want to use it later.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class ImageBase
    • toString

      public String toString()
      Overrides:
      toString in class Object