I am trying to calibrated fisheye camera in OpenCV 3.2. This is a code:
Mat newCamMat;
cameraMatrix= getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, 0, imageSize, 0); //Does not change anything
fisheye::estimateNewCameraMatrixForUndistortRectify(cameraMatrix, distCoeffs, imageSize,
Matx33d::eye(), newCamMat, 1);
fisheye::initUndistortRectifyMap(cameraMatrix, distCoeffs, Matx33d::eye(), newCamMat, imageSize,
CV_16SC2, map1, map2);
I used these flags in calibration:
fisheye::CALIB_FIX_SKEW | fisheye::CALIB_RECOMPUTE_EXTRINSIC | fisheye::CALIB_CHECK_COND
I want to get image cropped without the black areas around the usable area. For non-fisheye calibration I did it by setting alpha. For fisheye I dont know how to change it.Any suggestions?
You can use a masked
setTo
to set the Alpha channel value to be transparent.