mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 03:00:14 +08:00
Remove internal calib3d_c_api.h
The new C++ code is copy/pasted from OpenCV5: - functions initIntrinsicParams2D, subMatrix (the first 160 lines) - function prepareDistCoeffs - the different asserts Not all the API/code is ported to C++ yet to ease the review.
This commit is contained in:
parent
4866811933
commit
8c6339c04d
@ -1,94 +0,0 @@
|
|||||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
|
||||||
//
|
|
||||||
// By downloading, copying, installing or using the software you agree to this license.
|
|
||||||
// If you do not agree to this license, do not download, install,
|
|
||||||
// copy or use the software.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// License Agreement
|
|
||||||
// For Open Source Computer Vision Library
|
|
||||||
//
|
|
||||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
|
||||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
|
||||||
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
|
||||||
// Third party copyrights are property of their respective owners.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
// are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistribution's of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// * The name of the copyright holders may not be used to endorse or promote products
|
|
||||||
// derived from this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// This software is provided by the copyright holders and contributors "as is" and
|
|
||||||
// any express or implied warranties, including, but not limited to, the implied
|
|
||||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
|
||||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
|
||||||
// indirect, incidental, special, exemplary, or consequential damages
|
|
||||||
// (including, but not limited to, procurement of substitute goods or services;
|
|
||||||
// loss of use, data, or profits; or business interruption) however caused
|
|
||||||
// and on any theory of liability, whether in contract, strict liability,
|
|
||||||
// or tort (including negligence or otherwise) arising in any way out of
|
|
||||||
// the use of this software, even if advised of the possibility of such damage.
|
|
||||||
//
|
|
||||||
//M*/
|
|
||||||
|
|
||||||
#ifndef OPENCV_CALIB3D_C_API_H
|
|
||||||
#define OPENCV_CALIB3D_C_API_H
|
|
||||||
|
|
||||||
#include "opencv2/core/core_c.h"
|
|
||||||
#include "opencv2/calib3d/calib3d_c.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************************\
|
|
||||||
* Camera Calibration, Pose Estimation and Stereo *
|
|
||||||
\****************************************************************************************/
|
|
||||||
|
|
||||||
/* Finds perspective transformation between the object plane and image (view) plane */
|
|
||||||
int cvFindHomography( const CvMat* src_points,
|
|
||||||
const CvMat* dst_points,
|
|
||||||
CvMat* homography,
|
|
||||||
int method CV_DEFAULT(0),
|
|
||||||
double ransacReprojThreshold CV_DEFAULT(3),
|
|
||||||
CvMat* mask CV_DEFAULT(0),
|
|
||||||
int maxIters CV_DEFAULT(2000),
|
|
||||||
double confidence CV_DEFAULT(0.995));
|
|
||||||
|
|
||||||
/* Computes initial estimate of the intrinsic camera parameters
|
|
||||||
in case of planar calibration target (e.g. chessboard) */
|
|
||||||
void cvInitIntrinsicParams2D( const CvMat* object_points,
|
|
||||||
const CvMat* image_points,
|
|
||||||
const CvMat* npoints, CvSize image_size,
|
|
||||||
CvMat* camera_matrix,
|
|
||||||
double aspect_ratio CV_DEFAULT(1.) );
|
|
||||||
|
|
||||||
/* Finds intrinsic and extrinsic camera parameters
|
|
||||||
from a few views of known calibration pattern */
|
|
||||||
double cvCalibrateCamera2( const CvMat* object_points,
|
|
||||||
const CvMat* image_points,
|
|
||||||
const CvMat* point_counts,
|
|
||||||
CvSize image_size,
|
|
||||||
CvMat* camera_matrix,
|
|
||||||
CvMat* distortion_coeffs,
|
|
||||||
CvMat* rotation_vectors CV_DEFAULT(NULL),
|
|
||||||
CvMat* translation_vectors CV_DEFAULT(NULL),
|
|
||||||
int flags CV_DEFAULT(0),
|
|
||||||
CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
|
|
||||||
CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* OPENCV_CALIB3D_C_API_H */
|
|
File diff suppressed because it is too large
Load Diff
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "opencv2/core/core_c.h"
|
#include "opencv2/core/core_c.h"
|
||||||
#include "calib3d_c_api.h"
|
#include "opencv2/calib3d/calib3d_c.h"
|
||||||
|
|
||||||
/************************************************************************************\
|
/************************************************************************************\
|
||||||
Some backward compatibility stuff, to be moved to legacy or compat module
|
Some backward compatibility stuff, to be moved to legacy or compat module
|
||||||
@ -321,39 +321,3 @@ void CvLevMarq::step()
|
|||||||
for( int i = 0; i < nparams; i++ )
|
for( int i = 0; i < nparams; i++ )
|
||||||
param->data.db[i] = prevParam->data.db[i] - (mask->data.ptr[i] ? nonzero_param(j++) : 0);
|
param->data.db[i] = prevParam->data.db[i] - (mask->data.ptr[i] ? nonzero_param(j++) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CV_IMPL int cvFindHomography( const CvMat* _src, const CvMat* _dst, CvMat* __H, int method,
|
|
||||||
double ransacReprojThreshold, CvMat* _mask, int maxIters,
|
|
||||||
double confidence)
|
|
||||||
{
|
|
||||||
cv::Mat src = cv::cvarrToMat(_src), dst = cv::cvarrToMat(_dst);
|
|
||||||
|
|
||||||
if( src.channels() == 1 && (src.rows == 2 || src.rows == 3) && src.cols > 3 )
|
|
||||||
cv::transpose(src, src);
|
|
||||||
if( dst.channels() == 1 && (dst.rows == 2 || dst.rows == 3) && dst.cols > 3 )
|
|
||||||
cv::transpose(dst, dst);
|
|
||||||
|
|
||||||
if ( maxIters < 0 )
|
|
||||||
maxIters = 0;
|
|
||||||
if ( maxIters > 2000 )
|
|
||||||
maxIters = 2000;
|
|
||||||
|
|
||||||
if ( confidence < 0 )
|
|
||||||
confidence = 0;
|
|
||||||
if ( confidence > 1 )
|
|
||||||
confidence = 1;
|
|
||||||
|
|
||||||
const cv::Mat H = cv::cvarrToMat(__H), mask = cv::cvarrToMat(_mask);
|
|
||||||
cv::Mat H0 = cv::findHomography(src, dst, method, ransacReprojThreshold,
|
|
||||||
_mask ? cv::_OutputArray(mask) : cv::_OutputArray(), maxIters,
|
|
||||||
confidence);
|
|
||||||
|
|
||||||
if( H0.empty() )
|
|
||||||
{
|
|
||||||
cv::Mat Hz = cv::cvarrToMat(__H);
|
|
||||||
Hz.setTo(cv::Scalar::all(0));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
H0.convertTo(H, H.type());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user