Skip to content

Commit c33629e

Browse files
committed
Merge branch 'master' into text_detector_dnn
2 parents bf630be + e80393b commit c33629e

File tree

62 files changed

+972
-566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+972
-566
lines changed

modules/aruco/tutorials/aruco_detection/aruco_detection.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ A basic full example for pose estimation from single markers:
318318
if (ids.size() > 0) {
319319
cv::aruco::drawDetectedMarkers(imageCopy, corners, ids);
320320

321-
std::vector<cv::Mat> rvecs, tvecs;
321+
std::vector<cv::Vec3d> rvecs, tvecs;
322322
cv::aruco::estimatePoseSingleMarkers(corners, 0.05, cameraMatrix, distCoeffs, rvecs, tvecs);
323323
// draw axis for each marker
324324
for(int i=0; i<ids.size(); i++)

modules/bgsegm/src/bgfg_gmg.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class BackgroundSubtractorGMGImpl : public BackgroundSubtractorGMG
194194
String name_;
195195

196196
Mat_<int> nfeatures_;
197-
Mat_<unsigned int> colors_;
197+
Mat_<int> colors_;
198198
Mat_<float> weights_;
199199

200200
Mat buf_;
@@ -223,7 +223,7 @@ void BackgroundSubtractorGMGImpl::initialize(Size frameSize, double minVal, doub
223223
nfeatures_.setTo(Scalar::all(0));
224224
}
225225

226-
static float findFeature(unsigned int color, const unsigned int* colors, const float* weights, int nfeatures)
226+
static float findFeature(int color, const int* colors, const float* weights, int nfeatures)
227227
{
228228
for (int i = 0; i < nfeatures; ++i)
229229
{
@@ -248,7 +248,7 @@ static void normalizeHistogram(float* weights, int nfeatures)
248248
}
249249
}
250250

251-
static bool insertFeature(unsigned int color, float weight, unsigned int* colors, float* weights, int& nfeatures, int maxFeatures)
251+
static bool insertFeature(int color, float weight, int* colors, float* weights, int& nfeatures, int maxFeatures)
252252
{
253253
int idx = -1;
254254
for (int i = 0; i < nfeatures; ++i)
@@ -266,7 +266,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
266266
{
267267
// move feature to beginning of list
268268

269-
::memmove(colors + 1, colors, idx * sizeof(unsigned int));
269+
::memmove(colors + 1, colors, idx * sizeof(int));
270270
::memmove(weights + 1, weights, idx * sizeof(float));
271271

272272
colors[0] = color;
@@ -276,7 +276,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
276276
{
277277
// discard oldest feature
278278

279-
::memmove(colors + 1, colors, (nfeatures - 1) * sizeof(unsigned int));
279+
::memmove(colors + 1, colors, (nfeatures - 1) * sizeof(int));
280280
::memmove(weights + 1, weights, (nfeatures - 1) * sizeof(float));
281281

282282
colors[0] = color;
@@ -297,7 +297,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
297297

298298
template <typename T> struct Quantization
299299
{
300-
static unsigned int apply(const void* src_, int x, int cn, double minVal, double maxVal, int quantizationLevels)
300+
static int apply(const void* src_, int x, int cn, double minVal, double maxVal, int quantizationLevels)
301301
{
302302
const T* src = static_cast<const T*>(src_);
303303
src += x * cn;
@@ -313,7 +313,7 @@ template <typename T> struct Quantization
313313
class GMG_LoopBody : public ParallelLoopBody
314314
{
315315
public:
316-
GMG_LoopBody(const Mat& frame, const Mat& fgmask, const Mat_<int>& nfeatures, const Mat_<unsigned int>& colors, const Mat_<float>& weights,
316+
GMG_LoopBody(const Mat& frame, const Mat& fgmask, const Mat_<int>& nfeatures, const Mat_<int>& colors, const Mat_<float>& weights,
317317
int maxFeatures, double learningRate, int numInitializationFrames, int quantizationLevels, double backgroundPrior, double decisionThreshold,
318318
double maxVal, double minVal, int frameNum, bool updateBackgroundModel) :
319319
frame_(frame), fgmask_(fgmask), nfeatures_(nfeatures), colors_(colors), weights_(weights),
@@ -331,7 +331,7 @@ class GMG_LoopBody : public ParallelLoopBody
331331
mutable Mat_<uchar> fgmask_;
332332

333333
mutable Mat_<int> nfeatures_;
334-
mutable Mat_<unsigned int> colors_;
334+
mutable Mat_<int> colors_;
335335
mutable Mat_<float> weights_;
336336

337337
int maxFeatures_;
@@ -349,7 +349,7 @@ class GMG_LoopBody : public ParallelLoopBody
349349

350350
void GMG_LoopBody::operator() (const Range& range) const
351351
{
352-
typedef unsigned int (*func_t)(const void* src_, int x, int cn, double minVal, double maxVal, int quantizationLevels);
352+
typedef int (*func_t)(const void* src_, int x, int cn, double minVal, double maxVal, int quantizationLevels);
353353
static const func_t funcs[] =
354354
{
355355
Quantization<uchar>::apply,
@@ -375,10 +375,10 @@ void GMG_LoopBody::operator() (const Range& range) const
375375
for (int x = 0; x < frame_.cols; ++x, ++featureIdx)
376376
{
377377
int nfeatures = nfeatures_row[x];
378-
unsigned int* colors = colors_[featureIdx];
378+
int* colors = colors_[featureIdx];
379379
float* weights = weights_[featureIdx];
380380

381-
unsigned int newFeatureColor = func(frame_row, x, cn, minVal_, maxVal_, quantizationLevels_);
381+
int newFeatureColor = func(frame_row, x, cn, minVal_, maxVal_, quantizationLevels_);
382382

383383
bool isForeground = false;
384384

modules/ccalib/include/opencv2/ccalib.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class CV_EXPORTS CustomPattern : public Algorithm
7171

7272
bool isInitialized();
7373

74-
void getPatternPoints(OutputArray original_points);
74+
void getPatternPoints(std::vector<KeyPoint>& original_points);
7575
/**<
7676
Returns a vector<Point> of the original points.
7777
*/

modules/ccalib/include/opencv2/ccalib/omnidir.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ namespace internal
278278
double computeMeanReproErrStereo(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputArray K1, InputArray K2,
279279
InputArray D1, InputArray D2, double xi1, double xi2, InputArray om, InputArray T, InputArrayOfArrays omL, InputArrayOfArrays TL);
280280

281-
void checkFixed(Mat &G, int flags, int n);
282-
283281
void subMatrix(const Mat& src, Mat& dst, const std::vector<int>& cols, const std::vector<int>& rows);
284282

285283
void flags2idx(int flags, std::vector<int>& idx, int n);
@@ -309,4 +307,4 @@ namespace internal
309307
} // omnidir
310308

311309
} //cv
312-
#endif
310+
#endif

modules/ccalib/src/ccalib.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,9 @@ bool CustomPattern::findPattern(InputArray image, OutputArray matched_features,
405405
return (!m_ftrs.empty());
406406
}
407407

408-
void CustomPattern::getPatternPoints(OutputArray original_points)
408+
void CustomPattern::getPatternPoints(std::vector<KeyPoint>& original_points)
409409
{
410-
return Mat(keypoints).copyTo(original_points);
410+
original_points = keypoints;
411411
}
412412

413413
double CustomPattern::getPixelSize()

modules/ccalib/src/multicalib.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -749,12 +749,12 @@ void MultiCameraCalibration::writeParameters(const std::string& filename)
749749

750750
for (int camIdx = 0; camIdx < _nCamera; ++camIdx)
751751
{
752-
char num[10];
753-
sprintf(num, "%d", camIdx);
754-
std::string cameraMatrix = "camera_matrix_" + std::string(num);
755-
std::string cameraPose = "camera_pose_" + std::string(num);
756-
std::string cameraDistortion = "camera_distortion_" + std::string(num);
757-
std::string cameraXi = "xi_" + std::string(num);
752+
std::stringstream tmpStr;
753+
tmpStr << camIdx;
754+
std::string cameraMatrix = "camera_matrix_" + tmpStr.str();
755+
std::string cameraPose = "camera_pose_" + tmpStr.str();
756+
std::string cameraDistortion = "camera_distortion_" + tmpStr.str();
757+
std::string cameraXi = "xi_" + tmpStr.str();
758758

759759
fs << cameraMatrix << _cameraMatrix[camIdx];
760760
fs << cameraDistortion << _distortCoeffs[camIdx];
@@ -770,11 +770,11 @@ void MultiCameraCalibration::writeParameters(const std::string& filename)
770770

771771
for (int photoIdx = _nCamera; photoIdx < (int)_vertexList.size(); ++photoIdx)
772772
{
773-
char timestamp[100];
774-
sprintf(timestamp, "%d", _vertexList[photoIdx].timestamp);
775-
std::string photoTimestamp = "pose_timestamp_" + std::string(timestamp);
773+
std::stringstream tmpStr;
774+
tmpStr << _vertexList[photoIdx].timestamp;
775+
std::string photoTimestamp = "pose_timestamp_" + tmpStr.str();
776776

777777
fs << photoTimestamp << _vertexList[photoIdx].pose;
778778
}
779779
}
780-
}} // namespace multicalib, cv
780+
}} // namespace multicalib, cv

modules/ccalib/src/omnidir.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,8 +1785,6 @@ void cv::omnidir::internal::estimateUncertainties(InputArrayOfArrays objectPoint
17851785

17861786
errors = 3 * s * _JTJ_inv.diag();
17871787

1788-
checkFixed(errors, flags, n);
1789-
17901788
rms = 0;
17911789
const Vec2d* ptr_ex = reprojError.ptr<Vec2d>();
17921790
for (int i = 0; i < (int)reprojError.total(); i++)
@@ -1995,52 +1993,6 @@ double cv::omnidir::internal::computeMeanReproErrStereo(InputArrayOfArrays objec
19951993
return reProErr;
19961994
}
19971995

1998-
void cv::omnidir::internal::checkFixed(Mat& G, int flags, int n)
1999-
{
2000-
int _flags = flags;
2001-
if(_flags >= omnidir::CALIB_FIX_CENTER)
2002-
{
2003-
G.at<double>(6*n+3) = 0;
2004-
G.at<double>(6*n+4) = 0;
2005-
_flags -= omnidir::CALIB_FIX_CENTER;
2006-
}
2007-
if(_flags >= omnidir::CALIB_FIX_GAMMA)
2008-
{
2009-
G.at<double>(6*n) = 0;
2010-
G.at<double>(6*n+1) = 0;
2011-
_flags -= omnidir::CALIB_FIX_GAMMA;
2012-
}
2013-
if(_flags >= omnidir::CALIB_FIX_XI)
2014-
{
2015-
G.at<double>(6*n + 5) = 0;
2016-
_flags -= omnidir::CALIB_FIX_XI;
2017-
}
2018-
if(_flags >= omnidir::CALIB_FIX_P2)
2019-
{
2020-
G.at<double>(6*n + 9) = 0;
2021-
_flags -= omnidir::CALIB_FIX_P2;
2022-
}
2023-
if(_flags >= omnidir::CALIB_FIX_P1)
2024-
{
2025-
G.at<double>(6*n + 8) = 0;
2026-
_flags -= omnidir::CALIB_FIX_P1;
2027-
}
2028-
if(_flags >= omnidir::CALIB_FIX_K2)
2029-
{
2030-
G.at<double>(6*n + 7) = 0;
2031-
_flags -= omnidir::CALIB_FIX_K2;
2032-
}
2033-
if(_flags >= omnidir::CALIB_FIX_K1)
2034-
{
2035-
G.at<double>(6*n + 6) = 0;
2036-
_flags -= omnidir::CALIB_FIX_K1;
2037-
}
2038-
if(_flags >= omnidir::CALIB_FIX_SKEW)
2039-
{
2040-
G.at<double>(6*n + 2) = 0;
2041-
}
2042-
}
2043-
20441996
// This function is from fisheye.cpp
20451997
void cv::omnidir::internal::subMatrix(const Mat& src, Mat& dst, const std::vector<int>& cols, const std::vector<int>& rows)
20461998
{

modules/datasets/samples/tr_icdar_benchmark.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ void er_draw(vector<Mat> &channels, vector<vector<ERStat> > &regions, vector<Vec
133133
}
134134
}
135135

136+
// std::toupper is int->int
137+
static char char_toupper(char ch)
138+
{
139+
return (char)std::toupper((int)ch);
140+
}
141+
136142
int main(int argc, char *argv[])
137143
{
138144
const char *keys =
@@ -200,7 +206,7 @@ int main(int argc, char *argv[])
200206
for (size_t w=0; w<example->words.size(); w++)
201207
{
202208
string w_upper = example->words[w].value;
203-
transform(w_upper.begin(), w_upper.end(), w_upper.begin(), ::toupper);
209+
transform(w_upper.begin(), w_upper.end(), w_upper.begin(), char_toupper);
204210
if ((find (lex->begin(), lex->end(), w_upper) == lex->end()) &&
205211
(is_word_spotting) && (selected_lex != 0))
206212
example->words[w].value = "###";
@@ -297,7 +303,7 @@ int main(int argc, char *argv[])
297303
continue;
298304
}
299305

300-
std::transform(words[j].begin(), words[j].end(), words[j].begin(), ::toupper);
306+
std::transform(words[j].begin(), words[j].end(), words[j].begin(), char_toupper);
301307

302308
/* Increase confidence of predicted words matching a word in the lexicon */
303309
if (lex->size() > 0)
@@ -413,7 +419,7 @@ int main(int argc, char *argv[])
413419
}
414420
}
415421

416-
std::transform(t.value.begin(), t.value.end(), t.value.begin(), ::toupper);
422+
std::transform(t.value.begin(), t.value.end(), t.value.begin(), char_toupper);
417423
if (((t.value==final_words[j]) || (alnum_value==final_words[j])) &&
418424
!(final_boxes[j].tl().x > t.x+t.width || final_boxes[j].br().x < t.x ||
419425
final_boxes[j].tl().y > t.y+t.height || final_boxes[j].br().y < t.y))
@@ -430,7 +436,7 @@ int main(int argc, char *argv[])
430436
for (vector<word>::iterator it=example->words.begin(); it!=example->words.end(); ++it)
431437
{
432438
word &t = (*it);
433-
std::transform(t.value.begin(), t.value.end(), t.value.begin(), ::toupper);
439+
std::transform(t.value.begin(), t.value.end(), t.value.begin(), char_toupper);
434440
if ((t.value == "###") &&
435441
!(final_boxes[j].tl().x > t.x+t.width || final_boxes[j].br().x < t.x ||
436442
final_boxes[j].tl().y > t.y+t.height || final_boxes[j].br().y < t.y))

modules/datasets/samples/tr_svt_benchmark.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ void er_draw(vector<Mat> &channels, vector<vector<ERStat> > &regions, vector<Vec
133133
}
134134
}
135135

136+
// std::toupper is int->int
137+
static char char_toupper(char ch)
138+
{
139+
return (char)std::toupper((int)ch);
140+
}
141+
136142
int main(int argc, char *argv[])
137143
{
138144
const char *keys =
@@ -244,7 +250,7 @@ int main(int argc, char *argv[])
244250
continue;
245251
}
246252

247-
std::transform(words[j].begin(), words[j].end(), words[j].begin(), ::toupper);
253+
std::transform(words[j].begin(), words[j].end(), words[j].begin(), char_toupper);
248254

249255
if (find(example->lex.begin(), example->lex.end(), words[j]) == example->lex.end())
250256
{

modules/face/include/opencv2/face/facerec.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class CV_EXPORTS_W LBPHFaceRecognizer : public FaceRecognizer
151151

152152
/**
153153
@param radius The radius used for building the Circular Local Binary Pattern. The greater the
154-
radius, the
154+
radius, the smoother the image but more spatial information you can get.
155155
@param neighbors The number of sample points to build a Circular Local Binary Pattern from. An
156156
appropriate value is to use `8` sample points. Keep in mind: the more sample points you include,
157157
the higher the computational cost.

0 commit comments

Comments
 (0)