bumblebee2.h

00001
00002 /***************************************************************************
00003  *  bumblebee2.h - Point Grey Bumblebee 2 camera
00004  *
00005  *  Generated: Sat Apr 14 20:49:20 2007 (watching Ghostbusters)
00006  *  Copyright  2005-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023
00024 #ifndef __FIREVISION_CAMS_BUMBLEBEE2_H_
00025 #define __FIREVISION_CAMS_BUMBLEBEE2_H_
00026 
00027 #include <cams/firewire.h>
00028 #include <fvutils/color/bayer.h>
00029
00030 class Bumblebee2CameraData;
00031
00032 class Bumblebee2Camera : public FirewireCamera
00033 {
00034  public:
00035
00036   static const unsigned int ORIGINAL;
00037   static const unsigned int DEINTERLACED;
00038   static const unsigned int RGB_IMAGE;
00039
00040   Bumblebee2Camera(const CameraArgumentParser *cap);
00041   virtual ~Bumblebee2Camera();
00042
00043   virtual void open();
00044   virtual void close();
00045   virtual void capture();
00046
00047   virtual unsigned char* buffer();
00048
00049   virtual void set_image_number(unsigned int image_num);
00050
00051   bool is_bumblebee2();
00052   void write_triclops_config_from_camera_to_file(const char *filename);
00053
00054   void deinterlace_stereo();
00055   void decode_bayer();
00056
00057   virtual void     print_info();
00058   virtual uint32_t serial_no() const;
00059   virtual bool     verify_guid(uint64_t ver_guid) const;
00060
00061   static void deinterlace_stereo(unsigned char *raw16, unsigned char *deinterlaced,
00062                                  unsigned int width, unsigned int height);
00063   static void decode_bayer(unsigned char *deinterlaced, unsigned char *rgb,
00064                            unsigned int width, unsigned int height,
00065                            bayer_pattern_t bayer_pattern);
00066
00067  private:
00068   void get_triclops_context_from_camera();
00069   void get_bayer_tile();
00070   void deinterlace_green( unsigned char* src,  unsigned char* dest,
00071                           unsigned int width,  unsigned int height);
00072
00073 
00074   /** Bayer pattern */
00075   dc1394color_filter_t __bayer_pattern;
00076
00077   unsigned int   __image_num;
00078   unsigned char *__buffer;
00079   unsigned char *__buffer_deinterlaced;
00080   unsigned char *__buffer_rgb;
00081 };
00082
00083 #endif