Commit 5bbca68d authored by Vladislav Sovrasov's avatar Vladislav Sovrasov

bioinspired: add time measurement in sample

parent ca7683ee
...@@ -101,16 +101,23 @@ int main(int argc, char* argv[]) ...@@ -101,16 +101,23 @@ int main(int argc, char* argv[])
cv::UMat retinaOutput_magno; cv::UMat retinaOutput_magno;
// processing loop with stop condition // processing loop with stop condition
bool continueProcessing=true; // FIXME : not yet managed during process... int64 totalTime = 0;
while(continueProcessing) int64 totalFrames = 0;
while(true)
{ {
// if using video stream, then, grabbing a new frame, else, input remains the same // if using video stream, then, grabbing a new frame, else, input remains the same
if (videoCapture.isOpened()) if (videoCapture.isOpened())
videoCapture>>inputFrame; videoCapture>>inputFrame;
if(inputFrame.empty())
break;
// run retina filter // run retina filter
int64 frameTime = cv::getTickCount();
myRetina->run(inputFrame); myRetina->run(inputFrame);
// Retrieve and display retina output // Retrieve and display retina output
frameTime = cv::getTickCount() - frameTime;
totalTime += frameTime;
totalFrames++;
myRetina->getParvo(retinaOutput_parvo); myRetina->getParvo(retinaOutput_parvo);
myRetina->getMagno(retinaOutput_magno); myRetina->getMagno(retinaOutput_magno);
cv::imshow("retina input", inputFrame); cv::imshow("retina input", inputFrame);
...@@ -121,13 +128,12 @@ int main(int argc, char* argv[]) ...@@ -121,13 +128,12 @@ int main(int argc, char* argv[])
if(key == 'q') if(key == 'q')
break; break;
} }
}catch(cv::Exception e) std::cout << "\nMean frame processing time: " << (totalTime / cv::getTickFrequency()) / totalFrames << " s" << std::endl;
std::cout << "Retina demo end" << std::endl;
}
catch(const cv::Exception& e)
{ {
std::cerr<<"Error using Retina : "<<e.what()<<std::endl; std::cerr<<"Error using Retina : "<<e.what()<<std::endl;
} }
// Program end message
std::cout<<"Retina demo end"<<std::endl;
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment