Skip to content

Commit ea34e1e

Browse files
committed
Merge branch 'master' into GOTURN_Tracker
2 parents 303b616 + a6c8df3 commit ea34e1e

File tree

601 files changed

+131679
-112871
lines changed

Some content is hidden

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

601 files changed

+131679
-112871
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!--
2+
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
3+
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).
4+
5+
This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
6+
-->
7+
8+
##### System information (version)
9+
<!-- Example
10+
- OpenCV => 3.1
11+
- Operating System / Platform => Windows 64 Bit
12+
- Compiler => Visual Studio 2015
13+
-->
14+
15+
- OpenCV => :grey_question:
16+
- Operating System / Platform => :grey_question:
17+
- Compiler => :grey_question:
18+
19+
##### Detailed description
20+
21+
<!-- your description -->
22+
23+
##### Steps to reproduce
24+
25+
<!-- to add code example fence it with triple backticks and optional file extension
26+
```.cpp
27+
// C++ code example
28+
```
29+
or attach as .txt or .zip file
30+
-->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- Please use this line to close one or multiple issues when this pullrequest gets merged
2+
You can add another line right under the first one:
3+
resolves #1234
4+
resolves #1235
5+
-->
6+
7+
### This pullrequest changes
8+
9+
<!-- Please describe what your pullrequest is changing -->

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
Thumbs.db
99
tags
1010
tegra/
11+
*.i
12+
.download*

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ compiler:
44
- clang
55
before_script:
66
- cd ../
7-
- git clone https://github.com/Itseez/opencv.git
7+
- git clone https://github.com/opencv/opencv.git
88
- mkdir build-opencv
99
- cd build-opencv
1010
- cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ../opencv

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## Contributing guidelines
22

3-
All guidelines for contributing to the OpenCV repository can be found at [`How to contribute guideline`](https://github.com/Itseez/opencv/wiki/How_to_contribute).
3+
All guidelines for contributing to the OpenCV repository can be found at [`How to contribute guideline`](https://github.com/opencv/opencv/wiki/How_to_contribute).

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ provides production quality support for this module.
1313

1414
### How to build OpenCV with extra modules
1515

16-
You can build OpenCV, so it will include the modules from this repository.
16+
You can build OpenCV, so it will include the modules from this repository. Contrib modules are under constant development and it is recommended to use them alongside the master branch or latest releases of OpenCV.
17+
1718
Here is the CMake command for you:
1819

1920
```
@@ -46,10 +47,12 @@ If you prefer using the gui version of cmake (cmake-gui), then, you can add `ope
4647

4748
7. build the `opencv` core with the method you chose (make and make install if you chose Unix makfile at step 6)
4849

50+
8. to run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.
51+
4952
### Update the repository documentation
5053

5154
In order to keep a clean overview containing all contributed modules the following files need to be created/adapted.
5255

5356
1. Update the README.md file under the modules folder. Here you add your model with a single line description.
5457

55-
2. Add a README.md inside your own module folder. This README explains which functionality (seperate functions) is available, links to the corresponding samples and explains in somewhat more detail what the module is expected to do. If any extra requirements are needed to build the module without problems, add them here also.
58+
2. Add a README.md inside your own module folder. This README explains which functionality (seperate functions) is available, links to the corresponding samples and explains in somewhat more detail what the module is expected to do. If any extra requirements are needed to build the module without problems, add them here also.

modules/aruco/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
set(the_description "ArUco Marker Detection")
2-
ocv_define_module(aruco opencv_core opencv_imgproc opencv_calib3d WRAP python)
2+
ocv_define_module(aruco opencv_core opencv_imgproc opencv_calib3d WRAP python java)

modules/aruco/include/opencv2/aruco.hpp

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ struct CV_EXPORTS_W DetectorParameters {
173173
* @sa estimatePoseSingleMarkers, estimatePoseBoard
174174
*
175175
*/
176-
CV_EXPORTS_W void detectMarkers(InputArray image, Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
176+
CV_EXPORTS_W void detectMarkers(InputArray image, const Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
177177
OutputArray ids, const Ptr<DetectorParameters> &parameters = DetectorParameters::create(),
178178
OutputArrayOfArrays rejectedImgPoints = noArray());
179179

@@ -226,15 +226,24 @@ CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float ma
226226
class CV_EXPORTS_W Board {
227227

228228
public:
229-
// array of object points of all the marker corners in the board
230-
// each marker include its 4 corners, i.e. for M markers, the size is Mx4
229+
/**
230+
* @brief Provide way to create Board by passing nessesary data. Specially needed in Python.
231+
*
232+
* @param objPoints array of object points of all the marker corners in the board
233+
* @param dictionary the dictionary of markers employed for this board
234+
* @param ids vector of the identifiers of the markers in the board
235+
*
236+
*/
237+
CV_WRAP static Ptr<Board> create(InputArrayOfArrays objPoints, const Ptr<Dictionary> &dictionary, InputArray ids);
238+
/// array of object points of all the marker corners in the board
239+
/// each marker include its 4 corners in CCW order. For M markers, the size is Mx4.
231240
CV_PROP std::vector< std::vector< Point3f > > objPoints;
232241

233-
// the dictionary of markers employed for this board
242+
/// the dictionary of markers employed for this board
234243
CV_PROP Ptr<Dictionary> dictionary;
235244

236-
// vector of the identifiers of the markers in the board (same size than objPoints)
237-
// The identifiers refers to the board dictionary
245+
/// vector of the identifiers of the markers in the board (same size than objPoints)
246+
/// The identifiers refers to the board dictionary
238247
CV_PROP std::vector< int > ids;
239248
};
240249

@@ -277,7 +286,7 @@ class CV_EXPORTS_W GridBoard : public Board {
277286
* the marker size and marker separation.
278287
*/
279288
CV_WRAP static Ptr<GridBoard> create(int markersX, int markersY, float markerLength,
280-
float markerSeparation, Ptr<Dictionary> &dictionary, int firstMarker = 0);
289+
float markerSeparation, const Ptr<Dictionary> &dictionary, int firstMarker = 0);
281290

282291
/**
283292
*
@@ -322,8 +331,9 @@ class CV_EXPORTS_W GridBoard : public Board {
322331
* @param distCoeffs vector of distortion coefficients
323332
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
324333
* @param rvec Output vector (e.g. cv::Mat) corresponding to the rotation vector of the board
325-
* (@sa Rodrigues).
334+
* (@sa Rodrigues). Used as initial guess if not empty.
326335
* @param tvec Output vector (e.g. cv::Mat) corresponding to the translation vector of the board.
336+
* Used as initial guess if not empty.
327337
*
328338
* This function receives the detected markers and returns the pose of a marker board composed
329339
* by those markers.
@@ -334,7 +344,7 @@ class CV_EXPORTS_W GridBoard : public Board {
334344
* The function returns the number of markers from the input employed for the board pose estimation.
335345
* Note that returning a 0 means the pose has not been estimated.
336346
*/
337-
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, Ptr<Board> &board,
347+
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
338348
InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec,
339349
OutputArray tvec);
340350

@@ -373,7 +383,7 @@ CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, P
373383
* homography, and all the marker corners in the board must have the same Z coordinate.
374384
*/
375385
CV_EXPORTS_W void refineDetectedMarkers(
376-
InputArray image, Ptr<Board> &board, InputOutputArrayOfArrays detectedCorners,
386+
InputArray image,const Ptr<Board> &board, InputOutputArrayOfArrays detectedCorners,
377387
InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners,
378388
InputArray cameraMatrix = noArray(), InputArray distCoeffs = noArray(),
379389
float minRepDistance = 10.f, float errorCorrectionRate = 3.f, bool checkAllOrders = true,
@@ -437,7 +447,7 @@ CV_EXPORTS_W void drawAxis(InputOutputArray image, InputArray cameraMatrix, Inpu
437447
*
438448
* This function returns a marker image in its canonical form (i.e. ready to be printed)
439449
*/
440-
CV_EXPORTS_W void drawMarker(Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray img,
450+
CV_EXPORTS_W void drawMarker(const Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray img,
441451
int borderBits = 1);
442452

443453

@@ -457,7 +467,7 @@ CV_EXPORTS_W void drawMarker(Ptr<Dictionary> &dictionary, int id, int sidePixels
457467
* This function return the image of a planar board, ready to be printed. It assumes
458468
* the Board layout specified is planar by ignoring the z coordinates of the object points.
459469
*/
460-
CV_EXPORTS_W void drawPlanarBoard(Ptr<Board> &board, Size outSize, OutputArray img,
470+
CV_EXPORTS_W void drawPlanarBoard(const Ptr<Board> &board, Size outSize, OutputArray img,
461471
int marginSize = 0, int borderBits = 1);
462472

463473

@@ -474,7 +484,7 @@ void _drawPlanarBoardImpl(Board *board, Size outSize, OutputArray img,
474484
* @brief Calibrate a camera using aruco markers
475485
*
476486
* @param corners vector of detected marker corners in all frames.
477-
* The corners should have the same format returned by detectMarkers (@sa detectMarkers).
487+
* The corners should have the same format returned by detectMarkers (see #detectMarkers).
478488
* @param ids list of identifiers for each marker in corners
479489
* @param counter number of markers in each frame so that corners and ids can be split
480490
* @param board Marker Board layout
@@ -491,20 +501,38 @@ void _drawPlanarBoardImpl(Board *board, Size outSize, OutputArray img,
491501
* from the model coordinate space (in which object points are specified) to the world coordinate
492502
* space, that is, a real position of the board pattern in the k-th pattern view (k=0.. *M* -1).
493503
* @param tvecs Output vector of translation vectors estimated for each pattern view.
494-
* @param flags flags Different flags for the calibration process (@sa calibrateCamera)
504+
* @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic parameters.
505+
* Order of deviations values:
506+
* \f$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
507+
* s_4, \tau_x, \tau_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero.
508+
* @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic parameters.
509+
* Order of deviations values: \f$(R_1, T_1, \dotsc , R_M, T_M)\f$ where M is number of pattern views,
510+
* \f$R_i, T_i\f$ are concatenated 1x3 vectors.
511+
* @param perViewErrors Output vector of average re-projection errors estimated for each pattern view.
512+
* @param flags flags Different flags for the calibration process (see #calibrateCamera for details).
495513
* @param criteria Termination criteria for the iterative optimization algorithm.
496514
*
497515
* This function calibrates a camera using an Aruco Board. The function receives a list of
498516
* detected markers from several views of the Board. The process is similar to the chessboard
499517
* calibration in calibrateCamera(). The function returns the final re-projection error.
500518
*/
501-
CV_EXPORTS_W double calibrateCameraAruco(
502-
InputArrayOfArrays corners, InputArray ids, InputArray counter, Ptr<Board> &board,
519+
CV_EXPORTS_AS(calibrateCameraArucoExtended) double calibrateCameraAruco(
520+
InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr<Board> &board,
503521
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
504-
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
522+
OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
523+
OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics,
524+
OutputArray perViewErrors, int flags = 0,
505525
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
506526

507527

528+
/** @brief It's the same function as #calibrateCameraAruco but without calibration error estimation.
529+
*/
530+
CV_EXPORTS_W double calibrateCameraAruco(
531+
InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr<Board> &board,
532+
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
533+
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
534+
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
535+
508536

509537
//! @}
510538
}

modules/aruco/include/opencv2/aruco/charuco.hpp

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class CV_EXPORTS_W CharucoBoard : public Board {
9898
* and the size of the markers and chessboard squares.
9999
*/
100100
CV_WRAP static Ptr<CharucoBoard> create(int squaresX, int squaresY, float squareLength,
101-
float markerLength, Ptr<Dictionary> &dictionary);
101+
float markerLength, const Ptr<Dictionary> &dictionary);
102102

103103
/**
104104
*
@@ -146,6 +146,7 @@ class CV_EXPORTS_W CharucoBoard : public Board {
146146
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
147147
* @param distCoeffs optional vector of distortion coefficients
148148
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
149+
* @param minMarkers number of adjacent markers that must be detected to return a charuco corner
149150
*
150151
* This function receives the detected markers and returns the 2D position of the chessboard corners
151152
* from a ChArUco board using the detected Aruco markers. If camera parameters are provided,
@@ -155,10 +156,10 @@ class CV_EXPORTS_W CharucoBoard : public Board {
155156
* The function returns the number of interpolated corners.
156157
*/
157158
CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, InputArray markerIds,
158-
InputArray image, Ptr<CharucoBoard> &board,
159+
InputArray image, const Ptr<CharucoBoard> &board,
159160
OutputArray charucoCorners, OutputArray charucoIds,
160161
InputArray cameraMatrix = noArray(),
161-
InputArray distCoeffs = noArray());
162+
InputArray distCoeffs = noArray(), int minMarkers = 2);
162163

163164

164165

@@ -181,7 +182,7 @@ CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, Inp
181182
* If pose estimation is valid, returns true, else returns false.
182183
*/
183184
CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,
184-
Ptr<CharucoBoard> &board, InputArray cameraMatrix,
185+
const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
185186
InputArray distCoeffs, OutputArray rvec, OutputArray tvec);
186187

187188

@@ -223,19 +224,36 @@ CV_EXPORTS_W void drawDetectedCornersCharuco(InputOutputArray image, InputArray
223224
* from the model coordinate space (in which object points are specified) to the world coordinate
224225
* space, that is, a real position of the board pattern in the k-th pattern view (k=0.. *M* -1).
225226
* @param tvecs Output vector of translation vectors estimated for each pattern view.
226-
* @param flags flags Different flags for the calibration process (@sa calibrateCamera)
227+
* @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic parameters.
228+
* Order of deviations values:
229+
* \f$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
230+
* s_4, \tau_x, \tau_y)\f$ If one of parameters is not estimated, it's deviation is equals to zero.
231+
* @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic parameters.
232+
* Order of deviations values: \f$(R_1, T_1, \dotsc , R_M, T_M)\f$ where M is number of pattern views,
233+
* \f$R_i, T_i\f$ are concatenated 1x3 vectors.
234+
* @param perViewErrors Output vector of average re-projection errors estimated for each pattern view.
235+
* @param flags flags Different flags for the calibration process (see #calibrateCamera for details).
227236
* @param criteria Termination criteria for the iterative optimization algorithm.
228237
*
229238
* This function calibrates a camera using a set of corners of a Charuco Board. The function
230239
* receives a list of detected corners and its identifiers from several views of the Board.
231240
* The function returns the final re-projection error.
232241
*/
233-
CV_EXPORTS_W double calibrateCameraCharuco(
234-
InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, Ptr<CharucoBoard> &board,
242+
CV_EXPORTS_AS(calibrateCameraCharucoExtended) double calibrateCameraCharuco(
243+
InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr<CharucoBoard> &board,
235244
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
236-
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
245+
OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
246+
OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics,
247+
OutputArray perViewErrors, int flags = 0,
237248
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
238249

250+
/** @brief It's the same function as #calibrateCameraCharuco but without calibration error estimation.
251+
*/
252+
CV_EXPORTS_W double calibrateCameraCharuco(
253+
InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr<CharucoBoard> &board,
254+
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
255+
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
256+
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
239257

240258

241259

@@ -309,7 +327,7 @@ CV_EXPORTS_W void drawDetectedDiamonds(InputOutputArray image, InputArrayOfArray
309327
* This function return the image of a ChArUco marker, ready to be printed.
310328
*/
311329
// TODO cannot be exported yet; conversion from/to Vec4i is not wrapped in core
312-
CV_EXPORTS void drawCharucoDiamond(Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength,
330+
CV_EXPORTS void drawCharucoDiamond(const Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength,
313331
int markerLength, OutputArray img, int marginSize = 0,
314332
int borderBits = 1);
315333

modules/aruco/include/opencv2/aruco/dictionary.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class CV_EXPORTS_W Dictionary {
9191
* @see generateCustomDictionary
9292
*/
9393
CV_WRAP_AS(create_from) static Ptr<Dictionary> create(int nMarkers, int markerSize,
94-
Ptr<Dictionary> &baseDictionary);
94+
const Ptr<Dictionary> &baseDictionary);
9595

9696
/**
9797
* @see getPredefinedDictionary
@@ -194,7 +194,7 @@ CV_EXPORTS_AS(custom_dictionary) Ptr<Dictionary> generateCustomDictionary(
194194
CV_EXPORTS_AS(custom_dictionary_from) Ptr<Dictionary> generateCustomDictionary(
195195
int nMarkers,
196196
int markerSize,
197-
Ptr<Dictionary> &baseDictionary);
197+
const Ptr<Dictionary> &baseDictionary);
198198

199199

200200

0 commit comments

Comments
 (0)