46 #include <visp3/core/vpConfig.h>
51 #if defined(VISP_HAVE_DC1394)
54 #include <visp3/core/vpFrameGrabberException.h>
55 #include <visp3/core/vpImageConvert.h>
56 #include <visp3/core/vpTime.h>
57 #include <visp3/sensor/vp1394TwoGrabber.h>
60 "MODE_160x120_YUV444",
"MODE_320x240_YUV422",
"MODE_640x480_YUV411",
"MODE_640x480_YUV422",
61 "MODE_640x480_RGB8",
"MODE_640x480_MONO8",
"MODE_640x480_MONO16",
"MODE_800x600_YUV422",
62 "MODE_800x600_RGB8",
"MODE_800x600_MONO8",
"MODE_1024x768_YUV422",
"MODE_1024x768_RGB8",
63 "MODE_1024x768_MONO8",
"MODE_800x600_MONO16",
"MODE_1024x768_MONO16",
"MODE_1280x960_YUV422",
64 "MODE_1280x960_RGB8",
"MODE_1280x960_MONO8",
"MODE_1600x1200_YUV422",
"MODE_1600x1200_RGB8",
65 "MODE_1600x1200_MONO8",
"MODE_1280x960_MONO16",
"MODE_1600x1200_MONO16",
"MODE_EXIF",
66 "MODE_FORMAT7_0",
"MODE_FORMAT7_1",
"MODE_FORMAT7_2",
"MODE_FORMAT7_3",
67 "MODE_FORMAT7_4",
"MODE_FORMAT7_5",
"MODE_FORMAT7_6",
"MODE_FORMAT7_7"};
70 "FRAMERATE_1_875",
"FRAMERATE_3_75",
"FRAMERATE_7_5",
"FRAMERATE_15",
71 "FRAMERATE_30",
"FRAMERATE_60",
"FRAMERATE_120",
"FRAMERATE_240"};
74 "COLOR_CODING_MONO8",
"COLOR_CODING_YUV411",
"COLOR_CODING_YUV422",
"COLOR_CODING_YUV444",
75 "COLOR_CODING_RGB8",
"COLOR_CODING_MONO16",
"COLOR_CODING_RGB16",
"COLOR_CODING_MONO16S",
76 "COLOR_CODING_RGB16S",
"COLOR_CODING_RAW8",
"COLOR_CODING_RAW16",
124 : camera(NULL), cameras(NULL), num_cameras(0), camera_id(0), verbose(false), camIsOpen(NULL),
126 isDataModified(NULL), initialShutterMode(NULL), dataCam(NULL)
127 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
285 if (cam_id >= num_cameras) {
287 bool is_guid =
false;
289 for (
unsigned int i = 0; i < num_cameras; i++) {
290 if (cameras[i]->guid == cam_id) {
296 if (is_guid ==
false) {
297 std::cout <<
"Error: The camera with guid 0x" << std::hex << cam_id <<
" is not present" << std::endl;
298 std::cout << num_cameras <<
" camera(s) connected" << std::endl;
299 for (
unsigned int i = 0; i < num_cameras; i++) {
300 std::cout <<
" - camera " << i <<
" with guid 0x" << std::hex << cameras[i]->guid << std::endl;
306 this->camera_id = (
unsigned int)cam_id;
312 camera = cameras[this->camera_id];
332 cam_id = this->camera_id;
357 return this->camera_id;
375 vpCTRACE <<
"No camera found..." << std::endl;
379 ncameras = num_cameras;
391 unsigned int ncameras = 0;
393 vpCTRACE <<
"No camera found..." << std::endl;
397 ncameras = num_cameras;
457 setTransmission(DC1394_OFF);
458 setCapture(DC1394_OFF);
460 if (dc1394_video_set_mode(camera, (dc1394video_mode_t)videomode) != DC1394_SUCCESS) {
465 setCapture(DC1394_ON);
466 setTransmission(DC1394_ON);
469 if (dc1394_get_image_size_from_video_mode(camera, (dc1394video_mode_t)videomode, &this->
width, &this->
height) !=
501 dc1394video_mode_t _videomode;
502 if (dc1394_video_get_mode(camera, &_videomode) != DC1394_SUCCESS) {
538 dc1394video_modes_t _videomodes;
541 if (dc1394_video_get_supported_modes(camera, &_videomodes) != DC1394_SUCCESS) {
549 for (
unsigned i = 0; i < _videomodes.num; i++) {
551 videomodes.push_back(_mode);
555 return _videomodes.num;
579 dc1394video_modes_t _videomodes;
582 if (dc1394_video_get_supported_modes(camera, &_videomodes) != DC1394_SUCCESS) {
590 for (
unsigned i = 0; i < _videomodes.num; i++) {
612 if (dc1394_is_video_mode_scalable((dc1394video_mode_t)videomode))
699 setTransmission(DC1394_OFF);
700 setCapture(DC1394_OFF);
702 if (dc1394_video_set_framerate(camera, (dc1394framerate_t)fps) != DC1394_SUCCESS) {
708 setCapture(DC1394_ON);
709 setTransmission(DC1394_ON);
735 dc1394framerate_t _fps;
736 if (dc1394_video_get_framerate(camera, &_fps) != DC1394_SUCCESS) {
803 dc1394framerates_t _fps;
804 if (dc1394_video_get_supported_framerates(camera, (dc1394video_mode_t)mode, &_fps) != DC1394_SUCCESS) {
806 vpERROR_TRACE(
"Could not query supported frametates for mode %d\n", mode);
812 for (
unsigned int i = 0; i < _fps.num; i++)
876 dc1394framerates_t _fps;
877 if (dc1394_video_get_supported_framerates(camera, (dc1394video_mode_t)mode, &_fps) != DC1394_SUCCESS) {
879 vpERROR_TRACE(
"Could not query supported frametates for mode %d\n", mode);
885 for (
unsigned int i = 0; i < _fps.num; i++) {
949 dc1394video_mode_t _videomode;
950 if (dc1394_video_get_mode(camera, &_videomode) != DC1394_SUCCESS) {
962 if (dc1394_is_video_mode_scalable(_videomode)) {
963 setTransmission(DC1394_OFF);
964 setCapture(DC1394_OFF);
966 if (dc1394_format7_set_color_coding(camera, _videomode, (dc1394color_coding_t)coding) != DC1394_SUCCESS) {
972 setCapture(DC1394_ON);
973 setTransmission(DC1394_ON);
1001 dc1394video_mode_t _videomode;
1002 if (dc1394_video_get_mode(camera, &_videomode) != DC1394_SUCCESS) {
1009 dc1394color_coding_t _coding;
1010 if (dc1394_is_video_mode_scalable(_videomode)) {
1012 if (dc1394_format7_get_color_coding(camera, _videomode, &_coding) != DC1394_SUCCESS) {
1018 }
else if (dc1394_is_video_mode_still_image((dc1394video_mode_t)_videomode)) {
1022 if (dc1394_get_color_coding_from_video_mode(camera, (dc1394video_mode_t)_videomode, &_coding) != DC1394_SUCCESS) {
1024 vpERROR_TRACE(
"Could not query supported color coding for mode %d\n", _videomode);
1053 std::list<vp1394TwoColorCodingType> &codings)
1064 if (dc1394_is_video_mode_scalable((dc1394video_mode_t)mode)) {
1066 dc1394color_codings_t _codings;
1067 if (dc1394_format7_get_color_codings(camera, (dc1394video_mode_t)mode, &_codings) != DC1394_SUCCESS) {
1069 vpERROR_TRACE(
"Could not query supported color codings for mode %d\n", mode);
1072 if (_codings.num == 0)
1075 for (
unsigned int i = 0; i < _codings.num; i++)
1078 return _codings.num;
1079 }
else if (dc1394_is_video_mode_still_image((dc1394video_mode_t)mode)) {
1084 dc1394color_coding_t _coding;
1085 if (dc1394_get_color_coding_from_video_mode(camera, (dc1394video_mode_t)mode, &_coding) != DC1394_SUCCESS) {
1087 vpERROR_TRACE(
"Could not query supported color coding for mode %d\n", mode);
1123 if (dc1394_is_video_mode_scalable((dc1394video_mode_t)mode)) {
1125 dc1394color_codings_t _codings;
1126 if (dc1394_format7_get_color_codings(camera, (dc1394video_mode_t)mode, &_codings) != DC1394_SUCCESS) {
1128 vpERROR_TRACE(
"Could not query supported color codings for mode %d\n", mode);
1131 if (_codings.num == 0)
1134 for (
unsigned int i = 0; i < _codings.num; i++) {
1139 }
else if (dc1394_is_video_mode_still_image((dc1394video_mode_t)mode)) {
1144 dc1394color_coding_t _coding;
1145 if (dc1394_get_color_coding_from_video_mode(camera, (dc1394video_mode_t)mode, &_coding) != DC1394_SUCCESS) {
1147 vpERROR_TRACE(
"Could not query supported color coding for mode %d\n", mode);
1198 dc1394video_mode_t _videomode;
1199 if (dc1394_video_get_mode(camera, &_videomode) != DC1394_SUCCESS) {
1205 if (dc1394_is_video_mode_scalable(_videomode)) {
1207 setTransmission(DC1394_OFF);
1208 setCapture(DC1394_OFF);
1210 unsigned int max_width, max_height;
1211 if (dc1394_format7_get_max_image_size(camera, _videomode, &max_width, &max_height) != DC1394_SUCCESS) {
1218 vpTRACE(
"left: %d top: %d width: %d height: %d", left, top,
1219 width == 0 ? DC1394_USE_MAX_AVAIL: w,
1220 height == 0 ? DC1394_USE_MAX_AVAIL : h);
1221 vpTRACE(
"max_width: %d max_height: %d", max_width, max_height);
1224 if (left > max_width) {
1228 if (top > max_height) {
1238 if (w > (max_width - left))
1239 w = (max_width - left);
1240 roi_width = (int32_t)w;
1242 roi_width = DC1394_USE_MAX_AVAIL;
1247 if (h > (max_height - top))
1248 h = (max_height - top);
1249 roi_height = (int32_t)h;
1251 roi_height = DC1394_USE_MAX_AVAIL;
1254 if (dc1394_format7_set_roi(camera, _videomode,
1255 (dc1394color_coding_t)DC1394_QUERY_FROM_CAMERA,
1256 DC1394_USE_MAX_AVAIL
1260 roi_width, roi_height) != DC1394_SUCCESS) {
1266 if (dc1394_format7_get_image_size(camera, _videomode, &this->
width, &this->
height) != DC1394_SUCCESS) {
1272 setCapture(DC1394_ON);
1273 setTransmission(DC1394_ON);
1290 void vp1394TwoGrabber::initialize(
bool reset)
1292 if (
init ==
false) {
1294 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
1299 if (dc1394_camera_enumerate(d, &list) != DC1394_SUCCESS) {
1300 dc1394_camera_free_list(list);
1306 if (list->num == 0) {
1307 dc1394_camera_free_list(list);
1313 if (cameras != NULL)
1316 cameras =
new dc1394camera_t *[list->num];
1320 for (
unsigned int i = 0; i < list->num; i++) {
1321 cameras[i] = dc1394_camera_new(d, list->ids[i].guid);
1323 vpTRACE(
"Failed to initialize camera with guid \"%ld\"\n", list->ids[i].guid);
1334 dc1394_reset_bus(cameras[0]);
1338 dc1394_camera_free_list(list);
1341 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
1342 if (cameras != NULL)
1345 int err = dc1394_find_cameras(&cameras, &num_cameras);
1347 if (err != DC1394_SUCCESS && err != DC1394_NO_CAMERA) {
1351 " - if the kernel modules `ieee1394',`raw1394' and "
1352 "`ohci1394' are loaded \n"
1353 " - if you have read/write access to /dev/raw1394\n\n");
1358 if (num_cameras == 0) {
1365 isDataModified =
new bool[num_cameras];
1366 for (
unsigned int i = 0; i < num_cameras; i++)
1367 isDataModified[i] =
false;
1368 initialShutterMode =
new dc1394feature_mode_t[num_cameras];
1369 dataCam =
new vpDc1394TwoCameraParametersData[num_cameras];
1371 if (camera_id >= num_cameras) {
1380 std::cout <<
"------ Bus information ------" << std::endl;
1381 std::cout <<
"Number of camera(s) on the bus : " << num_cameras << std::endl;
1382 std::cout <<
"-----------------------------" << std::endl;
1385 if (camIsOpen != NULL)
1387 camIsOpen =
new bool[num_cameras];
1388 for (
unsigned int i = 0; i < num_cameras; i++) {
1389 camIsOpen[i] =
false;
1408 if (camIsOpen[camera_id] ==
false) {
1409 dc1394switch_t status = DC1394_OFF;
1413 dc1394_video_get_transmission(cameras[camera_id], &status);
1414 if (status != DC1394_OFF) {
1416 if (dc1394_video_set_transmission(cameras[camera_id], DC1394_OFF) != DC1394_SUCCESS)
1417 vpTRACE(
"Could not stop ISO transmission");
1420 if (dc1394_video_get_transmission(cameras[camera_id], &status) != DC1394_SUCCESS)
1421 vpTRACE(
"Could get ISO status");
1423 if (status == DC1394_ON) {
1424 vpTRACE(
"ISO transmission refuses to stop");
1426 #ifdef VISP_HAVE_DC1394_FIND_CAMERAS
1428 cameras[camera_id]->is_iso_on = status;
1438 setCapture(DC1394_ON);
1439 setTransmission(DC1394_ON);
1440 camIsOpen[camera_id] =
true;
1455 for (
unsigned int i = 0; i < num_cameras; i++) {
1457 camera = cameras[i];
1458 this->camera_id = i;
1459 setTransmission(DC1394_OFF);
1460 setCapture(DC1394_OFF);
1461 if (isDataModified[i]) {
1464 updateDataStructToCam();
1468 if (dc1394_feature_set_mode(camera, DC1394_FEATURE_BRIGHTNESS, initialShutterMode[i]) != DC1394_SUCCESS ||
1469 dc1394_feature_set_mode(camera, DC1394_FEATURE_EXPOSURE, initialShutterMode[i]) != DC1394_SUCCESS ||
1470 dc1394_feature_set_mode(camera, DC1394_FEATURE_SHARPNESS, initialShutterMode[i]) != DC1394_SUCCESS ||
1471 dc1394_feature_set_mode(camera, DC1394_FEATURE_HUE, initialShutterMode[i]) != DC1394_SUCCESS ||
1472 dc1394_feature_set_mode(camera, DC1394_FEATURE_SATURATION, initialShutterMode[i]) != DC1394_SUCCESS ||
1473 dc1394_feature_set_mode(camera, DC1394_FEATURE_GAMMA, initialShutterMode[i]) != DC1394_SUCCESS ||
1474 dc1394_feature_set_mode(camera, DC1394_FEATURE_SHUTTER, initialShutterMode[i]) != DC1394_SUCCESS ||
1475 dc1394_feature_set_mode(camera, DC1394_FEATURE_GAIN, initialShutterMode[i]) != DC1394_SUCCESS ||
1476 dc1394_feature_set_mode(camera, DC1394_FEATURE_IRIS, initialShutterMode[i])) {
1482 if (dc1394_camera_set_power(camera, DC1394_OFF) != DC1394_SUCCESS)
1483 std::cout <<
"Unable to turn camera off" << std::endl;
1485 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
1486 dc1394_camera_free(cameras[i]);
1487 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
1488 dc1394_free_camera(cameras[i]);
1492 if (camIsOpen != NULL) {
1497 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
1498 if (cameras != NULL) {
1507 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
1508 if (cameras != NULL) {
1518 if (isDataModified != NULL) {
1519 delete[] isDataModified;
1520 isDataModified = NULL;
1522 if (initialShutterMode != NULL) {
1523 delete[] initialShutterMode;
1524 initialShutterMode = NULL;
1526 if (dataCam != NULL) {
1554 if (size != num_buffers) {
1557 if (camIsOpen[camera_id]) {
1558 setCapture(DC1394_OFF);
1559 setCapture(DC1394_ON);
1621 dc1394feature_mode_t mode;
1623 mode = DC1394_FEATURE_MODE_AUTO;
1625 mode = DC1394_FEATURE_MODE_MANUAL;
1628 if (dc1394_feature_set_power(camera, DC1394_FEATURE_SHUTTER, DC1394_ON) != DC1394_SUCCESS) {
1634 if (dc1394_feature_set_mode(camera, DC1394_FEATURE_SHUTTER, mode) != DC1394_SUCCESS) {
1683 if (dc1394_avt_set_auto_shutter(camera, minvalue, maxvalue) != DC1394_SUCCESS) {
1711 if (dc1394_avt_get_auto_shutter(camera, &minvalue, &maxvalue) != DC1394_SUCCESS) {
1765 dc1394feature_mode_t mode;
1767 mode = DC1394_FEATURE_MODE_AUTO;
1769 mode = DC1394_FEATURE_MODE_MANUAL;
1772 if (dc1394_feature_set_power(camera, DC1394_FEATURE_GAIN, DC1394_ON) != DC1394_SUCCESS) {
1778 if (dc1394_feature_set_mode(camera, DC1394_FEATURE_GAIN, mode) != DC1394_SUCCESS) {
1827 if (dc1394_avt_set_auto_gain(camera, minvalue, maxvalue) != DC1394_SUCCESS) {
1855 if (dc1394_avt_get_auto_gain(camera, &minvalue, &maxvalue) != DC1394_SUCCESS) {
1880 void vp1394TwoGrabber::setCapture(dc1394switch_t _switch)
1888 if (_switch == DC1394_ON) {
1891 if (dc1394_capture_setup(camera, num_buffers, DC1394_CAPTURE_FLAGS_DEFAULT) != DC1394_SUCCESS) {
1893 "make sure that the video mode and framerate are "
1894 "supported by your camera.\n");
1899 dc1394error_t code = dc1394_capture_stop(camera);
1901 if (code != DC1394_SUCCESS && code != DC1394_CAPTURE_IS_NOT_SET) {
1923 void vp1394TwoGrabber::setTransmission(dc1394switch_t _switch)
1931 dc1394switch_t status = DC1394_OFF;
1933 if (dc1394_video_get_transmission(camera, &status) != DC1394_SUCCESS) {
1941 if (dc1394_video_set_transmission(camera, _switch) != DC1394_SUCCESS) {
1943 "make sure that the video mode and framerate are "
1944 "supported by your camera.\n");
1949 if (_switch == DC1394_ON) {
1950 status = DC1394_OFF;
1953 while (status == DC1394_OFF && i++ < 5) {
1955 if (dc1394_video_get_transmission(camera, &status) != DC1394_SUCCESS) {
2006 dc1394operation_mode_t op_mode;
2007 dc1394speed_t speed;
2011 if (camera->bmode_capable != DC1394_TRUE) {
2018 if (dc1394_video_set_operation_mode(camera, DC1394_OPERATION_MODE_1394B) != DC1394_SUCCESS) {
2024 if (dc1394_video_get_operation_mode(camera, &op_mode) != DC1394_SUCCESS) {
2030 if (dc1394_video_set_operation_mode(camera, DC1394_OPERATION_MODE_LEGACY) != DC1394_SUCCESS) {
2036 if (dc1394_video_get_operation_mode(camera, &op_mode) != DC1394_SUCCESS) {
2043 if (dc1394_video_set_iso_speed(camera, (dc1394speed_t)isospeed) != DC1394_SUCCESS) {
2049 if (dc1394_video_get_iso_speed(camera, &speed) != DC1394_SUCCESS) {
2134 dc1394video_frame_t *frame = NULL;
2136 if (dc1394_capture_dequeue(camera, DC1394_CAPTURE_POLICY_WAIT, &frame) != DC1394_SUCCESS) {
2137 vpERROR_TRACE(
"Error: Failed to capture from camera %d\n", camera_id);
2188 dc1394video_frame_t *frame;
2190 frame =
dequeue(I, timestamp,
id);
2247 dc1394video_frame_t *frame;
2253 timestamp = frame->timestamp;
2256 this->
width = frame->size[0];
2257 this->
height = frame->size[1];
2263 switch (frame->color_coding) {
2264 case DC1394_COLOR_CODING_MONO8:
2265 case DC1394_COLOR_CODING_RAW8:
2266 memcpy(I.
bitmap, (
unsigned char *)frame->image, size *
sizeof(
unsigned char));
2268 case DC1394_COLOR_CODING_MONO16:
2269 case DC1394_COLOR_CODING_RAW16:
2273 case DC1394_COLOR_CODING_YUV411:
2277 case DC1394_COLOR_CODING_YUV422:
2281 case DC1394_COLOR_CODING_YUV444:
2285 case DC1394_COLOR_CODING_RGB8:
2291 vpERROR_TRACE(
"Format conversion not implemented. Acquisition failed.");
2293 "Acquisition failed."));
2343 dc1394video_frame_t *frame;
2345 frame =
dequeue(I, timestamp,
id);
2402 dc1394video_frame_t *frame;
2408 timestamp = frame->timestamp;
2411 this->
width = frame->size[0];
2412 this->
height = frame->size[1];
2418 switch (frame->color_coding) {
2419 case DC1394_COLOR_CODING_MONO8:
2420 case DC1394_COLOR_CODING_RAW8:
2424 case DC1394_COLOR_CODING_MONO16:
2425 case DC1394_COLOR_CODING_RAW16:
2429 case DC1394_COLOR_CODING_YUV411:
2433 case DC1394_COLOR_CODING_YUV422:
2437 case DC1394_COLOR_CODING_YUV444:
2441 case DC1394_COLOR_CODING_RGB8:
2447 vpERROR_TRACE(
"Format conversion not implemented. Acquisition failed.");
2449 "Acquisition failed."));
2475 dc1394_capture_enqueue(camera, frame);
2496 dc1394video_frame_t *frame;
2498 frame =
dequeue(I, timestamp,
id);
2522 dc1394video_frame_t *frame;
2525 frame =
dequeue(I, timestamp,
id);
2546 dc1394video_frame_t *frame;
2549 frame =
dequeue(I, timestamp,
id);
2573 dc1394video_frame_t *frame;
2579 timestamp = frame->timestamp;
2582 this->
width = frame->size[0];
2583 this->
height = frame->size[1];
2589 switch (frame->color_coding) {
2590 case DC1394_COLOR_CODING_MONO8:
2591 case DC1394_COLOR_CODING_RAW8:
2595 case DC1394_COLOR_CODING_YUV411:
2599 case DC1394_COLOR_CODING_YUV422:
2603 case DC1394_COLOR_CODING_YUV444:
2607 case DC1394_COLOR_CODING_RGB8:
2613 vpERROR_TRACE(
"Format conversion not implemented. Acquisition failed.");
2615 "Acquisition failed."));
2738 std::cout <<
"----------------------------------------------------------" << std::endl
2739 <<
"----- Information for camera " << camera_id <<
" -----" << std::endl
2740 <<
"----------------------------------------------------------" << std::endl;
2742 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
2743 dc1394_camera_print_info(camera, stdout);
2744 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
2745 dc1394_print_camera_info(camera);
2748 dc1394featureset_t features;
2749 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
2750 if (dc1394_feature_get_all(camera, &features) != DC1394_SUCCESS)
2751 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
2752 if (dc1394_get_camera_feature_set(camera, &features) != DC1394_SUCCESS)
2756 vpERROR_TRACE(
"unable to get feature set for camera %d\n", camera_id);
2760 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
2761 dc1394_feature_print_all(&features, stdout);
2762 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
2763 dc1394_print_feature_set(&features);
2766 std::cout <<
"----------------------------------------------------------" << std::endl;
2783 std::string _str =
"";
2784 dc1394video_mode_t _videomode = (dc1394video_mode_t)videomode;
2786 if ((_videomode >= DC1394_VIDEO_MODE_MIN) && (_videomode <= DC1394_VIDEO_MODE_MAX)) {
2787 _str =
strVideoMode[_videomode - DC1394_VIDEO_MODE_MIN];
2789 vpCERROR <<
"The video mode " << (int)videomode <<
" is not supported by the camera" << std::endl;
2809 std::string _str =
"";
2810 dc1394framerate_t _fps = (dc1394framerate_t)fps;
2812 if ((_fps >= DC1394_FRAMERATE_MIN) && (_fps <= DC1394_FRAMERATE_MAX)) {
2815 vpCERROR <<
"The framerate " << (int)fps <<
" is not supported by the camera" << std::endl;
2835 std::string _str =
"";
2836 dc1394color_coding_t _coding = (dc1394color_coding_t)colorcoding;
2838 if ((_coding >= DC1394_COLOR_CODING_MIN) && (_coding <= DC1394_COLOR_CODING_MAX)) {
2842 vpCERROR <<
"The color coding " << (int)colorcoding <<
" is not supported by the camera" << std::endl;
2869 for (
int i = DC1394_VIDEO_MODE_MIN; i <= DC1394_VIDEO_MODE_MAX; i++) {
2901 for (
int i = DC1394_FRAMERATE_MIN; i <= DC1394_FRAMERATE_MAX; i++) {
2933 for (
int i = DC1394_COLOR_CODING_MIN; i <= DC1394_COLOR_CODING_MAX; i++) {
2977 for (
unsigned int i = 0; i < num_cameras; i++) {
2979 camera = cameras[i];
2980 setTransmission(DC1394_OFF);
2981 setCapture(DC1394_OFF);
2984 #ifdef VISP_HAVE_DC1394_CAMERA_ENUMERATE
2987 for (
unsigned int i = 0; i < num_cameras; i++) {
2989 dc1394_camera_free(cameras[i]);
2992 printf(
"Resetting bus...\n");
2993 dc1394_reset_bus(camera);
2995 dc1394_camera_free(camera);
3001 #elif defined VISP_HAVE_DC1394_FIND_CAMERAS
3005 for (
unsigned int i = 0; i < num_cameras; i++) {
3007 dc1394_free_camera(cameras[i]);
3012 dc1394_reset_bus(camera);
3013 dc1394_free_camera(camera);
3016 if (camIsOpen != NULL)
3065 uint64_t offset = 0x884;
3066 uint32_t value = 0x82000000 + (uint32_t)panControlValue;
3068 err = dc1394_set_control_register(camera, offset, value);
3069 if (err != DC1394_SUCCESS) {
3101 dc1394feature_t feature = DC1394_FEATURE_BRIGHTNESS;
3104 feature = DC1394_FEATURE_BRIGHTNESS;
3107 feature = DC1394_FEATURE_EXPOSURE;
3110 feature = DC1394_FEATURE_SHARPNESS;
3114 feature = DC1394_FEATURE_HUE;
3117 feature = DC1394_FEATURE_SATURATION;
3120 feature = DC1394_FEATURE_GAMMA;
3123 feature = DC1394_FEATURE_SHUTTER;
3126 feature = DC1394_FEATURE_GAIN;
3129 feature = DC1394_FEATURE_IRIS;
3146 err = dc1394_feature_get_value(camera, feature, &value);
3147 if (err != DC1394_SUCCESS) {
3152 return (
unsigned int)value;
3183 uint32_t value = (uint32_t)val;
3184 dc1394feature_t feature = DC1394_FEATURE_BRIGHTNESS;
3187 feature = DC1394_FEATURE_BRIGHTNESS;
3190 feature = DC1394_FEATURE_EXPOSURE;
3193 feature = DC1394_FEATURE_SHARPNESS;
3197 feature = DC1394_FEATURE_HUE;
3200 feature = DC1394_FEATURE_SATURATION;
3203 feature = DC1394_FEATURE_GAMMA;
3206 feature = DC1394_FEATURE_SHUTTER;
3209 feature = DC1394_FEATURE_GAIN;
3212 feature = DC1394_FEATURE_IRIS;
3229 dc1394bool_t hasManualMode = DC1394_FALSE;
3230 dc1394feature_modes_t modesAvailable;
3233 err = dc1394_feature_get_modes(camera, feature, &modesAvailable);
3234 if (err != DC1394_SUCCESS) {
3235 vpERROR_TRACE(
"Unable to detect the manual mode information");
3241 for (
unsigned int i = 0; i < modesAvailable.num; i++) {
3242 if (modesAvailable.modes[i] == DC1394_FEATURE_MODE_MANUAL) {
3243 hasManualMode = DC1394_TRUE;
3247 if (hasManualMode == DC1394_TRUE) {
3249 if (!isDataModified[camera_id]) {
3252 updateDataCamToStruct();
3253 err = dc1394_feature_get_mode(camera, feature, &(initialShutterMode[camera_id]));
3254 if (err != DC1394_SUCCESS) {
3259 isDataModified[camera_id] =
true;
3262 dc1394feature_mode_t manualMode = DC1394_FEATURE_MODE_MANUAL;
3263 err = dc1394_feature_set_mode(camera, feature, manualMode);
3264 if (err != DC1394_SUCCESS) {
3269 err = dc1394_feature_set_value(camera, feature, value);
3270 if (err != DC1394_SUCCESS) {
3276 vpERROR_TRACE(
"The camera does not have a manual mode.\nCannot change the value");
3295 guid = camera->guid;
3313 return camera->guid;
3320 inline void vp1394TwoGrabber::updateDataCamToStruct()
3337 inline void vp1394TwoGrabber::updateDataStructToCam()
3394 #elif !defined(VISP_BUILD_SHARED_LIBS)
3397 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 emited by the vpFrameGrabber class and its derivates.
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)