コード例 #1
0
void SurfaceSet::paintGL(int ns, bool allNodes, bool connect, bool glyphsVisible){
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST); //TODO: centralize that shit somewhere...
    qDebug() << "cs: " << cs << "surfs: " << surfs << "clear_depth: " << clear_depth;
    surfs.at(cs)->paintGL();
    if (clear_depth) {
        glClear(GL_DEPTH_BUFFER_BIT);
    }
    if (connect) paintConnectivity(threshold);
    glDisable(GL_LIGHTING);
    if (glyphsVisible) paintBufferedNodes(ns);
    //glClear(GL_DEPTH_BUFFER_BIT);
    paintROI();
    glEnable(GL_LIGHTING);
}
コード例 #2
0
cv::Mat clsTracking2D::getProcessedImage()
{
        
        if(isVideo)
                usleep(VIDEOFRAME_SLEEP);
        
        if(!initializedProcess){
                initializeProcessing();
        }
        
        if(resolutionChanged()){
        	WARNMSG(("Lost camera frame... wrong resolution."));
        	usleep(500);
        	return rawImage; // returns the previous frame... very dangerous in real-time systems.!
        }
        cv::Rect roi( cameraResolutions["roiX"], cameraResolutions["roiY"], cameraResolutions["roiW"],  cameraResolutions["roiH"]);
        rawMatROI = rawImage(roi);
        
        rawImageROIval = rawMatROI;
        rawImageROI = &rawImageROIval;
        
        rawImageIval = rawImage;
        rawImageI = &rawImageIval;
        
        // cvRectangle(rawImageI, cvPoint( paramsInt["roiX"], paramsInt["roiY"]),cvPoint( paramsInt["roiX"]+ paramsInt["roiW"], paramsInt["roiY"]+ paramsInt["roiH"]), CV_RGB(0,0,255), 1, 40, 0);
        
        frameCount++;
        
        //process background subtraction:
        switch(paramsInt["bg"] )
        {
        case BG_BGCodeBookModel:
        	INFOMSG(("calcCodeBook"));
                calcCodeBook(rawImageROI,foregroundImage,debugFrame);
                break;
        case BG_COLORSUBTRACTION:
        	INFOMSG(("calcBGsubtraction"));
                calcBGsubtraction(rawImageROI,foregroundImage);
                break;
        case BG_SEG:
        	INFOMSG(("calcBgSegmentation"));
                calcBgSegmentation(rawImageROI,foregroundImage);
                break;
        default:
                DEBUGMSG(("no bg model found"));
        }
        
        cvCopy(rawImageI,paintedFrame);
        
        paintROI(paintedFrame);
        
        if(readyForParticles && startTracking)
        {
                pParticles.processManyParticles(foregroundImage);
                                
                if(paramsInt["showTraces"] == 1)
                        pParticles.drawManyParticles(paintedFrame);
        }
        
        if(paramsInt["showProcessed"] == 1)
                rawImage = foregroundImage;
        else
                rawImage = paintedFrame;
        
        
        if(paramsInt["frameRate"] > 0 )
        {
                double timeElapsed = fpsTimer.getElapsedTime();
		double timeToSleep = ((1000.0/(double)paramsInt["frameRate"])-timeElapsed)*1000;
		if(timeToSleep > 0)
		{
			usleep(timeToSleep);
		}
		
		fpsTimer.reset();
		fpsTimer.start();
		
        }
        while(paramsInt["frameRate"] == 0)
        {
                usleep(3000);
        }
        
        return rawImage;
}