Skip to content

Commit eda4575

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents 01cfda4 + f6d0e94 commit eda4575

File tree

5 files changed

+51
-30
lines changed

5 files changed

+51
-30
lines changed

modules/aruco/include/opencv2/aruco.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ CV_EXPORTS_W void drawDetectedMarkers(InputOutputArray image, InputArrayOfArrays
471471
*
472472
* Given the pose estimation of a marker or board, this function draws the axis of the world
473473
* coordinate system, i.e. the system centered on the marker/board. Useful for debugging purposes.
474+
*
475+
* @deprecated use cv::drawFrameAxes
474476
*/
475477
CV_EXPORTS_W void drawAxis(InputOutputArray image, InputArray cameraMatrix, InputArray distCoeffs,
476478
InputArray rvec, InputArray tvec, float length);

modules/aruco/src/aruco.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,30 +1731,12 @@ void drawDetectedMarkers(InputOutputArray _image, InputArrayOfArrays _corners,
17311731

17321732
/**
17331733
*/
1734-
void drawAxis(InputOutputArray _image, InputArray _cameraMatrix, InputArray _distCoeffs,
1735-
InputArray _rvec, InputArray _tvec, float length) {
1736-
1737-
CV_Assert(_image.getMat().total() != 0 &&
1738-
(_image.getMat().channels() == 1 || _image.getMat().channels() == 3));
1739-
CV_Assert(length > 0);
1740-
1741-
// project axis points
1742-
vector< Point3f > axisPoints;
1743-
axisPoints.push_back(Point3f(0, 0, 0));
1744-
axisPoints.push_back(Point3f(length, 0, 0));
1745-
axisPoints.push_back(Point3f(0, length, 0));
1746-
axisPoints.push_back(Point3f(0, 0, length));
1747-
vector< Point2f > imagePoints;
1748-
projectPoints(axisPoints, _rvec, _tvec, _cameraMatrix, _distCoeffs, imagePoints);
1749-
1750-
// draw axis lines
1751-
line(_image, imagePoints[0], imagePoints[1], Scalar(0, 0, 255), 3);
1752-
line(_image, imagePoints[0], imagePoints[2], Scalar(0, 255, 0), 3);
1753-
line(_image, imagePoints[0], imagePoints[3], Scalar(255, 0, 0), 3);
1734+
void drawAxis(InputOutputArray _image, InputArray _cameraMatrix, InputArray _distCoeffs, InputArray _rvec,
1735+
InputArray _tvec, float length)
1736+
{
1737+
drawFrameAxes(_image, _cameraMatrix, _distCoeffs, _rvec, _tvec, length, 3);
17541738
}
17551739

1756-
1757-
17581740
/**
17591741
*/
17601742
void drawMarker(const Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray _img, int borderBits) {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
3+
# Python 2/3 compatibility
4+
from __future__ import print_function
5+
6+
import os
7+
8+
import cv2 as cv
9+
10+
from tests_common import NewOpenCVTests
11+
12+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
13+
MODULE_DIR = os.path.join(SCRIPT_DIR, '../../../')
14+
15+
class shape_test(NewOpenCVTests):
16+
17+
def test_computeDistance(self):
18+
19+
a = cv.imread(os.path.join(MODULE_DIR, 'samples/data/shape_sample/1.png'), cv.IMREAD_GRAYSCALE)
20+
b = cv.imread(os.path.join(MODULE_DIR, 'samples/data/shape_sample/2.png'), cv.IMREAD_GRAYSCALE)
21+
if a is None or b is None:
22+
raise unittest.SkipTest("Missing files with test data")
23+
24+
ca, _ = cv.findContours(a, cv.RETR_CCOMP, cv.CHAIN_APPROX_TC89_KCOS)
25+
cb, _ = cv.findContours(b, cv.RETR_CCOMP, cv.CHAIN_APPROX_TC89_KCOS)
26+
27+
hd = cv.createHausdorffDistanceExtractor()
28+
sd = cv.createShapeContextDistanceExtractor()
29+
30+
d1 = hd.computeDistance(ca[0], cb[0])
31+
d2 = sd.computeDistance(ca[0], cb[0])
32+
33+
self.assertAlmostEqual(d1, 26.4196891785, 3, "HausdorffDistanceExtractor")
34+
self.assertAlmostEqual(d2, 0.25804194808, 3, "ShapeContextDistanceExtractor")
35+
36+
if __name__ == '__main__':
37+
NewOpenCVTests.bootstrap()

modules/text/src/ocr_tesseract.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
#include <fstream>
4949
#include <queue>
5050

51+
#ifdef HAVE_TESSERACT
52+
#if !defined(USE_STD_NAMESPACE)
53+
#define USE_STD_NAMESPACE
54+
#endif
55+
#include <tesseract/baseapi.h>
56+
#include <tesseract/resultiterator.h>
57+
#endif
58+
5159
namespace cv
5260
{
5361
namespace text

modules/text/src/precomp.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,4 @@
4747

4848
#include "text_config.hpp"
4949

50-
#ifdef HAVE_TESSERACT
51-
#if !defined(USE_STD_NAMESPACE)
52-
#define USE_STD_NAMESPACE
53-
#endif
54-
#include <tesseract/baseapi.h>
55-
#include <tesseract/resultiterator.h>
56-
#endif
57-
5850
#endif

0 commit comments

Comments
 (0)