2 * Manuela Chessa, Fabio Solari, Fabio Tatti, Silvio P. Sabatini
4 * manuela.chessa@unige.it, fabio.solari@unige.it
6 * PSPC-lab - University of Genoa
9 #include "opencv2/contrib.hpp"
10 #include "opencv2/highgui.hpp"
20 cout << "LogPolar Blind Spot Model sample.\nShortcuts:"
21 "\n\tn for nearest pixel technique"
22 "\n\tb for bilinear interpolation technique"
23 "\n\to for overlapping circular receptive fields"
24 "\n\ta for adjacent receptive fields"
25 "\n\tq or ESC quit\n";
28 int main(int argc, char** argv)
30 Mat img = imread(argc > 1 ? argv[1] : "lena.jpg",1); // open the image
31 if(img.empty()) // check if we succeeded
33 cout << "can not load image\n";
39 int w=s.width, h=s.height;
40 int ro0=3; //radius of the blind spot
41 int R=120; //number of rings
43 //Creation of the four different objects that implement the four log-polar transformations
44 //Off-line computation
45 Point2i center(w/2,h/2);
46 LogPolar_Interp nearest(w, h, center, R, ro0, INTER_NEAREST);
47 LogPolar_Interp bilin(w,h, center,R,ro0);
48 LogPolar_Overlapping overlap(w,h,center,R,ro0);
49 LogPolar_Adjacent adj(w,h,center,R,ro0,0.25);
51 namedWindow("Cartesian",1);
52 namedWindow("retinal",1);
53 namedWindow("cortical",1);
55 Mat Cortical, Retinal;
61 Cortical=nearest.to_cortical(img);
62 Retinal=nearest.to_cartesian(Cortical);
64 Cortical=bilin.to_cortical(img);
65 Retinal=bilin.to_cartesian(Cortical);
67 Cortical=overlap.to_cortical(img);
68 Retinal=overlap.to_cartesian(Cortical);
70 Cortical=adj.to_cortical(img);
71 Retinal=adj.to_cartesian(Cortical);
74 imshow("Cartesian", img);
75 imshow("cortical", Cortical);
76 imshow("retinal", Retinal);
80 if(wk =='q' || (wk & 255) == 27) break;