Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
camera.cpp
1
2
/***************************************************************************
3
* camera.cpp - Abstract class defining a camera
4
*
5
* Created: Wed Jan 17 14:48:17 2007
6
* Copyright 2005-2009 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <fvcams/camera.h>
25
26
#include <core/exception.h>
27
#include <core/exceptions/software.h>
28
29
namespace
firevision {
30
#if 0
/* just to make Emacs auto-indent happy */
31
}
32
#endif
33
34
/** @class Camera <fvcams/camera.h>
35
* Camera interface for image aquiring devices in FireVision.
36
*
37
* In general cameras shall initiate a continuous flow of images and shall
38
* be optimized for real-time image processing (25 Hz).
39
*
40
* @fn void Camera::open() = 0
41
* Open the camera.
42
* The camera is opened, but image transfer not yet started. This can be used
43
* to detect general problems with the camera while delaying the real transfer
44
* startup until it is needed.
45
*
46
* @fn void Camera::start()
47
* Start image transfer from the camera.
48
* For many cameras opening the camera and starting transmission of images are
49
* two tasks. This method will simply initiate the transfer after the camera
50
* as been opened. And exception shall be thrown if the camera has not been
51
* opened.
52
*
53
* @fn void Camera::stop()
54
* Stop image transfer from the camera.
55
* This will stop the image transfer initiated with start(). This can be used
56
* to start and stop the image transfer at will without opening and closing
57
* operations inbetween.
58
*
59
* @fn void Camera::close()
60
* Close camera.
61
* This closes the camera device. The camera must have been stopped before
62
* calling close().
63
*
64
* @fn void Camera::capture()
65
* Capture an image.
66
* Although cameras shall operate with a continuous image flow where possible
67
* sometimes capturing an image means copying a buffer or advancing a buffer
68
* list pointer. This shall be done in this method. For a camera-using
69
* application it is mandatory to call capture() just before accessing the
70
* image buffer.
71
*
72
* @fn void Camera::flush()
73
* Flush image queue.
74
* Some cameras may have an image buffer queue. With this it can happen that
75
* if the processing of an image took longer than desired it is needed to flush
76
* this buffer queue.
77
*
78
* @fn bool Camera::ready()
79
* Camera is ready for taking pictures.
80
* The camera has been opened and started correctly and may now provide images.
81
* @return true, if the camera is ready, false otherwise
82
*
83
* @fn void Camera::print_info()
84
* Print out camera information.
85
* Shall print out camera information and current setup information on stdout.
86
*
87
* @fn unsigned char * Camera::buffer()
88
* Get access to current image buffer.
89
* This will return a pointer to the current buffer. The buffer contains an
90
* image of the given colorspace, width and height.
91
* @return pointer to image buffer
92
*
93
* @fn void Camera::dispose_buffer()
94
* Dispose current buffer.
95
* Some cameras need disposal of the current buffer (for example to free space
96
* in a queue to retrieve the next image). This is done with this method. It
97
* has to be called after all work has been done on the image as desired. After
98
* dispose_buffer() has been called no further access may happen to the image
99
* buffer or undesired behavior may happen.
100
*
101
* @fn unsigned int Camera::buffer_size()
102
* Size of buffer.
103
* Gets the size in bytes of the buffer returned by buffer().
104
* @return size of buffer in bytes
105
*
106
* @fn colorspace_t Camera::colorspace()
107
* Colorspace of returned image.
108
* @return colorspace of image returned by buffer()
109
*
110
* @fn unsigned int Camera::pixel_width()
111
* Width of image in pixels.
112
* @return width of image in pixels
113
*
114
* @fn unsigned int Camera::pixel_height()
115
* Height of image in pixels.
116
* @return height of image in pixels
117
*
118
* @fn void Camera::set_image_number(unsigned int n)
119
* Set image number to retrieve.
120
* If a camera is able to retrieve several images this method can be used to
121
* select the image to be retrieved with the next call to capture().
122
* @param n image number to set
123
*
124
*/
125
126
/** Virtual empty destructor. */
127
Camera::~Camera()
128
{
129
}
130
131
/** Get the Time of the last successfully captured image.
132
* Returns a Time representing the time when the last image was captured
133
* successfully. Note that calling this function is only valid after capture()
134
* and before dispose_buffer() has been called -- it is only valid when an image
135
* is currently available.
136
* @return Time of the currently processed image. The pointer shall be valid at
137
* least until the next call to dispose_buffer().
138
* @throw NotImplementedException thrown if Camera does not support time stamping
139
*/
140
fawkes::Time
*
141
Camera::capture_time()
142
{
143
throw
fawkes::NotImplementedException
(
"Timestamping not supported by this camera"
);
144
}
145
146
}
// end namespace firevision
fawkes::NotImplementedException
Called method has not been implemented.
Definition:
software.h:107
fawkes::Time
A class for handling time.
Definition:
time.h:91
src
libs
fvcams
camera.cpp
Generated by
1.8.5