platypush.plugins.camera.ir.mlx90640

class platypush.plugins.camera.ir.mlx90640.CameraIrMlx90640Plugin(fps=16, skip_frames=2, scale_factor=1, rotate=0, rawrgb_path=None, **kwargs)[source]

Plugin to interact with a ML90640 infrared thermal camera.

In order to use this plugin you’ll need to download and compile the mlx90640 C++ bindings and examples for the device. Instructions on Raspbian:

# Install the dependencies
$ [sudo] apt-get install libi2c-dev
$ cd $PLATYPUSH_SRC_DIR
$ git submodule init
$ git submodule update
$ cd platypush/plugins/camera/ir/mlx90640/lib
$ make clean
$ make bcm2835
$ make examples/rawrgb I2C_MODE=LINUX

Requires:

  • mlx90640-library installation (see instructions above)
  • PIL image library (pip install Pillow)
__init__(fps=16, skip_frames=2, scale_factor=1, rotate=0, rawrgb_path=None, **kwargs)[source]
Parameters:
  • fps – Frames per seconds (default: 16)
  • skip_frames – Number of frames to be skipped on sensor initialization/warmup (default: 2)
  • scale_factor – The camera outputs 24x32 pixels artifacts. Use scale_factor to scale them up to a larger image (default: 1)
  • rotate – Rotation angle in degrees (default: 0)
  • rawrgb_path – Specify it if the rawrgb executable compiled from https://github.com/pimoroni/mlx90640-library is in another folder than <directory of this file>/lib/examples.
capture(output_file=None, frames=1, grayscale=False, fps=None, skip_frames=None, scale_factor=None, rotate=None, format='jpeg')[source]

Capture one or multiple frames and return them as raw RGB

Parameters:
  • output_file (str) – Can be either the path to a single image file or a format string (e.g. ‘snapshots/image-{:04d}’) in case of multiple frames. If not set the function will return a list of base64 encoded representations of the raw RGB frames, otherwise the list of captured files.
  • frames (int) – Number of frames to be captured (default: 1). If None the capture process will proceed until stop is called.
  • grayscale (bool) – Save the image as grayscale - black pixels will be colder, white pixels warmer (default: False)
  • fps (int) – If set it overrides the fps parameter specified on the object (default: None)
  • skip_frames (int) – If set it overrides the skip_frames parameter specified on the object (default: None)
  • scale_factor (float) – If set it overrides the scale_factor parameter specified on the object (default: None)
  • rotate (int) – If set it overrides the rotate parameter specified on the object (default: None)
  • format (str) – Output image format if output_file is not specified (default: jpeg). It can be jpg, png, gif or any format supported by PIL
Returns:

list[str]. Each item is a base64 encoded representation of a frame in the specified format if output_file is not set, otherwise a list with the captured image files will be returned.

stop()[source]

Stop an ongoing capture session