25 #ifndef __BIASVIDEOSOURCE_DCAM_HH__
26 #define __BIASVIDEOSOURCE_DCAM_HH__
28 #include <bias_config.h>
31 #if defined(WIN32) && !defined(BIAS_HAVE_1394CAMERACMU)
32 # error You need 1394CAMERACMU for BIAS Videosource_DCAM. Please recompile BIAS with USE_1394CAMERACMU.
35 #if !defined(WIN32) && !defined(BIAS_HAVE_DC1394)
36 # error You need DC1394 for BIAS Videosource_DCAM. Please recompile BIAS with USE_DC1394.
40 #if !defined(BIAS_HAVE_1394CAMERACMU) && !defined(BIAS_HAVE_DC1394)
41 # error You need either DC1394 or 1394CameraCMU for BIAS Videosource_DCAM. Please recompile BIAS with one of them.
47 #include <Base/Common/W32Compat.hh>
50 # include <sys/time.h>
52 #ifdef BIAS_HAVE_PTHREADS
56 #include <Image/Camera.hh>
59 # include <1394Camera.h>
61 typedef unsigned long long int uint64_t;
63 # include <dc1394/control.h>
64 # include <dc1394/utils.h>
67 #include <VideoSource/VideoSource_Base.hh>
70 #ifndef MAX_1394_CARDS
71 #define MAX_1394_CARDS 2
74 #define MAX_1394_SOURCES 16
75 #ifndef MAX_1394_CHANNELS
76 #define MAX_1394_CHANNELS 256
79 #define MAX_DMABUFFERS 10
88 typedef dc_videomode dc1394video_mode_t;
140 std::vector<BIAS::dc1394video_mode_t>
videoModes;
141 std::vector<BIAS::dc1394video_mode_t>
f7_modes;
160 extern int BIASVideoSource_EXPORT
ScanBus(std::stringstream &ofs);
161 extern int BIASVideoSource_EXPORT
ScanBus(std::vector<CameraInfo> &camInfos);
209 typedef enum dc1394feature_t{
210 DC1394_FEATURE_BRIGHTNESS,
211 DC1394_FEATURE_EXPOSURE,
212 DC1394_FEATURE_SHARPNESS,
213 DC1394_FEATURE_WHITE_BALANCE,
215 DC1394_FEATURE_SATURATION,
216 DC1394_FEATURE_GAMMA,
217 DC1394_FEATURE_SHUTTER,
220 DC1394_FEATURE_FOCUS,
221 DC1394_FEATURE_TEMPERATURE,
222 DC1394_FEATURE_TRIGGER,
226 DC1394_FEATURE_OPTICAL_FILTER,
227 DC1394_FEATURE_CAPTURE_SIZE,
228 DC1394_FEATURE_CAPTURE_QUALITY
234 typedef enum dc1394feature_mode_t{
235 DC1394_FEATURE_MODE_AUTO,
236 DC1394_FEATURE_MODE_MANUAL
242 typedef enum dc1394color_coding_t{
243 DC1394_COLOR_CODING_MONO8= 352,
244 DC1394_COLOR_CODING_YUV411,
245 DC1394_COLOR_CODING_YUV422,
246 DC1394_COLOR_CODING_YUV444,
247 DC1394_COLOR_CODING_RGB8,
248 DC1394_COLOR_CODING_MONO16,
249 DC1394_COLOR_CODING_RGB16,
250 DC1394_COLOR_CODING_MONO16S,
251 DC1394_COLOR_CODING_RGB16S,
252 DC1394_COLOR_CODING_RAW8,
253 DC1394_COLOR_CODING_RAW16
256 #define FEATURE_MIN FEATURE_BRIGHTNESS
257 #define FEATURE_MAX FEATURE_CAPTURE_QUALITY
258 #define NUM_FEATURES (FEATURE_MAX - FEATURE_MIN + 1)
264 typedef enum dc_videomode{
265 DC1394_VIDEO_MODE_160x120_YUV444= 64,
266 DC1394_VIDEO_MODE_320x240_YUV422,
267 DC1394_VIDEO_MODE_640x480_YUV411,
268 DC1394_VIDEO_MODE_640x480_YUV422,
269 DC1394_VIDEO_MODE_640x480_RGB8,
270 DC1394_VIDEO_MODE_640x480_MONO8,
271 DC1394_VIDEO_MODE_640x480_MONO16,
272 DC1394_VIDEO_MODE_800x600_YUV422,
273 DC1394_VIDEO_MODE_800x600_RGB8,
274 DC1394_VIDEO_MODE_800x600_MONO8,
275 DC1394_VIDEO_MODE_1024x768_YUV422,
276 DC1394_VIDEO_MODE_1024x768_RGB8,
277 DC1394_VIDEO_MODE_1024x768_MONO8,
278 DC1394_VIDEO_MODE_800x600_MONO16,
279 DC1394_VIDEO_MODE_1024x768_MONO16,
280 DC1394_VIDEO_MODE_1280x960_YUV422,
281 DC1394_VIDEO_MODE_1280x960_RGB8,
282 DC1394_VIDEO_MODE_1280x960_MONO8,
283 DC1394_VIDEO_MODE_1600x1200_YUV422,
284 DC1394_VIDEO_MODE_1600x1200_RGB8,
285 DC1394_VIDEO_MODE_1600x1200_MONO8,
286 DC1394_VIDEO_MODE_1280x960_MONO16,
287 DC1394_VIDEO_MODE_1600x1200_MONO16,
288 DC1394_VIDEO_MODE_EXIF,
289 DC1394_VIDEO_MODE_FORMAT7_0,
290 DC1394_VIDEO_MODE_FORMAT7_1,
291 DC1394_VIDEO_MODE_FORMAT7_2,
292 DC1394_VIDEO_MODE_FORMAT7_3,
293 DC1394_VIDEO_MODE_FORMAT7_4,
294 DC1394_VIDEO_MODE_FORMAT7_5,
295 DC1394_VIDEO_MODE_FORMAT7_6,
296 DC1394_VIDEO_MODE_FORMAT7_7
301 #define DC1394_VIDEO_MODE_MIN DC1394_VIDEO_MODE_160x120_YUV444
302 #define DC1394_VIDEO_MODE_MAX DC1394_VIDEO_MODE_FORMAT7_7
303 #define DC1394_VIDEO_MODE_NUM (DC1394_VIDEO_MODE_MAX - DC1394_VIDEO_MODE_MIN + 1)
306 #define DC1394_VIDEO_MODE_FORMAT7_MIN DC1394_VIDEO_MODE_FORMAT7_0
307 #define DC1394_VIDEO_MODE_FORMAT7_MAX DC1394_VIDEO_MODE_FORMAT7_7
308 #define DC1394_VIDEO_MODE_FORMAT7_NUM (DC1394_VIDEO_MODE_FORMAT7_MAX - DC1394_VIDEO_MODE_FORMAT7_MIN + 1)
326 void ActivateScorpionTimestamp();
350 int OpenDevice(
int camid);
356 int SetFormat7(
int mode,
int bpp, dc1394color_coding_t colorCoding = DC1394_COLOR_CODING_MONO8);
362 void SetCam_ID(
int manualcamid_);
386 #ifdef BUILD_IMAGE_USHORT
425 void SetAutoShutter(
bool b);
430 bool GetAutoShutter();
436 void SetAutoGain(
bool b);
439 void SetAutoBrightness(
bool b);
441 bool GetAutoBrightness();
455 int AutoMode( dc1394feature_t feature, dc1394feature_mode_t mode);
463 int SetFeature(dc1394feature_t feature,
unsigned int value);
470 unsigned int GetFeature( dc1394feature_t feature);
477 int OnePushAuto(dc1394feature_t feature);
484 bool OnePushRunning(dc1394feature_t feature);
491 int SetColorFromMode_(dc1394video_mode_t videoMode);
493 int SetColorFromMode_();
494 dc1394video_mode_t FormatAndModeToEnum(
int Format,
int Mode);
507 int SetShutter(
float exptime);
520 int SetGain(
float g);
534 int SetBrightness(
float b);
540 float GetBrightness();
549 int SetWhiteBalance(
float rvalue,
float bvalue);
557 int SetGammaMode(
int g);
564 void SetExternalTrigger(
bool trigger =
true);
574 inline unsigned int GetTop(){
return Top_;};
584 int SetLeftTop(
unsigned int left,
unsigned int top);
596 BIASERR(
"Can not set camera id for DCams, they are identified automatically");
613 void SetModeAndFramerate(dc1394video_mode_t mode,
float framerate);
615 void SetFirewireB(
bool on);
623 bEnsureLatestFrame_ = ensure;
627 int &minBpP,
int &maxBpP){
628 maxWidth = MaxWidth_;
629 maxHeight = MaxHeight_;
643 void GetBytesPerPacketForFormat7(
int camid, dc1394video_mode_t mode,
int width,
int height,
unsigned int& bppmin,
unsigned int& bppmax);
650 static std::string VideoModeToString(dc1394video_mode_t mode);
662 int ActivateExternalTrigger_(
bool trigger =
true);
682 int UserSizeToMode();
688 int UserSizeToMode_16bit_();
694 int UserSizeToMode_8bit_();
700 int UserSizeToFormat7_();
707 int ApplyBytesPerPacket();
714 unsigned int CalcBytesPerPacket();
720 int ShowCapabilities();
726 unsigned long DcamFps_;
727 unsigned long DcamMode_;
745 dc1394framerates_t CameraFramerates_[DC1394_VIDEO_MODE_NUM];
770 unsigned int MaxWidth_, MaxHeight_, Left_,
Top_;
784 #ifdef BIAS_HAVE_PTHREADS
796 #endif // __BIASVIDEOSOURCE_DCAM_HH__
EColorModel
These are the most often used color models.
Stores the camera parameters such as Shutter, Gain, etc.
bool HasControlBrightness()
dc1394video_mode_t DcamMode_
Defines a common interface to different devices.
CameraModel_e
Enumeration for the known IEEE1394 camera models Only used internally in VideoSource_DCAM.
unsigned char OpticalFilter
std::vector< std::vector< float > > framerates
std::vector< unsigned int > f7_unitWidth
static int InstancesTotal_
std::vector< unsigned int > f7_MaxBpP
int BIASVideoSource_EXPORT ScanBus(std::stringstream &ofs)
support function to get the number of cameras and IDs of all cameras on one bus
unsigned int WhiteBalance
dc1394trigger_mode_t Trigger_
Stores camera information such as model, vendor, framerates.
bool OpticalFilterChanged
int GetTransmissionTime()
void ForceFormat7(bool forcef7)
this choses f7 mode even for standard resolution
enum BIAS::CameraModel_e CameraModel
This class VideoSource_DCAM implements access to IEEE1394 (Firewire, iLink) cameras following the DCa...
Image< unsigned char > * imageintern_
std::vector< unsigned int > f7_unitHeight
void GetFormat7ImageDimensions(int &maxWidth, int &maxHeight, int &minBpP, int &maxBpP)
std::vector< dc1394video_mode_t > videoModes
std::vector< unsigned int > f7_bestBpP
virtual void SetCameraID(int)
std::vector< unsigned int > f7_MinBpP
dc1394color_coding_t f7ColorCoding_
dc1394featureset_t DcamFeatures_
struct BIAS::CameraInfo_s CameraInfo
enum BIAS::LensModel_e LensModel
pthread_mutex_t grabMutex_
bool HasControlWhiteBalance()
void EnsureLatestFrame(const bool ensure)
std::vector< dc1394video_mode_t > f7_modes
bool AutoWhiteBalanceChanged
std::vector< unsigned int > f7_maxHeight
dc1394framerate_t DcamFps_
void SetBytesPerPacket(const int b)
sets the bytes per packet used for format 7
struct BIAS::CameraParameter_s CameraParameterSet
std::vector< unsigned int > f7_maxWidth
dc1394video_mode_t bestMode
bool ScorpionTimestampActive_
dc1394camera_list_t * cameraList
dc1394video_modes_t CameraModes_
LensModel_e
Enumeration for the known lenses for IEEE1394 cameras Only used internally in VideoSource_DCAM.