2 * svrt is the ``Synthetic Visual Reasoning Test'', an image
3 * generator for evaluating classification performance of machine
4 * learning systems, humans and primates.
6 * Copyright (c) 2009 Idiap Research Institute, http://www.idiap.ch/
7 * Written by Francois Fleuret <francois.fleuret@idiap.ch>
9 * This file is part of svrt.
11 * svrt is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 3 as
13 * published by the Free Software Foundation.
15 * svrt is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with selector. If not, see <http://www.gnu.org/licenses/>.
27 void compute_integral_image(Vignette *vignette, int *integral_image) {
29 for(int y = 0; y <= Vignette::height; y++) {
30 for(int x = 0; x <= Vignette::width; x++) {
31 if(x == 0 || y == 0) {
32 integral_image[k] = 0;
34 ASSERT(k >= (Vignette::width + 1) + 1);
35 integral_image[k] = vignette->content[x - 1 + Vignette::width * (y - 1)]
36 + integral_image[k - (Vignette::width + 1)]
37 + integral_image[k - 1]
38 - integral_image[k - (Vignette::width + 1) - 1];
46 void Stump::randomize() {
48 roi_x = int(drand48() * Vignette::width);
49 roi_y = int(drand48() * Vignette::height);
50 roi_w = int(drand48() * Vignette::width);
51 roi_h = int(drand48() * Vignette::height);
52 // #warning *!*!*!*!*!*!*!*!*!*!*!*!*!*
53 // roi_w = int(drand48() * Vignette::width/2);
54 // roi_h = int(drand48() * Vignette::height/2);
55 } while(roi_x + roi_w > Vignette::width || roi_y + roi_h > Vignette::height);
57 k1 = (roi_x + 0) + (roi_y + 0) * (Vignette::width + 1);
58 k2 = (roi_x + roi_w) + (roi_y + 0) * (Vignette::width + 1);
59 k3 = (roi_x + 0) + (roi_y + roi_h) * (Vignette::width + 1);
60 k4 = (roi_x + roi_w) + (roi_y + roi_h) * (Vignette::width + 1);