当前位置: 首页>>代码示例>>C++>>正文


C++ Kinect::checkNewVideoFrame方法代码示例

本文整理汇总了C++中Kinect::checkNewVideoFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ Kinect::checkNewVideoFrame方法的具体用法?C++ Kinect::checkNewVideoFrame怎么用?C++ Kinect::checkNewVideoFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kinect的用法示例。


在下文中一共展示了Kinect::checkNewVideoFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleKinect

void ScheinrieseApp::handleKinect()
{
    if (!hasKinect) {
        return;
    }

    if( mKinectTilt != mKinect.getTilt() ) {
        mKinect.setTilt( mKinectTilt );
    }

    if( mKinect.checkNewDepthFrame() ) {
        mDepthTexture = mKinect.getDepthImage();
    }

    if( mKinect.checkNewVideoFrame() ) {
        mColorTexture = mKinect.getVideoImage();
    }

    /* debug view */
    if (mColorTexture && !mDebugViewColor) {
        mGui->addLabel("COLOR");
        mDebugViewColor = mGui->addParam("COLOR", &mColorTexture);
        mDebugViewColor->var = &mColorTexture;
        console() << "color" << endl;
    }

    if (mDepthTexture && !mDebugViewDepth) {
        mGui->addLabel("DEPTH");
        mDebugViewDepth = mGui->addParam("DEPTH", &mDepthTexture);
        mDebugViewDepth->var = &mDepthTexture;
        console() << "depth" << endl;
    }
}
开发者ID:TheProduct,项目名称:Scheinriese,代码行数:33,代码来源:ScheinrieseApp.tess.cpp

示例2: lookingForUser


//.........这里部分代码省略.........
				cv::Point p1 = cv::Point(0,480 - mReflectionBottom-1);
				cv::Point p2 = cv::Point(640, 480);
				cv::rectangle(tmp, p1, p2, black, -1, 8, 0);
			}
			
			if (mReflectionTop > 0) {
				cv::Scalar black( 0, 0, 0 );
				cv::Point p1 = cv::Point(0, 0);
				cv::Point p2 = cv::Point(640, mReflectionTop);
				cv::rectangle(tmp, p1, p2, black, -1, 8, 0);
			}
			
			//tmp.copyTo(input, mBackground);
			
			cv::blur(tmp, blurred, cv::Size(10,10));
			
			// make two thresholded images one to display and one
			// to pass to find contours since its process alters the image
			cv::threshold( blurred, thresholded, mThreshold, 255, CV_THRESH_BINARY);
			cv::threshold( blurred, thresholded2, mThreshold, 255, CV_THRESH_BINARY);
			
			// 2d vector to store the found contours
			vector<vector<cv::Point> > contours;
			// find em
			cv::findContours(thresholded, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
			
			// convert theshold image to color for output
			// so we can draw blobs on it
			cv::cvtColor( thresholded2, output, CV_GRAY2RGB );
			cv::Scalar color( 0, 255, 255 );
			mUser = false;
			
			// loop the stored contours
			for (vector<vector<cv::Point> >::iterator it=contours.begin() ; it < contours.end(); it++ ){
				
				// center abd radius for current blob
				cv::Point2f center;
				float radius;
				// convert the cuntour point to a matrix 
				vector<cv::Point> pts = *it;
				cv::Mat pointsMatrix = cv::Mat(pts);
				// pass to min enclosing circle to make the blob 
				cv::minEnclosingCircle(pointsMatrix, center, radius);
				
				
				if (radius > mBlobMin && radius < mBlobMax) {
					mUserPos = 640 - center.x;
					mUser = true;
					if (mNoUserMessage == false) {
						mNoUserMessage = true;
					}
					
					cv::circle(output, center, radius, color, 3);
					
					mStopedTime = getElapsedSeconds();
					
					
					osc::Message message;
					message.addFloatArg(mUserPos);
					message.setAddress("/user/1");
					message.setRemoteEndpoint(mHost, mPort);
					mSender.sendMessage(message);
					
                    
				} else if (mNoUserMessage) {
					osc::Message message;
					message.addFloatArg(mUserPos);
					message.setAddress("/nouser");
					message.setRemoteEndpoint(mHost, mPort);
					mSender.sendMessage(message);
					
					mNoUserMessage = false;
					
				} 					
			}	
			
			cv::Scalar yellow( 0, 255, 255 );
			
			if (mReflectionBottom > 0) {
				
				cv::Point p1 = cv::Point(0, 480 - mReflectionBottom-1);
				cv::Point p2 = cv::Point(640, 480);
				cv::rectangle(output, p1, p2, yellow, -1, 8, 0);
			}
			
			if (mReflectionTop > 0) {
				cv::Scalar black( 0, 0, 0 );
				cv::Point p1 = cv::Point(0, 0);
				cv::Point p2 = cv::Point(640, mReflectionTop);
				cv::rectangle(output, p1, p2, yellow, -1, 8, 0);
			}
			
			mContourTexture = gl::Texture( fromOcv( output ) );
		}
	}
    
	if( mKinect.checkNewVideoFrame() )
		mColorTexture = mKinect.getVideoImage();
    
}
开发者ID:christianRakete,项目名称:Rogalarm,代码行数:101,代码来源:RogalarmApp.cpp


注:本文中的Kinect::checkNewVideoFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。