//============================================================================ // Name : retinademo.cpp // Author : Alexandre Benoit, benoit.alexandre.vision@gmail.com // Version : 0.1 // Copyright : LISTIC/GIPSA French Labs, july 2011 // Description : Gipsa/LISTIC Labs retina demo in C++, Ansi-style //============================================================================ #include #include #include "HVStools/retina.hpp" // for retina processing #include // image IO void help(std::string errorMessage) { std::cout<<"Program init error : "< It applies a spectral whithening (mid-frequency details enhancement)"< high frequency spatio-temporal noise reduction"< low frequency luminance to be reduced (luminance range compression)"< local logarithmic luminance compression allows details to be enhanced in low light conditions\n"< reports comments/remarks at benoit.alexandre.vision@gmail.com"<= 3) { std::cout<<"RetinaDemo: processing image "<>inputFrame; }else { // bad command parameter help("bad command parameter"); return -1; } if (inputFrame.empty()) { help("Input media could not be loaded, aborting"); return -1; } ////////////////////////////////////////////////////////////////////////////// // Program start in a try/catch safety context (Retina may throw errors) try { // create a retina instance with default parameters setup, uncomment the initialisation you wanna test cv::Ptr myRetina; // if the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision) if (useLogSampling) myRetina = new cv::Retina("params.xml", inputFrame.size(), true, cv::RETINA_COLOR_BAYER, true, 2.0, 10.0); else// -> else allocate "classical" retina : myRetina = new cv::Retina("params.xml", inputFrame.size()); // declare retina output buffers cv::Mat retinaOutput_parvo; cv::Mat retinaOutput_magno; // processing loop with stop condition bool continueProcessing=true; // FIXME : not yet managed during process... while(continueProcessing) { // if using video stream, then, grabbing a new frame, else, input remains the same if (videoCapture.isOpened()) videoCapture>>inputFrame; // run retina filter myRetina->run(inputFrame); // Retrieve and display retina output myRetina->getParvo(retinaOutput_parvo); myRetina->getMagno(retinaOutput_magno); cv::imshow("retina input", inputFrame); cv::imshow("Retina Parvo", retinaOutput_parvo); cv::imshow("Retina Magno", retinaOutput_magno); cv::waitKey(10); } }catch(cv::Exception e) { std::cerr<<"Error using Retina : "<