コード例 #1
0
/*!
 * \brief convenience function to initiate members
 * reserve memory...
 */
void MainCalib::init()
{
    qDebug("MainCalib::init()");
    device = NULL;
    set_numKinects();
    set_indexK(-1);
    set_format(true);
    video.reserve(640*480*3);//video pixel r+g+b = 3*uint8_t
    depth.reserve(640*480*2);//depth pixel uint16_t = 2*uint8_t
    ir.reserve(640*480);//ir pixel uint8_t

    timerDepth = new QTimer(this);
    timerVideo = new QTimer(this);
    timerIR = new QTimer(this);
    connect(timerDepth,SIGNAL(timeout()),this,SLOT(nextDepthFrame()));
    connect(timerVideo,SIGNAL(timeout()),this,SLOT(nextVideoFrame()));
    connect(timerIR,SIGNAL(timeout()),this,SLOT(nextIRFrame()));
}
コード例 #2
0
//////////////////////////////////
// captureVideoFrame()
//
bool captureVideoFrame()
{
	// Capture the next frame
	IplImage  * pVideoFrame = nextVideoFrame();
	if( !pVideoFrame ) 
		return false;	
	
	// Copy it to the display image, inverting it if needed
	if( !pfd_pVideoFrameCopy )
		pfd_pVideoFrameCopy = cvCreateImage( cvGetSize(pVideoFrame), 8, 3 );
	cvCopy( pVideoFrame, pfd_pVideoFrameCopy, 0 );
	pfd_pVideoFrameCopy->origin = pVideoFrame->origin;

	if( 1 == pfd_pVideoFrameCopy->origin ) // 1 means the image is inverted
	{
		cvFlip( pfd_pVideoFrameCopy, 0, 0 );
		pfd_pVideoFrameCopy->origin = 0;
	}
	return true;
}