Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void application::main_application()
- {
- currentInputFrame = vidSrc.extractFrame();
- // currentInputFrame = imread("/home/rahul.c/code/AMDI_USA_18_056/build/frame_30.png");
- this->vidSrc.incrementFrameCount();
- ++this->m_lastSSDFrameCount;
- if (currentInputFrame.empty()) {
- this->isVideoEnded = true;
- #if AMD_TENSOR
- this->m_openVXTensor.deInitTensor();
- #endif
- this->vidSrc.getVideoWriter()->release();
- } else {
- cv::cvtColor(currentInputFrame, gray_img, CV_RGB2GRAY);
- bool isSSD = true;
- if (isSSDNeeded()) {
- this->runSSD();
- isSSD = false;
- }
- if (isSSD) {
- for (vector<Person>::iterator it = this->m_activePersonList.begin(); it != this->m_activePersonList.end() && isSSD; ++it) {
- Person& p = *it;
- cv::Rect trackedHeadBBox;
- this->track(&p, &isSSD, &trackedHeadBBox);
- }
- }
- for (vector<Person>::iterator it = this->m_activePersonList.begin(); it != this->m_activePersonList.end(); ++it) {
- Person& p = *it;
- FaceBoundaryBox* box = p.getFaceBoundaryBox();
- bool isNegativeFRID = p.getFrid() == -1;
- cv::Scalar boxTextColor = isNegativeFRID ? cv::Scalar(0, 0, 255) : cv::Scalar(0, 255, 0);
- // const string displayText = isNegativeFRID ? "Unknown" : "FRID : " + to_string(p.getFrid());// + ", DIST : " + to_string(p.getFaceBoundaryBox()->getScore());
- const string displayText = isNegativeFRID ? "Unknown" : to_string(p.getFrid());
- cv::putText(
- currentInputFrame,
- displayText,
- cv::Point(
- p.getFaceBoundaryBox()->getNLoc_X(),
- p.getFaceBoundaryBox()->getNLoc_Y()
- ),
- FONT_HERSHEY_SIMPLEX,
- 0.6,
- boxTextColor,
- 2,
- p.getFaceBoundaryBox()->getNLoc_X() > 30 && p.getFaceBoundaryBox()->getNLoc_Y() > 30
- );
- cv::rectangle(
- currentInputFrame,
- cv::Rect(
- box->getNLoc_X(), box->getNLoc_Y(),
- box->getNWidth(), box->getNHeight()
- ),
- boxTextColor,
- 2
- );
- }
- this->m_stop = chrono::high_resolution_clock::now();
- chrono::duration<double> timeSpan = chrono::duration_cast<chrono::duration<double>>(this->m_stop - this->m_start);
- int frameCount = this->vidSrc.getFrameCount();
- double fps = frameCount / timeSpan.count();
- string displayText = to_string(frameCount) + ", " + to_string(fps) + " fps";
- cv::putText(
- currentInputFrame,
- displayText,
- cv::Point(30, 30),
- FONT_HERSHEY_SIMPLEX,
- 0.8,
- cv::Scalar(0, 0, 255),
- 2,
- false
- );
- display.displayVideo(currentInputFrame, vidSrc.getFileName());
- this->vidSrc.getVideoWriter()->write(currentInputFrame);
- // getchar();
- }
- }
Add Comment
Please, Sign In to add comment