我在 android 中使用 QCAR,并尝试将 QCARImage 转换为 cvMat 并使用 cvtColor 更改颜色。
我在cvtColor中得到以下错误,我想知道这个错误的含义。(dcn == 3 || dcn == 4), scn == 2 和 depth == CV_8U 分别是什么意思?
09-23 14:12:54.944: E/cv::error()(23942): OpenCV 错误: 断言失败 ((dcn == 3 || dcn == 4) && scn == 2 && depth == CV_8U)在 void cv::cvtColor(cv::InputArray, cv::OutputArray, int, int),文件 /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/color.cpp,第 3389 行09-23 14:12:54.944: A/libc(23942): 致命信号 11 (SIGSEGV) 在 0xdeadbaad (code=1), 线程 23963 (Thread-884)
这是我的代码
QCAR::State state = QCAR::Renderer::getInstance().begin();
// Explicitly render the Video Background
QCAR::Renderer::getInstance().drawVideoBackground();
//get the captured frame of camera
QCAR::Image *img = NULL;
QCAR::Frame frame = state.getFrame();
//getting qcar::image data from QCAR
for (int i = 0; i < frame.getNumImages(); ++i) {
const QCAR::Image *QCARimage = frame.getImage(i);
LOGD("format %d", QCARimage->getFormat());
if (QCARimage->getFormat() == QCAR::RGB565) {
img = (QCAR::Image*) QCARimage;
break;
}
}
if(img){
//converting to mat
Mat capture = Mat(img->getHeight(), img->getWidth(), CV_8UC3, (unsigned char *)img->getPixels());
cvtColor(capture, capture, CV_BGR5652BGR, 0);
}
对不起我的英语不好。