Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef NIFTI_CAMERA_CAMERA_H_
00009 #define NIFTI_CAMERA_CAMERA_H_
00010
00011 #include <queue>
00012 #include <set>
00013
00014 #include <dc1394/dc1394.h>
00015 #include <opencv2/core/core.hpp>
00016
00017 namespace nifti {
00018 namespace dc1394 {
00019
00028 class Camera {
00029
00030 public:
00031 Camera(dc1394camera_t* camera);
00032 Camera();
00033 virtual ~Camera();
00034
00038 void setup();
00039
00043 dc1394operation_mode_t getOperationMode();
00047 void setOperationMode(dc1394operation_mode_t operationMode);
00048
00052 dc1394speed_t getIsoSpeed();
00056 void setIsoSpeed(dc1394speed_t speed);
00057
00061 dc1394video_mode_t getVideoMode();
00065 void setVideoMode(dc1394video_mode_t videoMode);
00066
00070 dc1394color_coding_t getFormat7ColorCoding();
00074 dc1394color_filter_t getFormat7ColorFilter();
00078 float getFormat7FrameInterval();
00082 uint32_t getFormat7PacketsPerFrame();
00086 uint32_t getFormat7PacketSize();
00090 uint32_t getFormat7RecommendedPacketSize();
00091
00095 void getFormat7Roi(dc1394video_mode_t videoMode, dc1394color_coding_t* colorCoding, uint32_t* packetSize,
00096 uint32_t* left, uint32_t* top, uint32_t* width, uint32_t* height);
00100 virtual void setFormat7Roi(dc1394video_mode_t videoMode, dc1394color_coding_t colorCoding, int32_t packetSize, int32_t left,
00101 int32_t top, int32_t width, int32_t height);
00102
00106 void setupCapture();
00107
00111 void stopCapture();
00112
00116 void flushFrames();
00117
00121 void dropFrames(int n);
00122
00126 void startVideoTransmission();
00130 void stopVideoTransmission();
00131
00138 void startOneShot();
00139
00143 void stopOneShot();
00144
00153 void debayerFrame(dc1394video_frame_t* in, dc1394video_frame_t* out);
00154
00162 void captureColorMat(cv::Mat& bgrMat, uint64_t& timestamp, bool wait = true);
00163
00167 void powerOn();
00171 void powerOff();
00172
00176 void reset();
00177
00181 void resetBus();
00182
00186 void releaseAll();
00187
00188 dc1394bayer_method_t getBayerMethod();
00189 void setBayerMethod(dc1394bayer_method_t method);
00190
00199 dc1394video_frame_t* dequeueFrame(const dc1394capture_policy_t capturePolicy);
00200
00201 bool isFrameCorrupt(dc1394video_frame_t* frame);
00202
00207 void enqueueFrameLater(const dc1394video_frame_t* frame);
00208
00212 void enqueueFrames();
00213
00217 uint32_t getRegister(uint64_t offset);
00218
00222 void setRegister(uint64_t offset, uint32_t value);
00223
00224 uint32_t getControlRegister(uint64_t offset);
00225 void setControlRegister(uint64_t offset, uint32_t value);
00226
00230 void lockCapture();
00231
00235 void unlockCapture();
00236
00240 bool isFeaturePresent(dc1394feature_t feat);
00241
00245 bool isFeatureReadable(dc1394feature_t feat);
00246
00251 bool isFeatureSwitchable(dc1394feature_t feat);
00252
00256 bool isFeaturePowerOn(dc1394feature_t feat);
00257
00261 dc1394feature_mode_t getFeatureMode(dc1394feature_t feat);
00262
00266 bool isFeatureAbsoluteControlAvailable(dc1394feature_t feat);
00267
00271 bool isFeatureAbsoluteControlOn(dc1394feature_t feat);
00272
00276 uint32_t getFeatureMinBoundary(dc1394feature_t feat);
00277
00281 uint32_t getFeatureMaxBoundary(dc1394feature_t feat);
00282
00286 uint32_t getFeatureValue(dc1394feature_t feat);
00287
00291 float getFeatureMinAbsoluteBoundary(dc1394feature_t feat);
00292
00296 float getFeatureMaxAbsoluteBoundary(dc1394feature_t feat);
00297
00301 float getFeatureAbsoluteValue(dc1394feature_t feat);
00302
00303 void setFeaturePowerOn(dc1394feature_t feat);
00304
00305 void setFeaturePowerOff(dc1394feature_t feat);
00306
00315 void setFeaturetMode(dc1394feature_t feat, dc1394feature_mode_t mode);
00316
00317 void setFeatureAbsoluteControlOn(dc1394feature_t feat);
00318
00319 void setFeatureAbsoluteControlOff(dc1394feature_t feat);
00320
00324 void setFeatureValue(dc1394feature_t feat, uint32_t value);
00325
00329 void setFeatureAbsoluteValue(dc1394feature_t feat, float value);
00330
00334 uint32_t getWhiteBalanceBlue();
00335
00339 uint32_t getWhiteBalanceRed();
00340
00344 void setWhiteBalance(uint32_t u_b_value, uint32_t v_r_value);
00345
00349 void setWhiteBalanceBlue(uint32_t u_b_value);
00350
00354 void setWhiteBalanceRed(uint32_t v_r_value);
00355
00356 private:
00361 pthread_mutex_t captureMutex;
00362
00366 dc1394camera_t* camera;
00367
00371 std::queue<dc1394video_frame_t*> dequeuedFrames;
00372
00376 std::set<dc1394video_frame_t*> framesToEnqueue;
00377
00381 dc1394bayer_method_t bayerMethod;
00382
00383 };
00384
00385 }
00386 }
00387
00388 #endif