videoio: Support Orbbec Astra 3D cameras using OpenNI2 API

Only depth sensor is supported. Color sensor is accessible as a
regular UVC camera.
This commit is contained in:
Igor Murzov 2020-11-09 19:03:46 +03:00
parent 1f8f0abe92
commit 011d8e80d8
2 changed files with 11 additions and 3 deletions

View File

@ -112,6 +112,7 @@ enum VideoCaptureAPIs {
CAP_REALSENSE = 1500, //!< Synonym for CAP_INTELPERC
CAP_OPENNI2 = 1600, //!< OpenNI2 (for Kinect)
CAP_OPENNI2_ASUS = 1610, //!< OpenNI2 (for Asus Xtion and Occipital Structure sensors)
CAP_OPENNI2_ASTRA= 1620, //!< OpenNI2 (for Orbbec Astra)
CAP_GPHOTO2 = 1700, //!< gPhoto2 connection
CAP_GSTREAMER = 1800, //!< GStreamer
CAP_FFMPEG = 1900, //!< Open and record video file or stream using the FFMPEG library
@ -825,7 +826,7 @@ public:
@throws Exception %Exception on stream errors (check .isOpened() to filter out malformed streams) or VideoCapture type is not supported
The primary use of the function is in multi-camera environments.
The method fills the ready state vector, grabbs video frame, if camera is ready.
The method fills the ready state vector, grabs video frame, if camera is ready.
After this call use VideoCapture::retrieve() to decode and fetch frame data.
*/

View File

@ -103,7 +103,7 @@ private:
class CvCapture_OpenNI2 : public CvCapture
{
public:
enum { DEVICE_DEFAULT=0, DEVICE_MS_KINECT=0, DEVICE_ASUS_XTION=1, DEVICE_MAX=1 };
enum { DEVICE_DEFAULT=0, DEVICE_MS_KINECT=0, DEVICE_ASUS_XTION=1, DEVICE_ORBBEC_ASTRA=2, DEVICE_MAX=2 };
static const int INVALID_PIXEL_VAL = 0;
static const int INVALID_COORDINATE_VAL = 0;
@ -116,6 +116,7 @@ public:
CvCapture_OpenNI2(const char * filename);
virtual ~CvCapture_OpenNI2();
virtual int getCaptureDomain() CV_OVERRIDE { return cv::CAP_OPENNI2; }
virtual double getProperty(int propIdx) const CV_OVERRIDE;
virtual bool setProperty(int probIdx, double propVal) CV_OVERRIDE;
virtual bool grabFrame() CV_OVERRIDE;
@ -261,7 +262,8 @@ CvCapture_OpenNI2::CvCapture_OpenNI2(int index, const char * filename) :
index %= 10;
}
// Asus XTION and Occipital Structure Sensor do not have an image generator
needColor = (deviceType != DEVICE_ASUS_XTION);
// Orbbec Astra cameras don't provide OpenNI interface for color stream reading
needColor = (deviceType != DEVICE_ASUS_XTION) && (deviceType != DEVICE_ORBBEC_ASTRA);
// find appropriate device URI
openni::Array<openni::DeviceInfo> ldevs;
@ -300,6 +302,11 @@ CvCapture_OpenNI2::CvCapture_OpenNI2(int index, const char * filename) :
setProperty(CV_CAP_PROP_OPENNI2_MIRROR, 0.0);
isContextOpened = true;
CV_LOG_INFO(NULL, cv::format("Opened OpenNI camera: %s %s (%04x:%04x)",
device.getDeviceInfo().getVendor(), device.getDeviceInfo().getName(),
device.getDeviceInfo().getUsbVendorId(), device.getDeviceInfo().getUsbProductId())
);
}
CvCapture_OpenNI2::~CvCapture_OpenNI2()