20#include <yarp/os/Log.h>
21#include <yarp/os/LogStream.h>
27#define POINTGREY_REGISTER_TIMESTAMP 0x12F8
34 err = dc1394_get_control_register(camera,
37 DC1394_ERR_RTN(err,
"No embedded timestamp capability");
39 bool current = (value & 0x1U)!=0;
42 return DC1394_SUCCESS;
45 err = dc1394_set_control_register(camera,
48 DC1394_ERR_RTN(err,
"Cannot configure embedded timestamp");
49 err = dc1394_get_control_register(camera,
52 DC1394_ERR_RTN(err,
"Configuration for embedded timestamp won't stick");
54 current = value & 0x1;
56 return (enable==current)?DC1394_SUCCESS: DC1394_FAILURE;
62 m_dc1394_handle(NULL),
86 case DC1394_COLOR_CODING_MONO8:
return 1.0;
87 case DC1394_COLOR_CODING_MONO16:
return 2.0;
88 case DC1394_COLOR_CODING_YUV411:
return 1.5;
89 case DC1394_COLOR_CODING_YUV422:
return 2.0;
90 case DC1394_COLOR_CODING_YUV444:
return 3.0;
91 case DC1394_COLOR_CODING_RGB8:
return 3.0;
92 case DC1394_COLOR_CODING_RAW8:
return 1.0;
93 case DC1394_COLOR_CODING_RAW16:
return 2.0;
105 case DC1394_VIDEO_MODE_FORMAT7_0:
108 case DC1394_COLOR_CODING_MONO8:
return 31;
109 case DC1394_COLOR_CODING_RAW8:
return 31;
110 case DC1394_COLOR_CODING_YUV411:
return 26;
112 case DC1394_COLOR_CODING_MONO16:
return 15;
113 case DC1394_COLOR_CODING_RAW16:
return 15;
114 case DC1394_COLOR_CODING_YUV422:
return 15;
116 case DC1394_COLOR_CODING_YUV444:
return 11;
117 case DC1394_COLOR_CODING_RGB8:
return 11;
120 case DC1394_VIDEO_MODE_FORMAT7_1:
123 case DC1394_COLOR_CODING_MONO8:
return 54;
124 case DC1394_COLOR_CODING_MONO16:
return 54;
126 case DC1394_COLOR_CODING_YUV411:
return 31;
127 case DC1394_COLOR_CODING_YUV422:
return 31;
128 case DC1394_COLOR_CODING_YUV444:
return 31;
129 case DC1394_COLOR_CODING_RGB8:
return 31;
132 case DC1394_VIDEO_MODE_FORMAT7_2:
135 case DC1394_COLOR_CODING_MONO8:
return 31;
136 case DC1394_COLOR_CODING_MONO16:
return 26;
137 case DC1394_COLOR_CODING_YUV411:
return 31;
138 case DC1394_COLOR_CODING_YUV422:
return 26;
139 case DC1394_COLOR_CODING_YUV444:
return 17;
140 case DC1394_COLOR_CODING_RGB8:
return 17;
149 case DC1394_VIDEO_MODE_FORMAT7_0:
152 case DC1394_COLOR_CODING_MONO8:
153 case DC1394_COLOR_CODING_RAW8:
154 case DC1394_COLOR_CODING_YUV411:
return 59;
156 case DC1394_COLOR_CODING_MONO16:
157 case DC1394_COLOR_CODING_RAW16:
158 case DC1394_COLOR_CODING_YUV422:
return 47;
160 case DC1394_COLOR_CODING_YUV444:
161 case DC1394_COLOR_CODING_RGB8:
return 31;
164 case DC1394_VIDEO_MODE_FORMAT7_1:
167 case DC1394_COLOR_CODING_MONO8:
168 case DC1394_COLOR_CODING_MONO16:
return 100;
170 case DC1394_COLOR_CODING_YUV411:
171 case DC1394_COLOR_CODING_YUV422:
172 case DC1394_COLOR_CODING_YUV444:
173 case DC1394_COLOR_CODING_RGB8:
return 59;
176 case DC1394_VIDEO_MODE_FORMAT7_2:
179 case DC1394_COLOR_CODING_MONO8:
180 case DC1394_COLOR_CODING_MONO16:
181 case DC1394_COLOR_CODING_YUV411:
182 case DC1394_COLOR_CODING_YUV422:
183 case DC1394_COLOR_CODING_YUV444:
184 case DC1394_COLOR_CODING_RGB8:
return 59;
201 yarp::os::Value* retM;
202 retM=yarp::os::Value::makeList(
"1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0");
203 configFx=config.check(
"horizontalFov");
204 configFy=config.check(
"verticalFov");
205 configPPx=config.check(
"principalPointX");
206 configPPy=config.check(
"principalPointY");
207 configRet=config.check(
"rectificationMatrix");
210 bt=config.findGroup(
"cameraDistortionModelGroup");
213 if(bt.find(
"name").isNull() || bt.find(
"k1").isNull()
214 || bt.find(
"k2").isNull() || bt.find(
"k3").isNull()
215 || bt.find(
"t1").isNull() || bt.find(
"t2").isNull())
217 yError()<<
"usbCamera: group cameraDistortionModelGroup incomplete, "
218 "fields k1, k2, k3, t1, t2, name are required when using cameraDistortionModelGroup";
227 horizontalFov=config.check(
"horizontalFov",yarp::os::Value(0.0),
228 "desired horizontal fov of test image").asFloat64();
229 verticalFov=config.check(
"verticalFov",yarp::os::Value(0.0),
230 "desired vertical fov of test image").asFloat64();
231 if(config.check(
"mirror"))
234 yarp::os::Value(
false),
235 "mirroring disabled by default").asBool())){
236 yError(
"usbCamera: cannot set mirroring option");
241 intrinsic.put(
"focalLengthX",config.check(
"focalLengthX",yarp::os::Value(0.0),
"Horizontal component of the focal lenght").asFloat64());
242 intrinsic.put(
"focalLengthY",config.check(
"focalLengthY",yarp::os::Value(0.0),
"Vertical component of the focal lenght").asFloat64());
243 intrinsic.put(
"principalPointX",config.check(
"principalPointX",yarp::os::Value(0.0),
"X coordinate of the principal point").asFloat64());
244 intrinsic.put(
"principalPointY",config.check(
"principalPointY",yarp::os::Value(0.0),
"Y coordinate of the principal point").asFloat64());
245 intrinsic.put(
"rectificationMatrix",config.check(
"rectificationMatrix",*retM,
"Matrix that describes the lens' distortion"));
246 intrinsic.put(
"distortionModel",config.check(
"distortionModel",yarp::os::Value(
""),
"Reference to group of parameters describing the distortion model").asString());
257 intrinsic.put(
"name",bt.check(
"name",yarp::os::Value(
""),
"Name of the distortion model, see notes").asString());
258 intrinsic.put(
"k1",bt.check(
"k1",yarp::os::Value(0.0),
"Radial distortion coefficient of the lens").asFloat64());
259 intrinsic.put(
"k2",bt.check(
"k2",yarp::os::Value(0.0),
"Radial distortion coefficient of the lens").asFloat64());
260 intrinsic.put(
"k3",bt.check(
"k3",yarp::os::Value(0.0),
"Radial distortion coefficient of the lens").asFloat64());
261 intrinsic.put(
"t1",bt.check(
"t1",yarp::os::Value(0.0),
"Tangential distortion of the lens").asFloat64());
262 intrinsic.put(
"t2",bt.check(
"t2",yarp::os::Value(0.0),
"Tangential distortion of the lens").asFloat64());
267 if(config.check(
"cpu_affinity")) {
270 int affinity = config.find(
"cpu_affinity").asInt32();
271 CPU_SET(affinity, &set);
272 if (sched_setaffinity(getpid(),
sizeof(set), &set) == -1) {
273 yWarning(
"failed to set the CPU affinity\n");
278 if(config.check(
"rt_priority")) {
279 struct sched_param sch_param;
280 sch_param.__sched_priority = config.find(
"rt_priority").asInt32();
281 if( sched_setscheduler(0, SCHED_FIFO, &sch_param) != 0 ) {
282 yWarning(
"failed to set the real-time priority\n");
286 int size_x=
checkInt(config,
"width");
287 int size_y=
checkInt(config,
"height");
290 int format=
checkInt(config,
"video_type");
292 if (!config.check(
"use_network_time"))
301 unsigned int idCamera=0;
305 yDebug(
"Format = %d\n",format);
321 yError(
"failed to open Firewire Bus Manager\n");
322 yError(
"LINE: %d\n",__LINE__);
329 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
335 yError(
"no active cameras\n");
336 yError(
"LINE: %d\n",__LINE__);
340 if (config.check(
"guid"))
342 std::string sguid=config.find(
"guid").asString();
344 uint64_t guid=strtoull(sguid.c_str(),NULL,16);
356 yError(
"GUID=%s camera not found\n",sguid.c_str());
357 yError(
"LINE: %d\n",__LINE__);
361 else if (config.check(
"d"))
363 yWarning(
"--d <unit_number> parameter is deprecated, use --guid <64_bit_global_unique_identifier> instead\n");
364 idCamera=config.find(
"d").asInt32();
369 yError(
"invalid camera number\n");
370 yError(
"LINE: %d\n",__LINE__);
376 yError(
"can't create camera\n");
377 yError(
"LINE: %d\n",__LINE__);
382 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
384 uint32_t channel_in_use=0;
385 dc1394_video_get_iso_channel(
m_pCamera,&channel_in_use);
386 dc1394_video_set_iso_channel(
m_pCamera,idCamera);
402#ifdef _ENABLE_LEGACY_STACK_
407 const int BANDWIDTH_MAX=0x7FFFFFFF;
409 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
412 dc1394speed_t isoSpeed;
414 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
416 dc1394_video_set_operation_mode(
m_pCamera,DC1394_OPERATION_MODE_1394B);
420 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
423 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
432 if (
mHires) printf(
"Hires camera found\n");
465 if (!size_x) { size_x=512; }
466 if (!size_y) { size_y=384; }
467 SetF7(DC1394_VIDEO_MODE_FORMAT7_1,size_x,size_y,DC1394_COLOR_CODING_RGB8,44,off_x,off_y);
487 if (!size_x) { size_x=1024; }
488 if (!size_y) { size_y=768; }
489 SetF7(DC1394_VIDEO_MODE_FORMAT7_0,size_x,size_y,DC1394_COLOR_CODING_RGB8,44,off_x,off_y);
493 if (!size_x) { size_x=1024; }
494 if (!size_y) { size_y=768; }
495 SetF7(DC1394_VIDEO_MODE_FORMAT7_0,size_x,size_y,DC1394_COLOR_CODING_YUV422,44,off_x,off_y);
499 if (!size_x) { size_x=1024; }
500 if (!size_y) { size_y=768; }
501 SetF7(DC1394_VIDEO_MODE_FORMAT7_0,size_x,size_y,DC1394_COLOR_CODING_RAW8,44,off_x,off_y);
509 yError(
"Unsupported video format, camera configuration will be used.\n");
524 if (!size_x) { size_x=320; }
525 if (!size_y) { size_y=240; }
526 SetF7(DC1394_VIDEO_MODE_FORMAT7_1,size_x,size_y,DC1394_COLOR_CODING_RGB8,44,off_x,off_y);
530 if (!size_x) { size_x=640; }
531 if (!size_y) { size_y=480; }
532 SetF7(DC1394_VIDEO_MODE_FORMAT7_0,size_x,size_y,DC1394_COLOR_CODING_RGB8,44,off_x,off_y);
536 if (!size_x) { size_x=640; }
537 if (!size_y) { size_y=480; }
538 SetF7(DC1394_VIDEO_MODE_FORMAT7_0,size_x,size_y,DC1394_COLOR_CODING_RAW8,44,off_x,off_y);
542 if (!size_x) { size_x=640; }
543 if (!size_y) { size_y=480; }
544 SetF7(DC1394_VIDEO_MODE_FORMAT7_0,size_x,size_y,DC1394_COLOR_CODING_RAW16,44,off_x,off_y);
548 if (!size_x) { size_x=640; }
549 if (!size_y) { size_y=480; }
550 SetF7(DC1394_VIDEO_MODE_FORMAT7_0,size_x,size_y,DC1394_COLOR_CODING_YUV422,44,off_x,off_y);
554 yError(
"Unsupported video format, camera configuration will be used.\n");
558 for (
int f=DC1394_FEATURE_MIN;
f<=DC1394_FEATURE_MAX; ++
f)
560 dc1394bool_t bPresent;
561 error=dc1394_feature_is_present(
m_pCamera,(dc1394feature_t)
f,&bPresent);
563 if (
error==DC1394_SUCCESS)
567 dc1394_feature_get_boundaries(
m_pCamera,(dc1394feature_t)
f,&
m_iMin[
f-DC1394_FEATURE_MIN],&
m_iMax[
f-DC1394_FEATURE_MIN]);
569 dc1394bool_t bSwitch;
570 dc1394_feature_is_switchable(
m_pCamera,(dc1394feature_t)
f,&bSwitch);
574 dc1394switch_t turnOn=(dc1394switch_t)(
f!=DC1394_FEATURE_EXPOSURE &&
f!=DC1394_FEATURE_IRIS &&
f<DC1394_FEATURE_TEMPERATURE);
575 dc1394_feature_set_power(
m_pCamera,(dc1394feature_t)
f,turnOn);
577 dc1394_feature_set_mode(
m_pCamera,(dc1394feature_t)
f,DC1394_FEATURE_MODE_MANUAL);
578 dc1394_feature_set_absolute_control(
m_pCamera,(dc1394feature_t)
f,DC1394_OFF);
582 yInfo(
"Feature %d not supported by this camera model.\n",
f);
587 yError(
"Feature %d error %d\n",
f,
error);
592 if (
error!=DC1394_SUCCESS)
594 yError(
"%d can't setup capture\n",
error);
601 if (
error!=DC1394_SUCCESS)
603 yError(
"%d can't start transmission\n",
error);
621 yarp::os::Bottle& white_balance=config.findGroup(
"white_balance");
622 if (!white_balance.isNull())
624 setWhiteBalance(white_balance.get(2).asFloat64(),white_balance.get(1).asFloat64());
647 dc1394_video_set_transmission(
m_pCamera,DC1394_OFF);
681 return Capture(0,pBuffer,
true);
690 int xdim,ydim,buffDim;
691 dc1394framerate_t maxFramerate;
698 case DC1394_VIDEO_MODE_160x120_YUV444:
702 maxFramerate=DC1394_FRAMERATE_30;
704 case DC1394_VIDEO_MODE_320x240_YUV422:
708 maxFramerate=DC1394_FRAMERATE_30;
710 case DC1394_VIDEO_MODE_640x480_YUV411:
713 buffDim=(xdim*ydim*3)/2;
714 maxFramerate=DC1394_FRAMERATE_30;
716 case DC1394_VIDEO_MODE_640x480_YUV422:
720 maxFramerate=DC1394_FRAMERATE_30;
722 case DC1394_VIDEO_MODE_640x480_RGB8:
726 maxFramerate=DC1394_FRAMERATE_30;
728 case DC1394_VIDEO_MODE_640x480_MONO8:
732 maxFramerate=DC1394_FRAMERATE_30;
734 case DC1394_VIDEO_MODE_640x480_MONO16:
738 maxFramerate=DC1394_FRAMERATE_30;
741 case DC1394_VIDEO_MODE_800x600_YUV422:
745 maxFramerate=DC1394_FRAMERATE_30;
747 case DC1394_VIDEO_MODE_800x600_RGB8:
751 maxFramerate=DC1394_FRAMERATE_15;
753 case DC1394_VIDEO_MODE_800x600_MONO8:
757 maxFramerate=DC1394_FRAMERATE_30;
759 case DC1394_VIDEO_MODE_800x600_MONO16:
763 maxFramerate=DC1394_FRAMERATE_30;
766 case DC1394_VIDEO_MODE_1024x768_YUV422:
770 maxFramerate=DC1394_FRAMERATE_15;
772 case DC1394_VIDEO_MODE_1024x768_RGB8:
776 maxFramerate=DC1394_FRAMERATE_7_5;
778 case DC1394_VIDEO_MODE_1024x768_MONO8:
782 maxFramerate=DC1394_FRAMERATE_30;
784 case DC1394_VIDEO_MODE_1024x768_MONO16:
788 maxFramerate=DC1394_FRAMERATE_15;
798 default:
return false;
805 case DC1394_VIDEO_MODE_160x120_YUV444:
809 maxFramerate=DC1394_FRAMERATE_60;
811 case DC1394_VIDEO_MODE_320x240_YUV422:
815 maxFramerate=DC1394_FRAMERATE_60;
817 case DC1394_VIDEO_MODE_640x480_YUV411:
820 buffDim=(xdim*ydim*3)/2;
821 maxFramerate=DC1394_FRAMERATE_60;
823 case DC1394_VIDEO_MODE_640x480_YUV422:
827 maxFramerate=DC1394_FRAMERATE_30;
829 case DC1394_VIDEO_MODE_640x480_RGB8:
833 maxFramerate=DC1394_FRAMERATE_30;
835 case DC1394_VIDEO_MODE_640x480_MONO8:
839 maxFramerate=DC1394_FRAMERATE_30;
841 case DC1394_VIDEO_MODE_640x480_MONO16:
845 maxFramerate=DC1394_FRAMERATE_60;
855 default:
return false;
859 dc1394speed_t isoSpeed;
862 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
865 int busSpeed=10000000<<(isoSpeed-DC1394_ISO_SPEED_MIN);
868 static const double twoCams=0.5;
869 double fpsMax=twoCams*double(busSpeed)/double(buffDim);
870 printf(
"fpsMax = %f\n",fpsMax);
872 dc1394framerate_t framerate;
882 yWarning(
"framerate %d is too high, it will be set to the maximum available\n",
m_Framerate);
889 if (fpsMax<1.785){
return false; }
890 else if (fpsMax<3.75) { framerate=DC1394_FRAMERATE_1_875; }
891 else if (fpsMax<7.5) { framerate=DC1394_FRAMERATE_3_75; }
892 else if (fpsMax<15.0) { framerate=DC1394_FRAMERATE_7_5; }
893 else if (fpsMax<30.0) { framerate=DC1394_FRAMERATE_15; }
894 else if (fpsMax<60.0) { framerate=DC1394_FRAMERATE_30; }
895 else if (fpsMax<120.0){ framerate=DC1394_FRAMERATE_60; }
896 else if (fpsMax<120.0){ framerate=DC1394_FRAMERATE_60; }
897 else if (fpsMax<240.0){ framerate=DC1394_FRAMERATE_120; }
898 else { framerate=DC1394_FRAMERATE_240; }
900 if (framerate>maxFramerate)
902 framerate=maxFramerate;
905 yDebug(
"Framerate = %f\n",1.875*
double(1<<(framerate-DC1394_FRAMERATE_MIN)));
908 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
915 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
920#define SKIP 0x80000000
927 if (newVideoMode!=DC1394_VIDEO_MODE_FORMAT7_0 || newColorCoding!=DC1394_COLOR_CODING_RAW8)
return false;
930 dc1394color_coding_t actColorCoding=DC1394_COLOR_CODING_RGB8;
931 unsigned int actPacketSize=0;
933 dc1394video_mode_t actVideoMode;
936 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
938 if (actVideoMode>=DC1394_VIDEO_MODE_FORMAT7_0 && actVideoMode<=DC1394_VIDEO_MODE_FORMAT7_2)
940 error=dc1394_format7_get_packet_size(
m_pCamera,actVideoMode,&actPacketSize);
941 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
942 error=dc1394_format7_get_color_coding(
m_pCamera,actVideoMode,&actColorCoding);
943 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
945 else if (newVideoMode==
SKIP)
947 yError(
"no format 7 mode specified\n");
954 if (newVideoMode==
SKIP)
956 newVideoMode=actVideoMode;
958 dc1394video_modes_t modes;
959 dc1394_video_get_supported_modes(
m_pCamera,&modes);
960 bool bSupported=
false;
961 for (
unsigned int m=0; m<modes.num; ++m)
963 if (modes.modes[m]==(dc1394video_mode_t)newVideoMode)
971 yError(
"format 7 video mode %d not supported\n",newVideoMode-DC1394_VIDEO_MODE_FORMAT7_MIN);
980 if (newColorCoding==
SKIP)
982 newColorCoding=actColorCoding;
984 dc1394color_codings_t codings;
985 dc1394_format7_get_color_codings(
m_pCamera,(dc1394video_mode_t)newVideoMode,&codings);
987 for (
unsigned int m=0; m<codings.num; ++m)
989 if (codings.codings[m]==(dc1394color_coding_t)newColorCoding)
997 yError(
"invalid format 7 pixel format %d\n",newColorCoding-DC1394_COLOR_CODING_MIN);
1003 unsigned int maxWidth,maxHeight,wStep,hStep,xStep,yStep;
1005 error=dc1394_format7_get_max_image_size(
m_pCamera,(dc1394video_mode_t)newVideoMode,&maxWidth,&maxHeight);
1006 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1008 error=dc1394_format7_get_unit_size(
m_pCamera,(dc1394video_mode_t)newVideoMode,&wStep,&hStep);
1009 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1011 error=dc1394_format7_get_unit_position(
m_pCamera,(dc1394video_mode_t)newVideoMode,&xStep,&yStep);
1012 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1014 if (newVideoMode==DC1394_VIDEO_MODE_FORMAT7_1)
1019 if (actVideoMode<DC1394_VIDEO_MODE_FORMAT7_0)
1021 if (newXdim==
SKIP) newXdim=(int)maxWidth;
1022 if (newYdim==
SKIP) newYdim=(int)maxHeight;
1028 unsigned int xdim,ydim,xpos,ypos;
1029 error=dc1394_format7_get_image_size(
m_pCamera,actVideoMode,&xdim,&ydim);
1030 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1031 error=dc1394_format7_get_image_position(
m_pCamera,actVideoMode,&xpos,&ypos);
1032 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1034 if (newXdim==
SKIP) newXdim=xdim;
1035 if (newYdim==
SKIP) newYdim=ydim;
1036 if (x0==
SKIP) x0=xpos;
1037 if (y0==
SKIP) y0=ypos;
1041 if (newXdim>(
int)maxWidth) newXdim=(int)maxWidth;
1042 if (newYdim>(
int)maxHeight) newYdim=(
int)maxHeight;
1044 newXdim=(newXdim/wStep)*wStep;
1045 newYdim=(newYdim/hStep)*hStep;
1048 int xOff=(maxWidth -newXdim)/2+x0;
1049 int yOff=(maxHeight-newYdim)/2+y0;
1050 xOff=(xOff/xStep)*xStep;
1051 yOff=(yOff/yStep)*yStep;
1056 if (xOff+newXdim>maxWidth) xOff=maxWidth -newXdim;
1057 if (yOff+newYdim>maxHeight) yOff=maxHeight-newYdim;
1059 error=dc1394_video_set_mode(
m_pCamera,(dc1394video_mode_t)newVideoMode);
1060 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1061 error=dc1394_format7_set_color_coding(
m_pCamera,(dc1394video_mode_t)newVideoMode,(dc1394color_coding_t)newColorCoding);
1062 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1067 if (newBandPercent<0)
1071 else if (newBandPercent>100)
1076 dc1394speed_t isoSpeed;
1078 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1081 int busBand=10000000<<(isoSpeed-DC1394_ISO_SPEED_MIN);
1082 int fpsMax=
maxFPS((dc1394video_mode_t)newVideoMode,(dc1394color_coding_t)newColorCoding);
1083 double bpp=
bytesPerPixel((dc1394color_coding_t)newColorCoding);
1084 double newBandOcc=double(fpsMax*newXdim*newYdim)*bpp;
1088 unsigned int roundUp=0;
1099 yWarning(
"framerate %d is too high, it will be set to the maximum available %d\n",
m_Framerate,fps);
1105 unsigned int bytesPerPacket,maxBytesPerPacket,unitBytesPerPacket;
1106 error=dc1394_format7_get_packet_parameters(
m_pCamera,(dc1394video_mode_t)newVideoMode,&unitBytesPerPacket,&maxBytesPerPacket);
1107 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1108 bytesPerPacket=(
unsigned int)(0.01*
double(fps)/double(fpsMax)*double(newBandPercent)*double(busBand)*double(maxBytesPerPacket)/newBandOcc);
1109 bytesPerPacket=(roundUp+bytesPerPacket/unitBytesPerPacket)*unitBytesPerPacket;
1111 if (bytesPerPacket>maxBytesPerPacket)
1113 bytesPerPacket=maxBytesPerPacket;
1115 else if (bytesPerPacket<unitBytesPerPacket)
1117 bytesPerPacket=unitBytesPerPacket;
1120 printf(
"\nfps=%d newBandOcc=%f bpp=%f bytesPerPacket=%d maxBytesPerPacket=%d\n\n",fps,newBandOcc,bpp,bytesPerPacket,maxBytesPerPacket);
1122 error=dc1394_format7_set_roi(
m_pCamera,(dc1394video_mode_t)newVideoMode,(dc1394color_coding_t)newColorCoding,bytesPerPacket,xOff,yOff,newXdim,newYdim);
1123 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1141 dc1394error_t ret=dc1394_capture_dequeue(
m_pCamera,DC1394_CAPTURE_POLICY_WAIT,&
m_pFrame);
1143 if (ret!=DC1394_SUCCESS)
1147 yWarning(
"dc1394_capture_dequeue returned %d\n\n",ret);
1151 yError(
"dc1394_capture_dequeue returned %d\n\n",ret);
1172 uint32_t v = ntohl(*((uint32_t*)
m_pFrame->image));
1173 int nSecond = (v >> 25) & 0x7f;
1174 int nCycleCount = (v >> 12) & 0x1fff;
1175 int nCycleOffset = (v >> 0) & 0xfff;
1183 m_Stamp.update(
m_SecondOffset+(
double)nSecond + (((double)nCycleCount+((
double)nCycleOffset/3072.0))/8000.0));
1192 pBuffer=pImage->getRawImage();
1195 if (
m_pFrame->color_coding==DC1394_COLOR_CODING_RGB8 || bRaw)
1199 else if (
m_pFrame->color_coding==DC1394_COLOR_CODING_RAW8)
1204 else if (
m_pFrame->color_coding==DC1394_COLOR_CODING_RAW16)
1227 m_ConvFrame.color_coding=DC1394_COLOR_CODING_RGB8;
1269 uint32_t v = ntohl(*((uint32_t*)
m_pFrame->image));
1270 int nSecond = (v >> 25) & 0x7f;
1271 int nCycleCount = (v >> 12) & 0x1fff;
1272 int nCycleOffset = (v >> 0) & 0xfff;
1280 m_Stamp.update(
m_SecondOffset+(
double)nSecond + (((double)nCycleCount+((
double)nCycleOffset/3072.0))/8000.0));
1298 int f=feature-DC1394_FEATURE_MIN;
1300 if (dVal<0.0) dVal=0.0;
1301 if (dVal>1.0) dVal=1.0;
1313 int f=feature-DC1394_FEATURE_MIN;
1317 if (dVal<0.0)
return 0.0;
1318 if (dVal>1.0)
return 1.0;
1331 feature+=DC1394_FEATURE_MIN;
1333 dc1394_feature_is_present(
m_pCamera,(dc1394feature_t)feature,&value);
1340 if (value<0.0 || value>1.0)
return false;
1342 feature+=DC1394_FEATURE_MIN;
1343 return DC1394_SUCCESS==dc1394_feature_set_value(
m_pCamera,(dc1394feature_t)feature,
NormToValue(value,feature));
1350 feature+=DC1394_FEATURE_MIN;
1352 dc1394_feature_get_value(
m_pCamera,(dc1394feature_t)feature,&iVal);
1360 feature+=DC1394_FEATURE_MIN;
1362 dc1394_feature_is_switchable(
m_pCamera,(dc1394feature_t)feature,&value);
1370 feature+=DC1394_FEATURE_MIN;
1372 if (feature==DC1394_FEATURE_EXPOSURE)
1376 dc1394_feature_set_power(
m_pCamera,DC1394_FEATURE_GAIN,DC1394_ON);
1377 dc1394_feature_set_power(
m_pCamera,DC1394_FEATURE_SHUTTER,DC1394_ON);
1391 dc1394_feature_set_mode(
m_pCamera,DC1394_FEATURE_GAIN,DC1394_FEATURE_MODE_AUTO);
1392 dc1394_feature_set_mode(
m_pCamera,DC1394_FEATURE_SHUTTER,DC1394_FEATURE_MODE_AUTO);
1409 return DC1394_SUCCESS==dc1394_feature_set_power(
m_pCamera,(dc1394feature_t)feature,onoff?DC1394_ON:DC1394_OFF);
1416 feature+=DC1394_FEATURE_MIN;
1418 dc1394_feature_get_power(
m_pCamera,(dc1394feature_t)feature,&pwr);
1426 feature+=DC1394_FEATURE_MIN;
1427 dc1394feature_modes_t modes;
1428 if (DC1394_SUCCESS!=dc1394_feature_get_modes(
m_pCamera,(dc1394feature_t)feature,&modes))
return false;
1429 for (uint32_t num=0; num<modes.num; ++num)
1431 if (modes.modes[num]==DC1394_FEATURE_MODE_MANUAL)
1443 feature+=DC1394_FEATURE_MIN;
1444 dc1394feature_modes_t modes;
1445 if (DC1394_SUCCESS!=dc1394_feature_get_modes(
m_pCamera,(dc1394feature_t)feature,&modes))
return false;
1446 for (uint32_t num=0; num<modes.num; ++num)
1448 if (modes.modes[num]==DC1394_FEATURE_MODE_AUTO)
1460 feature+=DC1394_FEATURE_MIN;
1461 dc1394feature_modes_t modes;
1462 if (DC1394_SUCCESS!=dc1394_feature_get_modes(
m_pCamera,(dc1394feature_t)feature,&modes))
return false;
1463 for (uint32_t num=0; num<modes.num; ++num)
1465 if (modes.modes[num]==DC1394_FEATURE_MODE_ONE_PUSH_AUTO)
1477 feature+=DC1394_FEATURE_MIN;
1479 return DC1394_SUCCESS==dc1394_feature_set_mode(
m_pCamera,(dc1394feature_t)feature,auto_onoff?DC1394_FEATURE_MODE_AUTO:DC1394_FEATURE_MODE_MANUAL);
1486 feature+=DC1394_FEATURE_MIN;
1487 dc1394feature_mode_t mode;
1488 dc1394_feature_get_mode(
m_pCamera,(dc1394feature_t)feature,&mode);
1489 return mode==DC1394_FEATURE_MODE_AUTO;
1496 feature+=DC1394_FEATURE_MIN;
1497 return DC1394_SUCCESS==dc1394_feature_set_mode(
m_pCamera,(dc1394feature_t)feature,DC1394_FEATURE_MODE_ONE_PUSH_AUTO);
1503 if (b<0.0 || b>1.0 || r<0.0 || r>1.0 || !
m_pCamera)
1508 return DC1394_SUCCESS==dc1394_feature_whitebalance_set_value(
m_pCamera,
1517 bool ok=DC1394_SUCCESS==dc1394_feature_whitebalance_get_value(
m_pCamera,&iB,&iR);
1532 return 1<<(DC1394_VIDEO_MODE_FORMAT7_0-DC1394_VIDEO_MODE_MIN);
1535 dc1394video_modes_t modes;
1536 dc1394_video_get_supported_modes(
m_pCamera,&modes);
1538 unsigned int mask=0;
1539 for (
unsigned int m=0; m<modes.num; ++m)
1541 mask|=1<<(modes.modes[m]-DC1394_VIDEO_MODE_MIN);
1543 yInfo(
"video mode mask: %x\n",mask);
1554 yInfo(
"SET VIDEO MODE %d\n",newVideoMode);
1565 dc1394_video_set_transmission(
m_pCamera,DC1394_OFF);
1568 dc1394video_mode_t videoModeToSet=(dc1394video_mode_t)((
int)DC1394_VIDEO_MODE_MIN+newVideoMode);
1570 if (videoModeToSet<DC1394_VIDEO_MODE_FORMAT7_MIN)
1572 yError(
"Attempting to set NON format 7\n");
1577 yError(
"Attempting to set format 7\n");
1583 yError(
"Can't set DC1394_CAPTURE_FLAGS_DEFAULT\n");
1589 if (dc1394_video_set_transmission(
m_pCamera,DC1394_ON)!=DC1394_SUCCESS)
1591 yError(
"Can't set DC1394_ON\n");
1603 dc1394video_mode_t videoMode;
1604 dc1394_video_get_mode(
m_pCamera,&videoMode);
1605 return videoMode-DC1394_VIDEO_MODE_MIN;
1613 dc1394video_mode_t videoMode;
1615 if (
manage(
error) || videoMode>=DC1394_VIDEO_MODE_FORMAT7_MIN)
1617 yError(
"LINE: %d\n",__LINE__);
1621 dc1394framerates_t fps;
1622 dc1394_video_get_supported_framerates(
m_pCamera,videoMode,&fps);
1624 unsigned int mask=0;
1625 for (
unsigned int f=0;
f<fps.num; ++
f)
1627 mask|=1<<(fps.framerates[
f]-DC1394_FRAMERATE_MIN);
1638 dc1394video_mode_t videoMode;
1640 if (
manage(
error) || videoMode>=DC1394_VIDEO_MODE_FORMAT7_MIN)
1642 yError(
"LINE: %d\n",__LINE__);
1646 dc1394framerate_t fps;
1647 dc1394_video_get_framerate(
m_pCamera,&fps);
1649 return fps-DC1394_FRAMERATE_MIN;
1657 dc1394video_mode_t videoMode;
1659 if (
manage(
error) || videoMode>=DC1394_VIDEO_MODE_FORMAT7_MIN)
1661 yError(
"LINE: %d\n",__LINE__);
1665 return DC1394_SUCCESS==dc1394_video_set_framerate(
m_pCamera,(dc1394framerate_t)((
int)fps+DC1394_FRAMERATE_MIN));
1672 dc1394speed_t speed;
1673 dc1394_video_get_iso_speed(
m_pCamera,&speed);
1674 return speed-DC1394_ISO_SPEED_MIN;
1681 return DC1394_SUCCESS==dc1394_video_set_iso_speed(
m_pCamera,(dc1394speed_t)(speed+DC1394_ISO_SPEED_MIN));
1689 if (
mRawDriver)
return 1<<(DC1394_COLOR_CODING_RAW8-DC1394_COLOR_CODING_MIN);
1691 dc1394video_mode_t vm=(dc1394video_mode_t)(videoMode+DC1394_VIDEO_MODE_MIN);
1693 if (vm<DC1394_VIDEO_MODE_FORMAT7_MIN)
return 0;
1695 dc1394color_codings_t codings;
1696 dc1394_format7_get_color_codings(
m_pCamera,vm,&codings);
1698 unsigned int mask=0;
1699 for (
unsigned int m=0; m<codings.num; ++m)
1701 mask|=1<<(codings.codings[m]-DC1394_COLOR_CODING_MIN);
1704 yInfo(
"color coding mask for video mode %d is %x\n",videoMode,mask);
1712 if (
mRawDriver)
return 1<<(DC1394_COLOR_CODING_RAW8-DC1394_COLOR_CODING_MIN);
1714 dc1394video_mode_t videoMode;
1716 if (
manage(
error) || videoMode<DC1394_VIDEO_MODE_FORMAT7_MIN)
1718 yError(
"LINE: %d\n",__LINE__);
1722 dc1394color_codings_t codings;
1723 dc1394_format7_get_color_codings(
m_pCamera,videoMode,&codings);
1725 unsigned int mask=0;
1726 for (
unsigned int m=0; m<codings.num; ++m)
1728 mask|=1<<(codings.codings[m]-DC1394_COLOR_CODING_MIN);
1731 yInfo(
"actual color coding mask %x\n",mask);
1741 dc1394video_mode_t videoMode;
1743 if (
manage(
error) || videoMode<DC1394_VIDEO_MODE_FORMAT7_MIN)
1745 yError(
"LINE: %d\n",__LINE__);
1749 dc1394color_coding_t coding;
1750 dc1394_format7_get_color_coding(
m_pCamera,videoMode,&coding);
1751 return coding-DC1394_COLOR_CODING_MIN;
1766 dc1394video_mode_t videoMode;
1768 if (
manage(
error) || videoMode<DC1394_VIDEO_MODE_FORMAT7_MIN)
1770 yError(
"LINE: %d\n",__LINE__);
1776 dc1394_video_set_transmission(
m_pCamera,DC1394_OFF);
1779 dc1394color_coding_t cc=(dc1394color_coding_t)((
int)coding+DC1394_COLOR_CODING_MIN);
1786 yError(
"Can't set DC1394_CAPTURE_FLAGS_DEFAULT\n");
1792 if (bRetVal && dc1394_video_set_transmission(
m_pCamera,DC1394_ON)!=DC1394_SUCCESS)
1794 yError(
"Can't set DC1394_ON\n");
1810 dc1394video_mode_t videoMode;
1814 yError(
"LINE: %d\n",__LINE__);
1817 xoffstep=yoffstep=2;
1821 if (videoMode<DC1394_VIDEO_MODE_FORMAT7_MIN)
1825 xoffstep=yoffstep=2;
1829 error=dc1394_format7_get_unit_size(
m_pCamera,videoMode,&xstep,&ystep);
1830 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1831 error=dc1394_format7_get_max_image_size(
m_pCamera,videoMode,&xdim,&ydim);
1832 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1833 error=dc1394_format7_get_unit_position(
m_pCamera,videoMode,&xoffstep,&yoffstep);
1834 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1849 dc1394video_mode_t videoMode;
1851 if (
manage(
error) || videoMode<DC1394_VIDEO_MODE_FORMAT7_MIN)
1853 yError(
"LINE: %d\n",__LINE__);
1858 dc1394_video_set_transmission(
m_pCamera,DC1394_OFF);
1867 yError(
"Can't set DC1394_CAPTURE_FLAGS_DEFAULT\n");
1873 if (bRetVal && dc1394_video_set_transmission(
m_pCamera,DC1394_ON)!=DC1394_SUCCESS)
1875 yError(
"Can't set DC1394_ON\n");
1892 dc1394video_mode_t actVideoMode;
1893 dc1394error_t
error;
1896 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1898 if (actVideoMode<DC1394_VIDEO_MODE_FORMAT7_MIN)
1906 unsigned int xmaxdim,ymaxdim;
1907 error=dc1394_format7_get_max_image_size(
m_pCamera,actVideoMode,&xmaxdim,&ymaxdim);
1908 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1910 unsigned int xoff,yoff;
1911 error=dc1394_format7_get_image_position(
m_pCamera,actVideoMode,&xoff,&yoff);
1912 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1914 error=dc1394_format7_get_image_size(
m_pCamera,actVideoMode,&xdim,&ydim);
1915 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
1917 x0=(int)xoff-(xmaxdim-xdim)/2;
1918 y0=(int)yoff-(ymaxdim-ydim)/2;
1935 dc1394_video_set_transmission(
m_pCamera,DC1394_OFF);
1937 dc1394_video_set_operation_mode(
m_pCamera,b1394b?DC1394_OPERATION_MODE_1394B:DC1394_OPERATION_MODE_LEGACY);
1938 dc1394_video_set_iso_speed(
m_pCamera,DC1394_ISO_SPEED_400);
1942 yError(
"Can't set DC1394_CAPTURE_FLAGS_DEFAULT\n");
1948 if (dc1394_video_set_transmission(
m_pCamera,DC1394_ON)!=DC1394_SUCCESS)
1950 yError(
"Can't set DC1394_ON\n");
1963 dc1394operation_mode_t b1394b;
1964 dc1394_video_get_operation_mode(
m_pCamera,&b1394b);
1965 return b1394b==DC1394_OPERATION_MODE_1394B;
1972 return DC1394_SUCCESS==dc1394_video_set_transmission(
m_pCamera,(dc1394switch_t)bTxON);
1979 dc1394switch_t bTxON;
1980 dc1394_video_get_transmission(
m_pCamera,&bTxON);
1991 return DC1394_SUCCESS==dc1394_camera_set_broadcast(
m_pCamera,(dc1394bool_t)onoff);
2006 bool bRetVal=DC1394_SUCCESS==dc1394_memory_load(
m_pCamera,0);
2008 dc1394video_mode_t videoMode;
2009 dc1394_video_get_mode(
m_pCamera,&videoMode);
2026 dc1394_video_set_transmission(
m_pCamera,DC1394_OFF);
2033 yError(
"Can't set DC1394_CAPTURE_FLAGS_DEFAULT\n");
2039 if (dc1394_video_set_transmission(
m_pCamera,DC1394_ON)!=DC1394_SUCCESS)
2041 yError(
"Can't set DC1394_ON\n");
2062 dc1394_camera_set_power(
m_pCamera,(dc1394switch_t)onoff);
2066 yError(
"Can't set DC1394_CAPTURE_FLAGS_DEFAULT\n");
2072 if (dc1394_video_set_transmission(
m_pCamera,DC1394_ON)!=DC1394_SUCCESS)
2074 yError(
"Can't set DC1394_ON\n");
2085 dc1394_video_set_transmission(
m_pCamera,DC1394_OFF);
2087 dc1394_camera_set_power(
m_pCamera,(dc1394switch_t)onoff);
2101 return DC1394_SUCCESS==dc1394_capture_stop(
m_pCamera);
2109 dc1394video_mode_t videoMode;
2111 if (
manage(
error) || videoMode<DC1394_VIDEO_MODE_FORMAT7_MIN)
2113 yError(
"LINE: %d\n",__LINE__);
2117 dc1394speed_t isoSpeed;
2119 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return 0; }
2122 int busBand=10000000<<(isoSpeed-DC1394_ISO_SPEED_MIN);
2124 dc1394color_coding_t colorCoding;
2125 unsigned int dummy,bytesPerPacket,xDim,yDim;
2126 error=dc1394_format7_get_roi(
m_pCamera,videoMode,&colorCoding,&bytesPerPacket,&dummy,&dummy,&xDim,&yDim);
2127 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return 0; }
2129 unsigned int maxBytesPerPacket,unitBytesPerPacket;
2130 error=dc1394_format7_get_packet_parameters(
m_pCamera,videoMode,&unitBytesPerPacket,&maxBytesPerPacket);
2131 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return 0; }
2133 int fps=
maxFPS(videoMode,colorCoding);
2135 double maxBandOcc=double(fps*xDim*yDim)*bpp;
2136 double margin=double(busBand)/maxBandOcc;
2138 int bandPercent=(int)(100.0*
double(bytesPerPacket)/(double(maxBytesPerPacket)*margin));
2140 if (bandPercent<0) bandPercent=0;
else if (bandPercent>100) bandPercent=100;
2142 return (
unsigned)bandPercent;
2155 dc1394error_t
error;
2158 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
2161 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
2165 dc1394video_mode_t videoMode;
2167 if (
manage(
error) || videoMode<DC1394_VIDEO_MODE_FORMAT7_MIN)
2169 yError(
"LINE: %d\n",__LINE__);
2173 if (newBandPercent<0)
2177 else if (newBandPercent>100)
2182 dc1394speed_t isoSpeed;
2184 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
2187 int busBand=10000000<<(isoSpeed-DC1394_ISO_SPEED_MIN);
2189 dc1394color_coding_t colorCoding;
2190 unsigned int dummy,xDim,yDim;
2191 error=dc1394_format7_get_roi(
m_pCamera,videoMode,&colorCoding,&dummy,&dummy,&dummy,&xDim,&yDim);
2192 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
2194 unsigned int maxBytesPerPacket,unitBytesPerPacket;
2195 error=dc1394_format7_get_packet_parameters(
m_pCamera,videoMode,&unitBytesPerPacket,&maxBytesPerPacket);
2196 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
2198 int fps=
maxFPS(videoMode,colorCoding);
2200 double newBandOcc=double(fps*xDim*yDim)*bpp;
2202 unsigned int bytesPerPacket=(
unsigned int)(0.01*
double(newBandPercent)*double(busBand)*double(maxBytesPerPacket)/newBandOcc);
2203 bytesPerPacket=(bytesPerPacket/unitBytesPerPacket)*unitBytesPerPacket;
2204 if (bytesPerPacket>maxBytesPerPacket)
2206 bytesPerPacket=maxBytesPerPacket;
2208 else if (bytesPerPacket<unitBytesPerPacket)
2210 bytesPerPacket=unitBytesPerPacket;
2213 printf(
"videoMode %d band percnet %d bytesPerPacket %d\n",videoMode,newBandPercent,bytesPerPacket);
2215 error=dc1394_format7_set_packet_size(
m_pCamera,videoMode,bytesPerPacket);
2216 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
2218 error=dc1394_format7_get_packet_size(
m_pCamera,videoMode,&bytesPerPacket);
2219 if (
manage(
error)) { yError(
"LINE: %d\n",__LINE__);
return false; }
2223 yError(
"Can't set DC1394_CAPTURE_FLAGS_DEFAULT\n");
2229 if (dc1394_video_set_transmission(
m_pCamera,DC1394_ON)!=DC1394_SUCCESS)
2231 yError(
"Can't set DC1394_ON\n");
2237 printf(
"bytesPerPacket %d\n",bytesPerPacket);
2244#define NOT_PRESENT -1
2249 case YARP_FEATURE_BRIGHTNESS:
return DC1394_FEATURE_BRIGHTNESS;
2250 case YARP_FEATURE_EXPOSURE:
return DC1394_FEATURE_EXPOSURE;
2251 case YARP_FEATURE_SHARPNESS:
return DC1394_FEATURE_SHARPNESS;
2252 case YARP_FEATURE_WHITE_BALANCE:
return DC1394_FEATURE_WHITE_BALANCE;
2253 case YARP_FEATURE_HUE:
return DC1394_FEATURE_HUE;
2254 case YARP_FEATURE_SATURATION:
return DC1394_FEATURE_SATURATION;
2255 case YARP_FEATURE_GAMMA:
return DC1394_FEATURE_GAMMA;
2256 case YARP_FEATURE_SHUTTER:
return DC1394_FEATURE_SHUTTER;
2257 case YARP_FEATURE_GAIN:
return DC1394_FEATURE_GAIN;
2258 case YARP_FEATURE_IRIS:
return DC1394_FEATURE_IRIS;
2259 case YARP_FEATURE_FOCUS:
return DC1394_FEATURE_FOCUS;
2260 case YARP_FEATURE_TEMPERATURE:
return DC1394_FEATURE_TEMPERATURE;
2261 case YARP_FEATURE_TRIGGER:
return DC1394_FEATURE_TRIGGER;
2262 case YARP_FEATURE_TRIGGER_DELAY:
return DC1394_FEATURE_TRIGGER_DELAY;
2263 case YARP_FEATURE_FRAME_RATE:
return DC1394_FEATURE_FRAME_RATE;
2264 case YARP_FEATURE_ZOOM:
return DC1394_FEATURE_ZOOM;
2265 case YARP_FEATURE_PAN:
return DC1394_FEATURE_PAN;
2266 case YARP_FEATURE_TILT:
return DC1394_FEATURE_TILT;
2274 if (
error!=DC1394_SUCCESS)
2276 yError(
"%d\n",
error);
2284 if (config.check(key))
2286 return config.find(key).asInt32();
2294 if (config.check(key))
2296 return config.find(key).asFloat64();
2304 if (v<0.0 || v>1.0)
return false;
2305 int feature=YARP_FEATURE_BRIGHTNESS;
2312 if (v<0.0 || v>1.0)
return false;
2313 int feature=YARP_FEATURE_EXPOSURE;
2320 if (v<0.0 || v>1.0)
return false;
2321 int feature=YARP_FEATURE_SHARPNESS;
2328 if (blue<0.0 || blue>1.0 || red<0.0 || red>1.0)
return false;
2329 int feature=YARP_FEATURE_WHITE_BALANCE;
2336 if (v<0.0 || v>1.0)
return false;
2337 int feature=YARP_FEATURE_HUE;
2344 if (v<0.0 || v>1.0)
return false;
2345 int feature=YARP_FEATURE_SATURATION;
2352 if (v<0.0 || v>1.0)
return false;
2353 int feature=YARP_FEATURE_GAMMA;
2360 if (v<0.0 || v>1.0)
return false;
2361 int feature=YARP_FEATURE_SHUTTER;
2368 if (v<0.0 || v>1.0)
return false;
2369 int feature=YARP_FEATURE_GAIN;
2376 if (v<0.0 || v>1.0)
return false;
2377 int feature=YARP_FEATURE_IRIS;
2401double CFWCamera_DR2_2::CFWCamera_DR2_2::getHue()
2403 return getFeatureDC1394(TRANSL(YARP_FEATURE_HUE));
2438 yError()<<
"CFWCamera_DR2_2: getRgbSupportedConfigurations not supported yet";
2450 yError()<<
"CFWCamera_DR2_2: setRgbResolution not supported use setVideoModeDC1394 instead";
2472 yWarning()<<
"CFWCamera_DR2_2: mirroring not supported";
2477 yWarning()<<
"CFWCamera_DR2_2: mirroring not supported";
virtual bool setResetDC1394()
virtual bool setModeDC1394(int feature, bool auto_onoff)
virtual bool setTransmissionDC1394(bool bTxON)
virtual unsigned int getISOSpeedDC1394()
bool Capture(yarp::sig::ImageOf< yarp::sig::PixelRgb > *pImage, unsigned char *pBuffer=0, bool bRaw=false)
bool CaptureRaw(unsigned char *pBuffer)
virtual unsigned int getFPSDC1394()
virtual double getSharpness()
virtual unsigned int getColorCodingDC1394()
bool SetVideoMode(dc1394video_mode_t videoMode)
uint32_t m_iMax[DC1394_FEATURE_NUM]
dc1394video_frame_t m_ConvFrame_tmp
double checkDouble(yarp::os::Searchable &config, const char *key)
virtual bool setDefaultsDC1394()
bool mUseHardwareTimestamp
virtual bool getTransmissionDC1394()
virtual int getRgbHeight()
const yarp::os::Stamp & getLastInputStamp()
uint32_t NormToValue(double &dVal, int feature)
dc1394video_frame_t m_ConvFrame
virtual bool hasFeatureDC1394(int feature)
CFWCamera_DR2_2(bool raw)
dc1394camera_t * m_pCamera
virtual bool getWhiteBalanceDC1394(double &b, double &r)
bool SetF7(int newVideoMode, int newXdim, int newYdim, int newColorCoding, int newSpeed, int x0, int y0)
virtual double getBrightness()
virtual unsigned int getVideoModeMaskDC1394()
virtual bool setPowerDC1394(bool onoff)
virtual bool setHue(double v)
virtual bool setShutter(double v)
virtual unsigned int getBytesPerPacketDC1394()
virtual bool setWhiteBalanceDC1394(double b, double r)
virtual unsigned int getVideoModeDC1394()
virtual bool setCaptureDC1394(bool bON)
virtual bool setBrightness(double v)
bool manage(dc1394error_t error)
bool CaptureImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image)
unsigned int m_ShutterSaveValue
virtual bool setFeatureDC1394(int feature, double value)
virtual bool getWhiteBalance(double &blue, double &red)
yarp::os::Property intrinsic
virtual bool hasOnePushDC1394(int feature)
double ValueToNorm(uint32_t iVal, int feature)
virtual bool setRgbFOV(double horizontalFov, double verticalFov)
virtual bool getFormat7WindowDC1394(unsigned int &xdim, unsigned int &ydim, int &x0, int &y0)
virtual bool setOperationModeDC1394(bool b1394b)
unsigned int m_GainSaveValue
virtual bool setBytesPerPacketDC1394(unsigned int bpp)
virtual unsigned int getFPSMaskDC1394()
virtual bool setRgbMirroring(bool mirror)
virtual bool getOperationModeDC1394()
virtual bool hasAutoDC1394(int feature)
dc1394feature_mode_t m_ShutterSaveModeAuto
virtual bool getRgbFOV(double &horizontalFov, double &verticalFov)
virtual bool setBroadcastDC1394(bool onoff)
virtual bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations)
dc1394feature_mode_t m_GainSaveModeAuto
virtual bool getRgbResolution(int &width, int &height)
double bytesPerPixel(dc1394color_coding_t pixelFormat)
virtual bool setExposure(double v)
virtual bool setRgbResolution(int width, int height)
dc1394video_frame_t * m_pFramePoll
virtual bool setSharpness(double v)
uint32_t m_iMin[DC1394_FEATURE_NUM]
int checkInt(yarp::os::Searchable &config, const char *key)
virtual double getExposure()
virtual bool hasManualDC1394(int feature)
virtual double getGamma()
virtual int getRgbWidth()
virtual double getFeatureDC1394(int feature)
virtual unsigned int getActualColorCodingMaskDC1394()
virtual bool getFormat7MaxWindowDC1394(unsigned int &xdim, unsigned int &ydim, unsigned int &xstep, unsigned int &ystep, unsigned int &xoffstep, unsigned int &yoffstep)
dc1394video_frame_t * m_pFrame
bool CaptureRgb(unsigned char *pBuffer)
dc1394camera_list_t * m_pCameraList
virtual bool getRgbIntrinsicParam(yarp::os::Property &intrinsic)
virtual bool setGamma(double v)
virtual bool setActiveDC1394(int feature, bool onoff)
virtual bool setIris(double v)
virtual bool setFPSDC1394(int fps)
virtual unsigned int getColorCodingMaskDC1394(unsigned int video_mode)
virtual bool hasOnOffDC1394(int feature)
virtual bool getActiveDC1394(int feature)
virtual bool setISOSpeedDC1394(int speed)
virtual bool setColorCodingDC1394(int coding)
virtual bool getModeDC1394(int feature)
virtual double getShutter()
virtual bool setFormat7WindowDC1394(unsigned int xdim, unsigned int ydim, int x0, int y0)
virtual bool setWhiteBalance(double blue, double red)
virtual bool getRgbMirroring(bool &mirror)
virtual bool setVideoModeDC1394(int video_mode)
int maxFPS(dc1394video_mode_t mode, dc1394color_coding_t pixelFormat)
virtual double getSaturation()
virtual bool setOnePushDC1394(int feature)
unsigned int m_RawBufferSize
dc1394_t * m_dc1394_handle
virtual bool setSaturation(double v)
bool Create(yarp::os::Searchable &config)
virtual bool setGain(double v)
static dc1394error_t set_embedded_timestamp(dc1394camera_t *camera, bool enable)
#define POINTGREY_REGISTER_TIMESTAMP
#define DR_BAYER16_640x480
#define DR_BAYER_1024x768