本文整理汇总了C++中Kinect::checkNewColorFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ Kinect::checkNewColorFrame方法的具体用法?C++ Kinect::checkNewColorFrame怎么用?C++ Kinect::checkNewColorFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kinect
的用法示例。
在下文中一共展示了Kinect::checkNewColorFrame方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void HiKinectApp::update()
{
if( mKinect.checkNewDepthFrame() ) {
mDepthTexture = mKinect.getDepthImage();
mDepthSurface = Surface32f( mKinect.getDepthImage() );
mKinectReady = true;
if ( !mKinectIR ) {
mKinectIR = true;
mKinect.setVideoInfrared( true );
}
ci::Surface captureSurface = Surface8u( mKinect.getDepthImage() );
ci::Surface outputSurface = captureSurface;
mContours->clear();
mSilhouetteDetector->processSurface(&captureSurface, mContours, &outputSurface);
}
if( mKinect.checkNewColorFrame() )
mColorTexture = mKinect.getVideoImage();
if( mIsMouseDown ) // using small number instead of 0.0 because lights go black after a few seconds when going to 0.0f
mDirectional -= ( mDirectional - 0.00001f ) * 0.1f;
else
mDirectional -= ( mDirectional - 1.0f ) * 0.1f;
if (mKinectReady)
mGridMesh.updateKinect(mKinect);
else
mGridMesh.update();
}
示例2: update
void ContoursApp::update()
{
if ( mKinectReady && !mKinectIR )
mKinect.setVideoInfrared( true );
if( mKinect.checkNewDepthFrame() ) {
mDepthTexture = mKinect.getDepthImage();
mDepthSurface = Surface8u( mKinect.getDepthImage() );
mKinectReady = true;
ci::Surface captureSurface = Surface8u( mKinect.getDepthImage() );
ci::Surface outputSurface = captureSurface;
contours->clear();
silhouetteDetector->processSurface(&captureSurface, contours, &outputSurface);
console() << contours->size() << " is the size " << endl;
mTexture1 = outputSurface;
}
if( mKinect.checkNewColorFrame() ) {
mTexture2 = gl::Texture( mKinect.getVideoImage() );
}
}
示例3: update
void HandTrackingApp::update()
{
if( mKinect.checkNewDepthFrame() ){
ImageSourceRef depthImage = mKinect.getDepthImage();
// make a texture to display
mDepthTexture = depthImage;
// make a surface for opencv
mDepthSurface = depthImage;
if(mDepthSurface){
// once the surface is avalable pass it to opencv
// had trouble here with bit depth. surface comes in full color, needed to crush it down
cv::Mat input( toOcv( Channel8u( mDepthSurface ) ) ), blurred, thresholded, thresholded2, output;
cv::blur(input, 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 );
// 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);
cv::Scalar color( 0, 255, 0 );
if (radius > mBlobMin && radius < mBlobMax) {
// draw the blob if it's in range
cv::circle(output, center, radius, color);
//update the target position
mTargetPosition.x = 640 - center.x;
mTargetPosition.y = center.y;
mTargetPosition.z = 0;
}
}
mCvTexture = gl::Texture( fromOcv( output ) );
}
}
if( mKinect.checkNewColorFrame() )
mColorTexture = mKinect.getColorImage();
if( mKinectTilt != mKinect.getTilt() )
mKinect.setTilt( mKinectTilt );
}