void HIVSimpleDiagnostic::Update( float dt ) { bool cascade_state_ok = UpdateCascade(); if( !cascade_state_ok ) { // the cascadeState must be an abort state return ; } if( firstUpdate ) { result_of_positive_test = positiveTestResult() ; } else { // ------------------------------------------------------------------------------ // --- Count down the time until a positive test result comes back // --- Update() is called the same day as Distribute() so we don't want // --- to decrement the counter until the next day. // ------------------------------------------------------------------------------ days_to_diagnosis -= dt; } ActOnResultsIfTime(); firstUpdate = false; }
void MBLBPDetectSingleScale( const IplImage* img, MBLBPCascade * pCascade, CvSeq * positions, CvSize winStride) { IplImage * sum = 0; int ystep, xstep, ymax, xmax; CV_FUNCNAME( "MBLBPDetectSingleScale" ); __BEGIN__; if( !img ) CV_ERROR( CV_StsNullPtr, "Null image pointer" ); if( ! pCascade) CV_ERROR( CV_StsNullPtr, "Invalid classifier cascade" ); if( !positions ) CV_ERROR( CV_StsNullPtr, "Null CvSeq pointer" ); if(pCascade->win_width > img->width || pCascade->win_height > img->height) return ; CV_CALL( sum = cvCreateImage(cvSize(img->width, img->height), IPL_DEPTH_32S, 1)); myIntegral(img, sum); //cvIntegral(img, sum); UpdateCascade(pCascade, sum); ystep = winStride.height; xstep = winStride.width; ymax = img->height - pCascade->win_height -1; xmax = img->width - pCascade->win_width -1; #ifdef _OPENMP #pragma omp parallel for #endif for(int iy = 0; iy < ymax; iy+=ystep) { for(int ix = 0; ix < xmax; ix+=xstep) { int w_offset = iy * sum->widthStep / sizeof(int) + ix; int result = DetectAt(pCascade, w_offset); if( result > 0) { //since the integral image is different with that of OpenCV, //update the position to OpenCV's by adding 1. CvPoint pt = cvPoint(ix+1, iy+1); #ifdef _OPENMP omp_set_lock(&lock); #endif cvSeqPush(positions, &pt); #ifdef _OPENMP omp_unset_lock(&lock); #endif } if(result == 0) { ix += xstep; } } } __END__; cvReleaseImage(&sum); return ; }