flyr
TypeScript icon, indicating that this package has built-in type declarations

0.6.1 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i flyr

      Weekly Downloads

      0

      Version

      0.6.1

      License

      EUPL-1.2

      Unpacked Size

      370 kB

      Total Files

      5

      Last publish

      Collaborators

      • anieuwland