Flyr
Flyr is a library for extracting thermal data from FLIR images.
These are JS/TS bindings to a Rust codebase compiled to WebAssembly. There is
also a sibling project in flyr-py
,
which is Flyr fully written in Python.
Installation
This library is available on npmjs.com. Install by doing npm install flyr
or yarn install flyr
.
Usage
Import Flyr and open a thermogram using flyr.FlyrThermogramJs.newFromBytes
. After this, you can render to a canvas using renderToCanvas
or get the temperatures using kelvin()
, celsius()
or fahrenheit()
. Optical imagery's raw RGB values are also accessible under optical()
.
import * as flyr from "./flyr.js";
async function run() {
await flyr.default();
// Acquire Uint8Array bytes of a FLIR file, using e.g. FileReader
// or from a backend. Read using newFromBytes.
var flir_bytes = ...;
var t = flyr.FlyrThermogramJs.newFromBytes(bytes);
// Draw thermogram to a canvas
var extremes = t.defaultRenderRange();
var canvasId = "render-target"; // Should exist
t.renderToCanvas(extremes[0], extremes[1], canvasId);
t.drawOpticalToCanvas(extremes[0], extremes[1], canvasId);
// Retrieve temperatures as arrays
var kelvin = t.kelvin();
var celsius = t.celsius();
var fahrenheit = t.fahrenheit();
// Use thermogram's width and height to calculate the index of a
// specific pixel
var y = 10;
var x = 23;
var idx = y * t.width() + x;
var pixelTemp = kelvin[idx];
}
run();
Issue tracking
Issue tracking happens in the Blackbody repository.