178 |
kaklik |
1 |
#ifndef IMAGE_DC1394INPUT_H |
|
|
2 |
#define IMAGE_DC1394INPUT_H |
|
|
3 |
|
|
|
4 |
#include <libraw1394/raw1394.h> |
|
|
5 |
#include <libdc1394/dc1394_control.h> |
|
|
6 |
#include "image_input.h" |
|
|
7 |
|
|
|
8 |
namespace mimas { |
|
|
9 |
|
|
|
10 |
/** @addtogroup imageIO |
|
|
11 |
@{ */ |
|
|
12 |
/** @addtogroup imageInput |
|
|
13 |
@{ */ |
|
|
14 |
/** Image input from firewire digital camera (video1394). |
|
|
15 |
At the moment only grabbing of grayscale and YUV422-encoded images is |
|
|
16 |
supported. |
|
|
17 |
Grabbing has been tested with the following device: |
|
|
18 |
\li Basler A302fc |
|
|
19 |
|
|
|
20 |
See <A HREF="http://www.rmatsumoto.org/camera/dc1394-ohphone-old.html">Ryutaroh Matsumoto's</A> |
|
|
21 |
page for more information. |
|
|
22 |
|
|
|
23 |
Here is an example on how to use this class: |
|
|
24 |
\include dc1394/minimal.cc |
|
|
25 |
|
|
|
26 |
@author Jan Wedekind (jan@wedesoft.de) |
|
|
27 |
@date Wed Aug 4 13:53:59 GMT 2005 */ |
|
|
28 |
template< typename T > |
|
|
29 |
class image_dc1394input: public image_input< T > |
|
|
30 |
{ |
|
|
31 |
public: |
|
|
32 |
/// |
|
|
33 |
typedef enum { Unknown = 0, UYVY, RGB24, Grey8 } ColourSpace; |
|
|
34 |
/// |
|
|
35 |
image_dc1394input( const char *device = "", |
|
|
36 |
int node = 0, |
|
|
37 |
int channel = 0, |
|
|
38 |
int preferredFormat = -1, |
|
|
39 |
int preferredMode = -1, |
|
|
40 |
int preferredFormat7Colour = -1, |
|
|
41 |
int speed = SPEED_400 ) throw (mimasexception); |
|
|
42 |
/// |
|
|
43 |
virtual ~image_dc1394input(void); |
|
|
44 |
/// |
|
|
45 |
virtual void close(void); |
|
|
46 |
/// |
|
|
47 |
virtual void read( image<T> &img ) throw (mimasexception); |
|
|
48 |
/// |
|
|
49 |
dc1394_feature_info get_feature( int _id ) throw (mimasexception); |
|
|
50 |
/// |
|
|
51 |
void set_feature_value( int _id, unsigned int _value ) throw (mimasexception); |
|
|
52 |
/// |
|
|
53 |
unsigned int get_feature_value( int _id ) throw (mimasexception); |
|
|
54 |
protected: |
|
|
55 |
/// |
|
|
56 |
void selectFormat( int preferredFormat ) throw (mimasexception); |
|
|
57 |
/// |
|
|
58 |
void selectMode( int preferredMode ) throw (mimasexception); |
|
|
59 |
/// |
|
|
60 |
void selectFrameRate( int preferredFrameRate ) throw (mimasexception); |
|
|
61 |
/// |
|
|
62 |
void selectFormat7Colour( int preferredFormat7Colour ) throw (mimasexception); |
|
|
63 |
/// |
|
|
64 |
std::string m_device; |
|
|
65 |
/// |
|
|
66 |
nodeid_t *m_cameraNode; |
|
|
67 |
/// |
|
|
68 |
int m_node; |
|
|
69 |
/// |
|
|
70 |
raw1394handle_t m_handle; |
|
|
71 |
/// |
|
|
72 |
dc1394_cameracapture m_camera; |
|
|
73 |
/// |
|
|
74 |
int m_format; |
|
|
75 |
/// |
|
|
76 |
int m_mode; |
|
|
77 |
/// |
|
|
78 |
int m_format7Colour; |
|
|
79 |
/// |
|
|
80 |
ColourSpace m_colourSpace; |
|
|
81 |
/// |
|
|
82 |
int m_frameRate; |
|
|
83 |
/// |
|
|
84 |
bool m_bufferUsed; |
|
|
85 |
}; |
|
|
86 |
|
|
|
87 |
///@} |
|
|
88 |
|
|
|
89 |
///@} |
|
|
90 |
|
|
|
91 |
}; |
|
|
92 |
|
|
|
93 |
#include "image_dc1394input.tcc" |
|
|
94 |
#endif |