lepton3

package module
v0.0.0-...-24af961 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

README

lepton3

This package implements a robust, efficient Go interface to the FLIR Lepton 3 thermal cameras. Care is taken to avoid memory allocations in the critical path where possible to maximise performance.

Usage

A reasonably simple example of how to use the package can be found in the leptonutil subdirectory. This is a utility which captures frames from the camera and optionally saves them to PNG files.

To build leptonutil for the Raspberry Pi:

$ export GOARCH=arm
$ export GOARM=7
$ cd leptonutil
$ go build    # not install!

Further information

The data sheet for the camera contains a wealth of useful information. It can be found here: http://www.flir.com/uploadedFiles/OEM/Products/LWIR-Cameras/Lepton/Lepton-3-Engineering-Datasheet.pdf

Documentation

Index

Constants

View Source
const (

	// FrameCols is the X resolution of the Lepton 3 camera.
	FrameCols = 160

	// FrameRows is the Y resolution of the Lepton 3 camera.
	FrameRows = 120
)
View Source
const (
	FFCNever    = "never"
	FFCImminent = "imminent"
	FFCRunning  = "running"
	FFCComplete = "complete"
)

These are the valid values for the Telemetry.FFCState field.

View Source
const FramesHz = 9

FramesHz define the approximate number of frames per second emitted by the Lepton 3 camera.

Variables

View Source
var Big16 big16

Big16 translates big endian 16bits words but everything larger is in little endian.

It implements binary.ByteOrder.

Functions

func ParseTelemetry

func ParseTelemetry(raw []byte, t *Telemetry) error

ParseTelemetry converts a slice containing raw Lepton 3 telemetry data into a Telemetry struct.

Types

type Frame

type Frame struct {
	Pix    [FrameRows][FrameCols]uint16
	Status Telemetry
}

Frame represents the thermal readings for a single frame.

func (*Frame) Copy

func (fr *Frame) Copy(orig *Frame)

Copy sets current frame as other frame

type Lepton3

type Lepton3 struct {
	// contains filtered or unexported fields
}

Lepton3 manages a connection to an FLIR Lepton 3 camera. It is not goroutine safe.

func New

func New(spiSpeed int64) (*Lepton3, error)

New returns a new Lepton3 instance.

func (*Lepton3) Close

func (d *Lepton3) Close()

Close stops streaming of packets from the camera and closes the SPI device connection. It must only be called if streaming was started with Open().

func (*Lepton3) NextFrame

func (d *Lepton3) NextFrame(outFrame *RawFrame) error

NextFrame returns the next frame from the camera into the RawFrame provided.

The output RawFrame is provided (rather than being created by NextFrame) to minimise memory allocations.

NextFrame should only be called after a successful call to Open(). Although there is some internal buffering of camera packets, NextFrame must be called frequently enough to ensure frames are not lost.

func (*Lepton3) Open

func (d *Lepton3) Open() error

Open initialises the SPI connection and starts streaming packets from the camera.

func (*Lepton3) RunFFC

func (d *Lepton3) RunFFC() error

RunFFC forces the camera to run a Flat Field Correction recalibration.

func (*Lepton3) SetLogFunc

func (d *Lepton3) SetLogFunc(log func(string))

func (*Lepton3) SetRadiometry

func (d *Lepton3) SetRadiometry(enable bool) error

SetRadiometry enables or disables radiometry mode. If enabled, the camera will attempt to automatically compensate for ambient temperature changes.

func (*Lepton3) Snapshot

func (d *Lepton3) Snapshot() (*RawFrame, error)

Snapshot is convenience method for capturing a single frame. It should *not* be called if streaming is already active.

type RawFrame

type RawFrame [packetsPerFrame * vospiDataSize]byte

RawFrame hold the raw bytes for single frame. This is helpful for transferring frames around. It can be converted to the more useful Frame.

func (*RawFrame) ToFrame

func (rf *RawFrame) ToFrame(out *Frame) error

ToFrame converts a RawFrame to a Frame.

type Telemetry

type Telemetry struct {
	TimeOn       time.Duration
	FFCState     string
	FrameCount   int
	FrameMean    uint16
	TempC        float64
	LastFFCTempC float64
	LastFFCTime  time.Duration
}

Telemetry holds the useful status fields returned by a Lepton 3 thermal camera.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL