2012-02-27 1 views
2

내가 OpenCV의 VideoCapture 모듈에 의해 검색된 depthImage와 OpenCV의 임계 값을 사용하려고 해요,하지만 난 다음 오류 얻을 :사용 OpenCV의 임계 값

OpenCV Error: Bad argument in unknown function, file PATHTOOPENCV\opencv\modules\core\src\matrix.cpp line 646

내 코드는 다음과 같다 :

#include "opencv2/opencv.hpp" 
#include "opencv2/imgproc/imgproc.hpp" 
#include "opencv2/highgui/highgui.hpp" 
#include "opencv2/gpu/gpu.hpp" 

cv::VideoCapture kinect; 
cv::Mat rgbMap; 
cv::Mat dispMap; 
bool newFrame; 

void setup() 
{ 
    kinect.open(CV_CAP_OPENNI); 
    newFrame = false; 
} 

void update() 
{ 
    if(kinect.grab()) 
    { 
     kinect.retrieve(rgbMap, CV_CAP_OPENNI_BGR_IMAGE); 
     kinect.retrieve(dispMap, CV_CAP_OPENNI_DISPARITY_MAP); 
     newFrame = true; 
    } 
} 

void draw() 
{ 
    if(newFrame) 
    { 
     cv::Mat * _thresSrc = new cv::Mat(dispMap); 
     cv::Mat * _thresDst = new cv::Mat(dispMap); 

     cvThreshold(_thresSrc, _thresDst, 24, 255, CV_THRESH_BINARY); 

     // Draw _thresDst; 

     delete _thresSrc; 
     delete _thresDst; 
     newFrame = false; 
    } 
} 

당신이 C++ 인터페이스와 C 인터페이스를 혼합하는

답변

3

이 일을 시작하기 위해 당신의 도움을 주셔서 감사합니다, 그들은 쇼 함께 섞이지 마라!

cv::Mat

는 C++ 인터페이스에 속하고 cvThreshold()는 대신 cv::threshold()를 사용한다 C.에 속하는 :

double cv::threshold(const Mat& src, Mat& dst, double thresh, double maxVal, int thresholdType) 

Parameters:

src – Source array (single-channel, 8-bit of 32-bit floating point) 
dst – Destination array; will have the same size and the same type as src 
thresh – Threshold value 
maxVal – Maximum value to use with THRESH_BINARY and THRESH_BINARY_INV thresholding types 
thresholdType – Thresholding type (see the discussion)