29 #if CV_MAJOR_VERSION > 3 30 #include <opencv2/videoio/videoio_c.h> 38 return cv::getBuildInformation().find(
"OpenNI: YES") != std::string::npos;
42 Camera(imageRate, localTransform),
65 _capture.set( CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE, CV_CAP_OPENNI_VGA_30HZ );
68 UINFO(
"Depth generator output mode:");
69 UINFO(
"FRAME_WIDTH %f",
_capture.get( CV_CAP_PROP_FRAME_WIDTH ));
70 UINFO(
"FRAME_HEIGHT %f",
_capture.get( CV_CAP_PROP_FRAME_HEIGHT ));
71 UINFO(
"FRAME_MAX_DEPTH %f mm",
_capture.get( CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH ));
72 UINFO(
"BASELINE %f mm",
_capture.get( CV_CAP_PROP_OPENNI_BASELINE ));
74 UINFO(
"Focal %f",
_capture.get( CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH ));
75 UINFO(
"REGISTRATION %f",
_capture.get( CV_CAP_PROP_OPENNI_REGISTRATION ));
76 if(
_capture.get( CV_CAP_PROP_OPENNI_REGISTRATION ) == 0.0)
78 UERROR(
"Depth registration is not activated on this device!");
80 if(
_capture.get( CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT ) )
82 UINFO(
"Image generator output mode:");
83 UINFO(
"FRAME_WIDTH %f",
_capture.get( CV_CAP_OPENNI_IMAGE_GENERATOR+CV_CAP_PROP_FRAME_WIDTH ));
84 UINFO(
"FRAME_HEIGHT %f",
_capture.get( CV_CAP_OPENNI_IMAGE_GENERATOR+CV_CAP_PROP_FRAME_HEIGHT ));
85 UINFO(
"FPS %f",
_capture.get( CV_CAP_OPENNI_IMAGE_GENERATOR+CV_CAP_PROP_FPS ));
89 UERROR(
"Camera: Device doesn't contain image generator.");
115 _capture.retrieve(depth, CV_CAP_OPENNI_DEPTH_MAP );
116 _capture.retrieve(rgb, CV_CAP_OPENNI_BGR_IMAGE );
118 depth = depth.clone();
122 if(!rgb.empty() && !depth.empty())
127 float(rgb.cols/2) - 0.5f,
128 float(rgb.rows/2) - 0.5f,
129 this->getLocalTransform(),
137 ULOGGER_WARN(
"The camera must be initialized before requesting an image.");
virtual SensorData captureImage(CameraInfo *info=0)
cv::VideoCapture _capture
virtual bool isCalibrated() const
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
#define UASSERT(condition)
virtual ~CameraOpenNICV()
#define ULOGGER_DEBUG(...)
#define ULOGGER_WARN(...)
CameraOpenNICV(bool asus=false, float imageRate=0, const Transform &localTransform=CameraModel::opticalRotation())
#define ULOGGER_ERROR(...)