Skip to content

Commit 651b13f

Browse files
author
Ilya Krylov
committed
Refactored class Fisheye to namespace fisheye
1 parent c30fef1 commit 651b13f

File tree

3 files changed

+90
-92
lines changed

3 files changed

+90
-92
lines changed

modules/calib3d/include/opencv2/calib3d/calib3d.hpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,8 @@ CV_EXPORTS_W int estimateAffine3D(InputArray src, InputArray dst,
745745
OutputArray out, OutputArray inliers,
746746
double ransacThreshold=3, double confidence=0.99);
747747

748-
class CV_EXPORTS Fisheye
748+
namespace fisheye
749749
{
750-
public:
751-
752750
enum{
753751
CALIB_USE_INTRINSIC_GUESS = 1,
754752
CALIB_RECOMPUTE_EXTRINSIC = 2,
@@ -762,50 +760,50 @@ class CV_EXPORTS Fisheye
762760
};
763761

764762
//! projects 3D points using fisheye model
765-
static void projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine,
763+
CV_EXPORTS void projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine,
766764
InputArray K, InputArray D, double alpha = 0, OutputArray jacobian = noArray());
767765

768766
//! projects points using fisheye model
769-
static void projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec,
767+
CV_EXPORTS void projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec,
770768
InputArray K, InputArray D, double alpha = 0, OutputArray jacobian = noArray());
771769

772770
//! distorts 2D points using fisheye model
773-
static void distortPoints(InputArray undistorted, OutputArray distorted, InputArray K, InputArray D, double alpha = 0);
771+
CV_EXPORTS void distortPoints(InputArray undistorted, OutputArray distorted, InputArray K, InputArray D, double alpha = 0);
774772

775773
//! undistorts 2D points using fisheye model
776-
static void undistortPoints(InputArray distorted, OutputArray undistorted,
774+
CV_EXPORTS void undistortPoints(InputArray distorted, OutputArray undistorted,
777775
InputArray K, InputArray D, InputArray R = noArray(), InputArray P = noArray());
778776

779777
//! computing undistortion and rectification maps for image transform by cv::remap()
780778
//! If D is empty zero distortion is used, if R or P is empty identity matrixes are used
781-
static void initUndistortRectifyMap(InputArray K, InputArray D, InputArray R, InputArray P,
779+
CV_EXPORTS void initUndistortRectifyMap(InputArray K, InputArray D, InputArray R, InputArray P,
782780
const cv::Size& size, int m1type, OutputArray map1, OutputArray map2);
783781

784782
//! undistorts image, optionally changes resolution and camera matrix. If Knew zero identity matrix is used
785-
static void undistortImage(InputArray distorted, OutputArray undistorted,
783+
CV_EXPORTS void undistortImage(InputArray distorted, OutputArray undistorted,
786784
InputArray K, InputArray D, InputArray Knew = cv::noArray(), const Size& new_size = Size());
787785

788786
//! estimates new camera matrix for undistortion or rectification
789-
static void estimateNewCameraMatrixForUndistortRectify(InputArray K, InputArray D, const Size &image_size, InputArray R,
787+
CV_EXPORTS void estimateNewCameraMatrixForUndistortRectify(InputArray K, InputArray D, const Size &image_size, InputArray R,
790788
OutputArray P, double balance = 0.0, const Size& new_size = Size(), double fov_scale = 1.0);
791789

792790
//! performs camera calibaration
793-
static double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size,
791+
CV_EXPORTS double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size,
794792
InputOutputArray K, InputOutputArray D, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags = 0,
795793
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
796794

797795
//! stereo rectification estimation
798-
static void stereoRectify(InputArray K1, InputArray D1, InputArray K2, InputArray D2, const Size &imageSize, InputArray R, InputArray tvec,
796+
CV_EXPORTS void stereoRectify(InputArray K1, InputArray D1, InputArray K2, InputArray D2, const Size &imageSize, InputArray R, InputArray tvec,
799797
OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags, const Size &newImageSize = Size(),
800798
double balance = 0.0, double fov_scale = 1.0);
801799

802800
//! performs stereo calibaration
803-
static double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
801+
CV_EXPORTS double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
804802
InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize,
805803
OutputArray R, OutputArray T, int flags = CALIB_FIX_INTRINSIC,
806804
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
807805

808-
};
806+
}
809807

810808
}
811809

modules/calib3d/src/fisheye.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ namespace cv { namespace
1414
}}
1515

1616
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
17-
/// cv::Fisheye::projectPoints
17+
/// cv::fisheye::projectPoints
1818

19-
void cv::Fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine,
19+
void cv::fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine,
2020
InputArray K, InputArray D, double alpha, OutputArray jacobian)
2121
{
2222
projectPoints(objectPoints, imagePoints, affine.rvec(), affine.translation(), K, D, alpha, jacobian);
2323
}
2424

25-
void cv::Fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray _rvec,
25+
void cv::fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray _rvec,
2626
InputArray _tvec, InputArray _K, InputArray _D, double alpha, OutputArray jacobian)
2727
{
2828
// will support only 3-channel data now for points
@@ -202,9 +202,9 @@ void cv::Fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints
202202
}
203203

204204
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
205-
/// cv::Fisheye::distortPoints
205+
/// cv::fisheye::distortPoints
206206

207-
void cv::Fisheye::distortPoints(InputArray undistorted, OutputArray distorted, InputArray K, InputArray D, double alpha)
207+
void cv::fisheye::distortPoints(InputArray undistorted, OutputArray distorted, InputArray K, InputArray D, double alpha)
208208
{
209209
// will support only 2-channel data now for points
210210
CV_Assert(undistorted.type() == CV_32FC2 || undistorted.type() == CV_64FC2);
@@ -264,9 +264,9 @@ void cv::Fisheye::distortPoints(InputArray undistorted, OutputArray distorted, I
264264
}
265265

266266
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
267-
/// cv::Fisheye::undistortPoints
267+
/// cv::fisheye::undistortPoints
268268

269-
void cv::Fisheye::undistortPoints( InputArray distorted, OutputArray undistorted, InputArray _K, InputArray _D, InputArray _R, InputArray _P)
269+
void cv::fisheye::undistortPoints( InputArray distorted, OutputArray undistorted, InputArray _K, InputArray _D, InputArray _R, InputArray _P)
270270
{
271271
// will support only 2-channel data now for points
272272
CV_Assert(distorted.type() == CV_32FC2 || distorted.type() == CV_64FC2);
@@ -353,9 +353,9 @@ void cv::Fisheye::undistortPoints( InputArray distorted, OutputArray undistorted
353353
}
354354

355355
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
356-
/// cv::Fisheye::undistortPoints
356+
/// cv::fisheye::undistortPoints
357357

358-
void cv::Fisheye::initUndistortRectifyMap( InputArray _K, InputArray _D, InputArray _R, InputArray _P,
358+
void cv::fisheye::initUndistortRectifyMap( InputArray _K, InputArray _D, InputArray _R, InputArray _P,
359359
const cv::Size& size, int m1type, OutputArray map1, OutputArray map2 )
360360
{
361361
CV_Assert( m1type == CV_16SC2 || m1type == CV_32F || m1type <=0 );
@@ -449,23 +449,23 @@ void cv::Fisheye::initUndistortRectifyMap( InputArray _K, InputArray _D, InputAr
449449
}
450450

451451
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
452-
/// cv::Fisheye::undistortImage
452+
/// cv::fisheye::undistortImage
453453

454-
void cv::Fisheye::undistortImage(InputArray distorted, OutputArray undistorted,
454+
void cv::fisheye::undistortImage(InputArray distorted, OutputArray undistorted,
455455
InputArray K, InputArray D, InputArray Knew, const Size& new_size)
456456
{
457457
Size size = new_size.area() != 0 ? new_size : distorted.size();
458458

459459
cv::Mat map1, map2;
460-
initUndistortRectifyMap(K, D, cv::Matx33d::eye(), Knew, size, CV_16SC2, map1, map2 );
460+
fisheye::initUndistortRectifyMap(K, D, cv::Matx33d::eye(), Knew, size, CV_16SC2, map1, map2 );
461461
cv::remap(distorted, undistorted, map1, map2, INTER_LINEAR, BORDER_CONSTANT);
462462
}
463463

464464

465465
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
466-
/// cv::Fisheye::estimateNewCameraMatrixForUndistortRectify
466+
/// cv::fisheye::estimateNewCameraMatrixForUndistortRectify
467467

468-
void cv::Fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, InputArray D, const Size &image_size, InputArray R,
468+
void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, InputArray D, const Size &image_size, InputArray R,
469469
OutputArray P, double balance, const Size& new_size, double fov_scale)
470470
{
471471
CV_Assert( K.size() == Size(3, 3) && (K.depth() == CV_32F || K.depth() == CV_64F));
@@ -495,7 +495,7 @@ void cv::Fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
495495
}
496496
#endif
497497

498-
undistortPoints(points, points, K, D, R);
498+
fisheye::undistortPoints(points, points, K, D, R);
499499
cv::Scalar center_mass = mean(points);
500500
cv::Vec2d cn(center_mass.val);
501501

@@ -560,9 +560,9 @@ void cv::Fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
560560

561561

562562
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
563-
/// cv::Fisheye::stereoRectify
563+
/// cv::fisheye::stereoRectify
564564

565-
void cv::Fisheye::stereoRectify( InputArray K1, InputArray D1, InputArray K2, InputArray D2, const Size& imageSize,
565+
void cv::fisheye::stereoRectify( InputArray K1, InputArray D1, InputArray K2, InputArray D2, const Size& imageSize,
566566
InputArray _R, InputArray _tvec, OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2,
567567
OutputArray Q, int flags, const Size& newImageSize, double balance, double fov_scale)
568568
{
@@ -642,9 +642,9 @@ void cv::Fisheye::stereoRectify( InputArray K1, InputArray D1, InputArray K2, In
642642
}
643643

644644
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
645-
/// cv::Fisheye::calibrate
645+
/// cv::fisheye::calibrate
646646

647-
double cv::Fisheye::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size,
647+
double cv::fisheye::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size,
648648
InputOutputArray K, InputOutputArray D, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
649649
int flags , cv::TermCriteria criteria)
650650
{
@@ -758,9 +758,9 @@ double cv::Fisheye::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArray
758758
}
759759

760760
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
761-
/// cv::Fisheye::stereoCalibrate
761+
/// cv::fisheye::stereoCalibrate
762762

763-
double cv::Fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
763+
double cv::fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
764764
InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize,
765765
OutputArray R, OutputArray T, int flags, TermCriteria criteria)
766766
{
@@ -1094,7 +1094,7 @@ void cv::internal::projectPoints(cv::InputArray objectPoints, cv::OutputArray im
10941094
Matx33d K(param.f[0], param.f[0] * param.alpha, param.c[0],
10951095
0, param.f[1], param.c[1],
10961096
0, 0, 1);
1097-
Fisheye::projectPoints(objectPoints, imagePoints, _rvec, _tvec, K, param.k, param.alpha, jacobian);
1097+
fisheye::projectPoints(objectPoints, imagePoints, _rvec, _tvec, K, param.k, param.alpha, jacobian);
10981098
}
10991099

11001100
void cv::internal::ComputeExtrinsicRefine(const Mat& imagePoints, const Mat& objectPoints, Mat& rvec,
@@ -1251,7 +1251,7 @@ cv::Mat cv::internal::NormalizePixels(const Mat& imagePoints, const IntrinsicPar
12511251
ptr_d[i] = (ptr[i] - param.c).mul(Vec2d(1.0 / param.f[0], 1.0 / param.f[1]));
12521252
ptr_d[i][0] = ptr_d[i][0] - param.alpha * ptr_d[i][1];
12531253
}
1254-
cv::Fisheye::undistortPoints(distorted, undistorted, Matx33d::eye(), param.k);
1254+
cv::fisheye::undistortPoints(distorted, undistorted, Matx33d::eye(), param.k);
12551255
return undistorted;
12561256
}
12571257

0 commit comments

Comments
 (0)