Fawkes API  Fawkes Development Version
qa_createimage.cpp
1 /***************************************************************************
2  * qa_createimage.cpp - Simple test image creator
3  *
4  * Created: Thu Mar 17 22:41:55 2011
5  * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
6  *
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 /***************************************************************************
23  * qa_createimage.cpp - Create simple test image for debayering
24  *
25  * Created: Thu Mar 17 22:41:55 2011
26  * Copyright 2011 Tim Niemueller [www.niemueller.de]
27  *
28  ****************************************************************************/
29 
30 /* This program is free software; you can redistribute it and/or modify
31  * it under the terms of the GNU General Public License as published by
32  * the Free Software Foundation; either version 2 of the License, or
33  * (at your option) any later version. A runtime exception applies to
34  * this software (see LICENSE.GPL_WRE file mentioned below for details).
35  *
36  * This program is distributed in the hope that it will be useful,
37  * but WITHOUT ANY WARRANTY; without even the implied warranty of
38  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39  * GNU Library General Public License for more details.
40  *
41  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
42  */
43 
44 /// @cond QA
45 
46 #include <fvutils/writers/fvraw.h>
47 
48 #include <cstdlib>
49 #include <cstring>
50 
51 using namespace firevision;
52 
53 int
54 main(int argc, char **argv)
55 {
56  unsigned char *buf = (unsigned char *)malloc(640 * 480);
57  memset(buf, 0, 640*480);
58  unsigned char *b = buf;
59 
60  for (unsigned int h = 0; h < 480; h += 2) {
61  for (unsigned int w = 0; w < 640; w += 2) {
62  *b++ = 255;
63  ++b;
64  }
65  for (unsigned int w = 0; w < 640; w += 2) {
66  ++b;
67  *b++ = 255;
68  }
69  }
70 
71  FvRawWriter w("test.raw", 640, 480, MONO8, buf);
72  w.write();
73 
74  return 0;
75 }
76 
77 /// @endcond
FvRaw Writer implementation.
Definition: fvraw.h:34