stucked in drawChessboardCorners()

asked 2018-01-09 19:45:57 -0600

edamondo gravatar image

Hello,

I am using opencv together with a Ximea camera. Actually, I am not even sure the problem comes from opencv but I think so. I have the following piece of code (I try to calibrate my camera) :

void cameraCalibrationProcess(Mat& cameraMatrix, Mat& distanceCoefficients)                                                                                          
{                                                                                                                                                                    
    //createArucoMarkers();                                                                                                                                      
    Mat drawToFrame;                                                                                                                                             

    vector<Mat> savedImages;                                                                                                                                     

    vector<vector<Point2f>> markerCorners, rejectedCandidates;                                                                                                   

    namedWindow("ximea", CV_WINDOW_AUTOSIZE);                                                                                                                    
    int framesPerSecond = 60;                                                                                                                                    
    bool found;                                                                                                                                                  
    xiAPIplusCameraOcv cam;                                                                                                                                      
    cam.OpenFirst();                                                                                                                                             
    cam.SetExposureTime(10000); //10000 us = 10 ms                                                                                                               
    cam.StartAcquisition();                                                                                                                                      

    for(int i=0; i<=100; i++)                                                                                                                                    
    {                                                                                                                                                            

            vector<Vec2f> foundPoints;                                                                                                                           
            // Read and convert a frame from the camera                                                                                                          
            Mat frame = cam.GetNextImageOcvMat();                                                                                                                
            found = false;                                                                                                                                       

            found = findChessboardCorners(frame, chessboardDimensions, foundPoints);                                                                             
            frame.copyTo(drawToFrame);                                                                                                                           
            drawChessboardCorners(drawToFrame, chessboardDimensions, foundPoints, found);                                                                        
            if(found)                                                                                                                                            
            {                                                                                                                                                    
                    imshow("ximea", drawToFrame);                                                                                                                
            }                                                                                                                                                    
            else                                                                                                                                                 
            {                                                                                                                                                    
                    imshow("ximea", frame);                                                                                                                      
            }                                                                                                                                                    
    }                                                                                                                                                            
    cam.StopAcquisition();                                                                                                                                       
    cam.Close();                                                                                                                                                 
    cvWaitKey(200);
}

But the function gets stuck in the

drawChessboardCorners(drawToFrame, chessboardDimensions, foundPoints, found);

function and it displays :

Doing reset to mono

I am using a black and white ximea camera.

Do you know what can go wrong here?

thanks for the help

edit retag flag offensive close merge delete