本文整理汇总了C++中Kinect类的典型用法代码示例。如果您正苦于以下问题:C++ Kinect类的具体用法?C++ Kinect怎么用?C++ Kinect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kinect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openflkinect_get_user_col
static value openflkinect_get_user_col(value ref, value userID)
{
val_check_kind(ref, k_Kinect);
Kinect* k = static_cast<Kinect*>(val_data(ref));
return alloc_int( k->getUserColor( val_int(userID) ) );
}
示例2: openflkinect_get_status
static value openflkinect_get_status(value ref)
{
val_check_kind(ref, k_Kinect);
Kinect* k = static_cast<Kinect*>(val_data(ref));
return alloc_int( k->nuiStatus() );
}
示例3: openflkinect_get_is_capturing
static value openflkinect_get_is_capturing(value ref)
{
val_check_kind(ref, k_Kinect);
Kinect* k = static_cast<Kinect*>(val_data(ref));
return alloc_bool(k->isCapturing());
}
示例4: openflkinect_set_tilt
static void openflkinect_set_tilt(value ref, value degrees)
{
val_check_kind(ref, k_Kinect);
val_check(degrees, int);
Kinect* k = static_cast<Kinect*>(val_data(ref));
k->setTilt(val_int(degrees));
}
示例5: openflkinect_update_interactions
static value openflkinect_update_interactions(value ref)
{
val_check_kind(ref, k_Kinect);
Kinect* k = static_cast<Kinect*>(val_data(ref));
vector<NUI_USER_INFO> userInfos = k->interactionInfo();
value users = alloc_array(userInfos.size());
for ( int i=0; i<userInfos.size(); i++ )
{
NUI_USER_INFO& s = userInfos[i];
value user = alloc_empty_object();
val_array_set_i(users, i, user);
if ( userInfos[i].SkeletonTrackingId > 0 )
{
alloc_field( user, val_id( "isTracked" ),
alloc_bool( true ) );
alloc_field( user, val_id("skeletonTrackingId"),
alloc_int(userInfos[i].SkeletonTrackingId ));
value hands = alloc_array( NUI_USER_HANDPOINTER_COUNT );
alloc_field( user, val_id("handPointerInfos"),
hands);
for ( int j=0; j<NUI_USER_HANDPOINTER_COUNT; j++ )
{
value hand = alloc_empty_object();
val_array_set_i(hands, j, hand);
alloc_field( hand, val_id("handTypeEvent"),
alloc_float( userInfos[i].HandPointerInfos[j].HandEventType ));
alloc_field( hand, val_id("handType"),
alloc_float( userInfos[i].HandPointerInfos[j].HandType ));
alloc_field( hand, val_id("pressExtent"),
alloc_float( userInfos[i].HandPointerInfos[j].PressExtent ));
alloc_field( hand, val_id("rawX"),
alloc_float( userInfos[i].HandPointerInfos[j].RawX ));
alloc_field( hand, val_id("rawY"),
alloc_float( userInfos[i].HandPointerInfos[j].RawY ));
alloc_field( hand, val_id("rawZ"),
alloc_float( userInfos[i].HandPointerInfos[j].RawZ ));
alloc_field( hand, val_id("state"),
alloc_float( userInfos[i].HandPointerInfos[j].State ));
alloc_field( hand, val_id("x"),
alloc_float( userInfos[i].HandPointerInfos[j].X ));
alloc_field( hand, val_id("y"),
alloc_float( userInfos[i].HandPointerInfos[j].Y ));
val_array_set_i(hands, j, hand);
}
}
else
{
alloc_field( user, val_id( "isTracked" ), alloc_bool( false ) );
}
}
return users;
}
示例6: main
int main(){
Kinect K;
Filters F;
cout<<K.initialiseKinect()<<'\n';
KOCVStream STREAM(K,F);
STREAM.display("dei");
cin.get();
return 0;
}
示例7: writeImage
void kinectSkelApp::mouseUp( MouseEvent event )
{
writeImage( getHomeDirectory() + "kinect_color.png", mKinect.getColorImage() );
writeImage( getHomeDirectory() + "kinect_depth.png", mKinect.getDepthImage() );
// set tilt to random angle
mKinect.setLedColor( Kinect::LED_YELLOW );
}
示例8: main
int main( int argc, char* argv[] )
{
try{
Kinect kinect;
kinect.run();
} catch( std::exception& ex ){
std::cout << ex.what() << std::endl;
}
return 0;
}
示例9: openflkinect_get_user_count
static value openflkinect_get_user_count(value ref)
{
val_check_kind(ref, k_Kinect);
Kinect* k = static_cast<Kinect*>(val_data(ref));
if ( k->isCapturing() == false )
{
return alloc_int(0);
}
return alloc_int(k->getUserCount());
}
示例10: openflkinect_depth_frame_rate
static value openflkinect_depth_frame_rate(value ref)
{
val_check_kind(ref, k_Kinect);
Kinect* k = static_cast<Kinect*>(val_data(ref));
if ( k->isCapturing() == false )
{
return alloc_float(0.0f);
}
return alloc_float(k->depthFrameRate());
}
示例11: setupFont
void KinectStreamerApp::setup()
{
setupFont();
mOscBroadcaster.registerParams(mSettings);
mJointParameters.registerParams(mSettings);
mKinect.registerParams(mSettings);
mSettings.load(getAssetPath("kinectStreamerSettings.json").string());
mSettings.setup();
mKinect.setup();
mOscBroadcaster.setup(&mKinect);
// mOscBroadcaster.setDestination("127.0.0.1", 37000);
}
示例12: runKinect
//boucle de traitement de la kinect
void* Kinect::runKinect(void* k)
{
//setup
Kinect* kinect = static_cast<Kinect*>(k);
drawgrid = kinect->grille_;
Mat depthMat(480,640,CV_16UC1);
Freenect::Freenect freenect;
MyFreenectDevice& device = freenect.createDevice<MyFreenectDevice>(0);
device.startDepth();
//grille ¨virtuelle¨ plus petite pour A* au forum (pour accélérer la recherche de trajectoire).
char **sgrille = new char*[175];
for(int i=0;i<175;i++)
sgrille[i]=new char[175];
clock_t time;
while (!kinect->die_)
{
//si pas d´image disponible : attente de 10ms puis relancer la boucle.
if(!device.getDepth(depthMat))
{
delay(10);
continue;
}
pthread_mutex_lock(&mut);
depthMat.convertTo(depthf, CV_8UC1, 255.0/2048.0);
time = clock(); //debug : utilisé pour cronométrer les boucles
kinect->marquer_obstacles(depthMat);
// std::cout << "marquer" << (clock() - time) * 1000 / CLOCKS_PER_SEC << std::endl;
//executer AStar, division de grille par 2 pour aller plus vite
for(int x =0; x <175; x++)
for(int y =0; y <175; y++)
sgrille[x][y] = kinect->grille_->grille_[2 *x][2 * y] + kinect->grille_->grille_[2 *x + 1][2 * y] + kinect->grille_->grille_[2 *x][2 * y + 1] + kinect->grille_->grille_[2 *x+1][2 * y+1];
char *route = AStarStatic(240 / 2, 0, 240 / 2, TARGET / 2, sgrille, 175,175);
char lroute[ 2 * strlen(route)];
for(int x =0; x <strlen(route); x++)
{
lroute[2 * x] = route[x];
lroute[2 * x + 1] = route[x];
}
drawRouteOnMap(kinect->grille_->grille_, lroute, 240, 0);
if(strlen(route) != 0)
free(route);
// std::cout << (clock() - time) * 1000 / CLOCKS_PER_SEC << std::endl;
pthread_cond_signal(&cond);
pthread_mutex_unlock(&mut);
delay(40); //40ms sleep : laisse le temps pour dessiner la fenetre avant de reprendre le mutex
}
device.stopDepth();
delete(sgrille);
return 0;
}
示例13: main
int main()
{
Kinect *Program = new Kinect();
Program->PrzygotujChmury();
Program->NARF_ICP();
Program->ICP();
delete Program;
return 0;
}
示例14: openflkinect_get_skeleton_depth_pos
static value openflkinect_get_skeleton_depth_pos(value ref, value vec3)
{
val_check_kind(ref, k_Kinect);
Kinect* k = static_cast<Kinect*>(val_data(ref));
Vec2i adjusted = k->getSkeletonDepthPos(Vec3f(
val_float(val_field(vec3, val_id("x"))),
val_float(val_field(vec3, val_id("y"))),
val_float(val_field(vec3, val_id("z"))) ));
value ret = alloc_empty_object();
alloc_field( ret, val_id("x"), alloc_int(adjusted.x));
alloc_field( ret, val_id("y"), alloc_int(adjusted.y));
return ret;
}
示例15: openflkinect_init
static value openflkinect_init(value in)
{
value v;
v = alloc_abstract(k_Kinect, new Kinect());
Kinect* k = static_cast<Kinect*>(val_data(v));
DeviceOptions& opts = k->getDeviceOptions();
opts.deviceId = val_string(val_field(in, val_id("deviceId")));
opts.deviceIndex = val_int(val_field(in, val_id("deviceIndex;")));
opts.depthEnabled = val_bool(val_field(in, val_id("depthEnabled")));
opts.colorEnabled = val_bool(val_field(in, val_id("colorEnabled")));
opts.irEnabled = val_bool(val_field(in, val_id("irEnabled")));
opts.skeletonTrackingEnabled =
val_bool(val_field(in, val_id("skeletonTrackingEnabled")));
opts.interactionEnabled = val_bool(val_field(in, val_id("interactionEnabled")));
cout << opts.interactionEnabled << endl;
opts.depthResolution =
opts.getResolution(val_string(val_field(in, val_id("depthResolution"))));
opts.depthSize = opts.Vec2fromHaxePoint(in, "depthSize");
opts.colorResolution =
opts.getResolution(val_string(
val_field(in, val_id("colorResolution"))));
opts.colorSize = opts.Vec2fromHaxePoint(in, "colorSize");
opts.irResolution =
opts.getResolution(val_string(
val_field(in, val_id("irResolution"))));
opts.irSize = opts.Vec2fromHaxePoint(in, "irSize");
opts.nearModeEnabled = val_bool(val_field(in, val_id("nearModeEnabled")));
opts.seatedModeEnabled = val_bool(val_field(in, val_id("seatedModeEnabled")));
opts.userTrackingEnabled = val_bool(val_field(in, val_id("userTrackingEnabled")));
opts.extendedModeEnabled = val_bool(val_field(in, val_id("extendedModeEnabled")));
opts.mapColorToDepth = val_bool(val_field(in, val_id("mapColorToDepth")));
opts.binaryMode = val_bool(val_field(in, val_id("binaryMode")));
opts.userColor = val_bool(val_field(in, val_id("userColor")));
opts.removeBackground = val_bool(val_field(in, val_id("removeBackground")));
opts.inverted = val_bool(val_field(in, val_id("inverted")));
opts.flipped = val_bool(val_field(in, val_id("flipped")));
opts.transform = opts.getTransform(val_string(val_field(in,
val_id("transform"))));
return v;
}