Elo329
|
#include <cv.h>
#include <highgui.h>
#include <cxcore.h>
Ir al código fuente de este archivo.
Clases | |
struct | ce |
struct | code_book |
'defines' | |
#define | CHANNELS 3 |
'typedefs' | |
typedef struct ce | code_element |
typedef struct code_book | codeBook |
Funciones | |
int | cvupdateCodeBook (uchar *p, codeBook &c, unsigned *cbBounds, int numChannels=3) |
uchar | cvbackgroundDiff (uchar *p, codeBook &c, int numChannels, int *minMod, int *maxMod) |
int | cvclearStaleEntries (codeBook &c) |
int | cvcountSegmentation (codeBook *c, IplImage *I, int numChannels, int *minMod, int *maxMod) |
void | cvconnectedComponents (IplImage *mask, int poly1_hull0=1, float perimScale=4.0, int *num=NULL, CvRect *bbs=NULL, CvPoint *centers=NULL, int nClose=0) |
#define CHANNELS 3 |
typedef struct ce code_element |
uchar cvbackgroundDiff | ( | uchar * | p, |
codeBook & | c, | ||
int | numChannels, | ||
int * | minMod, | ||
int * | maxMod | ||
) |
uchar cvbackgroundDiff(uchar *p, codeBook &c, int minMod, int maxMod) Given a pixel and a code book, determine if the pixel is covered by the codebook
p pixel pointer (YUV interleaved) c codebook reference numChannels Number of channels we are testing maxMod Add this (possibly negative) number onto max level when code_element determining if new pixel is foreground minMod Subract this (possible negative) number from min level code_element when determining if pixel is foreground
NOTES: minMod and maxMod must have length numChannels, e.g. 3 channels => minMod[3], maxMod[3].
Return 0 => background, 255 => foreground
int cvclearStaleEntries | ( | codeBook & | c | ) |
int clearStaleEntries(codeBook &c) After you've learned for some period of time, periodically call this to clear out stale codebook entries
c Codebook to clean up
Return number of entries cleared
void cvconnectedComponents | ( | IplImage * | mask, |
int | poly1_hull0 = 1 , |
||
float | perimScale = 4.0 , |
||
int * | num = NULL , |
||
CvRect * | bbs = NULL , |
||
CvPoint * | centers = NULL , |
||
int | nClose = 0 |
||
) |
void cvconnectedComponents(IplImage *mask, int poly1_hull0, float perimScale, int *num, CvRect *bbs, CvPoint *centers, int nClose) This cleans up the forground segmentation mask derived from calls to cvbackgroundDiff
mask Is a grayscale (8 bit depth) "raw" mask image which will be cleaned up
OPTIONAL PARAMETERS: poly1_hull0 If set, approximate connected component by (DEFAULT) polygon, or else convex hull (0) perimScale Len = image (width+height)/perimScale. If contour len < this, delete that contour (DEFAULT: 4) num Maximum number of rectangles and/or centers to return, on return, will contain number filled (DEFAULT: NULL) bbs Pointer to bounding box rectangle vector of length num. (DEFAULT SETTING: NULL) centers Pointer to contour centers vectore of length num (DEFULT: NULL)
int cvcountSegmentation | ( | codeBook * | c, |
IplImage * | I, | ||
int | numChannels, | ||
int * | minMod, | ||
int * | maxMod | ||
) |
int countSegmentation(codeBook *c, IplImage *I)
Count how many pixels are detected as foreground c Codebook I Image (yuv, 24 bits) numChannels Number of channels we are testing maxMod Add this (possibly negative) number onto max level when code_element determining if new pixel is foreground minMod Subract this (possible negative) number from min level code_element when determining if pixel is foreground
NOTES: minMod and maxMod must have length numChannels, e.g. 3 channels => minMod[3], maxMod[3].
Return Count of fg pixels
int cvupdateCodeBook | ( | uchar * | p, |
codeBook & | c, | ||
unsigned * | cbBounds, | ||
int | numChannels | ||
) |
int updateCodeBook(uchar *p, codeBook &c, unsigned cbBounds) Updates the codebook entry with a new data point
p Pointer to a YUV pixel c Codebook for this pixel cbBounds Learning bounds for codebook (Rule of thumb: 10) numChannels Number of color channels we're learning
NOTES: cvBounds must be of size cvBounds[numChannels]
RETURN codebook index