mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #25075 from mshabunin:cleanup-imgproc-1
C-API cleanup: apps, imgproc_c and some constants #25075 Merge with https://github.com/opencv/opencv_contrib/pull/3642 * Removed obsolete apps - traincascade and createsamples (please use older OpenCV versions if you need them). These apps relied heavily on C-API * removed all mentions of imgproc C-API headers (imgproc_c.h, types_c.h) - they were empty, included core C-API headers * replaced usage of several C constants with C++ ones (error codes, norm modes, RNG modes, PCA modes, ...) - most part of this PR (split into two parts - all modules and calib+3d - for easier backporting) * removed imgproc C-API headers (as separate commit, so that other changes could be backported to 4.x) Most of these changes can be backported to 4.x.
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/imgproc/imgproc_c.h"
|
||||
#include "distortion_model.hpp"
|
||||
#include <stdio.h>
|
||||
#include <iterator>
|
||||
@@ -146,7 +145,7 @@ void cv::Rodrigues(InputArray _src, OutputArray _dst, OutputArray _jacobian)
|
||||
dst.setZero();
|
||||
|
||||
if( depth != CV_32F && depth != CV_64F )
|
||||
CV_Error( CV_StsUnsupportedFormat, "The matrices must have 32f or 64f data type" );
|
||||
CV_Error( cv::Error::StsUnsupportedFormat, "The matrices must have 32f or 64f data type" );
|
||||
|
||||
if( v2m )
|
||||
{
|
||||
@@ -532,7 +531,7 @@ void cv::projectPoints( InputArray _objectPoints,
|
||||
if(total % 3 != 0)
|
||||
{
|
||||
//we have stopped support of homogeneous coordinates because it cause ambiguity in interpretation of the input data
|
||||
CV_Error( CV_StsBadArg, "Homogeneous coordinates are not supported" );
|
||||
CV_Error( cv::Error::StsBadArg, "Homogeneous coordinates are not supported" );
|
||||
}
|
||||
count = total / 3;
|
||||
CV_Assert(objpt_depth == CV_32F || objpt_depth == CV_64F);
|
||||
@@ -560,7 +559,7 @@ void cv::projectPoints( InputArray _objectPoints,
|
||||
(rvec.size() == Size(3, 3) ||
|
||||
(rvec.rows == 1 && rvec.cols*rvec.channels() == 3) ||
|
||||
(rvec.rows == 3 && rvec.cols*rvec.channels() == 1)))) {
|
||||
CV_Error(CV_StsBadArg, "rvec must be 3x3 or 1x3 or 3x1 floating-point array");
|
||||
CV_Error(cv::Error::StsBadArg, "rvec must be 3x3 or 1x3 or 3x1 floating-point array");
|
||||
}
|
||||
|
||||
if( rvec.size() == Size(3, 3) )
|
||||
@@ -582,7 +581,7 @@ void cv::projectPoints( InputArray _objectPoints,
|
||||
if(!((tvec.depth() == CV_32F || tvec.depth() == CV_64F) &&
|
||||
((tvec.rows == 1 && tvec.cols*tvec.channels() == 3) ||
|
||||
(tvec.rows == 3 && tvec.cols*tvec.channels() == 1)))) {
|
||||
CV_Error(CV_StsBadArg, "tvec must be 1x3 or 3x1 floating-point array");
|
||||
CV_Error(cv::Error::StsBadArg, "tvec must be 1x3 or 3x1 floating-point array");
|
||||
}
|
||||
|
||||
Mat _t(tvec.size(), CV_64FC(tvec.channels()), t);
|
||||
@@ -591,7 +590,7 @@ void cv::projectPoints( InputArray _objectPoints,
|
||||
Mat cameraMatrix = _cameraMatrix.getMat();
|
||||
|
||||
if(cameraMatrix.size() != Size(3, 3) || cameraMatrix.channels() != 1)
|
||||
CV_Error( CV_StsBadArg, "Intrinsic parameters must be 3x3 floating-point matrix" );
|
||||
CV_Error( cv::Error::StsBadArg, "Intrinsic parameters must be 3x3 floating-point matrix" );
|
||||
Mat _a(3, 3, CV_64F, a);
|
||||
cameraMatrix.convertTo(_a, CV_64F);
|
||||
|
||||
@@ -609,7 +608,7 @@ void cv::projectPoints( InputArray _objectPoints,
|
||||
ktotal = (int)distCoeffs.total()*kcn;
|
||||
if( (distCoeffs.rows != 1 && distCoeffs.cols != 1) ||
|
||||
(ktotal != 4 && ktotal != 5 && ktotal != 8 && ktotal != 12 && ktotal != 14))
|
||||
CV_Error( CV_StsBadArg, cvDistCoeffErr );
|
||||
CV_Error( cv::Error::StsBadArg, cvDistCoeffErr );
|
||||
|
||||
Mat _k(distCoeffs.size(), CV_64FC(kcn), k);
|
||||
distCoeffs.convertTo(_k, CV_64F);
|
||||
|
||||
+10
-10
@@ -542,7 +542,7 @@ struct LevMarqDenseLinearBackend : public detail::LevMarqBackend
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_Error(CV_StsBadArg, "Geodesic acceleration is disabled");
|
||||
CV_Error(cv::Error::StsBadArg, "Geodesic acceleration is disabled");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -698,7 +698,7 @@ struct LevMarqDenseLinearBackend : public detail::LevMarqBackend
|
||||
{
|
||||
if (cb_alt)
|
||||
{
|
||||
CV_Error(CV_StsNotImplemented, "Geodesic acceleration is not implemented for normal callbacks, please use \"long\" callbacks");
|
||||
CV_Error(cv::Error::StsNotImplemented, "Geodesic acceleration is not implemented for normal callbacks, please use \"long\" callbacks");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -744,9 +744,9 @@ LevMarq::LevMarq(int nvars, LongCallback callback, const Settings& settings, Inp
|
||||
MatrixType matrixType, VariableType paramType, int nerrs, int solveMethod)
|
||||
{
|
||||
if (matrixType != MatrixType::AUTO && matrixType != MatrixType::DENSE)
|
||||
CV_Error(CV_StsNotImplemented, "General purpuse sparse solver for LevMarq is not implemented yet");
|
||||
CV_Error(cv::Error::StsNotImplemented, "General purpuse sparse solver for LevMarq is not implemented yet");
|
||||
if (paramType != VariableType::LINEAR)
|
||||
CV_Error(CV_StsNotImplemented, "SO(3) and SE(3) params for LevMarq are not implemented yet");
|
||||
CV_Error(cv::Error::StsNotImplemented, "SO(3) and SE(3) params for LevMarq are not implemented yet");
|
||||
|
||||
auto backend = makePtr<LevMarqDenseLinearBackend>(nvars, callback, mask, nerrs, solveMethod);
|
||||
pImpl = makePtr<LevMarq::Impl>(backend, settings);
|
||||
@@ -756,9 +756,9 @@ LevMarq::LevMarq(int nvars, NormalCallback callback, const Settings& settings, I
|
||||
MatrixType matrixType, VariableType paramType, bool LtoR, int solveMethod)
|
||||
{
|
||||
if (matrixType != MatrixType::AUTO && matrixType != MatrixType::DENSE)
|
||||
CV_Error(CV_StsNotImplemented, "General purpuse sparse solver for LevMarq is not implemented yet");
|
||||
CV_Error(cv::Error::StsNotImplemented, "General purpuse sparse solver for LevMarq is not implemented yet");
|
||||
if (paramType != VariableType::LINEAR)
|
||||
CV_Error(CV_StsNotImplemented, "SO(3) and SE(3) params for LevMarq are not implemented yet");
|
||||
CV_Error(cv::Error::StsNotImplemented, "SO(3) and SE(3) params for LevMarq are not implemented yet");
|
||||
|
||||
auto backend = makePtr<LevMarqDenseLinearBackend>(nvars, callback, mask, LtoR, solveMethod);
|
||||
pImpl = makePtr<LevMarq::Impl>(backend, settings);
|
||||
@@ -768,9 +768,9 @@ LevMarq::LevMarq(InputOutputArray param, LongCallback callback, const Settings&
|
||||
MatrixType matrixType, VariableType paramType, int nerrs, int solveMethod)
|
||||
{
|
||||
if (matrixType != MatrixType::AUTO && matrixType != MatrixType::DENSE)
|
||||
CV_Error(CV_StsNotImplemented, "General purpuse sparse solver for LevMarq is not implemented yet");
|
||||
CV_Error(cv::Error::StsNotImplemented, "General purpuse sparse solver for LevMarq is not implemented yet");
|
||||
if (paramType != VariableType::LINEAR)
|
||||
CV_Error(CV_StsNotImplemented, "SO(3) and SE(3) params for LevMarq are not implemented yet");
|
||||
CV_Error(cv::Error::StsNotImplemented, "SO(3) and SE(3) params for LevMarq are not implemented yet");
|
||||
|
||||
auto backend = makePtr<LevMarqDenseLinearBackend>(param, callback, mask, nerrs, solveMethod);
|
||||
pImpl = makePtr<LevMarq::Impl>(backend, settings);
|
||||
@@ -780,9 +780,9 @@ LevMarq::LevMarq(InputOutputArray param, NormalCallback callback, const Settings
|
||||
MatrixType matrixType, VariableType paramType, bool LtoR, int solveMethod)
|
||||
{
|
||||
if (matrixType != MatrixType::AUTO && matrixType != MatrixType::DENSE)
|
||||
CV_Error(CV_StsNotImplemented, "General purpuse sparse solver for LevMarq is not implemented yet");
|
||||
CV_Error(cv::Error::StsNotImplemented, "General purpuse sparse solver for LevMarq is not implemented yet");
|
||||
if (paramType != VariableType::LINEAR)
|
||||
CV_Error(CV_StsNotImplemented, "SO(3) and SE(3) params for LevMarq are not implemented yet");
|
||||
CV_Error(cv::Error::StsNotImplemented, "SO(3) and SE(3) params for LevMarq are not implemented yet");
|
||||
|
||||
auto backend = makePtr<LevMarqDenseLinearBackend>(param, callback, mask, LtoR, solveMethod);
|
||||
pImpl = makePtr<LevMarq::Impl>(backend, settings);
|
||||
|
||||
@@ -761,7 +761,7 @@ public:
|
||||
{
|
||||
if (geo && !useGeo)
|
||||
{
|
||||
CV_Error(CV_StsBadArg, "Geodesic acceleration is disabled");
|
||||
CV_Error(cv::Error::StsBadArg, "Geodesic acceleration is disabled");
|
||||
}
|
||||
|
||||
std::map<size_t, PoseGraphImpl::Node>& nodes = geo ? geoNodes : tempNodes;
|
||||
|
||||
@@ -1027,7 +1027,7 @@ int solvePnPGeneric( InputArray _opoints, InputArray _ipoints,
|
||||
vec_tvecs.push_back(tvec);
|
||||
}*/
|
||||
else
|
||||
CV_Error(CV_StsBadArg, "The flags argument must be one of SOLVEPNP_ITERATIVE, SOLVEPNP_P3P, "
|
||||
CV_Error(cv::Error::StsBadArg, "The flags argument must be one of SOLVEPNP_ITERATIVE, SOLVEPNP_P3P, "
|
||||
"SOLVEPNP_EPNP, SOLVEPNP_DLS, SOLVEPNP_UPNP, SOLVEPNP_AP3P, SOLVEPNP_IPPE, SOLVEPNP_IPPE_SQUARE or SOLVEPNP_SQPNP");
|
||||
|
||||
CV_Assert(vec_rvecs.size() == vec_tvecs.size());
|
||||
|
||||
@@ -173,9 +173,9 @@ void correctMatches( InputArray _F, InputArray _points1, InputArray _points2,
|
||||
CV_Assert(points1.size() == points2.size());
|
||||
CV_Assert(points1.rows == 1 || points1.cols == 1);
|
||||
if (points1.channels() != 2)
|
||||
CV_Error( CV_StsUnmatchedSizes, "The first set of points must contain two channels; one for x and one for y" );
|
||||
CV_Error( cv::Error::StsUnmatchedSizes, "The first set of points must contain two channels; one for x and one for y" );
|
||||
if (points2.channels() != 2)
|
||||
CV_Error( CV_StsUnmatchedSizes, "The second set of points must contain two channels; one for x and one for y" );
|
||||
CV_Error( cv::Error::StsUnmatchedSizes, "The second set of points must contain two channels; one for x and one for y" );
|
||||
|
||||
_newPoints1.create(points1.size(), points1.type());
|
||||
_newPoints2.create(points2.size(), points2.type());
|
||||
|
||||
Reference in New Issue
Block a user