The CodebookModel class This is a class made to interface (some way or another) the way OpenCV handles the Codebook segmentation method with the old C interface. This class works associating a changing image to it (be cautious if you're working with this image in more than one thread) to both learn the model and extract foreground difference masks from it.
More...
#include <codebookmodel.h>
|
| static double | getFGPercentageExtern (const cv::Mat mask) |
| | CodebookModel::getFGPercentageExtern Same function as getFGPercentage, but for external Mats, in order to apply some external operations (like morphology) first, before evaluating this percentage. More...
|
| |
| static void | getConnectedComponents (const cv::Mat &fginput, std::vector< cv::Mat > &masks, std::vector< cv::Rect > &boundingBoxes) |
| | getConnectedComponents Gets all the connected components in the binary input mask (I'll trust it's a binary 0-255, 8-bit uchar image). It returns both a mask and a bounding box for each connected component. Now, why is this a static member of THIS class? Because I can! More...
|
| |
The CodebookModel class This is a class made to interface (some way or another) the way OpenCV handles the Codebook segmentation method with the old C interface. This class works associating a changing image to it (be cautious if you're working with this image in more than one thread) to both learn the model and extract foreground difference masks from it.
| void CodebookModel::associateCommonImage |
( |
CommonImage * |
asoc | ) |
|
| void CodebookModel::getConnectedComponents |
( |
const cv::Mat & |
fginput, |
|
|
std::vector< cv::Mat > & |
masks, |
|
|
std::vector< cv::Rect > & |
boundingBoxes |
|
) |
| |
|
static |
getConnectedComponents Gets all the connected components in the binary input mask (I'll trust it's a binary 0-255, 8-bit uchar image). It returns both a mask and a bounding box for each connected component. Now, why is this a static member of THIS class? Because I can!
- Parameters
-
| fginput | Binary input mask |
| masks | Output vector of a binary mask for each connected component |
| boundingBoxes | Output vector of a bounding box for each connected component |
| void CodebookModel::getFG |
( |
QImage & |
output | ) |
|
CodebookModel::getFG The same, but with a QImage as an output image.
- Parameters
-
| double CodebookModel::getFGPercentage |
( |
| ) |
const |
CodebookModel::getFGPercentage Retrieves the percentage of the frame that is considered Foreground. To update the Foreground Mask, you must call updateFGMask prior to this function.
- Returns
- A number between 0 and 100. Returns -1 if no foreground mask was made yet (if it is in a learning phase, for example)
| double CodebookModel::getFGPercentageExtern |
( |
const cv::Mat |
mask | ) |
|
|
static |
CodebookModel::getFGPercentageExtern Same function as getFGPercentage, but for external Mats, in order to apply some external operations (like morphology) first, before evaluating this percentage.
- Parameters
-
- Returns
| int CodebookModel::getLearnedFrames |
( |
| ) |
const |
| double CodebookModel::getRelativeStaleThreshold |
( |
| ) |
const |
| void CodebookModel::setCBParameters |
( |
std::vector< uchar > |
params | ) |
|
CodebookModel::setCBParameters Sets the bounds for Codebook Parameters for each channel. The passing vector element must have at least 9 elements: triads for each YUV channel: minimum bound, maximum bound and cbBounds. Default value is 3,10 and 10 respectively for each triad.
- Parameters
-
| params | A vector with YUV parameters ordered that way. |
| void CodebookModel::setRelativeStaleThreshold |
( |
double |
rel | ) |
|
CodebookModel::setRelativeStaleThreshold Sets what portion of the retrieved codebooks are considered stale, and thus, deleted.
- Parameters
-
| rel | Number from 0.0 to 100.0 indicating what percentage of the run time a codebook is considered stale. |
| bool CodebookModel::updateFGMask |
( |
| ) |
|
CodebookModel::updateFGMask Uses the codebook model to extract the Foreground Mask from the current frame. You can get the mask using the getFG method. Note: You must take some frames to learn a model! I recommend to run learnFrame() on at least 100 frames before using this function!
- Returns
- True if the FG mask was successfully updated.
| bool CodebookModel::verifyNotNullity |
( |
| ) |
|
|
protected |
The documentation for this class was generated from the following files: