@@ -28,10 +28,8 @@ public static Mat InitCameraMatrix2D(
2828 Size imageSize ,
2929 double aspectRatio = 1.0 )
3030 {
31- if ( objectPoints is null )
32- throw new ArgumentNullException ( nameof ( objectPoints ) ) ;
33- if ( imagePoints is null )
34- throw new ArgumentNullException ( nameof ( imagePoints ) ) ;
31+ ArgumentNullException . ThrowIfNull ( objectPoints ) ;
32+ ArgumentNullException . ThrowIfNull ( imagePoints ) ;
3533
3634 var objectPointsPtrs = objectPoints . Select ( x => x . CvPtr ) . ToArray ( ) ;
3735 var imagePointsPtrs = imagePoints . Select ( x => x . CvPtr ) . ToArray ( ) ;
@@ -58,10 +56,8 @@ public static Mat InitCameraMatrix2D(
5856 Size imageSize ,
5957 double aspectRatio = 1.0 )
6058 {
61- if ( objectPoints is null )
62- throw new ArgumentNullException ( nameof ( objectPoints ) ) ;
63- if ( imagePoints is null )
64- throw new ArgumentNullException ( nameof ( imagePoints ) ) ;
59+ ArgumentNullException . ThrowIfNull ( objectPoints ) ;
60+ ArgumentNullException . ThrowIfNull ( imagePoints ) ;
6561
6662 using var opArray = new ArrayAddress2 < Point3f > ( objectPoints ) ;
6763 using var ipArray = new ArrayAddress2 < Point2f > ( imagePoints ) ;
@@ -206,10 +202,8 @@ public static double CalibrateCamera(
206202 CalibrationFlags flags = CalibrationFlags . None ,
207203 TermCriteria ? criteria = null )
208204 {
209- if ( objectPoints is null )
210- throw new ArgumentNullException ( nameof ( objectPoints ) ) ;
211- if ( imagePoints is null )
212- throw new ArgumentNullException ( nameof ( imagePoints ) ) ;
205+ ArgumentNullException . ThrowIfNull ( objectPoints ) ;
206+ ArgumentNullException . ThrowIfNull ( imagePoints ) ;
213207
214208 var criteria0 = criteria . GetValueOrDefault (
215209 new TermCriteria ( CriteriaTypes . Count | CriteriaTypes . Eps , 30 , Double . Epsilon ) ) ;
@@ -270,14 +264,10 @@ public static double CalibrateCamera(
270264 CalibrationFlags flags = CalibrationFlags . None ,
271265 TermCriteria ? criteria = null )
272266 {
273- if ( objectPoints is null )
274- throw new ArgumentNullException ( nameof ( objectPoints ) ) ;
275- if ( imagePoints is null )
276- throw new ArgumentNullException ( nameof ( imagePoints ) ) ;
277- if ( cameraMatrix is null )
278- throw new ArgumentNullException ( nameof ( cameraMatrix ) ) ;
279- if ( distCoeffs is null )
280- throw new ArgumentNullException ( nameof ( distCoeffs ) ) ;
267+ ArgumentNullException . ThrowIfNull ( objectPoints ) ;
268+ ArgumentNullException . ThrowIfNull ( imagePoints ) ;
269+ ArgumentNullException . ThrowIfNull ( cameraMatrix ) ;
270+ ArgumentNullException . ThrowIfNull ( distCoeffs ) ;
281271
282272 var criteria0 = criteria . GetValueOrDefault (
283273 new TermCriteria ( CriteriaTypes . Count | CriteriaTypes . Eps , 30 , Double . Epsilon ) ) ;
@@ -335,14 +325,10 @@ public static double RegisterCameras(
335325 InputOutputArray r , InputOutputArray t , OutputArray e , OutputArray f ,
336326 OutputArray perViewErrors , CalibrationFlags flags = CalibrationFlags . None , TermCriteria ? criteria = null )
337327 {
338- if ( objectPoints1 is null )
339- throw new ArgumentNullException ( nameof ( objectPoints1 ) ) ;
340- if ( objectPoints2 is null )
341- throw new ArgumentNullException ( nameof ( objectPoints2 ) ) ;
342- if ( imagePoints1 is null )
343- throw new ArgumentNullException ( nameof ( imagePoints1 ) ) ;
344- if ( imagePoints2 is null )
345- throw new ArgumentNullException ( nameof ( imagePoints2 ) ) ;
328+ ArgumentNullException . ThrowIfNull ( objectPoints1 ) ;
329+ ArgumentNullException . ThrowIfNull ( objectPoints2 ) ;
330+ ArgumentNullException . ThrowIfNull ( imagePoints1 ) ;
331+ ArgumentNullException . ThrowIfNull ( imagePoints2 ) ;
346332
347333 var criteria0 = criteria . GetValueOrDefault (
348334 new TermCriteria ( CriteriaTypes . Count | CriteriaTypes . Eps , 100 , 1e-6 ) ) ;
@@ -405,12 +391,9 @@ public static double CalibrateMultiview(
405391 CalibrationFlags flags = CalibrationFlags . None ,
406392 TermCriteria ? criteria = null )
407393 {
408- if ( objPoints is null )
409- throw new ArgumentNullException ( nameof ( objPoints ) ) ;
410- if ( imagePoints is null )
411- throw new ArgumentNullException ( nameof ( imagePoints ) ) ;
412- if ( imageSize is null )
413- throw new ArgumentNullException ( nameof ( imageSize ) ) ;
394+ ArgumentNullException . ThrowIfNull ( objPoints ) ;
395+ ArgumentNullException . ThrowIfNull ( imagePoints ) ;
396+ ArgumentNullException . ThrowIfNull ( imageSize ) ;
414397
415398 var criteria0 = criteria . GetValueOrDefault (
416399 new TermCriteria ( CriteriaTypes . Count | CriteriaTypes . Eps , 100 , double . Epsilon ) ) ;
@@ -486,12 +469,9 @@ public static double StereoCalibrate(
486469 CalibrationFlags flags = CalibrationFlags . FixIntrinsic ,
487470 TermCriteria ? criteria = null )
488471 {
489- if ( objectPoints is null )
490- throw new ArgumentNullException ( nameof ( objectPoints ) ) ;
491- if ( imagePoints1 is null )
492- throw new ArgumentNullException ( nameof ( imagePoints1 ) ) ;
493- if ( imagePoints2 is null )
494- throw new ArgumentNullException ( nameof ( imagePoints2 ) ) ;
472+ ArgumentNullException . ThrowIfNull ( objectPoints ) ;
473+ ArgumentNullException . ThrowIfNull ( imagePoints1 ) ;
474+ ArgumentNullException . ThrowIfNull ( imagePoints2 ) ;
495475
496476 var opPtrs = objectPoints . Select ( x => x . CvPtr ) . ToArray ( ) ;
497477 var ip1Ptrs = imagePoints1 . Select ( x => x . CvPtr ) . ToArray ( ) ;
@@ -554,20 +534,13 @@ public static double StereoCalibrate(
554534 CalibrationFlags flags = CalibrationFlags . FixIntrinsic ,
555535 TermCriteria ? criteria = null )
556536 {
557- if ( objectPoints is null )
558- throw new ArgumentNullException ( nameof ( objectPoints ) ) ;
559- if ( imagePoints1 is null )
560- throw new ArgumentNullException ( nameof ( imagePoints1 ) ) ;
561- if ( imagePoints2 is null )
562- throw new ArgumentNullException ( nameof ( imagePoints2 ) ) ;
563- if ( cameraMatrix1 is null )
564- throw new ArgumentNullException ( nameof ( cameraMatrix1 ) ) ;
565- if ( distCoeffs1 is null )
566- throw new ArgumentNullException ( nameof ( distCoeffs1 ) ) ;
567- if ( cameraMatrix2 is null )
568- throw new ArgumentNullException ( nameof ( cameraMatrix2 ) ) ;
569- if ( distCoeffs2 is null )
570- throw new ArgumentNullException ( nameof ( distCoeffs2 ) ) ;
537+ ArgumentNullException . ThrowIfNull ( objectPoints ) ;
538+ ArgumentNullException . ThrowIfNull ( imagePoints1 ) ;
539+ ArgumentNullException . ThrowIfNull ( imagePoints2 ) ;
540+ ArgumentNullException . ThrowIfNull ( cameraMatrix1 ) ;
541+ ArgumentNullException . ThrowIfNull ( distCoeffs1 ) ;
542+ ArgumentNullException . ThrowIfNull ( cameraMatrix2 ) ;
543+ ArgumentNullException . ThrowIfNull ( distCoeffs2 ) ;
571544
572545 var criteria0 = criteria . GetValueOrDefault (
573546 new TermCriteria ( CriteriaTypes . Count | CriteriaTypes . Eps , 30 , 1e-6 ) ) ;
@@ -642,14 +615,10 @@ public static void CalibrateHandEye(
642615 OutputArray t_cam2gripper ,
643616 HandEyeCalibrationMethod method = HandEyeCalibrationMethod . TSAI )
644617 {
645- if ( R_gripper2base is null )
646- throw new ArgumentNullException ( nameof ( R_gripper2base ) ) ;
647- if ( t_gripper2base is null )
648- throw new ArgumentNullException ( nameof ( t_gripper2base ) ) ;
649- if ( R_target2cam is null )
650- throw new ArgumentNullException ( nameof ( R_target2cam ) ) ;
651- if ( t_target2cam is null )
652- throw new ArgumentNullException ( nameof ( t_target2cam ) ) ;
618+ ArgumentNullException . ThrowIfNull ( R_gripper2base ) ;
619+ ArgumentNullException . ThrowIfNull ( t_gripper2base ) ;
620+ ArgumentNullException . ThrowIfNull ( R_target2cam ) ;
621+ ArgumentNullException . ThrowIfNull ( t_target2cam ) ;
653622
654623 var R_gripper2baseArray = R_gripper2base as Mat [ ] ?? R_gripper2base . ToArray ( ) ;
655624 var t_gripper2baseArray = t_gripper2base as Mat [ ] ?? t_gripper2base . ToArray ( ) ;
@@ -726,14 +695,10 @@ public static void CalibrateRobotWorldHandEye(
726695 OutputArray t_gripper2cam ,
727696 RobotWorldHandEyeCalibrationMethod method = RobotWorldHandEyeCalibrationMethod . SHAH )
728697 {
729- if ( R_world2cam is null )
730- throw new ArgumentNullException ( nameof ( R_world2cam ) ) ;
731- if ( t_world2cam is null )
732- throw new ArgumentNullException ( nameof ( t_world2cam ) ) ;
733- if ( R_base2gripper is null )
734- throw new ArgumentNullException ( nameof ( R_base2gripper ) ) ;
735- if ( t_base2gripper is null )
736- throw new ArgumentNullException ( nameof ( t_base2gripper ) ) ;
698+ ArgumentNullException . ThrowIfNull ( R_world2cam ) ;
699+ ArgumentNullException . ThrowIfNull ( t_world2cam ) ;
700+ ArgumentNullException . ThrowIfNull ( R_base2gripper ) ;
701+ ArgumentNullException . ThrowIfNull ( t_base2gripper ) ;
737702 var R_world2camArray = R_world2cam as Mat [ ] ?? R_world2cam . ToArray ( ) ;
738703 var t_world2camArray = t_world2cam as Mat [ ] ?? t_world2cam . ToArray ( ) ;
739704 var R_base2gripperArray = R_base2gripper as Mat [ ] ?? R_base2gripper . ToArray ( ) ;
@@ -805,14 +770,10 @@ public static void CalibrateRobotWorldHandEye(
805770 out double [ ] t_gripper2cam ,
806771 RobotWorldHandEyeCalibrationMethod method = RobotWorldHandEyeCalibrationMethod . SHAH )
807772 {
808- if ( R_world2cam is null )
809- throw new ArgumentNullException ( nameof ( R_world2cam ) ) ;
810- if ( t_world2cam is null )
811- throw new ArgumentNullException ( nameof ( t_world2cam ) ) ;
812- if ( R_base2gripper is null )
813- throw new ArgumentNullException ( nameof ( R_base2gripper ) ) ;
814- if ( t_base2gripper is null )
815- throw new ArgumentNullException ( nameof ( t_base2gripper ) ) ;
773+ ArgumentNullException . ThrowIfNull ( R_world2cam ) ;
774+ ArgumentNullException . ThrowIfNull ( t_world2cam ) ;
775+ ArgumentNullException . ThrowIfNull ( R_base2gripper ) ;
776+ ArgumentNullException . ThrowIfNull ( t_base2gripper ) ;
816777 var R_world2camArray = R_world2cam as Mat [ ] ?? R_world2cam . ToArray ( ) ;
817778 var t_world2camArray = t_world2cam as Mat [ ] ?? t_world2cam . ToArray ( ) ;
818779 var R_base2gripperArray = R_base2gripper as Mat [ ] ?? R_base2gripper . ToArray ( ) ;
0 commit comments