Skip to content

Commit e247b68

Browse files
authored
Merge pull request #3394 from AleksandrPanov:move_contrib_charuco_to_main_objdetect
Move contrib charuco to main objdetect
2 parents 2276095 + 49bdf7b commit e247b68

19 files changed

+155
-1541
lines changed

modules/aruco/include/opencv2/aruco.hpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,24 @@ namespace cv {
1111
namespace aruco {
1212

1313
/**
14+
* @defgroup aruco Aruco markers, module functionality was moved to objdetect module
15+
* @{
16+
* ArUco Marker Detection, module functionality was moved to objdetect module
17+
* @sa ArucoDetector, CharucoDetector, Board, GridBoard, CharucoBoard
18+
* @}
19+
*/
20+
21+
//! @addtogroup aruco
22+
//! @{
23+
24+
/** @brief detect markers
1425
@deprecated Use class ArucoDetector::detectMarkers
1526
*/
1627
CV_EXPORTS_W void detectMarkers(InputArray image, const Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
1728
OutputArray ids, const Ptr<DetectorParameters> &parameters = makePtr<DetectorParameters>(),
1829
OutputArrayOfArrays rejectedImgPoints = noArray());
1930

20-
/**
31+
/** @brief refine detected markers
2132
@deprecated Use class ArucoDetector::refineDetectedMarkers
2233
*/
2334
CV_EXPORTS_W void refineDetectedMarkers(InputArray image,const Ptr<Board> &board,
@@ -28,13 +39,13 @@ CV_EXPORTS_W void refineDetectedMarkers(InputArray image,const Ptr<Board> &boar
2839
bool checkAllOrders = true, OutputArray recoveredIdxs = noArray(),
2940
const Ptr<DetectorParameters> &parameters = makePtr<DetectorParameters>());
3041

31-
/**
32-
@deprecated Use Board::draw
42+
/** @brief draw planar board
43+
@deprecated Use Board::generateImage
3344
*/
3445
CV_EXPORTS_W void drawPlanarBoard(const Ptr<Board> &board, Size outSize, OutputArray img, int marginSize,
3546
int borderBits);
3647

37-
/**
48+
/** @brief get board object and image points
3849
@deprecated Use Board::matchImagePoints
3950
*/
4051
CV_EXPORTS_W void getBoardObjectAndImagePoints(const Ptr<Board> &board, InputArrayOfArrays detectedCorners,
@@ -83,6 +94,8 @@ CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float ma
8394
*/
8495
CV_EXPORTS_W bool testCharucoCornersCollinear(const Ptr<CharucoBoard> &board, InputArray charucoIds);
8596

97+
//! @}
98+
8699
}
87100
}
88101

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

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <opencv2/core.hpp>
88
#include <vector>
99
#include <opencv2/aruco.hpp>
10-
#include <opencv2/objdetect/aruco_detector.hpp>
10+
#include <opencv2/objdetect/charuco_detector.hpp>
1111
#include <opencv2/aruco/aruco_calib.hpp>
1212

1313

@@ -40,28 +40,15 @@ namespace aruco {
4040
* Only visible corners are returned. For each corner, its corresponding identifier is
4141
* also returned in charucoIds.
4242
* The function returns the number of interpolated corners.
43+
*
44+
* @deprecated Use CharucoDetector::detectBoard
4345
*/
4446
CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, InputArray markerIds,
4547
InputArray image, const Ptr<CharucoBoard> &board,
4648
OutputArray charucoCorners, OutputArray charucoIds,
4749
InputArray cameraMatrix = noArray(),
4850
InputArray distCoeffs = noArray(), int minMarkers = 2);
4951

50-
/**
51-
* @brief Draws a set of Charuco corners
52-
* @param image input/output image. It must have 1 or 3 channels. The number of channels is not
53-
* altered.
54-
* @param charucoCorners vector of detected charuco corners
55-
* @param charucoIds list of identifiers for each corner in charucoCorners
56-
* @param cornerColor color of the square surrounding each corner
57-
*
58-
* This function draws a set of detected Charuco corners. If identifiers vector is provided, it also
59-
* draws the id of each corner.
60-
*/
61-
CV_EXPORTS_W void drawDetectedCornersCharuco(InputOutputArray image, InputArray charucoCorners,
62-
InputArray charucoIds = noArray(),
63-
Scalar cornerColor = Scalar(255, 0, 0));
64-
6552
/**
6653
* @brief Detect ChArUco Diamond markers
6754
*
@@ -83,7 +70,9 @@ CV_EXPORTS_W void drawDetectedCornersCharuco(InputOutputArray image, InputArray
8370
* This function detects Diamond markers from the previous detected ArUco markers. The diamonds
8471
* are returned in the diamondCorners and diamondIds parameters. If camera calibration parameters
8572
* are provided, the diamond search is based on reprojection. If not, diamond search is based on
86-
* homography. Homography is faster than reprojection but can slightly reduce the detection rate.
73+
* homography. Homography is faster than reprojection, but less accurate.
74+
*
75+
* @deprecated Use CharucoDetector::detectDiamonds
8776
*/
8877
CV_EXPORTS_W void detectCharucoDiamond(InputArray image, InputArrayOfArrays markerCorners,
8978
InputArray markerIds, float squareMarkerLengthRate,
@@ -94,32 +83,6 @@ CV_EXPORTS_W void detectCharucoDiamond(InputArray image, InputArrayOfArrays mark
9483
(getPredefinedDictionary(PredefinedDictionaryType::DICT_4X4_50)));
9584

9685

97-
98-
/**
99-
* @brief Draw a set of detected ChArUco Diamond markers
100-
*
101-
* @param image input/output image. It must have 1 or 3 channels. The number of channels is not
102-
* altered.
103-
* @param diamondCorners positions of diamond corners in the same format returned by
104-
* detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers,
105-
* the dimensions of this array should be Nx4. The order of the corners should be clockwise.
106-
* @param diamondIds vector of identifiers for diamonds in diamondCorners, in the same format
107-
* returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>).
108-
* Optional, if not provided, ids are not painted.
109-
* @param borderColor color of marker borders. Rest of colors (text color and first corner color)
110-
* are calculated based on this one.
111-
*
112-
* Given an array of detected diamonds, this functions draws them in the image. The marker borders
113-
* are painted and the markers identifiers if provided.
114-
* Useful for debugging purposes.
115-
*/
116-
CV_EXPORTS_W void drawDetectedDiamonds(InputOutputArray image, InputArrayOfArrays diamondCorners,
117-
InputArray diamondIds = noArray(),
118-
Scalar borderColor = Scalar(0, 0, 255));
119-
120-
121-
122-
12386
/**
12487
* @brief Draw a ChArUco Diamond marker
12588
*

modules/aruco/misc/python/test/test_aruco.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,5 @@ def test_drawCharucoDiamond(self):
3535
img = cv.aruco.drawCharucoDiamond(aruco_dict, np.array([0, 1, 2, 3]), 100, 80)
3636
self.assertTrue(img is not None)
3737

38-
def test_write_read_dict(self):
39-
40-
try:
41-
aruco_dict = cv.aruco.getPredefinedDictionary(cv.aruco.DICT_5X5_50)
42-
markers_gold = aruco_dict.bytesList
43-
44-
# write aruco_dict
45-
filename = "test_dict.yml"
46-
fs_write = cv.FileStorage(filename, cv.FileStorage_WRITE)
47-
aruco_dict.writeDictionary(fs_write)
48-
fs_write.release()
49-
50-
# reset aruco_dict
51-
aruco_dict = cv.aruco.getPredefinedDictionary(cv.aruco.DICT_6X6_250)
52-
53-
# read aruco_dict
54-
fs_read = cv.FileStorage(filename, cv.FileStorage_READ)
55-
aruco_dict.readDictionary(fs_read.root())
56-
fs_read.release()
57-
58-
# check equal
59-
self.assertEqual(aruco_dict.markerSize, 5)
60-
self.assertEqual(aruco_dict.maxCorrectionBits, 3)
61-
np.testing.assert_array_equal(aruco_dict.bytesList, markers_gold)
62-
63-
finally:
64-
if os.path.exists(filename):
65-
os.remove(filename)
66-
6738
if __name__ == '__main__':
6839
NewOpenCVTests.bootstrap()

0 commit comments

Comments
 (0)