Fawkes API  Fawkes Development Version
qa_createimage.cpp
00001 /***************************************************************************
00002  *  qa_createimage.cpp - Simple test image creator
00003  *
00004  *  Created: Thu Mar 17 22:41:55 2011
00005  *  Copyright  2006-2011  Tim Niemueller [www.niemueller.de]
00006  *
00007  ****************************************************************************/
00008 
00009 /*  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU Library General Public License for more details.
00018  *
00019  *  Read the full text in the LICENSE.GPL file in the doc directory.
00020  */
00021 
00022 /***************************************************************************
00023  *  qa_createimage.cpp - Create simple test image for debayering
00024  *
00025  *  Created: Thu Mar 17 22:41:55 2011
00026  *  Copyright  2011  Tim Niemueller [www.niemueller.de]
00027  *
00028  ****************************************************************************/
00029 
00030 /*  This program is free software; you can redistribute it and/or modify
00031  *  it under the terms of the GNU General Public License as published by
00032  *  the Free Software Foundation; either version 2 of the License, or
00033  *  (at your option) any later version. A runtime exception applies to
00034  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00035  *
00036  *  This program is distributed in the hope that it will be useful,
00037  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00038  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00039  *  GNU Library General Public License for more details.
00040  *
00041  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00042  */
00043 
00044 /// @cond QA
00045 
00046 #include <fvutils/writers/fvraw.h>
00047 
00048 #include <cstdlib>
00049 #include <cstring>
00050 
00051 using namespace firevision;
00052 
00053 int
00054 main(int argc, char **argv)
00055 {
00056   unsigned char *buf = (unsigned char *)malloc(640 * 480);
00057   memset(buf, 0, 640*480);
00058   unsigned char *b = buf;
00059 
00060   for (unsigned int h = 0; h < 480; h += 2) {
00061     for (unsigned int w = 0; w < 640; w += 2) {
00062       *b++ = 255;
00063       ++b;
00064     }
00065     for (unsigned int w = 0; w < 640; w += 2) {
00066       ++b;
00067       *b++ = 255;
00068     }
00069   }
00070 
00071   FvRawWriter w("test.raw", 640, 480, MONO8, buf);
00072   w.write();
00073 
00074   return 0;
00075 }
00076 
00077 /// @endcond