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 pysvrt. If not, see <http://www.gnu.org/licenses/>.
25 #include "vision_problem_12.h"
28 VisionProblem_12::VisionProblem_12() { }
30 void VisionProblem_12::generate(int label, Vignette *vignette) {
32 scalar_t alpha, beta, gamma;
39 scalar_t xc, yc, radius;
40 xc = (random_uniform_0_1() * 0.5 + 0.25) * Vignette::width;
41 yc = (random_uniform_0_1() * 0.5 + 0.25) * Vignette::height;
42 radius = (random_uniform_0_1() * 0.5 + 0.1) * Vignette::width;
43 alpha = random_uniform_0_1() * 2 * M_PI;
44 beta = (random_uniform_0_1() * 0.4 + 0.1) * M_PI;
49 for(int n = 0; n < nb_shapes; n++) {
52 gamma = alpha + M_PI - beta/2;
54 gamma = alpha + M_PI + beta/2;
59 gamma = alpha + M_PI - beta/2;
63 gamma = alpha + M_PI + beta/2;
67 shape.randomize(small_part_size, small_part_hole_size);
69 shape.randomize(big_part_size, big_part_hole_size);
72 xs = int(xc + radius * cos(gamma));
73 ys = int(yc + radius * sin(gamma));
75 error |= shape.overwrites(vignette, xs, ys);
77 shape.draw(n, vignette, xs, ys);