![]() |
ROC SDK
2.4.0
Scalable Face Recognition Software
|
Detect foreground movement in video frames by looking for changes relative to a static background. More...
Typedefs | |
| typedef struct roc_foreground_type * | roc_foreground |
| Handle to a private foreground modeling type. | |
Functions | |
| roc_error | roc_new_foreground (roc_foreground *foreground) |
| Initialize a new foreground model. More... | |
| roc_error | roc_foreground_add_frame (roc_foreground foreground, const roc_image frame, roc_image *mask) |
| Classify image pixels into foreground and background. More... | |
| roc_error | roc_foreground_quality (const roc_image mask, float *foreground_quality) |
| Calculate a quality value based on the number of foreground pixels in the image. More... | |
| roc_error | roc_foreground_roi (const roc_image mask, size_t *x, size_t *y, size_t *width, size_t *height) |
| Identify a rectangular region of interest that captures the foreground content. More... | |
| roc_error | roc_foreground_render (const roc_image frame, const roc_image mask, roc_image *rendering) |
| Construct an image that visualizes the foreground. More... | |
| roc_error | roc_free_foreground (roc_foreground *foreground) |
| Free a foreground model. More... | |
Detect foreground movement in video frames by looking for changes relative to a static background.
| roc_error roc_new_foreground | ( | roc_foreground * | foreground | ) |
Initialize a new foreground model.
Add images to the model with roc_foreground_add_frame.
| [out] | foreground | Foreground model to initialize. |
| roc_error roc_foreground_add_frame | ( | roc_foreground | foreground, |
| const roc_image | frame, | ||
| roc_image * | mask | ||
| ) |
Classify image pixels into foreground and background.
The output mask is a ROC_GRAY8 image the same size as the input frames. Values in mask are either zero to indicate background, or 255 to indicate foreground. The mask can be passed to roc_foreground_quality or roc_foreground_roi. Free mask after use with roc_free_image.
For a visual understanding of the algorithm see roc_foreground_render.
| [in,out] | foreground | Background model to update. |
| [in] | frame | Image to model. |
| [out] | mask | ROC_GRAY8 foreground/foreground mask. |
Calculate a quality value based on the number of foreground pixels in the image.
foreground_quality = (number of pixels in mask) ^ 2 / (number pixels in motion region * number pixels in image)
| [in] | mask | Input foreground mask from roc_foreground_add_frame. |
| [out] | foreground_quality | Quality value based on the number of foreground pixels in the image. |
| roc_error roc_foreground_roi | ( | const roc_image | mask, |
| size_t * | x, | ||
| size_t * | y, | ||
| size_t * | width, | ||
| size_t * | height | ||
| ) |
Identify a rectangular region of interest that captures the foreground content.
| [in] | mask | Input foreground mask from roc_foreground_add_frame. |
| [out] | x | Output region of interest rectangle, top-left corner horizontal position. |
| [out] | y | Output region of interest rectangle, top-left corner vertical position. |
| [out] | width | Output region of interest rectangle width. |
| [out] | height | Output region of interest rectangle height. |
| roc_error roc_foreground_render | ( | const roc_image | frame, |
| const roc_image | mask, | ||
| roc_image * | rendering | ||
| ) |
Construct an image that visualizes the foreground.
Free rendering
| [in] | frame | Input frame from roc_foreground_add_frame. |
| [in] | mask | Resulting mask from roc_foreground_add_frame. |
| [out] | rendering | Rendered image the same size as frame. |
| roc_error roc_free_foreground | ( | roc_foreground * | foreground | ) |
Free a foreground model.
Deallocate memory for foreground previously allocated with roc_new_foreground.
| [in] | foreground | Background to free. |
1.8.15