2 //////////////////////////////////////////////////////////////////////////////////
3 // This program is free software: you can redistribute it and/or modify //
4 // it under the terms of the version 3 of the GNU General Public License //
5 // as published by the Free Software Foundation. //
7 // This program is distributed in the hope that it will be useful, but //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
10 // General Public License for more details. //
12 // You should have received a copy of the GNU General Public License //
13 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
15 // Written by Francois Fleuret //
16 // (C) Ecole Polytechnique Federale de Lausanne //
17 // Contact <pom@epfl.ch> for comments & bug reports //
18 //////////////////////////////////////////////////////////////////////////////////
25 #include "rgb_image.h"
27 class ProbaView : public Array<scalar_t> {
29 ProbaView(int view_width, int view_height);
31 void from_image(const RGBImage *picture);
33 inline void fill(const scalar_t &t) {
34 register scalar_t *s = content;
36 for(i = 0; i < width * height - 7; i += 8) {
37 *(s++) = t; *(s++) = t; *(s++) = t; *(s++) = t;
38 *(s++) = t; *(s++) = t; *(s++) = t; *(s++) = t;
40 for(; i < width * height; i++) *(s++) = t;
43 inline void multiply_subarray(int xmin, int ymin, int xmax, int ymax, scalar_t k) {
44 register scalar_t *s = content + xmin * height + ymin;
45 for(register int x = 0; x < xmax - xmin; x++) {
46 for(register int y = 0; y < ymax - ymin; y++) *(s++) *= k;
47 s += height - ymax + ymin;