void initializeFace(){ // 顔検出を有効にする auto sts = senseManager->EnableFace(); if (sts<PXC_STATUS_NO_ERROR) { throw std::runtime_error("顔検出の有効化に失敗しました"); } //顔検出器を生成する PXCFaceModule* faceModule = senseManager->QueryFace(); if (faceModule == 0) { throw std::runtime_error("顔検出器の作成に失敗しました"); } //顔検出のプロパティを取得 PXCFaceConfiguration* config = faceModule->CreateActiveConfiguration(); if (config == 0) { throw std::runtime_error("顔検出のプロパティ取得に失敗しました"); } config->SetTrackingMode(PXCFaceConfiguration::TrackingModeType::FACE_MODE_COLOR_PLUS_DEPTH); config->ApplyChanges(); // パイプラインを初期化する sts = senseManager->Init(); if (sts<PXC_STATUS_NO_ERROR) { throw std::runtime_error("パイプラインの初期化に失敗しました"); } // デバイス情報の取得 auto device = senseManager->QueryCaptureManager()->QueryDevice(); if (device == 0) { throw std::runtime_error("デバイスの取得に失敗しました"); } // ミラー表示にする device->SetMirrorMode(PXCCapture::Device::MirrorMode::MIRROR_MODE_HORIZONTAL); PXCCapture::DeviceInfo deviceInfo; device->QueryDeviceInfo(&deviceInfo); if (deviceInfo.model == PXCCapture::DEVICE_MODEL_IVCAM) { device->SetDepthConfidenceThreshold(1); device->SetIVCAMFilterOption(6); device->SetIVCAMMotionRangeTradeOff(21); } config->detection.isEnabled = true; config->QueryExpressions()->Enable(); //追加:顔の表出情報取得を可能にする config->QueryExpressions()->EnableAllExpressions(); //追加:すべての表出情報を取得可能にする config->QueryExpressions()->properties.maxTrackedFaces = EXPRESSION_MAXFACES; //追加:二人までの表出を取得可能に設定する config->ApplyChanges(); faceData = faceModule->CreateOutput(); }
void Genie_Emotion::initilizeFace(){ auto sts = senseManager->EnableFace(); if (sts<PXC_STATUS_NO_ERROR) { throw std::runtime_error("2\n"); } sts = senseManager->EnableEmotion(); PXCFaceModule* faceModule = senseManager->QueryFace(); if (faceModule == 0) { throw std::runtime_error("3\n"); } PXCFaceConfiguration* config = faceModule->CreateActiveConfiguration(); if (config == 0) { throw std::runtime_error("4\n"); } config->SetTrackingMode(PXCFaceConfiguration::TrackingModeType::FACE_MODE_COLOR); sts = senseManager->Init(); if (sts<PXC_STATUS_NO_ERROR) { throw std::runtime_error("5\n"); } auto device = senseManager->QueryCaptureManager()->QueryDevice(); if (device == 0) { throw std::runtime_error("6\n"); } device->SetMirrorMode(PXCCapture::Device::MirrorMode::MIRROR_MODE_HORIZONTAL); PXCCapture::DeviceInfo deviceInfo; device->QueryDeviceInfo(&deviceInfo); if (deviceInfo.model == PXCCapture::DEVICE_MODEL_IVCAM) { device->SetDepthConfidenceThreshold(1); device->SetIVCAMFilterOption(6); device->SetIVCAMMotionRangeTradeOff(21); } config->detection.isEnabled = true; config->QueryExpressions()->Enable(); config->QueryExpressions()->EnableAllExpressions(); config->QueryExpressions()->properties.maxTrackedFaces = 2; config->ApplyChanges(); faceData = faceModule->CreateOutput(); }
void Emotions::setup() { mSenseMgr = PXCSenseManager::CreateInstance(); if (!mSenseMgr) cout << "failed to create SDK Sense Manager" << endl; mSenseMgr->EnableFace(); faceModule = mSenseMgr->QueryFace(); facec = faceModule->CreateActiveConfiguration(); PXCFaceConfiguration::ExpressionsConfiguration *expc = facec->QueryExpressions(); expc->Enable(); expc->EnableAllExpressions(); facec->SetTrackingMode(PXCFaceConfiguration::TrackingModeType::FACE_MODE_COLOR); facec->ApplyChanges(); fdata = faceModule->CreateOutput(); mSenseMgr->EnableEmotion(); cout << "Initialized" << endl; mSenseMgr->Init(); }