OpenCV キャリブレーション サンプル (レンズ補正には問題なく機能します) で説明されているように、カメラのキャリブレーションを実行しています。さらに、空間補正を行いたいと考えています。カメラがチェッカーボードに平行でない場合、チェッカーボードをカメラに平行にするために必要な回転を取得したいと考えています。それは私がやっていることです:
// calculate intrinsic matrix and distortion coefficients for lens correction and get
// the rotation "rotation"
cvCalibrateCamera2(object_points,image_points,point_counts,cvGetSize(gray_image),
intrinsic_matrix, distortion_coeffs,
rotation,NULL,
0);
...
// convert the rotation to a 3x3 matrix
cv::Rodrigues(rotation,rotMtx,cv::noArray());
// generate maps for lens correction
cv::initUndistortRectifyMap(intrinsic,distortion,cv::Mat(),
cv::getOptimalNewCameraMatrix(intrinsic,distortion,imageSize,1,imageSize,0),
imageSize, CV_16SC2,*handle->mapx,*handle->mapy);
...
// perform lens correction
cv::remap(cv::Mat(sImage),dImage,*handle->mapx,*handle->mapy,cv::INTER_LINEAR);
...
// apply the rotation to make the mage parallel to the camera
cv::warpPerspective(dImage,dImage2,rotMtx,cv::Size(handle->width,handle->height),cv::INTER_LANCZOS4,cv::BORDER_TRANSPARENT,cv::Scalar());
cvCalibrateCamera2() によって返される回転 3x1 回転値は !=0 であるため、何かが返されます。ただし、 warpPerspective() は画像を回転しません。
ここで何が問題なのですか?画像を正しく「並列化」するにはどうすればよいですか?