43 #include <visp3/core/vpConfig.h>
48 #if defined(VISP_HAVE_DC1394)
51 #include <visp3/core/vpFrameGrabberException.h>
52 #include <visp3/core/vpImageConvert.h>
53 #include <visp3/core/vpTime.h>
54 #include <visp3/sensor/vp1394TwoGrabber.h>
57 "MODE_160x120_YUV444",
"MODE_320x240_YUV422",
"MODE_640x480_YUV411",
"MODE_640x480_YUV422",
58 "MODE_640x480_RGB8",
"MODE_640x480_MONO8",
"MODE_640x480_MONO16",
"MODE_800x600_YUV422",
59 "MODE_800x600_RGB8",
"MODE_800x600_MONO8",
"MODE_1024x768_YUV422",
"MODE_1024x768_RGB8",
60 "MODE_1024x768_MONO8",
"MODE_800x600_MONO16",
"MODE_1024x768_MONO16",
"MODE_1280x960_YUV422",
61 "MODE_1280x960_RGB8",
"MODE_1280x960_MONO8",
"MODE_1600x1200_YUV422",
"MODE_1600x1200_RGB8",
62 "MODE_1600x1200_MONO8",
"MODE_1280x960_MONO16",
"MODE_1600x1200_MONO16",
"MODE_EXIF",
63 "MODE_FORMAT7_0",
"MODE_FORMAT7_1",
"MODE_FORMAT7_2",
"MODE_FORMAT7_3",
64 "MODE_FORMAT7_4",
"MODE_FORMAT7_5",
"MODE_FORMAT7_6",
"MODE_FORMAT7_7"};
67 "FRAMERATE_1_875",
"FRAMERATE_3_75",
"FRAMERATE_7_5",
"FRAMERATE_15",
68 "FRAMERATE_30",
"FRAMERATE_60",
"FRAMERATE_120",
"FRAMERATE_240"};
71 "COLOR_CODING_MONO8",
"COLOR_CODING_YUV411",
"COLOR_CODING_YUV422",
"COLOR_CODING_YUV444",
72 "COLOR_CODING_RGB8",
"COLOR_CODING_MONO16",
"COLOR_CODING_RGB16",
"COLOR_CODING_MONO16S",
73 "COLOR_CODING_RGB16S",
"COLOR_CODING_RAW8",
"COLOR_CODING_RAW16",
121 : camera(NULL), cameras(NULL), num_cameras(0), camera_id(0), verbose(false), camIsOpen(NULL),
123 isDataModified(NULL), initialShutterMode(NULL), dataCam(NULL)
124 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
282 if (cam_id >= num_cameras) {
284 bool is_guid =
false;
286 for (
unsigned int i = 0; i < num_cameras; i++) {
287 if (cameras[i]->guid == cam_id) {
293 if (is_guid ==
false) {
294 std::cout <<
"Error: The camera with guid 0x" << std::hex << cam_id <<
" is not present" << std::endl;
295 std::cout << num_cameras <<
" camera(s) connected" << std::endl;
296 for (
unsigned int i = 0; i < num_cameras; i++) {
297 std::cout <<
" - camera " << i <<
" with guid 0x" << std::hex << cameras[i]->guid << std::endl;
303 this->camera_id = (
unsigned int)cam_id;
309 camera = cameras[this->camera_id];
329 cam_id = this->camera_id;
354 return this->camera_id;
372 vpCTRACE <<
"No camera found..." << std::endl;
376 ncameras = num_cameras;
388 unsigned int ncameras = 0;
390 vpCTRACE <<
"No camera found..." << std::endl;
394 ncameras = num_cameras;
454 setTransmission(DC1394_OFF);
455 setCapture(DC1394_OFF);
457 if (dc1394_video_set_mode(camera, (dc1394video_mode_t)videomode) != DC1394_SUCCESS) {
462 setCapture(DC1394_ON);
463 setTransmission(DC1394_ON);
466 if (dc1394_get_image_size_from_video_mode(camera, (dc1394video_mode_t)videomode, &this->
width, &this->
height) !=
498 dc1394video_mode_t _videomode;
499 if (dc1394_video_get_mode(camera, &_videomode) != DC1394_SUCCESS) {
535 dc1394video_modes_t _videomodes;
538 if (dc1394_video_get_supported_modes(camera, &_videomodes) != DC1394_SUCCESS) {
546 for (
unsigned i = 0; i < _videomodes.num; i++) {
548 videomodes.push_back(_mode);
552 return _videomodes.num;
576 dc1394video_modes_t _videomodes;
579 if (dc1394_video_get_supported_modes(camera, &_videomodes) != DC1394_SUCCESS) {
587 for (
unsigned i = 0; i < _videomodes.num; i++) {
609 if (dc1394_is_video_mode_scalable((dc1394video_mode_t)videomode))
696 setTransmission(DC1394_OFF);
697 setCapture(DC1394_OFF);
699 if (dc1394_video_set_framerate(camera, (dc1394framerate_t)fps) != DC1394_SUCCESS) {
705 setCapture(DC1394_ON);
706 setTransmission(DC1394_ON);
732 dc1394framerate_t _fps;
733 if (dc1394_video_get_framerate(camera, &_fps) != DC1394_SUCCESS) {
800 dc1394framerates_t _fps;
801 if (dc1394_video_get_supported_framerates(camera, (dc1394video_mode_t)mode, &_fps) != DC1394_SUCCESS) {
803 vpERROR_TRACE(
"Could not query supported frametates for mode %d\n", mode);
809 for (
unsigned int i = 0; i < _fps.num; i++)
873 dc1394framerates_t _fps;
874 if (dc1394_video_get_supported_framerates(camera, (dc1394video_mode_t)mode, &_fps) != DC1394_SUCCESS) {
876 vpERROR_TRACE(
"Could not query supported frametates for mode %d\n", mode);
882 for (
unsigned int i = 0; i < _fps.num; i++) {
946 dc1394video_mode_t _videomode;
947 if (dc1394_video_get_mode(camera, &_videomode) != DC1394_SUCCESS) {
959 if (dc1394_is_video_mode_scalable(_videomode)) {
960 setTransmission(DC1394_OFF);
961 setCapture(DC1394_OFF);
963 if (dc1394_format7_set_color_coding(camera, _videomode, (dc1394color_coding_t)coding) != DC1394_SUCCESS) {
969 setCapture(DC1394_ON);
970 setTransmission(DC1394_ON);
998 dc1394video_mode_t _videomode;
999 if (dc1394_video_get_mode(camera, &_videomode) != DC1394_SUCCESS) {
1006 dc1394color_coding_t _coding;
1007 if (dc1394_is_video_mode_scalable(_videomode)) {
1009 if (dc1394_format7_get_color_coding(camera, _videomode, &_coding) != DC1394_SUCCESS) {
1015 }
else if (dc1394_is_video_mode_still_image((dc1394video_mode_t)_videomode)) {
1019 if (dc1394_get_color_coding_from_video_mode(camera, (dc1394video_mode_t)_videomode, &_coding) != DC1394_SUCCESS) {
1021 vpERROR_TRACE(
"Could not query supported color coding for mode %d\n", _videomode);
1050 std::list<vp1394TwoColorCodingType> &codings)
1061 if (dc1394_is_video_mode_scalable((dc1394video_mode_t)mode)) {
1063 dc1394color_codings_t _codings;
1064 if (dc1394_format7_get_color_codings(camera, (dc1394video_mode_t)mode, &_codings) != DC1394_SUCCESS) {
1066 vpERROR_TRACE(
"Could not query supported color codings for mode %d\n", mode);
1069 if (_codings.num == 0)
1072 for (
unsigned int i = 0; i < _codings.num; i++)
1075 return _codings.num;
1076 }
else if (dc1394_is_video_mode_still_image((dc1394video_mode_t)mode)) {
1081 dc1394color_coding_t _coding;
1082 if (dc1394_get_color_coding_from_video_mode(camera, (dc1394video_mode_t)mode, &_coding) != DC1394_SUCCESS) {
1084 vpERROR_TRACE(
"Could not query supported color coding for mode %d\n", mode);
1120 if (dc1394_is_video_mode_scalable((dc1394video_mode_t)mode)) {
1122 dc1394color_codings_t _codings;
1123 if (dc1394_format7_get_color_codings(camera, (dc1394video_mode_t)mode, &_codings) != DC1394_SUCCESS) {
1125 vpERROR_TRACE(
"Could not query supported color codings for mode %d\n", mode);
1128 if (_codings.num == 0)
1131 for (
unsigned int i = 0; i < _codings.num; i++) {
1136 }
else if (dc1394_is_video_mode_still_image((dc1394video_mode_t)mode)) {
1141 dc1394color_coding_t _coding;
1142 if (dc1394_get_color_coding_from_video_mode(camera, (dc1394video_mode_t)mode, &_coding) != DC1394_SUCCESS) {
1144 vpERROR_TRACE(
"Could not query supported color coding for mode %d\n", mode);
1195 dc1394video_mode_t _videomode;
1196 if (dc1394_video_get_mode(camera, &_videomode) != DC1394_SUCCESS) {
1202 if (dc1394_is_video_mode_scalable(_videomode)) {
1204 setTransmission(DC1394_OFF);
1205 setCapture(DC1394_OFF);
1207 unsigned int max_width, max_height;
1208 if (dc1394_format7_get_max_image_size(camera, _videomode, &max_width, &max_height) != DC1394_SUCCESS) {
1215 vpTRACE(
"left: %d top: %d width: %d height: %d", left, top,
1216 width == 0 ? DC1394_USE_MAX_AVAIL: w,
1217 height == 0 ? DC1394_USE_MAX_AVAIL : h);
1218 vpTRACE(
"max_width: %d max_height: %d", max_width, max_height);
1221 if (left > max_width) {
1225 if (top > max_height) {
1235 if (w > (max_width - left))
1236 w = (max_width - left);
1237 roi_width = (int32_t)w;
1239 roi_width = DC1394_USE_MAX_AVAIL;
1244 if (h > (max_height - top))
1245 h = (max_height - top);
1246 roi_height = (int32_t)h;
1248 roi_height = DC1394_USE_MAX_AVAIL;
1251 if (dc1394_format7_set_roi(camera, _videomode,
1252 (dc1394color_coding_t)DC1394_QUERY_FROM_CAMERA,
1253 DC1394_USE_MAX_AVAIL
1257 roi_width, roi_height) != DC1394_SUCCESS) {
1263 if (dc1394_format7_get_image_size(camera, _videomode, &this->
width, &this->
height) != DC1394_SUCCESS) {
1269 setCapture(DC1394_ON);
1270 setTransmission(DC1394_ON);
1287 void vp1394TwoGrabber::initialize(
bool reset)
1289 if (
init ==
false) {
1291 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
1296 if (dc1394_camera_enumerate(d, &list) != DC1394_SUCCESS) {
1297 dc1394_camera_free_list(list);
1303 if (list->num == 0) {
1304 dc1394_camera_free_list(list);
1310 if (cameras != NULL)
1313 cameras =
new dc1394camera_t *[list->num];
1317 for (
unsigned int i = 0; i < list->num; i++) {
1318 cameras[i] = dc1394_camera_new(d, list->ids[i].guid);
1320 vpTRACE(
"Failed to initialize camera with guid \"%ld\"\n", list->ids[i].guid);
1331 dc1394_reset_bus(cameras[0]);
1335 dc1394_camera_free_list(list);
1338 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
1339 if (cameras != NULL)
1342 int err = dc1394_find_cameras(&cameras, &num_cameras);
1344 if (err != DC1394_SUCCESS && err != DC1394_NO_CAMERA) {
1348 " - if the kernel modules `ieee1394',`raw1394' and "
1349 "`ohci1394' are loaded \n"
1350 " - if you have read/write access to /dev/raw1394\n\n");
1355 if (num_cameras == 0) {
1362 isDataModified =
new bool[num_cameras];
1363 for (
unsigned int i = 0; i < num_cameras; i++)
1364 isDataModified[i] =
false;
1365 initialShutterMode =
new dc1394feature_mode_t[num_cameras];
1366 dataCam =
new vpDc1394TwoCameraParametersData[num_cameras];
1368 if (camera_id >= num_cameras) {
1377 std::cout <<
"------ Bus information ------" << std::endl;
1378 std::cout <<
"Number of camera(s) on the bus : " << num_cameras << std::endl;
1379 std::cout <<
"-----------------------------" << std::endl;
1382 if (camIsOpen != NULL)
1384 camIsOpen =
new bool[num_cameras];
1385 for (
unsigned int i = 0; i < num_cameras; i++) {
1386 camIsOpen[i] =
false;
1405 if (camIsOpen[camera_id] ==
false) {
1406 dc1394switch_t status = DC1394_OFF;
1410 dc1394_video_get_transmission(cameras[camera_id], &status);
1411 if (status != DC1394_OFF) {
1413 if (dc1394_video_set_transmission(cameras[camera_id], DC1394_OFF) != DC1394_SUCCESS)
1414 vpTRACE(
"Could not stop ISO transmission");
1417 if (dc1394_video_get_transmission(cameras[camera_id], &status) != DC1394_SUCCESS)
1418 vpTRACE(
"Could get ISO status");
1420 if (status == DC1394_ON) {
1421 vpTRACE(
"ISO transmission refuses to stop");
1423 #ifdef VISP_HAVE_DC1394_FIND_CAMERAS
1425 cameras[camera_id]->is_iso_on = status;
1435 setCapture(DC1394_ON);
1436 setTransmission(DC1394_ON);
1437 camIsOpen[camera_id] =
true;
1452 for (
unsigned int i = 0; i < num_cameras; i++) {
1454 camera = cameras[i];
1455 this->camera_id = i;
1456 setTransmission(DC1394_OFF);
1457 setCapture(DC1394_OFF);
1458 if (isDataModified[i]) {
1461 updateDataStructToCam();
1465 if (dc1394_feature_set_mode(camera, DC1394_FEATURE_BRIGHTNESS, initialShutterMode[i]) != DC1394_SUCCESS ||
1466 dc1394_feature_set_mode(camera, DC1394_FEATURE_EXPOSURE, initialShutterMode[i]) != DC1394_SUCCESS ||
1467 dc1394_feature_set_mode(camera, DC1394_FEATURE_SHARPNESS, initialShutterMode[i]) != DC1394_SUCCESS ||
1468 dc1394_feature_set_mode(camera, DC1394_FEATURE_HUE, initialShutterMode[i]) != DC1394_SUCCESS ||
1469 dc1394_feature_set_mode(camera, DC1394_FEATURE_SATURATION, initialShutterMode[i]) != DC1394_SUCCESS ||
1470 dc1394_feature_set_mode(camera, DC1394_FEATURE_GAMMA, initialShutterMode[i]) != DC1394_SUCCESS ||
1471 dc1394_feature_set_mode(camera, DC1394_FEATURE_SHUTTER, initialShutterMode[i]) != DC1394_SUCCESS ||
1472 dc1394_feature_set_mode(camera, DC1394_FEATURE_GAIN, initialShutterMode[i]) != DC1394_SUCCESS ||
1473 dc1394_feature_set_mode(camera, DC1394_FEATURE_IRIS, initialShutterMode[i])) {
1479 if (dc1394_camera_set_power(camera, DC1394_OFF) != DC1394_SUCCESS)
1480 std::cout <<
"Unable to turn camera off" << std::endl;
1482 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
1483 dc1394_camera_free(cameras[i]);
1484 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
1485 dc1394_free_camera(cameras[i]);
1489 if (camIsOpen != NULL) {
1494 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
1495 if (cameras != NULL) {
1504 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
1505 if (cameras != NULL) {
1515 if (isDataModified != NULL) {
1516 delete[] isDataModified;
1517 isDataModified = NULL;
1519 if (initialShutterMode != NULL) {
1520 delete[] initialShutterMode;
1521 initialShutterMode = NULL;
1523 if (dataCam != NULL) {
1551 if (size != num_buffers) {
1554 if (camIsOpen[camera_id]) {
1555 setCapture(DC1394_OFF);
1556 setCapture(DC1394_ON);
1618 dc1394feature_mode_t mode;
1620 mode = DC1394_FEATURE_MODE_AUTO;
1622 mode = DC1394_FEATURE_MODE_MANUAL;
1625 if (dc1394_feature_set_power(camera, DC1394_FEATURE_SHUTTER, DC1394_ON) != DC1394_SUCCESS) {
1631 if (dc1394_feature_set_mode(camera, DC1394_FEATURE_SHUTTER, mode) != DC1394_SUCCESS) {
1680 if (dc1394_avt_set_auto_shutter(camera, minvalue, maxvalue) != DC1394_SUCCESS) {
1708 if (dc1394_avt_get_auto_shutter(camera, &minvalue, &maxvalue) != DC1394_SUCCESS) {
1762 dc1394feature_mode_t mode;
1764 mode = DC1394_FEATURE_MODE_AUTO;
1766 mode = DC1394_FEATURE_MODE_MANUAL;
1769 if (dc1394_feature_set_power(camera, DC1394_FEATURE_GAIN, DC1394_ON) != DC1394_SUCCESS) {
1775 if (dc1394_feature_set_mode(camera, DC1394_FEATURE_GAIN, mode) != DC1394_SUCCESS) {
1824 if (dc1394_avt_set_auto_gain(camera, minvalue, maxvalue) != DC1394_SUCCESS) {
1852 if (dc1394_avt_get_auto_gain(camera, &minvalue, &maxvalue) != DC1394_SUCCESS) {
1877 void vp1394TwoGrabber::setCapture(dc1394switch_t _switch)
1885 if (_switch == DC1394_ON) {
1888 if (dc1394_capture_setup(camera, num_buffers, DC1394_CAPTURE_FLAGS_DEFAULT) != DC1394_SUCCESS) {
1890 "make sure that the video mode and framerate are "
1891 "supported by your camera.\n");
1896 dc1394error_t code = dc1394_capture_stop(camera);
1898 if (code != DC1394_SUCCESS && code != DC1394_CAPTURE_IS_NOT_SET) {
1920 void vp1394TwoGrabber::setTransmission(dc1394switch_t _switch)
1928 dc1394switch_t status = DC1394_OFF;
1930 if (dc1394_video_get_transmission(camera, &status) != DC1394_SUCCESS) {
1938 if (dc1394_video_set_transmission(camera, _switch) != DC1394_SUCCESS) {
1940 "make sure that the video mode and framerate are "
1941 "supported by your camera.\n");
1946 if (_switch == DC1394_ON) {
1947 status = DC1394_OFF;
1950 while (status == DC1394_OFF && i++ < 5) {
1952 if (dc1394_video_get_transmission(camera, &status) != DC1394_SUCCESS) {
2003 dc1394operation_mode_t op_mode;
2004 dc1394speed_t speed;
2008 if (camera->bmode_capable != DC1394_TRUE) {
2013 if (dc1394_video_set_operation_mode(camera, DC1394_OPERATION_MODE_1394B) != DC1394_SUCCESS) {
2018 if (dc1394_video_get_operation_mode(camera, &op_mode) != DC1394_SUCCESS) {
2023 if (dc1394_video_set_operation_mode(camera, DC1394_OPERATION_MODE_LEGACY) != DC1394_SUCCESS) {
2028 if (dc1394_video_get_operation_mode(camera, &op_mode) != DC1394_SUCCESS) {
2034 if (dc1394_video_set_iso_speed(camera, (dc1394speed_t)isospeed) != DC1394_SUCCESS) {
2039 if (dc1394_video_get_iso_speed(camera, &speed) != DC1394_SUCCESS) {
2123 dc1394video_frame_t *frame = NULL;
2125 if (dc1394_capture_dequeue(camera, DC1394_CAPTURE_POLICY_WAIT, &frame) != DC1394_SUCCESS) {
2126 vpERROR_TRACE(
"Error: Failed to capture from camera %d\n", camera_id);
2177 dc1394video_frame_t *frame;
2179 frame =
dequeue(I, timestamp,
id);
2236 dc1394video_frame_t *frame;
2242 timestamp = frame->timestamp;
2245 this->
width = frame->size[0];
2246 this->
height = frame->size[1];
2252 switch (frame->color_coding) {
2253 case DC1394_COLOR_CODING_MONO8:
2254 case DC1394_COLOR_CODING_RAW8:
2255 memcpy(I.
bitmap, (
unsigned char *)frame->image, size *
sizeof(
unsigned char));
2257 case DC1394_COLOR_CODING_MONO16:
2258 case DC1394_COLOR_CODING_RAW16:
2262 case DC1394_COLOR_CODING_YUV411:
2266 case DC1394_COLOR_CODING_YUV422:
2270 case DC1394_COLOR_CODING_YUV444:
2274 case DC1394_COLOR_CODING_RGB8:
2280 vpERROR_TRACE(
"Format conversion not implemented. Acquisition failed.");
2282 "Acquisition failed."));
2332 dc1394video_frame_t *frame;
2334 frame =
dequeue(I, timestamp,
id);
2391 dc1394video_frame_t *frame;
2397 timestamp = frame->timestamp;
2400 this->
width = frame->size[0];
2401 this->
height = frame->size[1];
2407 switch (frame->color_coding) {
2408 case DC1394_COLOR_CODING_MONO8:
2409 case DC1394_COLOR_CODING_RAW8:
2413 case DC1394_COLOR_CODING_MONO16:
2414 case DC1394_COLOR_CODING_RAW16:
2418 case DC1394_COLOR_CODING_YUV411:
2422 case DC1394_COLOR_CODING_YUV422:
2426 case DC1394_COLOR_CODING_YUV444:
2430 case DC1394_COLOR_CODING_RGB8:
2436 vpERROR_TRACE(
"Format conversion not implemented. Acquisition failed.");
2438 "Acquisition failed."));
2464 dc1394_capture_enqueue(camera, frame);
2485 dc1394video_frame_t *frame;
2487 frame =
dequeue(I, timestamp,
id);
2511 dc1394video_frame_t *frame;
2514 frame =
dequeue(I, timestamp,
id);
2535 dc1394video_frame_t *frame;
2538 frame =
dequeue(I, timestamp,
id);
2562 dc1394video_frame_t *frame;
2568 timestamp = frame->timestamp;
2571 this->
width = frame->size[0];
2572 this->
height = frame->size[1];
2578 switch (frame->color_coding) {
2579 case DC1394_COLOR_CODING_MONO8:
2580 case DC1394_COLOR_CODING_RAW8:
2584 case DC1394_COLOR_CODING_YUV411:
2588 case DC1394_COLOR_CODING_YUV422:
2592 case DC1394_COLOR_CODING_YUV444:
2596 case DC1394_COLOR_CODING_RGB8:
2602 vpERROR_TRACE(
"Format conversion not implemented. Acquisition failed.");
2604 "Acquisition failed."));
2727 std::cout <<
"----------------------------------------------------------" << std::endl
2728 <<
"----- Information for camera " << camera_id <<
" -----" << std::endl
2729 <<
"----------------------------------------------------------" << std::endl;
2731 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
2732 dc1394_camera_print_info(camera, stdout);
2733 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
2734 dc1394_print_camera_info(camera);
2737 dc1394featureset_t features;
2738 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
2739 if (dc1394_feature_get_all(camera, &features) != DC1394_SUCCESS)
2740 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
2741 if (dc1394_get_camera_feature_set(camera, &features) != DC1394_SUCCESS)
2745 vpERROR_TRACE(
"unable to get feature set for camera %d\n", camera_id);
2749 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
2750 dc1394_feature_print_all(&features, stdout);
2751 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
2752 dc1394_print_feature_set(&features);
2755 std::cout <<
"----------------------------------------------------------" << std::endl;
2772 std::string _str =
"";
2773 dc1394video_mode_t _videomode = (dc1394video_mode_t)videomode;
2775 if ((_videomode >= DC1394_VIDEO_MODE_MIN) && (_videomode <= DC1394_VIDEO_MODE_MAX)) {
2776 _str =
strVideoMode[_videomode - DC1394_VIDEO_MODE_MIN];
2778 vpCERROR <<
"The video mode " << (int)videomode <<
" is not supported by the camera" << std::endl;
2798 std::string _str =
"";
2799 dc1394framerate_t _fps = (dc1394framerate_t)fps;
2801 if ((_fps >= DC1394_FRAMERATE_MIN) && (_fps <= DC1394_FRAMERATE_MAX)) {
2804 vpCERROR <<
"The framerate " << (int)fps <<
" is not supported by the camera" << std::endl;
2824 std::string _str =
"";
2825 dc1394color_coding_t _coding = (dc1394color_coding_t)colorcoding;
2827 if ((_coding >= DC1394_COLOR_CODING_MIN) && (_coding <= DC1394_COLOR_CODING_MAX)) {
2831 vpCERROR <<
"The color coding " << (int)colorcoding <<
" is not supported by the camera" << std::endl;
2858 for (
int i = DC1394_VIDEO_MODE_MIN; i <= DC1394_VIDEO_MODE_MAX; i++) {
2890 for (
int i = DC1394_FRAMERATE_MIN; i <= DC1394_FRAMERATE_MAX; i++) {
2922 for (
int i = DC1394_COLOR_CODING_MIN; i <= DC1394_COLOR_CODING_MAX; i++) {
2966 for (
unsigned int i = 0; i < num_cameras; i++) {
2968 camera = cameras[i];
2969 setTransmission(DC1394_OFF);
2970 setCapture(DC1394_OFF);
2973 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
2976 for (
unsigned int i = 0; i < num_cameras; i++) {
2978 dc1394_camera_free(cameras[i]);
2981 printf(
"Resetting bus...\n");
2982 dc1394_reset_bus(camera);
2984 dc1394_camera_free(camera);
2990 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
2994 for (
unsigned int i = 0; i < num_cameras; i++) {
2996 dc1394_free_camera(cameras[i]);
3001 dc1394_reset_bus(camera);
3002 dc1394_free_camera(camera);
3005 if (camIsOpen != NULL)
3054 uint64_t offset = 0x884;
3055 uint32_t value = 0x82000000 + (uint32_t)panControlValue;
3057 err = dc1394_set_control_register(camera, offset, value);
3058 if (err != DC1394_SUCCESS) {
3090 dc1394feature_t feature = DC1394_FEATURE_BRIGHTNESS;
3093 feature = DC1394_FEATURE_BRIGHTNESS;
3096 feature = DC1394_FEATURE_EXPOSURE;
3099 feature = DC1394_FEATURE_SHARPNESS;
3103 feature = DC1394_FEATURE_HUE;
3106 feature = DC1394_FEATURE_SATURATION;
3109 feature = DC1394_FEATURE_GAMMA;
3112 feature = DC1394_FEATURE_SHUTTER;
3115 feature = DC1394_FEATURE_GAIN;
3118 feature = DC1394_FEATURE_IRIS;
3135 err = dc1394_feature_get_value(camera, feature, &value);
3136 if (err != DC1394_SUCCESS) {
3141 return (
unsigned int)value;
3172 uint32_t value = (uint32_t)val;
3173 dc1394feature_t feature = DC1394_FEATURE_BRIGHTNESS;
3176 feature = DC1394_FEATURE_BRIGHTNESS;
3179 feature = DC1394_FEATURE_EXPOSURE;
3182 feature = DC1394_FEATURE_SHARPNESS;
3186 feature = DC1394_FEATURE_HUE;
3189 feature = DC1394_FEATURE_SATURATION;
3192 feature = DC1394_FEATURE_GAMMA;
3195 feature = DC1394_FEATURE_SHUTTER;
3198 feature = DC1394_FEATURE_GAIN;
3201 feature = DC1394_FEATURE_IRIS;
3218 dc1394bool_t hasManualMode = DC1394_FALSE;
3219 dc1394feature_modes_t modesAvailable;
3222 err = dc1394_feature_get_modes(camera, feature, &modesAvailable);
3223 if (err != DC1394_SUCCESS) {
3224 vpERROR_TRACE(
"Unable to detect the manual mode information");
3230 for (
unsigned int i = 0; i < modesAvailable.num; i++) {
3231 if (modesAvailable.modes[i] == DC1394_FEATURE_MODE_MANUAL) {
3232 hasManualMode = DC1394_TRUE;
3236 if (hasManualMode == DC1394_TRUE) {
3238 if (!isDataModified[camera_id]) {
3241 updateDataCamToStruct();
3242 err = dc1394_feature_get_mode(camera, feature, &(initialShutterMode[camera_id]));
3243 if (err != DC1394_SUCCESS) {
3248 isDataModified[camera_id] =
true;
3251 dc1394feature_mode_t manualMode = DC1394_FEATURE_MODE_MANUAL;
3252 err = dc1394_feature_set_mode(camera, feature, manualMode);
3253 if (err != DC1394_SUCCESS) {
3258 err = dc1394_feature_set_value(camera, feature, value);
3259 if (err != DC1394_SUCCESS) {
3265 vpERROR_TRACE(
"The camera does not have a manual mode.\nCannot change the value");
3284 guid = camera->guid;
3302 return camera->guid;
3309 inline void vp1394TwoGrabber::updateDataCamToStruct()
3326 inline void vp1394TwoGrabber::updateDataStructToCam()
3383 #elif !defined(VISP_BUILD_SHARED_LIBS)
3386 void dummy_vp1394TwoGrabber(){};
Class for firewire ieee1394 video devices using libdc1394-2.x api.
void setAutoShutter(bool enable=true)
static const char * strColorCoding[DC1394_COLOR_CODING_NUM]
void getVideoMode(vp1394TwoVideoModeType &videomode)
void setAutoGain(bool enable=true)
void setParameterValue(vp1394TwoParametersType param, unsigned int val)
static std::string colorCoding2string(vp1394TwoColorCodingType colorcoding)
void setRingBufferSize(unsigned int size)
void getFramerate(vp1394TwoFramerateType &fps)
uint32_t getFramerateSupported(vp1394TwoVideoModeType videomode, std::list< vp1394TwoFramerateType > &fps)
void acquire(vpImage< unsigned char > &I)
void setPanControl(unsigned int panControlValue)
static vp1394TwoColorCodingType string2colorCoding(std::string colorcoding)
static vp1394TwoVideoModeType string2videoMode(std::string videomode)
void setColorCoding(vp1394TwoColorCodingType coding)
bool isVideoModeFormat7(vp1394TwoVideoModeType videomode)
void setVideoMode(vp1394TwoVideoModeType videomode)
unsigned int getRingBufferSize() const
void setFormat7ROI(unsigned int left=0, unsigned int top=0, unsigned int width=0, unsigned int height=0)
void getAutoShutter(unsigned int &minvalue, unsigned int &maxvalue)
unsigned int getNumCameras() const
void setCamera(uint64_t camera)
static vp1394TwoFramerateType string2framerate(std::string fps)
void enqueue(dc1394video_frame_t *frame)
vp1394TwoGrabber & operator>>(vpImage< unsigned char > &I)
unsigned int getParameterValue(vp1394TwoParametersType param)
void getAutoGain(unsigned int &minvalue, unsigned int &maxvalue)
void getColorCoding(vp1394TwoColorCodingType &coding)
void setIsoTransmissionSpeed(vp1394TwoIsoSpeedType isospeed)
uint32_t getColorCodingSupported(vp1394TwoVideoModeType videomode, std::list< vp1394TwoColorCodingType > &codings)
virtual ~vp1394TwoGrabber()
void setFramerate(vp1394TwoFramerateType fps)
static std::string framerate2string(vp1394TwoFramerateType fps)
bool isColorCodingSupported(vp1394TwoVideoModeType videomode, vp1394TwoColorCodingType coding)
bool isFramerateSupported(vp1394TwoVideoModeType videomode, vp1394TwoFramerateType fps)
dc1394video_frame_t * dequeue()
static std::string videoMode2string(vp1394TwoVideoModeType videomode)
static const char * strVideoMode[DC1394_VIDEO_MODE_NUM]
vp1394TwoGrabber(bool reset=true)
bool isVideoModeSupported(vp1394TwoVideoModeType videomode)
uint32_t getVideoModeSupported(std::list< vp1394TwoVideoModeType > &videomodes)
void open(vpImage< unsigned char > &I)
static const char * strFramerate[DC1394_FRAMERATE_NUM]
Error that can be emitted by the vpFrameGrabber class and its derivates.
@ settingError
Grabber settings error.
@ initializationError
Grabber initialization error.
@ otherError
Grabber returned an other error.
unsigned int height
Number of rows in the image.
bool init
Set to true if the frame grabber has been initialized.
unsigned int width
Number of columns in the image.
static void YUV411ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void MONO16ToGrey(unsigned char *grey16, unsigned char *grey, unsigned int size)
static void YUV422ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void YUV411ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void GreyToRGBa(unsigned char *grey, unsigned char *rgba, unsigned int width, unsigned int height)
static void MONO16ToRGBa(unsigned char *grey16, unsigned char *rgba, unsigned int size)
static void RGBToGrey(unsigned char *rgb, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false)
static void RGBToRGBa(unsigned char *rgb, unsigned char *rgba, unsigned int size)
static void YUV422ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void YUV444ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void YUV444ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
unsigned int getWidth() const
void resize(unsigned int h, unsigned int w)
resize the image : Image initialization
Type * bitmap
points toward the bitmap
unsigned int getHeight() const
VISP_EXPORT int wait(double t0, double t)