HRESULT CVCAConfigure::DoSave( DWORD dwEngId ) { VCA5_APP_ENGINE_CONFIG *pCfg = &(m_EngineConfig[dwEngId]); // SquishIds( pCfg ); SaveZones( dwEngId, &(pCfg->Zones) ); SaveRules( dwEngId, &(pCfg->Rules) ); SaveCounters( dwEngId, &(pCfg->Counters) ); SaveCalibration( dwEngId, &(pCfg->CalibInfo) ); SaveObjects( dwEngId, &(pCfg->ClsObjects) ); SaveTamper( dwEngId, &(pCfg->TamperInfo) ); SaveSceneChange( dwEngId, &(pCfg->SceneChangeInfo) ); SaveAdvanced( dwEngId, &(pCfg->AdvInfo) ); return S_OK; }
void glutKeyboard (unsigned char key, int /*x*/, int /*y*/) { switch (key) { case 27: CleanupExit(); case 'b': // Draw background? g_bDrawBackground = !g_bDrawBackground; break; case 'x': // Draw pixels at all? g_bDrawPixels = !g_bDrawPixels; break; case 's': // Draw Skeleton? g_bDrawSkeleton = !g_bDrawSkeleton; break; case 'i': // Print label? g_bPrintID = !g_bPrintID; break; case 'l': // Print ID & state as label, or only ID? g_bPrintState = !g_bPrintState; break; case 'f': // Print FrameID g_bPrintFrameID = !g_bPrintFrameID; break; case 'j': // Mark joints g_bMarkJoints = !g_bMarkJoints; break; case'p': g_bPause = !g_bPause; break; case 'S': SaveCalibration(); break; case 'L': LoadCalibration(); break; } }
// キャリブレーションの終了 void XN_CALLBACK_TYPE CalibrationEnd(xn::SkeletonCapability& capability, XnUserID nId, XnBool bSuccess, void* pCookie) { xn::UserGenerator* user = (xn::UserGenerator*)pCookie; // キャリブレーション成功 if (bSuccess) { std::cout << "キャリブレーション成功。ユーザー:" << nId << std::endl; user->GetSkeletonCap().StartTracking(nId); // キャリブレーションデータを保存する SaveCalibration( *user ); } // キャリブレーション失敗 else { std::cout << "キャリブレーション失敗。ユーザー:" << nId << std::endl; } }
Creator::Creator(QWidget *parent) : QWidget(parent) { _modifier = 0; qRegisterMetaType<MessageLevel>("MessageLevel"); qRegisterMetaType<cv::Mat>("cv::Mat"); qRegisterMetaType<CalibrationSet>("CalibrationSet"); qRegisterMetaType<QMatrix4x4>("QMatrix4x4"); qRegisterMetaType<PositionDesc>("PositionDesc"); ui.setupUi(this); // populate values to comboboxes ui.modifierCombo->addItem("None", QVariant(NoneModifier)); ui.modifierCombo->addItem("Canny", QVariant(CannyModifier)); // connections // Global application // shortcuts _shortcuts.push_back(new QShortcut(QKeySequence("Ctrl+s"), this)); _shortcuts.push_back(new QShortcut(QKeySequence("Alt+a"), this)); _shortcuts.push_back(new QShortcut(QKeySequence("Alt+n"), this)); connect(_shortcuts[0], SIGNAL(activated()), this, SLOT(SaveSettings())); connect(_shortcuts[1], SIGNAL(activated()), this, SLOT(AddPoint())); connect(_shortcuts[2], SIGNAL(activated()), this, SLOT(AddNewPoint())); // worker connects connect(this, SIGNAL(modeChangedSignal(int)), _capturer.GetWorker(), SLOT(SetMode(int))); connect(ui.renderer, SIGNAL( DescChangedSignal(PositionDesc&)), this, SLOT(FillActive(PositionDesc&))); // rendered connects connect(ui.renderGroup, SIGNAL(buttonClicked(int)), ui.renderer, SLOT(ChangeRenderStyle(int))); ui.renderGroup->setId(ui.renderPointsButton, RenderPoints); ui.renderGroup->setId(ui.renderWireframeButton, RenderWireframe); ui.renderGroup->setId(ui.renderFullButton, RenderComplete); connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(LoadModel())); connect(ui.renderer, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.infobox, SLOT(Report(MessageLevel, const QString&))); connect(ui.reloadShadersButton, SIGNAL(clicked()), ui.renderer, SLOT(ChangeShaders())); connect(ui.lockGroup, SIGNAL(buttonClicked(int)), ui.renderer, SLOT(ChangeActiveKeyPos(int))); ui.lockGroup->setId(ui.cameraRadioButton, PositionCamera); ui.lockGroup->setId(ui.modelRadioButton, PositionModel); ui.lockGroup->setId(ui.lightRadioButton, PositionLight); // videorender connections connect(ui.applyDescButton, SIGNAL(clicked()), this, SLOT(ChangeActiveDesc())); connect(ui.saveSettingsButton, SIGNAL(clicked(void)), this, SLOT(SaveSettings())); connect(ui.playButton, SIGNAL(clicked(void)), this, SLOT(PlayVideo())); connect(ui.pauseButton, SIGNAL(clicked(void)), this, SLOT(Pause(void))); connect(ui.cloudPoints, SIGNAL(Finished(void)), this, SLOT(EnablePlay())); connect(ui.cloudPoints, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.infobox, SLOT(Report(MessageLevel, const QString&))); connect(ui.createMeshButton, SIGNAL(clicked()),this, SLOT(StartCreating())); //connect(ui.nextFrameButton, SIGNAL(clicked(void)), ui.cloudPoints, SLOT(RequestNextFrame())); //connect(ui.prevFrameButton, SIGNAL(clicked(void)), ui.cloudPoints, SLOT(RequestPrevFrame())); ui.nextFrameButton->setDisabled(true); ui.prevFrameButton->setDisabled(true); connect(ui.stopButton, SIGNAL(clicked(void)), this, SLOT(Stop(void))); connect(ui.featuresCheckbox, SIGNAL(clicked(void)), this, SLOT(FeaturesFromFrame())); connect(ui.stopButton, SIGNAL(clicked(void)), this, SLOT(Stop())); connect(ui.greyCheckBox, SIGNAL(clicked(void)), this, SLOT(ShowGreyFrame(void))); connect(ui.newButton, SIGNAL(clicked(void)), this, SLOT(CreateNew(void))); //calibration connects connect(ui.loadCalibrationButton, SIGNAL(clicked()), this, SLOT(LoadCalibration(void))); connect(ui.runCalibrationButton, SIGNAL(clicked()), this, SLOT(RunCalibration(void))); connect(ui.calibrationFolderButton, SIGNAL(clicked()), this, SLOT(LoadCalibrationImages())); connect(ui.applyCalibrationButton, SIGNAL(clicked()), this, SLOT(SendParameters())); connect(ui.playUndistortedButton, SIGNAL(clicked()), this, SLOT(ShowUndistorted())); connect(ui.saveCalibrationButton, SIGNAL(clicked()), this, SLOT(SaveCalibration())); connect(&_capturer, SIGNAL(imageReadySignal(cv::Mat)), ui.cloudPoints, SLOT(setImage(cv::Mat))); connect(&_capturer, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.cloudPoints, SLOT(Report(MessageLevel, const QString &))); connect(_capturer.GetWorker(), SIGNAL(camParametersSignal(cv::Mat, cv::Mat)), ui.cloudPoints, SLOT(ShowParameters(cv::Mat, cv::Mat))); connect(ui.cloudPoints, SIGNAL(setCalibrationSignal(CalibrationSet)), _capturer.GetWorker(), SLOT(ChangeCalibration(CalibrationSet))); // comparer connects connect(ui.compareNext, SIGNAL(clicked()), this, SLOT(GetNextImagePair())); connect(this, SIGNAL(PreparePairSignal(int, int)), _capturer.GetWorker(), SLOT(PreparePair(int,int))); connect(_capturer.GetWorker(), SIGNAL(imagePairSignal(cv::Mat, cv::Mat)), this, SLOT(SetCompare(cv::Mat, cv::Mat))); connect(ui.applyModifierButton, SIGNAL(clicked()), this, SLOT(SetModifier())); //connect(ui.comparePrev, SIGNAL(clicked()), this, SLOT(GetPrevImagePair())); // rest of the initialization LoadSettings(); }
bool Run() { //Main loop - get keypresses and interpret them keystate=GetRemoteKeys(); if(keystate != oldKeystate) { oldKeystate = keystate; if(keystate & KEY_HOME) { return false; } if (mode == 1 || mode == 2) { //menu navigation is only relevant to menu modes if(keystate & KEY_LEFT_BACK) { //Menu down if (menuItem<MAXMENU) { menuItem++; if(menuItem==3 || menuItem==4) { menuNum=6; } else if (menuItem == 5) { menuNum=3; } else { menuNum=1; } } } if(keystate & KEY_LEFT_FORWARD) { //Menu up if (menuItem>1) { menuItem--; if(menuItem==3 || menuItem==4) { menuNum=6; } else if (menuItem == 5) { menuNum=3; } else { menuNum=1; } } } } if (mode == 1) { if(keystate & KEY_RIGHT_FORWARD) { //Menu down if (menuNum<24) { menuNum++; } } if(keystate & KEY_RIGHT_BACK) { //Menu up if (menuNum>1) { menuNum--; } } if(keystate & KEY_INPUT1) { //Clear PlaySound(SOUND_FIRE); steps=0; menuItem=1; menuNum=1; mode=1; OpenMotors(); } if(keystate & KEY_INPUT2) { //Menu select if(steps+1<MAXSTEPS) { steps++; moveList[steps].cmd=menuItem; moveList[steps].num=menuNum; PlaySound(SOUND_BEEP); } } if(keystate & KEY_MENU) { //Switch to second menu mode=2; menuItem=1; menuNum=1; PlaySound(SOUND_BEEP); } } else if (mode == 2) { if(keystate & KEY_INPUT1) { //Switch back to first menu mode=1; menuItem=1; menuNum=1; PlaySound(SOUND_BEEP); } if (keystate & KEY_INPUT2) { //Menu select switch(menuItem) { case 1: { //Free Roam mode=4; PlaySound(SOUND_BEEP); CloseMotors(); } break; case 2: { //Load route LoadRoute(); ClearScreen(); PlaySound(SOUND_BEEP); SetTextColor(white); DrawText(5, 65, "Loading..."); Show(); Sleep(500); //Just so they notice... mode=2; } break; case 3: { //Save route PlaySound(SOUND_BEEP); SaveRoute(); ClearScreen(); SetTextColor(white); DrawText(5, 65, "Saving..."); Show(); Sleep(500); //Just so they notice... mode=2; } break; case 4: { //Recalibrate PlaySound(SOUND_BEEP); mode=3; //Recalibration mode menuNum=1; //Use menuNum as steps throught the process - 1=ready, 2=working } break; case 5: { //About PlaySound(SOUND_GO); mode=5; CloseMotors(); } break; } } if(keystate & KEY_MENU) { //Switch back to first menu mode=1; menuItem=1; menuNum=1; PlaySound(SOUND_BEEP); } } else if (mode==3) { //Recalibrate. if(keystate & KEY_INPUT1) { //Cancel PlaySound(SOUND_BEEP); SetMotors(0,0); mode=2; menuItem=4; menuNum=1; } if (keystate & KEY_INPUT2) { //Start/Stop PlaySound(SOUND_BEEP); switch (menuNum) { case 1: { //Start menuNum=2; ResetTimer(); SetMotors(10000,-10000); } break; case 2: { //Stop rotateSleep = ReadTimer() / 24; SetMotors(0,0); mode=2; menuItem=4; menuNum=1; SaveCalibration(); } } } } else if (mode==4 || mode==5) { if(keystate & KEY_MENU) { //Switch back to first menu PlaySound(SOUND_BEEP); mode=2; menuItem=1; menuNum=1; OpenMotors(); } if (keystate & KEY_INPUT1) { IRState = !IRState; SetIR(IRState); } if (keystate & KEY_INPUT2) { PlaySound(SOUND_BEEP); mode=2; menuItem=1; menuNum=1; OpenMotors(); } } if(keystate & KEY_RUN) { //Go ClearScreen(); Show(); PlaySound(SOUND_GO); //Cycle through steps and execute int count; SetTextColor(green); for(count=1; count<=steps;count++) { switch(moveList[count].cmd) { case 1: { //Forward ClearScreen(); DrawText(5, 100, "%d: Forward %d",count, moveList[count].num); Show(); SetMotors(10000,10000); Sleep(FORWARDSLEEP * moveList[count].num); SetMotors(0,0); } break; case 2: { //Back ClearScreen(); DrawText(5, 100, "%d: Back %d",count, moveList[count].num); Show(); SetMotors(-10000,-10000); Sleep(FORWARDSLEEP * moveList[count].num); SetMotors(0,0); } break; case 3: { //Right ClearScreen(); DrawText(5, 100, "%d: Right %d",count, moveList[count].num * 15); Show(); SetMotors(10000,-10000); Sleep(rotateSleep * moveList[count].num); SetMotors(0,0); } break; case 4: { //Left ClearScreen(); DrawText(5, 100, "%d: Left %d",count, moveList[count].num * 15); Show(); SetMotors(-10000,10000); Sleep(rotateSleep * moveList[count].num); SetMotors(0,0); } break; case 5: { //Fire ClearScreen(); SetTextColor(red); DrawText(10, 45, "PEW! PEW! PEW!"); SetTextColor(green); DrawText(5, 100, "%d: Fire %d",count, moveList[count].num); Show(); int fireCount; for(fireCount=0; fireCount<moveList[count].num; fireCount++) { PlaySound(SOUND_FIRE); } } } } //reset menu pointer menuItem=1; menuNum=1; PlaySound(SOUND_GO); } DrawMenu(); } Sleep(50); //to stop the radio being on full time return true; }