@@ -101,16 +101,23 @@ int main(int argc, char* argv[])
101
101
cv::UMat retinaOutput_magno;
102
102
103
103
// processing loop with stop condition
104
- bool continueProcessing=true ; // FIXME : not yet managed during process...
105
- while (continueProcessing)
104
+ int64 totalTime = 0 ;
105
+ int64 totalFrames = 0 ;
106
+ while (true )
106
107
{
107
108
// if using video stream, then, grabbing a new frame, else, input remains the same
108
109
if (videoCapture.isOpened ())
109
110
videoCapture>>inputFrame;
111
+ if (inputFrame.empty ())
112
+ break ;
110
113
111
114
// run retina filter
115
+ int64 frameTime = cv::getTickCount ();
112
116
myRetina->run (inputFrame);
113
117
// Retrieve and display retina output
118
+ frameTime = cv::getTickCount () - frameTime;
119
+ totalTime += frameTime;
120
+ totalFrames++;
114
121
myRetina->getParvo (retinaOutput_parvo);
115
122
myRetina->getMagno (retinaOutput_magno);
116
123
cv::imshow (" retina input" , inputFrame);
@@ -121,13 +128,12 @@ int main(int argc, char* argv[])
121
128
if (key == ' q' )
122
129
break ;
123
130
}
124
- }catch (cv::Exception e)
131
+ std::cout << " \n Mean frame processing time: " << (totalTime / cv::getTickFrequency ()) / totalFrames << " s" << std::endl;
132
+ std::cout << " Retina demo end" << std::endl;
133
+ }
134
+ catch (const cv::Exception& e)
125
135
{
126
136
std::cerr<<" Error using Retina : " <<e.what ()<<std::endl;
127
137
}
128
-
129
- // Program end message
130
- std::cout<<" Retina demo end" <<std::endl;
131
-
132
138
return 0 ;
133
139
}
0 commit comments