Skip to content

Commit 3fddea2

Browse files
authored
Merge pull request opencv#26435 from vrabaud:4x_calibration_base
Remove unused internal C functions
2 parents 6873bde + 3d89824 commit 3fddea2

File tree

6 files changed

+0
-752
lines changed

6 files changed

+0
-752
lines changed

modules/calib3d/src/calib3d_c_api.h

Lines changed: 0 additions & 205 deletions
Original file line numberDiff line numberDiff line change
@@ -55,45 +55,8 @@ extern "C" {
5555
* Camera Calibration, Pose Estimation and Stereo *
5656
\****************************************************************************************/
5757

58-
typedef struct CvPOSITObject CvPOSITObject;
59-
60-
/* Allocates and initializes CvPOSITObject structure before doing cvPOSIT */
61-
CvPOSITObject* cvCreatePOSITObject( CvPoint3D32f* points, int point_count );
62-
63-
64-
/* Runs POSIT (POSe from ITeration) algorithm for determining 3d position of
65-
an object given its model and projection in a weak-perspective case */
66-
void cvPOSIT( CvPOSITObject* posit_object, CvPoint2D32f* image_points,
67-
double focal_length, CvTermCriteria criteria,
68-
float* rotation_matrix, float* translation_vector);
69-
70-
/* Releases CvPOSITObject structure */
71-
void cvReleasePOSITObject( CvPOSITObject** posit_object );
72-
73-
/* updates the number of RANSAC iterations */
74-
int cvRANSACUpdateNumIters( double p, double err_prob,
75-
int model_points, int max_iters );
76-
7758
void cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst );
7859

79-
/* Calculates fundamental matrix given a set of corresponding points */
80-
/*#define CV_FM_7POINT 1
81-
#define CV_FM_8POINT 2
82-
83-
#define CV_LMEDS 4
84-
#define CV_RANSAC 8
85-
86-
#define CV_FM_LMEDS_ONLY CV_LMEDS
87-
#define CV_FM_RANSAC_ONLY CV_RANSAC
88-
#define CV_FM_LMEDS CV_LMEDS
89-
#define CV_FM_RANSAC CV_RANSAC*/
90-
91-
int cvFindFundamentalMat( const CvMat* points1, const CvMat* points2,
92-
CvMat* fundamental_matrix,
93-
int method CV_DEFAULT(CV_FM_RANSAC),
94-
double param1 CV_DEFAULT(3.), double param2 CV_DEFAULT(0.99),
95-
CvMat* status CV_DEFAULT(NULL) );
96-
9760
/* For each input point on one of images
9861
computes parameters of the corresponding
9962
epipolar line on the other image */
@@ -102,15 +65,6 @@ void cvComputeCorrespondEpilines( const CvMat* points,
10265
const CvMat* fundamental_matrix,
10366
CvMat* correspondent_lines );
10467

105-
/* Triangulation functions */
106-
107-
void cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2,
108-
CvMat* projPoints1, CvMat* projPoints2,
109-
CvMat* points4D);
110-
111-
void cvCorrectMatches(CvMat* F, CvMat* points1, CvMat* points2,
112-
CvMat* new_points1, CvMat* new_points2);
113-
11468
/* Finds perspective transformation between the object plane and image (view) plane */
11569
int cvFindHomography( const CvMat* src_points,
11670
const CvMat* dst_points,
@@ -129,45 +83,6 @@ void cvInitIntrinsicParams2D( const CvMat* object_points,
12983
CvMat* camera_matrix,
13084
double aspect_ratio CV_DEFAULT(1.) );
13185

132-
// Performs a fast check if a chessboard is in the input image. This is a workaround to
133-
// a problem of cvFindChessboardCorners being slow on images with no chessboard
134-
// - src: input image
135-
// - size: chessboard size
136-
// Returns 1 if a chessboard can be in this image and findChessboardCorners should be called,
137-
// 0 if there is no chessboard, -1 in case of error
138-
int cvCheckChessboard(IplImage* src, CvSize size);
139-
140-
/* Detects corners on a chessboard calibration pattern */
141-
/*int cvFindChessboardCorners( const void* image, CvSize pattern_size,
142-
CvPoint2D32f* corners,
143-
int* corner_count CV_DEFAULT(NULL),
144-
int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE) );*/
145-
146-
/* Draws individual chessboard corners or the whole chessboard detected */
147-
/*void cvDrawChessboardCorners( CvArr* image, CvSize pattern_size,
148-
CvPoint2D32f* corners,
149-
int count, int pattern_was_found );*/
150-
151-
/*#define CV_CALIB_USE_INTRINSIC_GUESS 1
152-
#define CV_CALIB_FIX_ASPECT_RATIO 2
153-
#define CV_CALIB_FIX_PRINCIPAL_POINT 4
154-
#define CV_CALIB_ZERO_TANGENT_DIST 8
155-
#define CV_CALIB_FIX_FOCAL_LENGTH 16
156-
#define CV_CALIB_FIX_K1 32
157-
#define CV_CALIB_FIX_K2 64
158-
#define CV_CALIB_FIX_K3 128
159-
#define CV_CALIB_FIX_K4 2048
160-
#define CV_CALIB_FIX_K5 4096
161-
#define CV_CALIB_FIX_K6 8192
162-
#define CV_CALIB_RATIONAL_MODEL 16384
163-
#define CV_CALIB_THIN_PRISM_MODEL 32768
164-
#define CV_CALIB_FIX_S1_S2_S3_S4 65536
165-
#define CV_CALIB_TILTED_MODEL 262144
166-
#define CV_CALIB_FIX_TAUX_TAUY 524288
167-
#define CV_CALIB_FIX_TANGENT_DIST 2097152
168-
169-
#define CV_CALIB_NINTRINSIC 18*/
170-
17186
/* Finds intrinsic and extrinsic camera parameters
17287
from a few views of known calibration pattern */
17388
double cvCalibrateCamera2( const CvMat* object_points,
@@ -182,37 +97,6 @@ double cvCalibrateCamera2( const CvMat* object_points,
18297
CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
18398
CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) );
18499

185-
/* Finds intrinsic and extrinsic camera parameters
186-
from a few views of known calibration pattern */
187-
double cvCalibrateCamera4( const CvMat* object_points,
188-
const CvMat* image_points,
189-
const CvMat* point_counts,
190-
CvSize image_size,
191-
int iFixedPoint,
192-
CvMat* camera_matrix,
193-
CvMat* distortion_coeffs,
194-
CvMat* rotation_vectors CV_DEFAULT(NULL),
195-
CvMat* translation_vectors CV_DEFAULT(NULL),
196-
CvMat* newObjPoints CV_DEFAULT(NULL),
197-
int flags CV_DEFAULT(0),
198-
CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
199-
CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) );
200-
201-
/* Computes various useful characteristics of the camera from the data computed by
202-
cvCalibrateCamera2 */
203-
void cvCalibrationMatrixValues( const CvMat *camera_matrix,
204-
CvSize image_size,
205-
double aperture_width CV_DEFAULT(0),
206-
double aperture_height CV_DEFAULT(0),
207-
double *fovx CV_DEFAULT(NULL),
208-
double *fovy CV_DEFAULT(NULL),
209-
double *focal_length CV_DEFAULT(NULL),
210-
CvPoint2D64f *principal_point CV_DEFAULT(NULL),
211-
double *pixel_aspect_ratio CV_DEFAULT(NULL));
212-
213-
/*#define CV_CALIB_FIX_INTRINSIC 256
214-
#define CV_CALIB_SAME_FOCAL_LENGTH 512*/
215-
216100
/* Computes the transformation from one camera coordinate system to another one
217101
from a few correspondent views of the same calibration target. Optionally, calibrates
218102
both cameras */
@@ -248,95 +132,6 @@ int cvStereoRectifyUncalibrated( const CvMat* points1, const CvMat* points2,
248132
CvMat* H1, CvMat* H2,
249133
double threshold CV_DEFAULT(5));
250134

251-
252-
253-
/* stereo correspondence parameters and functions */
254-
255-
#define CV_STEREO_BM_NORMALIZED_RESPONSE 0
256-
#define CV_STEREO_BM_XSOBEL 1
257-
258-
/* Block matching algorithm structure */
259-
typedef struct CvStereoBMState
260-
{
261-
// pre-filtering (normalization of input images)
262-
int preFilterType; // =CV_STEREO_BM_NORMALIZED_RESPONSE now
263-
int preFilterSize; // averaging window size: ~5x5..21x21
264-
int preFilterCap; // the output of pre-filtering is clipped by [-preFilterCap,preFilterCap]
265-
266-
// correspondence using Sum of Absolute Difference (SAD)
267-
int SADWindowSize; // ~5x5..21x21
268-
int minDisparity; // minimum disparity (can be negative)
269-
int numberOfDisparities; // maximum disparity - minimum disparity (> 0)
270-
271-
// post-filtering
272-
int textureThreshold; // the disparity is only computed for pixels
273-
// with textured enough neighborhood
274-
int uniquenessRatio; // accept the computed disparity d* only if
275-
// SAD(d) >= SAD(d*)*(1 + uniquenessRatio/100.)
276-
// for any d != d*+/-1 within the search range.
277-
int speckleWindowSize; // disparity variation window
278-
int speckleRange; // acceptable range of variation in window
279-
280-
int trySmallerWindows; // if 1, the results may be more accurate,
281-
// at the expense of slower processing
282-
CvRect roi1, roi2;
283-
int disp12MaxDiff;
284-
285-
// temporary buffers
286-
CvMat* preFilteredImg0;
287-
CvMat* preFilteredImg1;
288-
CvMat* slidingSumBuf;
289-
CvMat* cost;
290-
CvMat* disp;
291-
} CvStereoBMState;
292-
293-
#define CV_STEREO_BM_BASIC 0
294-
#define CV_STEREO_BM_FISH_EYE 1
295-
#define CV_STEREO_BM_NARROW 2
296-
297-
CvStereoBMState* cvCreateStereoBMState(int preset CV_DEFAULT(CV_STEREO_BM_BASIC),
298-
int numberOfDisparities CV_DEFAULT(0));
299-
300-
void cvReleaseStereoBMState( CvStereoBMState** state );
301-
302-
void cvFindStereoCorrespondenceBM( const CvArr* left, const CvArr* right,
303-
CvArr* disparity, CvStereoBMState* state );
304-
305-
CvRect cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity,
306-
int numberOfDisparities, int SADWindowSize );
307-
308-
void cvValidateDisparity( CvArr* disparity, const CvArr* cost,
309-
int minDisparity, int numberOfDisparities,
310-
int disp12MaxDiff CV_DEFAULT(1) );
311-
312-
/* Reprojects the computed disparity image to the 3D space using the specified 4x4 matrix */
313-
void cvReprojectImageTo3D( const CvArr* disparityImage,
314-
CvArr* _3dImage, const CvMat* Q,
315-
int handleMissingValues CV_DEFAULT(0) );
316-
317-
/** @brief Transforms the input image to compensate lens distortion
318-
@see cv::undistort
319-
*/
320-
void cvUndistort2( const CvArr* src, CvArr* dst,
321-
const CvMat* camera_matrix,
322-
const CvMat* distortion_coeffs,
323-
const CvMat* new_camera_matrix CV_DEFAULT(0) );
324-
325-
/** @brief Computes transformation map from intrinsic camera parameters
326-
that can used by cvRemap
327-
*/
328-
void cvInitUndistortMap( const CvMat* camera_matrix,
329-
const CvMat* distortion_coeffs,
330-
CvArr* mapx, CvArr* mapy );
331-
332-
/** @brief Computes undistortion+rectification map for a head of stereo camera
333-
@see cv::initUndistortRectifyMap
334-
*/
335-
void cvInitUndistortRectifyMap( const CvMat* camera_matrix,
336-
const CvMat* dist_coeffs,
337-
const CvMat *R, const CvMat* new_camera_matrix,
338-
CvArr* mapx, CvArr* mapy );
339-
340135
/** @brief Computes the original (undistorted) feature coordinates
341136
from the observed (distorted) coordinates
342137
@see cv::undistortPoints

modules/calib3d/src/calibration.cpp

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -679,82 +679,6 @@ CV_IMPL double cvCalibrateCamera2( const CvMat* objectPoints,
679679
distCoeffs, rvecs, tvecs, NULL, NULL, NULL, flags, termCrit);
680680
}
681681

682-
CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints,
683-
const CvMat* imagePoints, const CvMat* npoints,
684-
CvSize imageSize, int iFixedPoint, CvMat* cameraMatrix, CvMat* distCoeffs,
685-
CvMat* rvecs, CvMat* tvecs, CvMat* newObjPoints, int flags, CvTermCriteria termCrit )
686-
{
687-
if( !CV_IS_MAT(npoints) )
688-
CV_Error( cv::Error::StsBadArg, "npoints is not a valid matrix" );
689-
if( CV_MAT_TYPE(npoints->type) != CV_32SC1 ||
690-
(npoints->rows != 1 && npoints->cols != 1) )
691-
CV_Error( cv::Error::StsUnsupportedFormat,
692-
"the array of point counters must be 1-dimensional integer vector" );
693-
694-
bool releaseObject = iFixedPoint > 0 && iFixedPoint < npoints->data.i[0] - 1;
695-
int nimages = npoints->rows * npoints->cols;
696-
int npstep = npoints->rows == 1 ? 1 : npoints->step / CV_ELEM_SIZE(npoints->type);
697-
int i, ni;
698-
// check object points. If not qualified, report errors.
699-
if( releaseObject )
700-
{
701-
if( !CV_IS_MAT(objectPoints) )
702-
CV_Error( cv::Error::StsBadArg, "objectPoints is not a valid matrix" );
703-
Mat matM;
704-
if(CV_MAT_CN(objectPoints->type) == 3) {
705-
matM = cvarrToMat(objectPoints);
706-
} else {
707-
convertPointsHomogeneous(cvarrToMat(objectPoints), matM);
708-
}
709-
710-
matM = matM.reshape(3, 1);
711-
ni = npoints->data.i[0];
712-
for( i = 1; i < nimages; i++ )
713-
{
714-
if( npoints->data.i[i * npstep] != ni )
715-
{
716-
CV_Error( cv::Error::StsBadArg, "All objectPoints[i].size() should be equal when "
717-
"object-releasing method is requested." );
718-
}
719-
Mat ocmp = matM.colRange(ni * i, ni * i + ni) != matM.colRange(0, ni);
720-
ocmp = ocmp.reshape(1);
721-
if( countNonZero(ocmp) )
722-
{
723-
CV_Error( cv::Error::StsBadArg, "All objectPoints[i] should be identical when object-releasing"
724-
" method is requested." );
725-
}
726-
}
727-
}
728-
729-
return cvCalibrateCamera2Internal(objectPoints, imagePoints, npoints, imageSize, iFixedPoint,
730-
cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints, NULL,
731-
NULL, flags, termCrit);
732-
}
733-
734-
void cvCalibrationMatrixValues( const CvMat *calibMatr, CvSize imgSize,
735-
double apertureWidth, double apertureHeight, double *fovx, double *fovy,
736-
double *focalLength, CvPoint2D64f *principalPoint, double *pasp )
737-
{
738-
/* Validate parameters. */
739-
if(calibMatr == 0)
740-
CV_Error(cv::Error::StsNullPtr, "Some of parameters is a NULL pointer!");
741-
742-
if(!CV_IS_MAT(calibMatr))
743-
CV_Error(cv::Error::StsUnsupportedFormat, "Input parameters must be matrices!");
744-
745-
double dummy = .0;
746-
Point2d pp;
747-
cv::calibrationMatrixValues(cvarrToMat(calibMatr), imgSize, apertureWidth, apertureHeight,
748-
fovx ? *fovx : dummy,
749-
fovy ? *fovy : dummy,
750-
focalLength ? *focalLength : dummy,
751-
pp,
752-
pasp ? *pasp : dummy);
753-
754-
if(principalPoint)
755-
*principalPoint = cvPoint2D64f(pp.x, pp.y);
756-
}
757-
758682

759683
//////////////////////////////// Stereo Calibration ///////////////////////////////////
760684

@@ -1870,21 +1794,6 @@ void cv::reprojectImageTo3D( InputArray _disparity,
18701794
}
18711795

18721796

1873-
void cvReprojectImageTo3D( const CvArr* disparityImage,
1874-
CvArr* _3dImage, const CvMat* matQ,
1875-
int handleMissingValues )
1876-
{
1877-
cv::Mat disp = cv::cvarrToMat(disparityImage);
1878-
cv::Mat _3dimg = cv::cvarrToMat(_3dImage);
1879-
cv::Mat mq = cv::cvarrToMat(matQ);
1880-
CV_Assert( disp.size() == _3dimg.size() );
1881-
int dtype = _3dimg.type();
1882-
CV_Assert( dtype == CV_16SC3 || dtype == CV_32SC3 || dtype == CV_32FC3 );
1883-
1884-
cv::reprojectImageTo3D(disp, _3dimg, mq, handleMissingValues != 0, dtype );
1885-
}
1886-
1887-
18881797

18891798
namespace cv
18901799
{

modules/calib3d/src/checkchessboard.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
//M*/
4141

4242
#include "precomp.hpp"
43-
#include "calib3d_c_api.h"
4443

4544
#include <vector>
4645
#include <algorithm>
@@ -150,18 +149,6 @@ static bool checkQuads(vector<pair<float, int> > & quads, const cv::Size & size)
150149
return false;
151150
}
152151

153-
// does a fast check if a chessboard is in the input image. This is a workaround to
154-
// a problem of cvFindChessboardCorners being slow on images with no chessboard
155-
// - src: input image
156-
// - size: chessboard size
157-
// Returns 1 if a chessboard can be in this image and findChessboardCorners should be called,
158-
// 0 if there is no chessboard, -1 in case of error
159-
int cvCheckChessboard(IplImage* src, CvSize size)
160-
{
161-
cv::Mat img = cv::cvarrToMat(src);
162-
return (int)cv::checkChessboard(img, size);
163-
}
164-
165152
bool cv::checkChessboard(InputArray _img, Size size)
166153
{
167154
Mat img = _img.getMat();

0 commit comments

Comments
 (0)