我在android中使用QCAR,並嘗試將QCARImage轉換爲cvMat並使用cvtColor更改顏色。我想知道cv錯誤的含義
我在cvtColor中出現了下面的錯誤,我想知道這個錯誤的含義。 每個(dcn == 3 || dcn == 4),scn == 2和depth == CV_8U是什麼意思?
09-23 14:12:54.944:E/CV ::誤差()(23942):OpenCV的錯誤:斷言失敗((DCN == 3 || DCN == 4)& & SCN == 2 & (cv :: InputArray,cv :: OutputArray,int,int),file/home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/color.cpp,line 3389 09-23 14:12:54.944:A/libc(23942):致命的信號11(SIGSEGV)在0xdeadbaad(代碼= 1),線程23963(線程-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);
}
對不起,我英文很差。
謝謝您的回覆!我一直陷在這個問題上半天,但現在完全解決了。 – user2738844