Linux1394Capture.h
Go to the documentation of this file.
1 // ****************************************************************************
2 // This file is part of the Integrating Vision Toolkit (IVT).
3 //
4 // The IVT is maintained by the Karlsruhe Institute of Technology (KIT)
5 // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de).
6 //
7 // Copyright (C) 2014 Karlsruhe Institute of Technology (KIT).
8 // All rights reserved.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are met:
12 //
13 // 1. Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
15 //
16 // 2. Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
19 //
20 // 3. Neither the name of the KIT nor the names of its contributors may be
21 // used to endorse or promote products derived from this software
22 // without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY
25 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY
28 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 // ****************************************************************************
35 // ****************************************************************************
36 // Filename: Linux1394Capture.h
37 // Author: Pedram Azad, Kai Welke
38 // Date: 2005
39 // ****************************************************************************
40 // Changes: 24.08.2006, Kai Welke
41 // * Added YUV411 support
42 // 25.09.2006, Kai Welke
43 // * Added support for UIDs and different frame rates
44 // ****************************************************************************
45 
46 
47 #ifndef _LINUX_1394_CAPTURE_H_
48 #define _LINUX_1394_CAPTURE_H_
49 
50 
51 // ****************************************************************************
52 // Necessary includes
53 // ****************************************************************************
54 
56 #include "Image/ImageProcessor.h"
57 #include <string>
58 
59 #include <libraw1394/raw1394.h>
60 #include <libdc1394/dc1394_control.h>
61 
62 
63 
64 // ****************************************************************************
65 // Forward declarations
66 // ****************************************************************************
67 
68 class CByteImage;
69 
70 
71 // ****************************************************************************
72 // Defines
73 // ****************************************************************************
74 
75 #define MAX_CAMERAS 4 // don't set this smaller than 2
76 #define MAX_PORTS 4
77 
78 
79 
80 
81 // ****************************************************************************
82 // CLinux1394Capture
83 // ****************************************************************************
84 
86 {
87 public:
88  // constructor, variable arguments are camera uids as const char*
89  CLinux1394Capture(int nCameras, VideoMode mode, ColorMode colorMode, ImageProcessor::BayerPatternType bayerPatternType = ImageProcessor::eBayerRG, FrameRate frameRate = e30fps);
90  CLinux1394Capture(VideoMode mode, ColorMode colorMode, ImageProcessor::BayerPatternType bayerPatternType = ImageProcessor::eBayerRG, FrameRate frameRate = e30fps, int nNumberUIDs = 0, ...);
91 
92  // format 7 modes
93  CLinux1394Capture(int nCameras, VideoMode mode, int nFormat7PacketSize = -1, int nFormat7MinX = 0, int nFormat7MinY = 0, int nFormat7Width = 640, int nFormat7Height = 480,
95 
96  CLinux1394Capture(VideoMode mode, int nFormat7PacketSize = -1, int nFormat7MinX = 0, int nFormat7MinY = 0, int nFormat7Width = 640, int nFormat7Height = 480,
98 
99 
100  // destructor
102 
103 
104  // public methods
105  bool OpenCamera();
106  void CloseCamera();
107  bool CaptureImage(CByteImage **ppImages);
108  bool CaptureBayerPatternImage(CByteImage **ppImages);
109 
110  void SetGain(unsigned int nValue);
111  void SetExposure(unsigned int nValue);
112  void SetShutter(unsigned int nValue);
113 
114  int GetWidth() { return width; }
115  int GetHeight() { return height; }
117  int GetNumberOfCameras() { return m_nCameras; }
118 
119 
120 private:
121  struct TCameraInfo
122  {
123  int nPort;
124  int nIndex;
126  };
127 
128  // private methods
129  bool OpenCamera(int nCamera);
130  bool InitCameraMode();
131  int GetDCFrameRateMode(FrameRate frameRate);
132 
133  // conversion
134  void ConvertYUV411(CByteImage* pInput, CByteImage* pOutput);
135  void YUVToRGB(int y, int u, int v, unsigned char* output);
136 
137  // multiple camera handling
138  bool ListCameras();
139  std::string CamUIDToString(unsigned int nLow, unsigned int nHigh);
140 
141  // private attributes
142  // temporary images for capruting
145 
146  int m_nPorts;
147  int m_nMode;
148 
149  int width;
150  int height;
151 
152  // number of cameras requested by user
154  // requested video mode (see VideoCaptureInterface.h)
156  // requested color mode (see VideoCaptureInterface.h)
158  // requested frame rate (see VideoCaptureInterface.h)
160  // requested bayer pattern type (see ImageProcessor.h)
162  // unique camera ids as requested by user
165  // opened camera ids
167  // video mode
169  // format 7 mode
176 
177  // static for all instances
178  // lib dc + raw specific camera data
179  static raw1394handle_t m_handles[MAX_CAMERAS];
180  static dc1394_cameracapture m_cameras[MAX_CAMERAS];
181  static nodeid_t *m_pCameraNodes[MAX_PORTS];
182 
183  // internal camera data
184  static int m_nOverallCameras;
187 
188  // static instance counter for handle destruction
189  static int m_nInstances;
190 };
191 
192 
193 
194 #endif /* _LINUX_1394_CAPTURE_H_ */
int m_nOpenedCameras[MAX_CAMERAS]
void ConvertYUV411(CByteImage *pInput, CByteImage *pOutput)
int GetDCFrameRateMode(FrameRate frameRate)
BayerPatternType
The four possible variants for Bayer pattern conversion.
CByteImage * m_pTempImageHeader
static TCameraInfo m_CameraInfo[MAX_CAMERAS]
static nodeid_t * m_pCameraNodes[MAX_PORTS]
const ImageProcessor::BayerPatternType m_bayerPatternType
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
Definition: ByteImage.h:80
CLinux1394Capture(int nCameras, VideoMode mode, ColorMode colorMode, ImageProcessor::BayerPatternType bayerPatternType=ImageProcessor::eBayerRG, FrameRate frameRate=e30fps)
const ColorMode m_colorMode
static dc1394_cameracapture m_cameras[MAX_CAMERAS]
static raw1394handle_t m_handles[MAX_CAMERAS]
void SetExposure(unsigned int nValue)
static int m_nOverallCameras
CByteImage::ImageType GetType()
bool CaptureImage(CByteImage **ppImages)
void SetShutter(unsigned int nValue)
#define MAX_PORTS
GLsizei const GLchar ** string
Definition: glext.h:3528
const VideoMode m_mode
GLint mode
Definition: glext.h:4669
std::string m_sCameraUID[MAX_CAMERAS]
std::string CamUIDToString(unsigned int nLow, unsigned int nHigh)
ImageType
Enum specifying the supported image types.
Definition: ByteImage.h:86
Interface to video capture modules.
static CLinux1394Capture * m_pCameraOpener[MAX_CAMERAS]
void SetGain(unsigned int nValue)
GLenum GLint GLint y
Definition: glext.h:3125
const GLdouble * v
Definition: glext.h:3212
#define MAX_CAMERAS
void YUVToRGB(int y, int u, int v, unsigned char *output)
bool CaptureBayerPatternImage(CByteImage **ppImages)
CByteImage * m_pTempImage


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Mon Dec 2 2019 03:47:28