Ask Your Question

artoon_42's profile - activity

2015-05-22 09:07:28 -0600 commented question opencv 3.0 fisheye calibration

Up please !

2015-05-19 05:06:53 -0600 asked a question opencv 3.0 fisheye calibration

I try to calibrate my fisheye camera using opencv 3.0.

I use this code:

int _imageWidth = 5184;
int _imageHeight = 3456;
cv::Matx33d _cameraMatrix;
cv::Vec4d _distCoeffs;
std::vector<std::vector<cv::Point2d> > imagePoints(1);
std::vector<std::vector<cv::Point3d> > objectPoints(1);
std::vector<cv::Vec3d> rvecs(1);
std::vector<cv::Vec3d> tvecs(1);
int flags = cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC | cv::fisheye::CALIB_FIX_SKEW | cv::fisheye::CALIB_FIX_K3 | cv::fisheye::CALIB_FIX_K4 ;


double rms = cv::fisheye::calibrate(objectPoints, imagePoints, cv::Size(_imageWidth, _imageHeight), _cameraMatrix, _distCoeffs, rvecs, tvecs, flags, cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 100, DBL_EPSILON));

I use this photo:

success picture

with this objectPoints:

{x=-2.4998999999999998 y=0.00000000000000000 z=0.00000000000000000 }
{x=-1.7677000000000000 y=-1.7677000000000000 z=0.00000000000000000 }
{x=-1.7677000000000000 y=1.7678000000000000 z=0.00000000000000000 }
{x=-1.9699000000000000 y=0.00000000000000000 z=1.5391999999999999 }
{x=-1.3929000000000000 y=-1.3929000000000000 z=1.5391999999999999 }
{x=-1.3929000000000000 y=1.3930000000000000 z=1.5391999999999999 }
{x=0.00000000000000000 y=-2.4998999999999998 z=0.00000000000000000 }
{x=0.00000000000000000 y=-1.9699000000000000 z=1.5391999999999999 }
{x=0.00000000000000000 y=0.00000000000000000 z=2.5000000000000000 }
{x=0.00000000000000000 y=1.9700000000000000 z=1.5391999999999999 }
{x=0.00000000000000000 y=2.5000000000000000 z=0.00000000000000000 }
{x=1.3930000000000000 y=-1.3929000000000000 z=1.5391999999999999 }
{x=1.3930000000000000 y=1.3930000000000000 z=1.5391999999999999 }
{x=1.9700000000000000 y=0.00000000000000000 z=1.5391999999999999 }
{x=1.7678000000000000 y=-1.7677000000000000 z=0.00000000000000000 }
{x=1.7678000000000000 y=1.7678000000000000 z=0.00000000000000000 }
{x=2.5000000000000000 y=0.00000000000000000 z=0.00000000000000000 }

and this imagePoints:

{x=2464.5648148148148 y=443.00925925925924 }                
{x=3429.7624113475172 y=756.99645390070907 }                
{x=1540.6558441558441 y=901.56493506493507 }                
{x=2487.5740740740739 y=967.90740740740739 }                
{x=3095.3457711442784 y=1160.3308457711441 }                
{x=1911.0628415300546 y=1260.0136612021856 }                
{x=3904.2130801687763 y=1653.2046413502107 }                
{x=3391.5899470899471 y=1719.6058201058199 }                
{x=2552.2247706422017 y=1813.3746177370028 }                
{x=1717.0277777777778 y=1871.4444444444443 }                
{x=1214.3235294117646 y=1898.3588235294117 }                
{x=3205.9190476190474 y=2328.4428571428571 }                
{x=2018.9355555555555 y=2442.0111111111109 }                
{x=2644.6023102310228 y=2627.8696369636964 }                
{x=3619.5897435897432 y=2628.8589743589741 }                
{x=1687.1732026143791 y=2818.9313725490197 }                
{x=2708.9143302180682 y=3131.5031152647975 }

I get a reprojection error of 4.04px so the calibration is good.

Now if I use another picture (the camera has been moved slightly): fail picture

The objectPointsare the same and in the same order.

The imagePoints are:

{x=2459.8866666666668 y=441.56666666666666 }                
{x=3428.7755102040815 y=755.87414965986386 }                
{x=1541.5804597701149 y=898.29310344827582 }                
{x=2481.5166666666664 y=965.35000000000002 }                
{x=3089.9254385964909 y=1160.3771929824561 }                
{x=1905.8081761006288 y=1254.1981132075471 }                
{x=3904.0458333333327 y=1664.0708333333332 }                
{x=3384.4035087719299 y=1725.4824561403507 }                
{x=2539.3900709219856 y=1810.2553191489362 }                
{x=1708.0555555555554 y=1860.3282828282827 }                
{x=1211.4629629629630 y=1882.4382716049381 }                
{x=3190.0820105820103 y=2336.2037037037035 }                
{x=2001.1436781609195 y=2430.5766283524904 }                
{x=2621.9691358024693 y=2626.6810699588477 }                
{x=3603.0503875968989 y=2645.9341085271317 }                
{x=1665.5180180180180 y=2799.5330330330326 }                
{x=2676.5030864197529 y=3133.2870370370370 ...
(more)