Giter VIP home page Giter VIP logo

thermalcamera's Introduction

ThermalCamera

MLX90640 Thermal Camera with Edge Detect Video Overlay, for Raspberry Pi

The Thermal Camera resolution is 32x24, scaled to match the Video Camera resolution. Running the Video Camera at high resolutions lowers the framerate due to the Laplacian Edge Detect processing:

Table

Hardware

Cameras

The cameras need to be mounted flat and as close together as possible:

The USB camera pictured is "Bare USB Webcam" from Public Lab which unfortunately is no longer available.

These will probably work, but with a different FOV:

By default the camera device is /dev/video0. To change it, edit videoDev in config.ini:

videoDev = /dev/video0

Software

Installation

Installs:

  • pygame
  • colour
  • MLX90640
  • wiringPi
cd /home/pi
git clone https://github.com/obstruse/ThermalCamera.git
sudo ThermalCamera/install/installThermalCamera.sh

Execution

Run the program from the command line:

/home/pi/ThermalCamera/python/heat.py

You can run the program remotely from an SSH connection, with the heat displayed in an X-window. Framerate will drop (see timings above)

Click on the window to bring up the menu overlay:

Menu

Commands ย 
MAX/+/- changes the maximum threshold for red pixels.
MIN/+/- changes the minimum threshold for blue pixels.
Capture copy the current camra image to /home/pi/Pictures
Mode cycle through the display modes
Back return to display
Exit exit program

Display Modes:

  • heat + camera overlay
  • heat + edge detect overlay
  • heat only (no scaling)
  • camera only (no scaling)

The Capture only saves a single image. To capture series of images over a period of time, use the gpio command to set GPIO5. For example, to capture 3 seconds of images, this command:

pi@rpi4:~ $ gpio -g write 5 1; sleep 3; gpio -g write 5 0

The captured images in /home/pi/Pictures can be combined into an MP4 or GIF using ffmpeg and convert, for example:

#!
PATTERN=${1}
convert -delay 8 -coalesce -duplicate 1,-2-1 -layers Optimize -loop 0 ${PATTERN}\*.jpg ${PATTERN}.gif

Alignment

Field Of View (FOV)

The script needs the FOV of both cameras in order to scale the images properly. The camera data sheet might have a value for FOV, but it's often missing or incorrect.

To measure the FOV, use the heat only and camera only modes of heat.py. Separate two objects horizontally until they are at the edges of the image. Measure the distance between the objects and the distance to the camera to calculate the FOV:

FOV = degrees(atan(width/distance/2)*2)

FOV

Enter the values for camFOV and heatFOV in config.ini:

camFOV = 35
heatfov = 40

Offset

If you carefully mounted the two cameras, the two images should line up fairly well... but then there's the parallax caused by the distance between them.

To correct for mounting errors and parallax, use the keyboard arrow keys to offset the images until they line up. Press 'w' to save the offsets in the config.ini file



Camera

Thermal Camera with LCD Touchscreen

Hot Watermelon PiZero

EICO 460

EICO 460 Oscilloscope chassis hot spots

thermalcamera's People

Contributors

obstruse avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.