|
TinyRobotics
|
Computes pixel-wise differences between consecutive grayscale camera images. More...
#include <CameraImageDiff.h>
Public Member Functions | |
| void | process (const uint8_t *image, size_t width, size_t height) |
| void | threshold (uint8_t thresh) |
| Simple thresholding: convert difference to binary mask. | |
| uint32_t | countChanges () |
| Count number of pixels above threshold. | |
| std::tuple< uint32_t, uint32_t, uint32_t > | countChangesSplitVertical () |
| std::tuple< uint32_t, uint32_t, uint32_t > | countChangesSplitHorizontal () |
| void | end () |
| int | getWidth () const |
| int | getHeight () const |
| int | getPixelCount () const |
| uint8_t * | getDiff () |
Protected Attributes | |
| int | width_ = 0 |
| int | height_ = 0 |
| std::vector< uint8_t, AllocatorPSRAM< uint8_t > > | prevImage_ |
| std::vector< uint8_t, AllocatorPSRAM< uint8_t > > | diff_ |
| std::vector< uint8_t, AllocatorPSRAM< uint8_t > > | mask_ |
Computes pixel-wise differences between consecutive grayscale camera images.
This class is designed for simple motion or change detection in a sequence of grayscale images. It calculates the absolute difference between the current and previous image, applies a threshold, and provides methods to count the number of changed pixels globally or in image regions.
Features:
Usage Example:
|
inline |
Count number of changed pixels in top, center, and bottom thirds of the image.
|
inline |
Count number of changed pixels in left, center, and right thirds of the image.
|
inline |
Provides the raw difference buffer (grayscale values 0–255) for external use or debugging.