2 using namespace Psychlops;
4 void psychlops_main() {
5 Canvas cnvs(1024,1024,Canvas::window);
12 Color::setGammaValue(1.0,1.0,1.0);
15 Image buf[10], reference[10], difference[10], difference2[10];
17 Figures::ShaderGrating grat;
20 grat.wavelength = 30.0;
22 grat.orientation = PI/8;
25 Figures::ShaderExponentialDot dot;
30 Figures::ShaderGabor gabor;
33 gabor.wavelength = 30.0;
35 gabor.orientation = PI/8;
39 Figures::drawGratingToImage(reference[0], 240,240 , 1.0/30.0, 1, PI/8, 0);
40 Figures::drawExponentialToImage(reference[1], 30, 1);
41 Figures::drawGaborToImage(reference[2], 30, 1.0/30.0, 1, PI/8, 0);
44 cnvs.clear(Color(0.25));
45 for(int i=0; i<3; i++) {
46 Figures::substructImages(difference[i], buf[i], reference[i], 64.0);
47 buf[i].shift(50,50+i*300).draw();
48 reference[i].shift(350,50+i*300).draw();
49 difference[i].shift(650, 50+i*300).draw();
52 const int DIFF = 2, SLINE = 120;
53 difference2[DIFF].set(480,512);
55 for(int y=0; y<240; y++) {
56 y1 = (int)(512-reference[DIFF].getPix(SLINE,y).getR()*512);
57 y2 = (int)(512-buf[DIFF].getPix(SLINE,y).getR()*512);
58 difference2[DIFF].rect(Psychlops::Rectangle(y*2, y1, y*2+1, 511), Color(0.4));
59 if(y1>y2) difference2[DIFF].rect(Psychlops::Rectangle(y*2, y2, y*2+1, y1), Color::green);
60 if(y1<y2) difference2[DIFF].rect(Psychlops::Rectangle(y*2, y1, y*2+1, y2), Color::red);
62 difference2[DIFF].centering().draw();
66 while(!Keyboard::esc.pushed()) {