Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < NUM_OF_PICS; i++) {
- printf("FileName : %sn", filefinder.name);
- string img_path = path + "CameraCalibration/" + filefinder.name;
- images_color[i] = imread(img_path);
- images[i] = imread(img_path, 0);
- images_copy[i] = images_color[i].clone();
- cp_img = images[i].clone();
- bool patternfound = findChessboardCorners(images[i], patternsize, edges,
- CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
- + CALIB_CB_FAST_CHECK);
- if (patternfound) {
- cornerSubPix(images[i], edges, Size(11, 11), Size(-1, -1), TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 50, 0.0001));
- edge_points.push_back(edges);
- drawChessboardCorners(images_copy[i], patternsize, Mat(edges), patternfound);
- points_vector_pile.push_back(points_vector);
- }
- cout << "Pic_" + to_string(i) << ": "<< patternfound << endl;
- nExistNext = _findnext(handle, &filefinder);
- }
- calibrateCamera(points_vector_pile, edge_points, patternsize, camera_matrix, dist_coeffs, rvecs, tvecs);
- for (int i = 0; i < 10; i++) {
- Mat ouputImage;
- undistort(images[i], ouputImage, camera_matrix, dist_coeffs);
- namedWindow("Undistorted_" + to_string(i), WINDOW_NORMAL);
- resizeWindow("Undistorted_" + to_string(i), ouputImage.cols / 2, ouputImage.rows / 2);
- imshow("Undistorted_" + to_string(i), ouputImage);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement