2015-12-22 03:37:23 -0500 asked a question Unknow exception when using fisheye::calibrate function hei, guys. I am now working for a fisheye camera calibration and i have stuck for a long time. When my code run to fisheye::calibrate function, there aways has a "unhandled excption". here is my code: #include #include using namespace cv; using namespace std; int main(int argc, char** argv) { VideoCapture camera(1); if (!camera.isOpened()) { cout << "Failed to open camera." << std::endl; return -1; } const char* window_name = "output"; namedWindow(window_name); Mat frame; Size boardSize; boardSize.width = 9; boardSize.height = 6; int remaining_frames = 5; Matx33d K; Vec4d D; Mat identity = Mat::eye(3, 3, CV_64F); vector > img_points; vector > obj_points; vector obj_temp; int width = 9; int height = 6; int sq_sz = 30; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { obj_temp.push_back(Point3d(double(j * sq_sz), double(i * sq_sz), 0)); } } for (int i = 0; i < remaining_frames; i++) obj_points.push_back(obj_temp); while (1) { if (!camera.read(frame)) { cout << "Failed to read frame" << std::endl; break; } if (remaining_frames > 0) { vector corners; bool found = findChessboardCorners(frame, boardSize, corners, CALIB_CB_ADAPTIVE_THRESH | CALIB_CB_NORMALIZE_IMAGE | CALIB_CB_FAST_CHECK); drawChessboardCorners(frame, boardSize, corners, found); if (found && waitKey(30)==32) { vector img_temp; for (int i = 0; i < width*height; i++) { Point2d temp = corners[i]; img_temp.push_back(temp); } img_points.push_back(img_temp); remaining_frames--; cout << remaining_frames << " frames to calibration." << endl; if (remaining_frames == 0) { cout << "Computing distortion" << endl; int flags = 0; flags |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC; flags |= cv::fisheye::CALIB_CHECK_COND; flags |= cv::fisheye::CALIB_FIX_SKEW; // here is someting wrong fisheye::calibrate(obj_points, img_points, Size(640, 480), K, D, noArray(), noArray(), flags, TermCriteria(3, 20, 1e-6)); cout << "Finished computing distortion" << endl; } } imshow(window_name, frame); waitKey(1); } else { Mat output; fisheye::undistortImage(frame, output, K, D, identity); imshow(window_name, output); waitKey(1); } //if (waitKey(30) > 0) { // break; //} } return 0; }  i have tried many ways to solve this problem, include change the different version of opencv, install different version of Visual Studio, tried many data types and flags used in fisheye::calibration function. all these ways are failed. is there any one can help me? Thank you for advance! 2015-03-12 21:45:19 -0500 commented question There is something wrong when I read 2+ cameras. Thank you for you suggestion! I will try to use the C++ code. I installed my VS2010 with Chinese language package, so the message box has some Chinese characters. I will try to reinstall my software. 2015-03-12 21:31:39 -0500 answered a question Using multiple external cameras Hello, I don't know how to solve this problem just because I have a same situation as you discribed. I read 5 USB cameras but only first two of CvCapture returned with other camerals return NULL. So, I try to read the camera dynamically. However, I am facing a new weird problem. You can see my problem at: http://answers.opencv.org/question/57... 2015-03-12 10:07:48 -0500 asked a question There is something wrong when I read 2+ cameras. I have a project recently that I need to read more than 2 cameras using OpenCV. But I am facing a weird problem that I can't solve. When I execute my code step by step, it just OK, but when I run my project automatically, there is something wrong. Here is my code: while (1) { //////////////////////////////////////////////////////////////////////////////// //When I execute the following part step by step, it is just OK //But when I run the project automatically, there is someting wrong for (i=0; i<3; i++){ cap = cvCaptureFromCAM(i); cvGrabFrame(cap); cam = cvRetrieveFrame(cap); cvCopy(cam, ImageBuffer[i]); cvReleaseCapture(&cap); } /////////////////////////////////////////////////////////////////////////////// cvGetCols(pairs, &part, 0, 640); cvCopy(ImageBuffer[0], &part); cvGetCols(pairs, &part, 640, 640*2); cvCopy(ImageBuffer[1], &part); cvGetCols(pairs, &part, 640*2, 640*3); cvCopy(ImageBuffer[2], &part); cvShowImage("Pairs", pairs); if(27==cvWaitKey(10)) break; }  When I run the project, the error is like that: So, what is wrong with my code? Can anyone could solve the problem? Thanks In Advance!