//============================================================================ // Name : retinademo.cpp // Author : Alexandre Benoit, benoit.alexandre.vision@gmail.com // Version : 0.1 // Copyright : LISTIC/GIPSA French Labs, May 2015 // Description : Gipsa/LISTIC Labs quick retina demo in C++, Ansi-style //============================================================================ // include bioinspired module and OpenCV core utilities #include "opencv2/bioinspired.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/videoio.hpp" #include "opencv2/highgui.hpp" #include #include // main function int main(int argc, char* argv[]) { // basic input arguments checking if (argc>1) { std::cout<<"****************************************************"< 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"< more informations and papers at : http://sites.google.com/site/benoitalexandrevision/"< you can use this to fine tune parameters and load them if you save to file 'RetinaSpecificParameters.xml'"<>inputFrame; // allocate a retina instance with input size equal to the one of the loaded image cv::Ptr myRetina = cv::bioinspired::createRetina(inputFrame.size()); /* retina parameters management methods use sample -> save current (here default) retina parameters to a xml file (you may use it only one time to get the file and modify it) */ myRetina->write("RetinaDefaultParameters.xml"); // -> load parameters if file exists myRetina->setup("RetinaSpecificParameters.xml"); // reset all retina buffers (open your eyes) myRetina->clearBuffers(); // declare retina output buffers cv::Mat retinaOutput_parvo; cv::Mat retinaOutput_magno; //main processing loop bool stillProcess=true; while(stillProcess){ // if using video stream, then, grabbing a new frame, else, input remains the same if (videoCapture.isOpened()) videoCapture>>inputFrame; else stillProcess=false; // 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(5); } }