00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef HAVE_CONFIG_H
00025 #include <config.h>
00026 #endif
00027
00028
00029 #include <stdio.h>
00030 #include <stdlib.h>
00031 #include <iostream.h>
00032 #include <string.h>
00033
00034
00035 #include <cv.h>
00036 #include <cxcore.h>
00037 #include <highgui.h>
00038 #include <cvaux.h>
00039
00040
00041 #include <dc1394_control.h>
00042 #include <raw1394.h>
00043
00044
00045 #include <conversions.h>
00046
00047
00048
00049
00050
00051 #define TRUE 1
00052 #define FALSE 0
00053
00054
00055
00056
00057
00058 class camera1394_control {
00059 public:
00060
00061
00062
00066 camera1394_control();
00070 ~camera1394_control();
00071
00072
00077 int PrintPossibleModes(void);
00078
00083 int PrintPossibleFrameRates(void);
00084
00089 int PrintCameraFeatures(void){dc1394_print_feature_set(featureset); return 1;};
00090
00095 int PrintCameraInfo(void){dc1394_print_camera_info(camerainfo); return 1;};
00096
00097
00103 int SetHandleNum(int num){handlenum=num;;return 1;};
00104
00110 int SetNodeNum(int num){nodenum=num;return 1;};
00111
00129 int SetColorFormat(int cm);
00130
00156 int SetFeatureToManualAuto(unsigned int f, unsigned int val);
00157
00165 int SetFlgverbose(unsigned char val){return flg.verbose=val;};
00166
00174 int SetFlgtestimgparams(unsigned char val){return flg.testimgparams=val;};
00175
00176
00177
00178 int DmaUnlisten(void){return dc1394_dma_unlisten(handle,&cameracapture);};
00179 int CleanupIsoChannels(void){return 1;};
00180
00185 int OpenHandle(void);
00186
00191 int TurnOffCamera(void);
00192
00197 int TurnOnCamera(void);
00198
00203 int GetCameraNodes(void);
00204
00209 int SetupCapture_dma(void);
00210
00215 int StartIsoTransmission(void);
00216
00224 int GetFrame_dma(IplImage *img);
00225
00230 int InitCameraToFactorySettings(void){return dc1394_init_camera(handle, numnodes[nodenum]);};
00231
00232
00233
00234 int GetFrameRate(void);
00235 int GetBrightness(void);
00236 int GetSaturation(void);
00237 int GetExposure(void);
00238 int GetSharpness(void);
00239 int GetWhiteBalance(void);
00240 int GetHue(void);
00241 int GetGamma(void);
00242 int GetShutter(void);
00243 int GetGain(void);
00244
00245
00246 int SetFrameRate(int fr);
00247 int SetBrightness(unsigned int b);
00248 int SetSaturation(unsigned int s);
00249 int SetExposure(unsigned int e);
00250 int SetSharpness(unsigned int s);
00251 int SetWhiteBalance(unsigned int ub, unsigned int vr);
00252 int SetHue(unsigned int h);
00253 int SetGamma(unsigned int g);
00254 int SetShutter(unsigned int s);
00255 int SetGain(unsigned int g);
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272 private:
00273 raw1394handle_t handle;
00274
00275 int handlenum;
00276 int nodenum;
00277 nodeid_t *numnodes;
00278 dc1394_feature_info *feature;
00279 dc1394_feature_set *featureset;
00280 dc1394_miscinfo *info;
00281 dc1394_camerainfo *camerainfo;
00282 int numCameras;
00283 dc1394_cameracapture cameracapture;
00284 char* devicename;
00285 unsigned char * TmpBuffer;
00286
00287 struct {unsigned char verbose;
00288 unsigned char hashandle;
00289 unsigned char testimgparams;
00290 }flg;
00291
00292 struct {int width;
00293 int height;
00294 int numchannels;
00295 int colormode;
00296 int framerate;
00297 unsigned int Brightness,Exposure,Sharpness,Hue,Saturation, Gamma, Temperature, Shutter, Gain ,FrameRate;
00298 struct {unsigned int u_b_value, v_r_value;}WhiteBalance;
00299
00300 }captureparams;
00301
00302
00303
00304 };