Filtering with the retina model

Image restoration is concerned with filtering the digital image to minimize the effect of degradations. Degradation is produced by the sensing environment during image acquisition by optical or electronic devices. The effectiveness of image filtering depends on the extent and the accuracy of the knowledge of the degradation process as well as on the filter design.

In OpenCV, there are several isotropic and anisotropic filters available operating on both spatial and frequency domains. One of the most recent filters is the retina filter, which is based on a model of the human visual system. There is a class named Retina to perform spatio-temporal filtering modeling the two main retina information channels, which are parvocellular (parvo) due to foveal vision and magnocellular (magno) due to peripheral vision. The parvo channel is related to detail extraction while the magno channel is dedicated to motion analysis.

The Retina class may be applied on still images, images sequences, and video sequences to perform motion analysis. Here we present a simplified version of the retinademo algorithm provided in OpenCV. The algorithm Filter_Retina.cpp presented here demonstrates the use of the retina model images, which can be used to perform texture analysis with enhanced signal-to-noise ratio and enhanced details that are robust against input image luminance ranges. The main properties of the human retina model are as follows:

  • Spectral whitening (mid-frequency detail enhancement)
  • High-frequency spatio-temporal noise reduction (temporal noise and high-frequency spatial noise are minimized)
  • Low-frequency luminance reduction (luminance range compression): High-luminance regions do not hide details in darker regions anymore
  • Local logarithmic luminance compression allows details to be enhanced even in low-light conditions

Note

For more information, refer to Using Human Visual System Modeling for bio-inspired low level image processing, Benoit A., Caplier A., Durette B., Herault J., Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773. DOI at http://dx.doi.org/10.1016/j.cviu.2010.01.011.

The following is the code for the example:

#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
    //Declare input image and retina output buffers
    Mat src, retinaOutput_parvo, retinaOutput_magno;

    src =  imread("starry_night.jpg", 1); // load image in RGB

    //Create a retina instance with default parameters setup
    Ptr< Retina> myRetina;

    //Allocate "classical" retina :
    myRetina = new  Retina(src.size());

    //Save default retina parameters file
    myRetina->write("RetinaDefaultParameters.xml");

    //The retina parameters may be reload using method "setup"
    //Uncomment to load parameters if file exists
    //myRetina->setup("RetinaSpecificParameters.xml");
    myRetina->clearBuffers();

    //Several iteration of the filter may be done
    for( int iter = 1; iter < 6; iter++ ){
        // run retina filter
        myRetina->run(src);

        // Retrieve and display retina output
        myRetina->getParvo(retinaOutput_parvo);
        myRetina->getMagno(retinaOutput_magno);

        //Create windows and display results
        namedWindow("Source Image", 0 );
        namedWindow("Retina Parvo", 0 );
        namedWindow("Retina Magno", 0 );

        imshow("Source Image", src);
        imshow("Retina Parvo", retinaOutput_parvo);
        imshow("Retina Magno", retinaOutput_magno);
    }
    cout<<"Retina demo end"<< endl;   // Program end message
    waitKey();
    return 0;
}

The code explanation is given here: the example first reads the input image and obtains the retina model of the image using classical parameters for the model. The retina can be settled up with various parameters; by default, the retina cancels mean luminance and enforces all details of the visual scene. The filter is then run five times and the parvo and magno images and its details are shown. The following screenshot shows the output of the retina model filter after the five iterations:

Filtering with the retina model

Output of the retina filter after five iterations

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset