unknwon array type error

asked 2015-06-30 15:20:00 -0500

sasmn gravatar image

updated 2015-06-30 16:40:16 -0500

I am trying to detect edges of a disparity map using canny edge detector.Unfortunately, I keep receiving the error OpenCV Error: Bab argument (unknwon array type) in cv::cvarrToMat

I am using a track bar to adjust the threshold value

CvMat src; 
CvMat dst, detected_edges;
CvMat* vdisp; //  disparity map 
Mat srcM,dstM,detected_edgesM;

int edgeThresh = 1;
int lowThreshold;
int const max_lowThreshold = 100;
int ratio = 3;
int kernel_size = 3; 
char* window_name = "Edge Map";

void CannyThreshold(int,void*)
        detected_edgesM=Mat(&detected_edges,true); /// Reduce noise with a kernel 3x3   
        blur( srcM,  detected_edgesM, Size(3,3) );// blur( src_gray, detected_edges, Size(3,3) );   

        // Canny detector 
    Canny( detected_edgesM, detected_edgesM, lowThreshold, lowThreshold*ratio, kernel_size );

    /// Using Canny's output as a mask, we display our result  
       cvZero(&dst);  //dst = Scalar::all(0); //the  error is returned from her while debugging  
       cvCopy(vdisp,&dst,&detected_edges);//src.copyTo( dst, detected_edges);
       cvShowImage(window_name,&dst);  //imshow( window_name, dst ); 

int realTimeDestanceCalc()
        /// Create a window for canny
    namedWindow( window_name, CV_WINDOW_AUTOSIZE );
    /// Create a Trackbar for user to enter canny threshold
     createTrackbar( "Min Threshold:", window_name, &lowThreshold, max_lowThreshold, CannyThreshold );


         src = cvMat(imageSizeL.height,imageSizeL.width,CV_8U,vdisp);   

         while (true)
                //----- calculating disparity map processes -----//

                src=*vdisp; //cvCvtColor(vdisp,&src,CV_BGR2GRAY);

how can I fix this problem ?

edit retag flag offensive close merge delete


look here i think you try to do same. you musn't fix old c-api with c++

sturkmen gravatar imagesturkmen ( 2015-06-30 16:48:50 -0500 )edit

I integrated this code in my program, but I changed the type of variables. It's very difficult to do that know , because the whole program is based on old c-api.

sasmn gravatar imagesasmn ( 2015-06-30 18:01:29 -0500 )edit

is there a link to your code?

sturkmen gravatar imagesturkmen ( 2015-06-30 18:12:15 -0500 )edit

I wrote in the post all the statements I used to detect the edges

sasmn gravatar imagesasmn ( 2015-06-30 19:29:52 -0500 )edit