本帖最后由 luyu 于 2019-3-11 16:22 编辑
OpenCV3.4.0+VS2017,一直显示未定义标识符 CV_8UC3等,但是头文件添加应该无误。怎么解决啊???- #include "pch.h"
- #include <stdlib.h>
- #include <windows.h>
- #include <iostream>
- #include <opencv2/opencv.hpp>
- #include <opencv2/imgproc/hal/interface.h>
- #include <opencv2/imgproc/imgproc_c.h>
- #include <string>
- #include <OpenNI.h>
- #include <iostream>
复制代码
if (oniColorStream.readFrame(&oniColorImg) == STATUS_OK)
{
// convert data(RGB) into OpenCV type(BGR)
cv::Mat cvRGBImg(oniColorImg.getHeight(), oniColorImg.getWidth(), CV_8UC3, (void*)oniColorImg.getData());
cv::cvtColor(cvRGBImg, cvBGRImg, COLOR_RGB2BGR);
cv::imshow("image", cvBGRImg);
}
if (oniIRStream.readFrame(&oniIRImg) == STATUS_OK)
{
cv::Mat cvRawImg16U(oniIRImg.getHeight(), oniIRImg.getWidth(), CV_16UC1, (void*)oniIRImg.getData());
cvRawImg16U.convertTo(cvDepthImg, CV_8U, 255.0 / (oniIRStream.getMaxPixelValue()));
//【5】
// convert depth image GRAY to BGR
cv::cvtColor(cvDepthImg, cvFusionImg, COLOR_GRAY2BGR);
cv::imshow("depth", cvDepthImg);
}
|