Skip to content

Commit 6b1faf0

Browse files
authored
Merge pull request #3735 from paroj:ovisup
ovis: force camera extent update to get correct bbox #3735 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake --- fixes #3732
1 parent 3c2bcbf commit 6b1faf0

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

modules/ovis/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ocv_glob_module_sources()
2424
ocv_module_include_directories()
2525
ocv_create_module()
2626

27-
ocv_add_samples(opencv_aruco)
27+
ocv_add_samples(opencv_objdetect opencv_aruco)
2828

2929
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-parameter)
3030
ocv_target_link_libraries(${the_module} ${OGRE_LIBRARIES})

modules/ovis/samples/aruco_ar_demo.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <opencv2/videoio.hpp>
44

55
#include <opencv2/ovis.hpp>
6-
#include <opencv2/aruco_detector.hpp>
6+
#include <opencv2/aruco.hpp>
77

88
#include <iostream>
99

@@ -24,10 +24,12 @@ int main()
2424
const double focal_length = 800.0;
2525

2626
// aruco
27-
Ptr<aruco::Dictionary> adict = aruco::getPredefinedDictionary(aruco::DICT_4X4_50);
28-
//Mat out_img;
29-
//aruco::drawMarker(adict, 0, 400, out_img);
30-
//imshow("marker", out_img);
27+
aruco::Dictionary adict = aruco::getPredefinedDictionary(aruco::DICT_4X4_50);
28+
29+
aruco::ArucoDetector detector(adict);
30+
Mat out_img;
31+
adict.generateImageMarker(0, 400, out_img);
32+
imshow("marker", out_img);
3133

3234
// random calibration data, your mileage may vary
3335
Mat1d cm = Mat1d::zeros(3, 3); // init empty matrix
@@ -53,7 +55,7 @@ int main()
5355
while (ovis::waitKey(1) != KEY_ESCAPE) {
5456
cap.read(img);
5557
win->setBackground(img);
56-
aruco::detectMarkers(img, adict, corners, ids);
58+
detector.detectMarkers(img, corners, ids);
5759

5860
waitKey(1);
5961

modules/ovis/samples/aruco_ar_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# aruco
55
adict = cv.aruco.getPredefinedDictionary(cv.aruco.DICT_4X4_50)
6-
cv.imshow("marker", cv.aruco.drawMarker(adict, 0, 400))
6+
cv.imshow("marker", adict.generateImageMarker(0, 400))
77

88
# random calibration data. your mileage may vary.
99
imsize = (800, 600)

modules/ovis/src/ovis.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ class WindowSceneImpl : public WindowScene
588588
cam->setDebugDisplayEnabled(true);
589589
cam->setNearClipDistance(1e-9);
590590
cam->setFarClipDistance(zFar);
591+
cam->getFrustumExtents(); // force update
591592

592593
_setCameraIntrinsics(cam, K, imsize);
593594

0 commit comments

Comments
 (0)