FACE_API HANDLE facetrackCreate(TVAInitParams* params, int NumObjects) { HANDLE hModule = faceCreate(params, 1, 320, 1.41, false, NumObjects); if (hModule == NULL) return NULL; TheFace* p = (TheFace*)hModule; p->f->SetNeedTrack(true); return hModule; }
bool Nfdc::dispatch(const std::string& command) { if (command == "add-nexthop") { if (m_nOptions != 2) return false; fibAddNextHop(); } else if (command == "remove-nexthop") { if (m_nOptions != 2) return false; fibRemoveNextHop(); } else if (command == "register") { if (m_nOptions != 2) return false; ribRegisterPrefix(); } else if (command == "unregister") { if (m_nOptions != 2) return false; ribUnregisterPrefix(); } else if (command == "create") { if (m_nOptions != 1) return false; faceCreate(); } else if (command == "destroy") { if (m_nOptions != 1) return false; faceDestroy(); } else if (command == "set-strategy") { if (m_nOptions != 2) return false; strategyChoiceSet(); } else if (command == "unset-strategy") { if (m_nOptions != 1) return false; strategyChoiceUnset(); } else usage(m_programName); return true; }
// детектирование лиц bool DetectFace(TVAInitParams& params, CvCapture* capture, bool save = false) { TVAFace* faces = new TVAFace[cNumObjects]; char buf[256]; params.SaveLog = false; params.Path = "D:\\_alt\\database\\log\\"; HANDLE face = faceCreate(¶ms, 1, 256, 1.1, true, cNumObjects); if (!face) { printf("%s\n", "Cannot open detect engine."); return false; } for (;;) { IplImage* frame = NULL; frame = cvQueryFrame(capture); if (!frame) break; int num = 0; DWORD t = GetTickCount(); faceProcess(face, frame->width, frame->height, frame->nChannels, (unsigned char*)frame->imageData, faces, &num); t = GetTickCount() - t; if (num > 0) { for (int i = 0; i < num; i++) { DrawFace(frame, faces[i]); } } CvScalar color = CV_RGB(255, 0, 0); char buf[32]; sprintf(buf, "proc time = %d", t); cvPutText(frame, buf, cvPoint(10, 10), &g_font, color); cvShowImage(_MODULE_, frame); int c; c = cvWaitKey(10); if ((char)c == 27) break; } faceRelease(&face); free(faces); return true; }