|
EMBER 0.1
EMBER is a fire suppression system with a thermal IR camera for hot blob detection on a pan/tilt mechanism with a solenoid for commanded water flow.
|
Thermal camera reading and hot blob detection task. More...
#include "PrintStream.h"#include "task_read_camera.h"#include <Arduino.h>#include <Wire.h>#include "shares.h"#include "task_webserver.h"#include "adafruit_mlx90640.h"Macros | |
| #define | HOTBLOB_DETECT_THRESHOLD 50.0f |
| #define | HOTBLOB_INCLUSION_THRESHOLD 49.0f |
| #define | FIRE_ALERT_THRESHOLD 70.0f |
| #define | FIRE_COOLDOWN_THRESHOLD 60.0f |
| #define | NUM_PIXELS 768 |
Functions | |
| void | findHotBlob (const float *frame, uint16_t seedIdx, float tempThreshold, uint16_t &outCentroidIdx, float &outMaxTemp, float &outAvgTemp, uint16_t &outSize, float &outCentroidX, float &outCentroidY) |
| function which finds the centroid of a hot blob in a thermal frame | |
| void | task_read_camera (void *p_params) |
| task which reads the MLX90640 thermal camera and detects hotspots | |
Variables | |
| Adafruit_MLX90640 | mlx |
Thermal camera reading and hot blob detection task.
| void findHotBlob | ( | const float * | frame, |
| uint16_t | seedIdx, | ||
| float | tempThreshold, | ||
| uint16_t & | outCentroidIdx, | ||
| float & | outMaxTemp, | ||
| float & | outAvgTemp, | ||
| uint16_t & | outSize, | ||
| float & | outCentroidX, | ||
| float & | outCentroidY ) |
function which finds the centroid of a hot blob in a thermal frame
this functions performs a breadth-first search (BFS) starting from a seed pixel to find all connected pixels above a temperature threshold, effectively identifying a "blob" of hot pixels. It computes the weighted centroid of the blob based on pixel temperatures, as well as the maximum temperature, average temperature, and size of the blob.
| frame | pointer to the thermal frame array (size 768) |
| seedIdx | index of the seed pixel to start the search from |
| tempThreshold | temperature threshold for including pixels in the blob |
| outCentroidIdx | reference to store the index of the computed centroid pixel |
| outMaxTemp | reference to store the maximum temperature found in the blob |
| outAvgTemp | reference to store the average temperature of the blob |
| outSize | reference to store the size (number of pixels) of the blob |
| outCentroidX | reference to store the X coordinate of the centroid |
| outCentroidY | reference to store the Y coordinate of the centroid |
| void task_read_camera | ( | void * | p_params | ) |
task which reads the MLX90640 thermal camera and detects hotspots
This task continuously reads frames from the MLX90640 thermal camera at a set refresh rate. It processes each frame to find the hottest pixel and then identifies a connected "hot blob" of pixels around it that exceed a defined temperature threshold. The task computes the centroid of the hot blob and applies temporal smoothing to reduce jitter in the detected position. If the maximum temperature of the blob exceeds a fire alert threshold, it sets a shared boolean "fire" to true. The task runs indefinitely with no delay, relying on the camera's refresh rate for timing.
| p_params | not used and should be set to void in the xTaskCreate call |