Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int to proper enum type #12288

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3a20946
Cleanup macros and enable expansion of `__VA_ARGS__` for Visual Studio
cv3d Sep 19, 2018
47ee431
Macros for enum-arguments backwards compatibility
cv3d Sep 19, 2018
07ba24d
Convert struct Param to enum struct
cv3d Sep 19, 2018
6080fd6
Enabled ParamType.type for enum types
cv3d Sep 19, 2018
55b1c9a
Enabled `cv.read` and `cv.write` for enum types
cv3d Sep 19, 2018
dcac3ca
Rename unnamed enum to AAKAZE.DescriptorType
cv3d Sep 19, 2018
e19a916
Rename unnamed enum to AccessFlag
cv3d Sep 19, 2018
dc32213
Rename unnamed enum to AgastFeatureDetector.DetectorType
cv3d Sep 19, 2018
e832e09
Convert struct DrawMatchesFlags to enum struct
cv3d Sep 19, 2018
1994093
Rename unnamed enum to FastFeatureDetector.DetectorType
cv3d Sep 19, 2018
b42c732
Rename unnamed enum to Formatter.FormatType
cv3d Sep 19, 2018
8b14a7f
Rename unnamed enum to HOGDescriptor.HistogramNormType
cv3d Sep 19, 2018
c5e80e0
Rename unnamed enum to DescriptorMatcher.MatcherType
cv3d Sep 19, 2018
07bb784
Rename unnamed enum to KAZE.DiffusivityType
cv3d Sep 19, 2018
8ca0e3d
Rename unnamed enum to ORB.ScoreType
cv3d Sep 19, 2018
42d915b
Rename unnamed enum to UMatData.MemoryFlag
cv3d Sep 19, 2018
94f6825
Rename unnamed enum to _InputArray.KindFlag
cv3d Sep 19, 2018
dd523e5
Rename unnamed enum to _OutputArray.DepthMask
cv3d Sep 19, 2018
b9fd60b
Convert normType enums to static const NormTypes
cv3d Sep 19, 2018
f448ce8
Avoid conflicts with ElemType
cv3d Sep 19, 2018
cd8f009
Rename unnamed enum to DescriptorStorageFormat
cv3d Sep 19, 2018
65b4ad7
Refactor
cv3d Sep 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion apps/interactive-calibration/calibController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void calib::calibDataController::filterFrames()
mCalibData->allCharucoIds.erase(mCalibData->allCharucoIds.begin() + worstElemIndex);
}

cv::Mat newErrorsVec = cv::Mat((int)numberOfFrames - 1, 1, CV_64F);
cv::Mat newErrorsVec = cv::Mat((int)numberOfFrames - 1, 1, CV_64FC1);
std::copy(mCalibData->perViewErrors.ptr<double>(0),
mCalibData->perViewErrors.ptr<double>((int)worstElemIndex), newErrorsVec.ptr<double>(0));
if((int)worstElemIndex < (int)numberOfFrames-1) {
Expand Down
2 changes: 1 addition & 1 deletion apps/interactive-calibration/frameProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ bool CalibProcessor::checkLastFrame()
const double badAngleThresh = 40;

if(!mCalibData->cameraMatrix.total()) {
tmpCamMatrix = cv::Mat::eye(3, 3, CV_64F);
tmpCamMatrix = cv::Mat::eye(3, 3, CV_64FC1);
tmpCamMatrix.at<double>(0,0) = 20000;
tmpCamMatrix.at<double>(1,1) = 20000;
tmpCamMatrix.at<double>(0,2) = mCalibData->imageSize.height/2;
Expand Down
8 changes: 4 additions & 4 deletions apps/interactive-calibration/rotationConverters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void calib::Euler(const cv::Mat& src, cv::Mat& dst, int argType)
if((src.rows == 3) && (src.cols == 3))
{
//convert rotation matrix to 3 angles (pitch, yaw, roll)
dst = cv::Mat(3, 1, CV_64F);
dst = cv::Mat(3, 1, CV_64FC1);
double pitch, yaw, roll;

if(src.at<double>(0,2) < -0.998)
Expand Down Expand Up @@ -78,9 +78,9 @@ void calib::Euler(const cv::Mat& src, cv::Mat& dst, int argType)
else if(argType != CALIB_RADIANS)
CV_Error(cv::Error::StsBadFlag, "Invalid argument type");

dst = cv::Mat(3, 3, CV_64F);
cv::Mat M(3, 3, CV_64F);
cv::Mat i = cv::Mat::eye(3, 3, CV_64F);
dst = cv::Mat(3, 3, CV_64FC1);
cv::Mat M(3, 3, CV_64FC1);
cv::Mat i = cv::Mat::eye(3, 3, CV_64FC1);
i.copyTo(dst);
i.copyTo(M);

Expand Down
14 changes: 7 additions & 7 deletions apps/traincascade/HOGfeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ void CvHOGEvaluator::Feature::write(FileStorage &fs, int featComponentIdx) const

void CvHOGEvaluator::integralHistogram(const Mat &img, vector<Mat> &histogram, Mat &norm, int nbins) const
{
CV_Assert( img.type() == CV_8U || img.type() == CV_8UC3 );
CV_Assert( img.type() == CV_8UC1 || img.type() == CV_8UC3 );
int x, y, binIdx;

Size gradSize(img.size());
Size histSize(histogram[0].size());
Mat grad(gradSize, CV_32F);
Mat qangle(gradSize, CV_8U);
Mat grad(gradSize, CV_32FC1);
Mat qangle(gradSize, CV_8UC1);

AutoBuffer<int> mapbuf(gradSize.width + gradSize.height + 4);
int* xmap = mapbuf.data() + 1;
Expand All @@ -178,10 +178,10 @@ void CvHOGEvaluator::integralHistogram(const Mat &img, vector<Mat> &histogram, M
int width = gradSize.width;
AutoBuffer<float> _dbuf(width*4);
float* dbuf = _dbuf.data();
Mat Dx(1, width, CV_32F, dbuf);
Mat Dy(1, width, CV_32F, dbuf + width);
Mat Mag(1, width, CV_32F, dbuf + width*2);
Mat Angle(1, width, CV_32F, dbuf + width*3);
Mat Dx(1, width, CV_32FC1, dbuf);
Mat Dy(1, width, CV_32FC1, dbuf + width);
Mat Mag(1, width, CV_32FC1, dbuf + width*2);
Mat Angle(1, width, CV_32FC1, dbuf + width*3);

float angleScale = (float)(nbins/CV_PI);

Expand Down
17 changes: 9 additions & 8 deletions apps/traincascade/boost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b

__CV_BEGIN__;

int i, idx_total, idx_selected = 0, step, type, prev = INT_MIN, is_sorted = 1;
int i, idx_total, idx_selected = 0, step, prev = INT_MIN, is_sorted = 1;
ElemType type;
uchar* srcb = 0;
int* srci = 0;
int* dsti;
Expand Down Expand Up @@ -658,7 +659,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
(MAX(0,max_c_count - 33)/32)*sizeof(int),sizeof(void*));
split_heap = cvCreateSet( 0, sizeof(*split_heap), maxSplitSize, tree_storage );

priors = cvCreateMat( 1, get_num_classes(), CV_64F );
priors = cvCreateMat( 1, get_num_classes(), CV_64FC1);
cvSet(priors, cvScalar(1));
priors_mult = cvCloneMat( priors );
counts = cvCreateMat( 1, get_num_classes(), CV_32SC1 );
Expand Down Expand Up @@ -1423,11 +1424,11 @@ void CvCascadeBoost::update_weights( CvBoostTree* tree )
cvReleaseMat( &subsample_mask );
cvReleaseMat( &weights );

orig_response = cvCreateMat( 1, n, CV_32S );
weak_eval = cvCreateMat( 1, n, CV_64F );
subsample_mask = cvCreateMat( 1, n, CV_8U );
weights = cvCreateMat( 1, n, CV_64F );
subtree_weights = cvCreateMat( 1, n + 2, CV_64F );
orig_response = cvCreateMat( 1, n, CV_32SC1);
weak_eval = cvCreateMat( 1, n, CV_64FC1);
subsample_mask = cvCreateMat( 1, n, CV_8UC1);
weights = cvCreateMat( 1, n, CV_64FC1);
subtree_weights = cvCreateMat( 1, n + 2, CV_64FC1);

if (data->is_buf_16u)
{
Expand Down Expand Up @@ -1464,7 +1465,7 @@ void CvCascadeBoost::update_weights( CvBoostTree* tree )

if( params.boost_type == LOGIT )
{
sum_response = cvCreateMat( 1, n, CV_64F );
sum_response = cvCreateMat( 1, n, CV_64FC1);

for( int i = 0; i < n; i++ )
{
Expand Down
24 changes: 12 additions & 12 deletions apps/traincascade/old_ml_boost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,11 +1179,11 @@ CvBoost::update_weights( CvBoostTree* tree )
cvReleaseMat( &weights );
cvReleaseMat( &subtree_weights );

CV_CALL( orig_response = cvCreateMat( 1, n, CV_32S ));
CV_CALL( weak_eval = cvCreateMat( 1, n, CV_64F ));
CV_CALL( subsample_mask = cvCreateMat( 1, n, CV_8U ));
CV_CALL( weights = cvCreateMat( 1, n, CV_64F ));
CV_CALL( subtree_weights = cvCreateMat( 1, n + 2, CV_64F ));
CV_CALL( orig_response = cvCreateMat( 1, n, CV_32SC1));
CV_CALL( weak_eval = cvCreateMat( 1, n, CV_64FC1));
CV_CALL( subsample_mask = cvCreateMat( 1, n, CV_8UC1));
CV_CALL( weights = cvCreateMat( 1, n, CV_64FC1));
CV_CALL( subtree_weights = cvCreateMat( 1, n + 2, CV_64FC1));

if( data->have_priors )
{
Expand Down Expand Up @@ -1237,7 +1237,7 @@ CvBoost::update_weights( CvBoostTree* tree )

if( params.boost_type == LOGIT )
{
CV_CALL( sum_response = cvCreateMat( 1, n, CV_64F ));
CV_CALL( sum_response = cvCreateMat( 1, n, CV_64FC1));

for( i = 0; i < n; i++ )
{
Expand Down Expand Up @@ -1274,8 +1274,8 @@ CvBoost::update_weights( CvBoostTree* tree )
cvXorS( subsample_mask, cvScalar(1.), subsample_mask );
data->get_vectors( subsample_mask, values, missing, 0 );

_sample = cvMat( 1, data->var_count, CV_32F );
_mask = cvMat( 1, data->var_count, CV_8U );
_sample = cvMat( 1, data->var_count, CV_32FC1);
_mask = cvMat( 1, data->var_count, CV_8UC1);

// run tree through all the non-processed samples
for( i = 0; i < n; i++ )
Expand Down Expand Up @@ -1492,8 +1492,8 @@ CvBoost::get_active_vars( bool absolute_idx )
const CvDTreeNode* node;

assert(!active_vars && !active_vars_abs);
mask = cvCreateMat( 1, data->var_count, CV_8U );
inv_map = cvCreateMat( 1, data->var_count, CV_32S );
mask = cvCreateMat( 1, data->var_count, CV_8UC1);
inv_map = cvCreateMat( 1, data->var_count, CV_32SC1);
cvZero( mask );
cvSet( inv_map, cvScalar(-1) );

Expand Down Expand Up @@ -1533,8 +1533,8 @@ CvBoost::get_active_vars( bool absolute_idx )

//if ( nactive_vars > 0 )
{
active_vars = cvCreateMat( 1, nactive_vars, CV_32S );
active_vars_abs = cvCreateMat( 1, nactive_vars, CV_32S );
active_vars = cvCreateMat( 1, nactive_vars, CV_32SC1);
active_vars_abs = cvCreateMat( 1, nactive_vars, CV_32SC1);

have_active_cat_vars = false;

Expand Down
4 changes: 2 additions & 2 deletions apps/traincascade/old_ml_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ int CvMLData::read_csv(const char* filename)
storage = cvCreateMemStorage();
seq = cvCreateSeq( 0, sizeof(*seq), cols_count*sizeof(float), storage );

var_types = cvCreateMat( 1, cols_count, CV_8U );
var_types = cvCreateMat( 1, cols_count, CV_8UC1);
cvZero( var_types );
var_types_ptr = var_types->data.ptr;

Expand Down Expand Up @@ -245,7 +245,7 @@ int CvMLData::read_csv(const char* filename)
fclose(file);

values = cvCreateMat( seq->total, cols_count, CV_32FC1 );
missing = cvCreateMat( seq->total, cols_count, CV_8U );
missing = cvCreateMat( seq->total, cols_count, CV_8UC1);
var_idx_mask = cvCreateMat( 1, values->cols, CV_8UC1 );
cvSet( var_idx_mask, cvRealScalar(1) );
train_sample_count = seq->total;
Expand Down
5 changes: 3 additions & 2 deletions apps/traincascade/old_ml_inner_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_

__BEGIN__;

int i, idx_total, idx_selected = 0, step, type, prev = INT_MIN, is_sorted = 1;
int i, idx_total, idx_selected = 0, step, prev = INT_MIN, is_sorted = 1;
ElemType type;
uchar* srcb = 0;
int* srci = 0;
int* dsti;
Expand Down Expand Up @@ -1062,7 +1063,7 @@ cvPreparePredictData( const CvArr* _sample, int dims_all,


static void
icvConvertDataToSparse( const uchar* src, int src_step, int src_type,
icvConvertDataToSparse(const uchar* src, int src_step, int src_type,
uchar* dst, int dst_step, int dst_type,
CvSize size, int* idx )
{
Expand Down
10 changes: 5 additions & 5 deletions apps/traincascade/old_ml_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
{
int m = get_num_classes();
double sum = 0;
CV_CALL( priors = cvCreateMat( 1, m, CV_64F ));
CV_CALL( priors = cvCreateMat( 1, m, CV_64FC1));
for( i = 0; i < m; i++ )
{
double val = have_priors ? params.priors[i] : 1.;
Expand Down Expand Up @@ -3390,7 +3390,7 @@ void CvDTree::prune_cv()
double min_err = 0, min_err_se = 0;
int min_idx = -1;

CV_CALL( ab = cvCreateMat( 1, 256, CV_64F ));
CV_CALL( ab = cvCreateMat( 1, 256, CV_64FC1));

// build the main tree sequence, calculate alpha's
for(;;tree_count++)
Expand All @@ -3401,7 +3401,7 @@ void CvDTree::prune_cv()

if( ab->cols <= tree_count )
{
CV_CALL( temp = cvCreateMat( 1, ab->cols*3/2, CV_64F ));
CV_CALL( temp = cvCreateMat( 1, ab->cols*3/2, CV_64FC1));
for( ti = 0; ti < ab->cols; ti++ )
temp->data.db[ti] = ab->data.db[ti];
cvReleaseMat( &ab );
Expand All @@ -3420,7 +3420,7 @@ void CvDTree::prune_cv()
ab->data.db[ti] = sqrt(ab->data.db[ti]*ab->data.db[ti+1]);
ab->data.db[tree_count-1] = DBL_MAX*0.5;

CV_CALL( err_jk = cvCreateMat( cv_n, tree_count, CV_64F ));
CV_CALL( err_jk = cvCreateMat( cv_n, tree_count, CV_64FC1));
err = err_jk->data.db;

for( j = 0; j < cv_n; j++ )
Expand Down Expand Up @@ -3744,7 +3744,7 @@ const CvMat* CvDTree::get_var_importance()
double* importance;
if( !node )
return 0;
var_importance = cvCreateMat( 1, data->var_count, CV_64F );
var_importance = cvCreateMat( 1, data->var_count, CV_64FC1);
cvZero( var_importance );
importance = var_importance->data.db;

Expand Down
6 changes: 3 additions & 3 deletions modules/calib3d/include/opencv2/calib3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ points1 and points2 are the same input for findEssentialMat. :
}

// cametra matrix with both focal lengths = 1, and principal point = (0, 0)
Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
Mat cameraMatrix = Mat::eye(3, 3, CV_64FC1);

Mat E, R, t, mask;

Expand Down Expand Up @@ -1799,7 +1799,7 @@ perspectiveTransform .
CV_EXPORTS_W void reprojectImageTo3D( InputArray disparity,
OutputArray _3dImage, InputArray Q,
bool handleMissingValues = false,
int ddepth = -1 );
ElemDepth ddepth = CV_DEPTH_AUTO);

/** @brief Calculates the Sampson Distance between two points.

Expand Down Expand Up @@ -2310,7 +2310,7 @@ namespace fisheye
@param map2 The second output map.
*/
CV_EXPORTS_W void initUndistortRectifyMap(InputArray K, InputArray D, InputArray R, InputArray P,
const cv::Size& size, int m1type, OutputArray map1, OutputArray map2);
const cv::Size& size, ElemType m1type, OutputArray map1, OutputArray map2);

/** @brief Transforms an image to compensate for fisheye lens distortion.

Expand Down
4 changes: 2 additions & 2 deletions modules/calib3d/perf/perf_affine2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static Mat rngPartialAffMat() {
double ty = rngIn(-2, 2);
double aff[2*3] = { std::cos(theta) * scale, -std::sin(theta) * scale, tx,
std::sin(theta) * scale, std::cos(theta) * scale, ty };
return Mat(2, 3, CV_64F, aff).clone();
return Mat(2, 3, CV_64FC1, aff).clone();
}

PERF_TEST_P( EstimateAffine, EstimateAffine2D, ESTIMATE_PARAMS )
Expand All @@ -72,7 +72,7 @@ PERF_TEST_P( EstimateAffine, EstimateAffine2D, ESTIMATE_PARAMS )
const int method = get<2>(params);
const size_t refining = get<3>(params);

Mat aff(2, 3, CV_64F);
Mat aff(2, 3, CV_64FC1);
cv::randu(aff, -2., 2.);

// LMEDS can't handle more than 50% outliers (by design)
Expand Down
4 changes: 2 additions & 2 deletions modules/calib3d/perf/perf_pnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ PERF_TEST_P(PointsNum_Algo, solvePnPSmallPoints,
warmup(tvec, WARMUP_RNG);

// normalize Rodrigues vector
Mat rvec_tmp = Mat::eye(3, 3, CV_32F);
Mat rvec_tmp = Mat::eye(3, 3, CV_32FC1);
cv::Rodrigues(rvec, rvec_tmp);
cv::Rodrigues(rvec_tmp, rvec);

Expand Down Expand Up @@ -122,7 +122,7 @@ PERF_TEST_P(PointsNum, DISABLED_SolvePnPRansac, testing::Values(5, 3*9, 7*13))
camera_mat.at<float>(2, 0) = 0.f;
camera_mat.at<float>(2, 1) = 0.f;

Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));
Mat dist_coef(1, 8, CV_32FC1, cv::Scalar::all(0));

vector<cv::Point2f> image_vec;

Expand Down
2 changes: 1 addition & 1 deletion modules/calib3d/perf/perf_stereosgbm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ PERF_TEST_P( TestStereoCorresp, DISABLED_TooLongInDebug_SGBM, Combine(Values(Siz

Mat src_left(sz, CV_8UC3);
Mat src_right(sz, CV_8UC3);
Mat dst(sz, CV_16S);
Mat dst(sz, CV_16SC1);

MakeArtificialExample(rng,src_left,src_right);

Expand Down
8 changes: 4 additions & 4 deletions modules/calib3d/src/ap3p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ bool ap3p::solve(cv::Mat &R, cv::Mat &tvec, const cv::Mat &opoints, const cv::Ma
points[6], points[7], points[8], points[9], points[10], points[11], points[12], points[13],
points[14],
points[15], points[16], points[17], points[18], points[19]);
cv::Mat(3, 1, CV_64F, translation).copyTo(tvec);
cv::Mat(3, 3, CV_64F, rotation_matrix).copyTo(R);
cv::Mat(3, 1, CV_64FC1, translation).copyTo(tvec);
cv::Mat(3, 3, CV_64FC1, rotation_matrix).copyTo(R);
return result;
}

Expand All @@ -342,8 +342,8 @@ int ap3p::solve(std::vector<cv::Mat> &Rs, std::vector<cv::Mat> &tvecs, const cv:

for (int i = 0; i < solutions; i++) {
cv::Mat R, tvec;
cv::Mat(3, 1, CV_64F, translation[i]).copyTo(tvec);
cv::Mat(3, 3, CV_64F, rotation_matrix[i]).copyTo(R);
cv::Mat(3, 1, CV_64FC1, translation[i]).copyTo(tvec);
cv::Mat(3, 3, CV_64FC1, rotation_matrix[i]).copyTo(R);

Rs.push_back(R);
tvecs.push_back(tvec);
Expand Down