{
LOGI("LEAVE");
switch (type) {
- case DFS_DATA_TYPE_UINT8:
+ case DFS_DATA_TYPE_UINT8C1:
+ return CV_8UC1;
+ case DFS_DATA_TYPE_UINT8C3:
return CV_8UC3;
default:
LOGE("Invalide type");
{
LOGI("ENTER");
- if (!base.data || !extra.data) {
+ if (!base.data) {
throw std::runtime_error("invalid data pointer");
}
- if (cv::Size(base.width, base.height) != mImageSize ||
- cv::Size(extra.width, extra.height) != mImageSize) {
- throw std::runtime_error("invalid size");
- }
+ int baseCvType = 1;
+ int extraCvType = -1;
+ cv::Mat baseMat, extraMat;
- int baseCvType = ConvertDfsDataTypeToCV(base.type);
- int extraCvType = ConvertDfsDataTypeToCV(extra.type);
- if (baseCvType < 0 || extraCvType < 0) {
- throw std::runtime_error("invalid data type");
- }
+ if (!extra.data) {
+ LOGI("side-by-side");
+ if (cv::Size(base.width >> 1, base.height) != mImageSize) {
+ throw std::runtime_error("invalid size");
+ }
- cv::Mat baseMat(cv::Size(base.width, base.height), baseCvType, base.data);
- cv::Mat extraMat(cv::Size(extra.width, extra.height), extraCvType, extra.data);
+ baseCvType = ConvertDfsDataTypeToCV(base.type);
+ if (baseCvType < 0) {
+ throw std::runtime_error("invalid data type");
+ }
+ cv::Mat mat(cv::Size(base.width, base.height), baseCvType, base.data);
+ LOGI("%zd x %zd", base.width, base.height);
+ baseMat = mat(cv::Rect(0, 0,
+ mImageSize.width,
+ mImageSize.height)).clone();
+ extraMat = mat(cv::Rect(mImageSize.width, 0,
+ mImageSize.width,
+ mImageSize.height)).clone();
+ } else {
+ if (cv::Size(base.width, base.height) != mImageSize ||
+ cv::Size(extra.width, extra.height) != mImageSize) {
+ throw std::runtime_error("invalid size");
+ }
+ baseCvType = ConvertDfsDataTypeToCV(base.type);
+ extraCvType = ConvertDfsDataTypeToCV(extra.type);
+ if (baseCvType < 0 || extraCvType < 0) {
+ throw std::runtime_error("invalid data type");
+ }
+
+ baseMat = cv::Mat(cv::Size(base.width, base.height),
+ baseCvType,
+ base.data);;
+ extraMat = cv::Mat(cv::Size(extra.width,
+ extra.height),
+ extraCvType,
+ extra.data);
+ }
if (baseMat.size() != extraMat.size()) {
throw std::runtime_error("base and extra should be the same size");
}
mDepthData.data = mDispMat.ptr<unsigned char>();
- mDepthData.type = DFS_DATA_TYPE_UINT8;
+ mDepthData.type = DFS_DATA_TYPE_UINT8C1;
mDepthData.width = mDispMat.cols;
mDepthData.height = mDispMat.rows;
mDepthData.stride = mDispMat.elemSize() * mDispMat.cols;