Fawkes API  Fawkes Development Version
buffer.h
1 
2 /***************************************************************************
3  * buffer.h - Camera model for a simple buffer
4  *
5  * Created: Tue Mar 08 22:42:12 2016
6  * Copyright 2005-2016 Tim Niemueller [www.niemueller.de]
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. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #ifndef __FIREVISION_CAMS_BUFFER_H_
24 #define __FIREVISION_CAMS_BUFFER_H_
25 
26 #include <fvcams/camera.h>
27 
28 namespace firevision {
29 #if 0 /* just to make Emacs auto-indent happy */
30 }
31 #endif
32 
33 class CameraArgumentParser;
34 
35 class BufferCamera : public Camera
36 {
37  public:
38  BufferCamera(colorspace_t cspace, unsigned int width, unsigned int height);
39  ~BufferCamera();
40 
41  virtual void open();
42  virtual void start();
43  virtual void stop();
44  virtual void close();
45  virtual void capture();
46  virtual void flush();
47 
48  virtual bool ready();
49 
50  virtual void print_info();
51 
52  virtual unsigned char * buffer();
53  virtual unsigned int buffer_size();
54  virtual void dispose_buffer();
55 
56  virtual unsigned int pixel_width();
57  virtual unsigned int pixel_height();
58  virtual colorspace_t colorspace();
59 
60  virtual void set_image_number(unsigned int n);
61 
62  private:
63  unsigned char* buffer_;
64  unsigned int buffer_size_;
65  unsigned int width_;
66  unsigned int height_;
67  colorspace_t cspace_;
68 };
69 
70 } // end namespace firevision
71 
72 #endif
virtual unsigned int buffer_size()
Size of buffer.
Definition: buffer.cpp:103
Camera interface for image aquiring devices in FireVision.
Definition: camera.h:35
virtual void stop()
Stop image transfer from the camera.
Definition: buffer.cpp:78
virtual void start()
Start image transfer from the camera.
Definition: buffer.cpp:73
virtual unsigned int pixel_width()
Width of image in pixels.
Definition: buffer.cpp:141
virtual unsigned char * buffer()
Get access to current image buffer.
Definition: buffer.cpp:96
virtual unsigned int pixel_height()
Height of image in pixels.
Definition: buffer.cpp:148
virtual void close()
Close camera.
Definition: buffer.cpp:110
virtual void capture()
Capture an image.
Definition: buffer.cpp:90
virtual void dispose_buffer()
Dispose current buffer.
Definition: buffer.cpp:116
virtual void set_image_number(unsigned int n)
Set image number to retrieve.
Definition: buffer.cpp:135
Simple buffer with a Camera interface.
Definition: buffer.h:35
BufferCamera(colorspace_t cspace, unsigned int width, unsigned int height)
Constructor.
Definition: buffer.cpp:49
~BufferCamera()
Destructor.
Definition: buffer.cpp:60
virtual void print_info()
Print out camera information.
Definition: buffer.cpp:84
virtual colorspace_t colorspace()
Colorspace of returned image.
Definition: buffer.cpp:155
virtual void open()
Open the camera.
Definition: buffer.cpp:67
virtual bool ready()
Camera is ready for taking pictures.
Definition: buffer.cpp:128
virtual void flush()
Flush image queue.
Definition: buffer.cpp:122