Fawkes API Fawkes Development Version
buffer.cpp
1
2/***************************************************************************
3 * buffer.cpp - Camera model for a simple buffer
4 *
5 * Created: Tue Mar 08 22:44:33 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#include <fvcams/buffer.h>
24
25#include <cstdlib>
26
27using namespace fawkes;
28
29namespace firevision {
30
31/** @class BufferCamera <fvcams/buffer.h>
32 * Simple buffer with a Camera interface.
33 * This camera implementation provides a simple image buffer that can be
34 * modified externally and is wrapped using the standard Camera interface.
35 *
36 * @author Tim Niemueller
37 */
38
39/** Constructor.
40 * @param cspace color space of image
41 * @param width width of image
42 * @param height height of image
43 */
44BufferCamera::BufferCamera(colorspace_t cspace, unsigned int width, unsigned int height)
45{
46 cspace_ = cspace;
47 width_ = width;
48 height_ = height;
49 buffer_ = malloc_buffer(cspace, width, height);
50 buffer_size_ = colorspace_buffer_size(cspace, width, height);
51}
52
53/** Destructor. */
55{
56 free(buffer_);
57}
58
59void
61{
62}
63
64void
66{
67}
68
69void
71{
72}
73
74void
76{
77}
78
79void
81{
82}
83
84unsigned char *
86{
87 return buffer_;
88}
89
90unsigned int
92{
93 return buffer_size_;
94}
95
96void
98{
99}
100
101void
103{
104}
105
106void
108{
109}
110
111bool
113{
114 return true;
115}
116
117void
119{
120}
121
122unsigned int
124{
125 return width_;
126}
127
128unsigned int
130{
131 return height_;
132}
133
134colorspace_t
136{
137 return cspace_;
138}
139
140} // end namespace firevision
BufferCamera(colorspace_t cspace, unsigned int width, unsigned int height)
Constructor.
Definition: buffer.cpp:44
virtual void set_image_number(unsigned int n)
Set image number to retrieve.
Definition: buffer.cpp:118
virtual void open()
Open the camera.
Definition: buffer.cpp:60
virtual void flush()
Flush image queue.
Definition: buffer.cpp:107
virtual unsigned int pixel_width()
Width of image in pixels.
Definition: buffer.cpp:123
virtual void dispose_buffer()
Dispose current buffer.
Definition: buffer.cpp:102
virtual void print_info()
Print out camera information.
Definition: buffer.cpp:75
virtual void stop()
Stop image transfer from the camera.
Definition: buffer.cpp:70
virtual void start()
Start image transfer from the camera.
Definition: buffer.cpp:65
virtual colorspace_t colorspace()
Colorspace of returned image.
Definition: buffer.cpp:135
virtual unsigned int buffer_size()
Size of buffer.
Definition: buffer.cpp:91
virtual unsigned int pixel_height()
Height of image in pixels.
Definition: buffer.cpp:129
virtual bool ready()
Camera is ready for taking pictures.
Definition: buffer.cpp:112
virtual void capture()
Capture an image.
Definition: buffer.cpp:80
~BufferCamera()
Destructor.
Definition: buffer.cpp:54
virtual void close()
Close camera.
Definition: buffer.cpp:97
virtual unsigned char * buffer()
Get access to current image buffer.
Definition: buffer.cpp:85
Fawkes library namespace.