Bioinspired - Retinex Algorithm

asked 2018-03-12 23:24:45 -0500

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.

edit retag flag offensive close merge delete

Comments

" I dont get the magno and parvo output." -- what does it mean ?

do you have an example image, where it "fails" ?

berak gravatar imageberak ( 2018-03-13 02:48:22 -0500 )edit

@berak, they are the outputs for this algorithm.
myRetina->getParvo(retinaOutput_parvo); myRetina->getMagno(retinaOutput_magno);

the images are does_not_workworks

madhu_18_gr gravatar imagemadhu_18_gr ( 2018-03-13 13:38:29 -0500 )edit

please never just say "does not work" again, when asking for help !

be concise, be explicit, else noone can or will help you !

berak gravatar imageberak ( 2018-03-13 13:42:58 -0500 )edit
1

@berak, That was a description to the image name, I just wanted to mention that, with that image(does_not_work) the algorithm gives a blank output, while with the image(works) I get the correct parvo and magno outputs. I am sorry for not being descriptive, but I don't know why I am not getting the results as expected.

madhu_18_gr gravatar imagemadhu_18_gr ( 2018-03-13 15:09:25 -0500 )edit

don't worry, all i'm trying is to get you to be more verbose about it !

berak gravatar imageberak ( 2018-03-13 15:23:43 -0500 )edit
1

Does the algorithm have a size restriction, I just resized the image and I was able to get an output. Is there a reason ?

madhu_18_gr gravatar imagemadhu_18_gr ( 2018-03-13 16:49:20 -0500 )edit

idk., sorry (needs to read the paper, i guess). did you try changing some of the configuration parameters ?

berak gravatar imageberak ( 2018-03-14 03:36:51 -0500 )edit

@berak nope, I used the realistic parameters used in opencv example. I should try changing the parameters.

madhu_18_gr gravatar imagemadhu_18_gr ( 2018-03-14 12:54:23 -0500 )edit