Ask Your Question

Revision history [back]

Bioinspired - Retinex Algorithm

While running the bioinspired retinex algorithm, I get the Magno and Parvo output, but for some images, I dont get the magno and parvo output. For me it is completely random. I would need some help on the same. Maybe I am missing out on something

std::string _path = "183816031218.jpg";
cv::Mat source = cv::imread(_path);
std::cout << "Size of input image " << source.size() << std::endl;
//cv::resize(source, source, cv::Size(), 0.5, 0.5, cv::INTER_LINEAR);
cv::imshow("Initial Image", source);
cv::waitKey(0);
cv::destroyAllWindows();

//applying retinex algorithm
// allocate a retina instance with input size equal to the one of the loaded image
cv::Ptr<cv::bioinspired::Retina> myRetina = cv::bioinspired::createRetina(source.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
        // run retina on the input image
        myRetina->run(source);
    // grab retina outputs
    myRetina->getParvo(retinaOutput_parvo);
    myRetina->getMagno(retinaOutput_magno);
    // draw retina outputs
    cv::imshow("retina input", source);
    cv::imshow("Retina Parvo", retinaOutput_parvo);
    cv::imshow("Retina Magno", retinaOutput_magno);
    cv::waitKey(0);

I am literally just coying and editing the sample code from the opencv link.

I would appreciate some help here. Thankyou.