Fawkes API Fawkes Development Version
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 <core/exception.h>
25#include <core/exceptions/software.h>
26#include <fvcams/camera.h>
27
28namespace firevision {
29
30/** @class Camera <fvcams/camera.h>
31 * Camera interface for image aquiring devices in FireVision.
32 *
33 * In general cameras shall initiate a continuous flow of images and shall
34 * be optimized for real-time image processing (25 Hz).
35 *
36 * @fn void Camera::open() = 0
37 * Open the camera.
38 * The camera is opened, but image transfer not yet started. This can be used
39 * to detect general problems with the camera while delaying the real transfer
40 * startup until it is needed.
41 *
42 * @fn void Camera::start()
43 * Start image transfer from the camera.
44 * For many cameras opening the camera and starting transmission of images are
45 * two tasks. This method will simply initiate the transfer after the camera
46 * as been opened. And exception shall be thrown if the camera has not been
47 * opened.
48 *
49 * @fn void Camera::stop()
50 * Stop image transfer from the camera.
51 * This will stop the image transfer initiated with start(). This can be used
52 * to start and stop the image transfer at will without opening and closing
53 * operations inbetween.
54 *
55 * @fn void Camera::close()
56 * Close camera.
57 * This closes the camera device. The camera must have been stopped before
58 * calling close().
59 *
60 * @fn void Camera::capture()
61 * Capture an image.
62 * Although cameras shall operate with a continuous image flow where possible
63 * sometimes capturing an image means copying a buffer or advancing a buffer
64 * list pointer. This shall be done in this method. For a camera-using
65 * application it is mandatory to call capture() just before accessing the
66 * image buffer.
67 *
68 * @fn void Camera::flush()
69 * Flush image queue.
70 * Some cameras may have an image buffer queue. With this it can happen that
71 * if the processing of an image took longer than desired it is needed to flush
72 * this buffer queue.
73 *
74 * @fn bool Camera::ready()
75 * Camera is ready for taking pictures.
76 * The camera has been opened and started correctly and may now provide images.
77 * @return true, if the camera is ready, false otherwise
78 *
79 * @fn void Camera::print_info()
80 * Print out camera information.
81 * Shall print out camera information and current setup information on stdout.
82 *
83 * @fn unsigned char * Camera::buffer()
84 * Get access to current image buffer.
85 * This will return a pointer to the current buffer. The buffer contains an
86 * image of the given colorspace, width and height.
87 * @return pointer to image buffer
88 *
89 * @fn void Camera::dispose_buffer()
90 * Dispose current buffer.
91 * Some cameras need disposal of the current buffer (for example to free space
92 * in a queue to retrieve the next image). This is done with this method. It
93 * has to be called after all work has been done on the image as desired. After
94 * dispose_buffer() has been called no further access may happen to the image
95 * buffer or undesired behavior may happen.
96 *
97 * @fn unsigned int Camera::buffer_size()
98 * Size of buffer.
99 * Gets the size in bytes of the buffer returned by buffer().
100 * @return size of buffer in bytes
101 *
102 * @fn colorspace_t Camera::colorspace()
103 * Colorspace of returned image.
104 * @return colorspace of image returned by buffer()
105 *
106 * @fn unsigned int Camera::pixel_width()
107 * Width of image in pixels.
108 * @return width of image in pixels
109 *
110 * @fn unsigned int Camera::pixel_height()
111 * Height of image in pixels.
112 * @return height of image in pixels
113 *
114 * @fn void Camera::set_image_number(unsigned int n)
115 * Set image number to retrieve.
116 * If a camera is able to retrieve several images this method can be used to
117 * select the image to be retrieved with the next call to capture().
118 * @param n image number to set
119 *
120 */
121
122/** Virtual empty destructor. */
124{
125}
126
127/** Get the Time of the last successfully captured image.
128 * Returns a Time representing the time when the last image was captured
129 * successfully. Note that calling this function is only valid after capture()
130 * and before dispose_buffer() has been called -- it is only valid when an image
131 * is currently available.
132 * @return Time of the currently processed image. The pointer shall be valid at
133 * least until the next call to dispose_buffer().
134 * @throw NotImplementedException thrown if Camera does not support time stamping
135 */
138{
139 throw fawkes::NotImplementedException("Timestamping not supported by this camera");
140}
141
142} // end namespace firevision
Called method has not been implemented.
Definition: software.h:105
A class for handling time.
Definition: time.h:93
virtual fawkes::Time * capture_time()
Get the Time of the last successfully captured image.
Definition: camera.cpp:137
virtual ~Camera()
Virtual empty destructor.
Definition: camera.cpp:123