24 #ifndef __FIREVISION_CAMS_V4L2_H_ 25 #define __FIREVISION_CAMS_V4L2_H_ 27 #include <fvcams/camera.h> 29 #include <linux/types.h> 30 #include <linux/videodev2.h> 32 #include <fvcams/control/color.h> 33 #include <fvcams/control/image.h> 36 #define MMAP_NUM_BUFFERS 4; 43 class CameraArgumentParser;
54 V4L2Camera(
const char *device_name =
"/dev/video0");
67 virtual unsigned char *
buffer();
102 virtual unsigned int gain();
103 virtual void set_gain(
unsigned int gain);
105 virtual const char *
format();
107 virtual unsigned int width();
108 virtual unsigned int height();
109 virtual void set_size(
unsigned int width,
110 unsigned int height);
115 virtual unsigned int fps();
116 virtual void set_fps(
unsigned int fps);
125 virtual void set_one_control(
const char *ctrl,
unsigned int id,
int value);
129 virtual void post_open();
130 virtual void select_read_method();
131 virtual void select_format();
132 virtual void set_fps();
133 virtual void set_controls();
134 virtual void create_buffer();
135 virtual void reset_cropping();
161 struct ControlParameterInt
169 V4L2CameraData *_data;
171 ReadMethod _read_method;
175 colorspace_t _colorspace;
178 unsigned int _height;
179 unsigned int _bytes_per_line;
180 FrameBuffer *_frame_buffers;
181 unsigned int _buffers_length;
193 ControlParameterInt _brightness;
194 ControlParameterInt _contrast;
195 ControlParameterInt _saturation;
196 ControlParameterInt _hue;
197 ControlParameterInt _red_balance;
198 ControlParameterInt _blue_balance;
199 ControlParameterInt _exposure;
200 ControlParameterInt _gain;
201 ControlParameterInt _lens_x;
202 ControlParameterInt _lens_y;
210 #endif //__FIREVISION_CAMS_V4L2_H_ char * _device_name
Device name.
virtual fawkes::Time * capture_time()
Get the Time of the last successfully captured image.
virtual void set_lens_y_corr(unsigned int y_corr)
Set lens y correction.
Camera interface for image aquiring devices in FireVision.
virtual void set_brightness(unsigned int brightness)
Set new brightness.
virtual void close()
Close camera.
virtual void stop()
Stop image transfer from the camera.
virtual unsigned int lens_y_corr()
Get current lens y correction.
virtual void set_auto_exposure(bool enabled)
Enable/disable auto exposure.
virtual void print_info()
Print out camera information.
virtual bool auto_gain()
Return whether auto gain is enabled.
virtual bool horiz_mirror()
Return whether the camera image is horizontally mirrored.
virtual void set_fps(unsigned int fps)
Set the number of frames per second the camera tries to deliver.
virtual const char * format()
Get the image format the camera currently uses.
Camera color control interface.
Video4Linux 2 camera access implementation.
virtual void set_horiz_mirror(bool enabled)
Set whether the camera should mirror images horizontally.
virtual void set_auto_white_balance(bool enabled)
Enable/disable auto white balance.
A class for handling time.
Camera image control interface.
virtual void set_hue(int hue)
Set new hue.
virtual colorspace_t colorspace()
Colorspace of returned image.
virtual void set_format(const char *format)
Set the image format the camera should use.
virtual int v_balance()
Get current v balance.
virtual void set_auto_gain(bool enabled)
Enable/disable auto gain.
virtual int u_balance()
Get current u balance.
virtual unsigned int brightness()
Get current brightness.
virtual void set_size(unsigned int width, unsigned int height)
Set the image size the camera should use.
virtual unsigned int buffer_size()
Size of buffer.
virtual void set_lens_x_corr(unsigned int x_corr)
Set lens x correction.
General Video4Linux camera implementation.
virtual int red_balance()
Get current red balance.
V4L2Camera(const char *device_name="/dev/video0")
Constructor.
virtual unsigned int contrast()
Get current contrast.
virtual unsigned int pixel_width()
Width of image in pixels.
virtual unsigned char * buffer()
Get access to current image buffer.
virtual void set_contrast(unsigned int contrast)
Set new contrast.
virtual bool ready()
Camera is ready for taking pictures.
virtual unsigned int fps()
Get the number of frames per second that have been requested from the camera.
virtual ~V4L2Camera()
Destructor.
virtual unsigned int height()
Get the current height of the image.
virtual unsigned int exposure()
Get current exposure.
virtual bool vert_mirror()
Return whether the camera image is vertically mirrored.
virtual void set_one_control(const char *ctrl, unsigned int id, int value)
Set one Camera control value.
virtual bool auto_exposure()
Return whether auto exposure is enabled.
virtual int get_one_control(const char *ctrl, unsigned int id)
Get one Camera control value.
virtual void set_exposure(unsigned int exposure)
Set new exposure.
virtual void size(unsigned int &width, unsigned int &height)
Get the current image size.
virtual void set_saturation(unsigned int saturation)
Set new saturation.
virtual void set_vert_mirror(bool enabled)
Set whether the camera should mirror images vertically.
virtual void set_blue_balance(int blue_balance)
Set blue balance.
virtual void open()
Open the camera.
virtual void set_red_balance(int red_balance)
Set red balance.
virtual void capture()
Capture an image.
virtual unsigned int width()
Get the current width of the image.
virtual void dispose_buffer()
Dispose current buffer.
virtual int hue()
Get current hue.
virtual unsigned int gain()
Get current gain.
virtual void set_gain(unsigned int gain)
Set new gain.
virtual int blue_balance()
Get current blue balance.
virtual void set_u_balance(int u_balance)
Set u balance.
virtual bool auto_white_balance()
Return whether auto white balance is enabled.
virtual unsigned int saturation()
Get current saturation.
virtual void start()
Start image transfer from the camera.
virtual void flush()
Flush image queue.
virtual void set_image_number(unsigned int n)
Set image number to retrieve.
virtual void set_v_balance(int v_balance)
Set v balance.
virtual unsigned int pixel_height()
Height of image in pixels.
virtual unsigned int lens_x_corr()
Get current lens x correction.