Elo329
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' 'defines'
Referencia del Archivo cv_yuv_codebook.cpp
#include "cv_yuv_codebook.h"
#include "procesos.h"

'defines'

#define CV_CVX_WHITE   CV_RGB(0xff,0xff,0xff)
#define CV_CVX_BLACK   CV_RGB(0x00,0x00,0x00)

Funciones

int cvupdateCodeBook (uchar *p, codeBook &c, unsigned *cbBounds, int numChannels)
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, float perimScale, int *num, CvRect *bbs, CvPoint *centers, int nClose)

Variables

int CVCONTOUR_APPROX_LEVEL = 2
int CVCLOSE_ITR = 1

Documentación de los 'defines'

#define CV_CVX_BLACK   CV_RGB(0x00,0x00,0x00)
#define CV_CVX_WHITE   CV_RGB(0xff,0xff,0xff)

Documentación de las funciones

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

Documentación de las variables

int CVCLOSE_ITR = 1
int CVCONTOUR_APPROX_LEVEL = 2

GLOBALS FOR ALL CAMERA MODELS For connected components: