1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Merge pull request #29175 from asmorkalov:as/geometry2

Geometry module #29175

OpenCV Contrib: https://github.com/opencv/opencv_contrib/pull/4129
CI changes: https://github.com/opencv/ci-gha-workflow/pull/313

Continues
- https://github.com/opencv/opencv/pull/28804
- https://github.com/opencv/opencv/pull/29101
- https://github.com/opencv/opencv/pull/29108
- https://github.com/opencv/opencv/pull/28810

Todo for followup PRs:
- [x] Rename doxygen groups
- [x] Fix JS modules layout and whitelists
- [ ] Sort tutorials code/snippets

### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Alexander Smorkalov
2026-05-31 14:23:15 +03:00
committed by GitHub
parent 14a475aa0b
commit 59218f9edd
291 changed files with 267 additions and 248 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ endif()
set(STD_OPENCV_LIBS opencv-data)
set(STD_OPENCV_DEV libopencv-dev)
foreach(module 3d calib core dnn features flann highgui
foreach(module geometry calib core dnn features flann highgui
imgcodecs imgproc ml objdetect
photo stereo stitching ts video videoio)
if(HAVE_opencv_${module})

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

@@ -1,5 +1,5 @@
3d processing and visualisation (3d module) {#tutorial_table_of_content_3d}
Computational geometry module {#tutorial_table_of_content_geometry}
==========================================================
- @subpage tutorial_point_cloud
@@ -156,17 +156,17 @@ cmake \
Each module is a subdirectory of the `modules` directory. It is possible to disable one module:
```.sh
cmake -DBUILD_opencv_3d=OFF ../opencv
cmake -DBUILD_opencv_geometry=OFF ../opencv
```
The opposite option is to build only specified modules and all modules they depend on:
```.sh
cmake -DBUILD_LIST=calib3d,videoio,ts ../opencv
cmake -DBUILD_LIST=geometry,videoio,ts ../opencv
```
In this example we requested 3 modules and configuration script has determined all dependencies automatically:
```
-- OpenCV modules:
-- To be built: calib3d core features flann highgui imgcodecs imgproc ts videoio
-- To be built: core features flann geometry highgui imgcodecs imgproc ts videoio
```
@@ -114,7 +114,7 @@ Making a project
since I plan to use the whole bunch:
opencv_core opencv_imgproc opencv_imgcodecs opencv_highgui opencv_videoio opencv_video opencv_features
opencv_3d opencv_objdetect opencv_flann
opencv_geometry opencv_objdetect opencv_flann
![](images/a10.png)
@@ -125,7 +125,7 @@ Making a project
@endcode
My output (in case you want to check) was:
@code{.bash}
-L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_video -lopencv_features -lopencv_3d -lopencv_calib -lopencv_stereo -lopencv_objdetect -lopencv_videoio -lopencv_imgcodecs -lopencv_flann
-L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_video -lopencv_features -lopencv_geometry -lopencv_calib -lopencv_stereo -lopencv_objdetect -lopencv_videoio -lopencv_imgcodecs -lopencv_flann
@endcode
Now you are done. Click **OK**
+1 -1
View File
@@ -11,7 +11,7 @@ OpenCV Tutorials {#tutorial_root}
- @subpage tutorial_table_of_content_dnn - infer neural networks using built-in _dnn_ module
- @subpage tutorial_table_of_content_other - other modules (stitching, video)
- @subpage tutorial_table_of_content_ios - running OpenCV on an iDevice
- @subpage tutorial_table_of_content_3d - 3d objects processing and visualisation
- @subpage tutorial_table_of_content_geometry - 2d and 3d geometry primitives and point clouds processing
- @subpage tutorial_table_of_content_photo - photo module functions (hdr_image, ccm)
@cond CUDA_MODULES
- @subpage tutorial_table_of_content_gpu - utilizing power of video card to run CV algorithms
-16
View File
@@ -1,16 +0,0 @@
set(the_description "Camera Calibration and 3D Reconstruction")
ocv_add_dispatched_file(undistort SSE2 AVX2)
set(debug_modules "")
if(DEBUG_opencv_3d)
list(APPEND debug_modules opencv_highgui)
endif()
ocv_define_module(3d opencv_imgproc opencv_flann ${debug_modules}
WRAP java objc python js
)
ocv_target_link_libraries(${the_module} ${LAPACK_LIBRARIES})
if(NOT HAVE_EIGEN)
message(STATUS "3d: Eigen support is disabled. Eigen is Required for Posegraph optimization")
endif()
-21
View File
@@ -1,21 +0,0 @@
{
"whitelist":
{
"": [
"findHomography",
"drawFrameAxes",
"estimateAffine2D",
"getDefaultNewCameraMatrix",
"initUndistortRectifyMap",
"Rodrigues",
"solvePnP",
"solvePnPRansac",
"solvePnPRefineLM",
"projectPoints",
"undistort",
"fisheye_initUndistortRectifyMap",
"fisheye_projectPoints"
],
"UsacParams": ["UsacParams"]
}
}
+1 -1
View File
@@ -4,6 +4,6 @@ set(debug_modules "")
if(DEBUG_opencv_calib)
list(APPEND debug_modules opencv_highgui)
endif()
ocv_define_module(calib opencv_imgproc opencv_objdetect opencv_flann opencv_3d opencv_stereo ${debug_modules}
ocv_define_module(calib opencv_imgproc opencv_objdetect opencv_flann opencv_geometry opencv_stereo ${debug_modules}
WRAP java objc python js
)
+1 -1
View File
@@ -7,7 +7,7 @@
#ifndef OPENCV_CALIB3D_HPP
#define OPENCV_CALIB3D_HPP
#include "opencv2/3d.hpp"
#include "opencv2/geometry.hpp"
#include "opencv2/stereo.hpp"
#include "opencv2/calib.hpp"
@@ -2,7 +2,6 @@ package org.opencv.test.calib;
import java.util.ArrayList;
import org.opencv.cv3d.Cv3d;
import org.opencv.calib.Calib;
import org.opencv.core.Core;
import org.opencv.core.CvType;
+1 -1
View File
@@ -47,7 +47,7 @@
#include "opencv2/core/private.hpp"
#include "opencv2/calib.hpp"
#include "opencv2/3d.hpp"
#include "opencv2/geometry.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/features.hpp"
+1 -1
View File
@@ -8,7 +8,7 @@
#include <numeric>
#include "opencv2/ts.hpp"
#include "opencv2/3d.hpp"
#include "opencv2/geometry.hpp"
#include "opencv2/calib.hpp"
#endif
+1 -1
View File
@@ -19,7 +19,7 @@ ocv_add_dispatched_file_force_all("layers/cpu_kernels/transpose_kernels" AVX AVX
ocv_add_dispatched_file_force_all("layers/cpu_kernels/gridsample_kernels" AVX AVX2 NEON RVV LASX)
ocv_add_dispatched_file_force_all("layers/cpu_kernels/nary_eltwise_kernels" AVX AVX2 NEON RVV LASX)
ocv_add_module(dnn opencv_core opencv_imgproc opencv_3d WRAP python java objc js)
ocv_add_module(dnn opencv_core opencv_imgproc opencv_geometry WRAP python java objc js)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/plugin.cmake)
+1 -1
View File
@@ -10,7 +10,7 @@
#include <iterator>
#include <opencv2/imgproc.hpp>
#include <opencv2/3d.hpp>
#include <opencv2/geometry/2d.hpp>
namespace cv {
namespace dnn {
+1 -1
View File
@@ -9,7 +9,7 @@
#include "nms.inl.hpp"
#include <opencv2/imgproc.hpp>
#include <opencv2/3d.hpp>
#include <opencv2/geometry/2d.hpp>
namespace cv { namespace dnn {
CV__DNN_INLINE_NS_BEGIN
+1 -1
View File
@@ -14,7 +14,7 @@
#include <opencv2/core/utils/configuration.private.hpp>
#include <opencv2/core/utils/logger.hpp>
#include <opencv2/3d.hpp>
#include <opencv2/geometry.hpp>
#ifdef _WIN32
#ifndef NOMINMAX
+1 -1
View File
@@ -4,7 +4,7 @@
#include "test_precomp.hpp"
#include <opencv2/dnn/shape_utils.hpp>
#include <opencv2/3d.hpp>
#include <opencv2/geometry/2d.hpp>
#include "npy_blob.hpp"
#include <map>
#include <set>
+1 -1
View File
@@ -6,7 +6,7 @@ set(debug_modules "")
if(DEBUG_opencv_features)
list(APPEND debug_modules opencv_highgui)
endif()
ocv_define_module(features opencv_imgproc opencv_3d ${debug_modules} OPTIONAL opencv_flann WRAP java objc python js)
ocv_define_module(features opencv_imgproc opencv_geometry ${debug_modules} OPTIONAL opencv_flann WRAP java objc python js)
ocv_install_3rdparty_licenses(mscr "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/mscr/chi_table_LICENSE.txt")
ocv_install_3rdparty_licenses(annoylib "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/annoy/LICENSE")
@@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.opencv.cv3d.Cv3d;
import org.opencv.geometry.Geometry;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfInt;
@@ -135,7 +135,7 @@ public class FeaturesTest extends OpenCVTestCase {
MatOfPoint2f points1 = new MatOfPoint2f(lp1.toArray(new Point[0]));
MatOfPoint2f points2 = new MatOfPoint2f(lp2.toArray(new Point[0]));
Mat hmg = Cv3d.findHomography(points1, points2, Cv3d.RANSAC, 3);
Mat hmg = Geometry.findHomography(points1, points2, Geometry.RANSAC, 3);
assertMatEqual(Mat.eye(3, 3, CvType.CV_64F), hmg, EPS);
+1 -1
View File
@@ -45,7 +45,7 @@
#include "opencv2/features.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/3d.hpp"
#include "opencv2/geometry.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/core/private.hpp"
+16
View File
@@ -0,0 +1,16 @@
set(the_description "Computational geometry primitives")
ocv_add_dispatched_file(undistort SSE2 AVX2)
set(debug_modules "")
if(DEBUG_opencv_geometry)
list(APPEND debug_modules opencv_highgui)
endif()
ocv_define_module(geometry opencv_imgproc opencv_flann ${debug_modules}
WRAP java objc python js
)
ocv_target_link_libraries(${the_module} ${LAPACK_LIBRARIES})
if(NOT HAVE_EIGEN)
message(STATUS "Geometry: Eigen support is disabled. Eigen is Required for Posegraph optimization")
endif()

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

@@ -0,0 +1,20 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#ifndef OPENCV_GEOMETRY_HPP
#define OPENCV_GEOMETRY_HPP
/**
@defgroup geometry Computational geometry primitives module.
*/
//! @addtogroup geometry
//! @{
#include "opencv2/geometry/2d.hpp"
#include "opencv2/geometry/3d.hpp"
//! @} geometry
#endif
@@ -10,7 +10,7 @@
namespace cv {
//! @addtogroup imgproc_shape
//! @addtogroup geometry_shape
//! @{
//! types of intersection between rectangles
@@ -28,7 +28,7 @@ enum LineSegmentDetectorModes {
//!< refined through increase of precision, decrement in size, etc.
};
//! @addtogroup imgproc_subdiv2d
//! @addtogroup geometry_subdiv2d
//! @{
class CV_EXPORTS_W Subdiv2D
@@ -304,9 +304,9 @@ protected:
Point2f bottomRight;
};
//! @} imgproc_subdiv2d
//! @} geometry_subdiv2d
//! @addtogroup imgproc_feature
//! @addtogroup geometry_feature
//! @{
/** @example samples/cpp/snippets/lsd_lines.cpp
@@ -388,7 +388,7 @@ CV_EXPORTS_W Ptr<LineSegmentDetector> createLineSegmentDetector(
double sigma_scale = 0.6, double quant = 2.0, double ang_th = 22.5,
double log_eps = 0, double density_th = 0.7, int n_bins = 1024);
//! @} imgproc_feature
//! @} geometry_feature
/** @example samples/python/snippets/squares.py
A n example using approxPolyDP function in python. *
@@ -8,13 +8,12 @@
#include "opencv2/core.hpp"
#include "opencv2/core/utils/logger.hpp"
#include "opencv2/3d/2d.hpp"
#include "opencv2/3d/depth.hpp"
#include "opencv2/3d/odometry.hpp"
#include "opencv2/3d/odometry_frame.hpp"
#include "opencv2/3d/odometry_settings.hpp"
#include "opencv2/3d/volume.hpp"
#include "opencv2/3d/ptcloud.hpp"
#include "opencv2/geometry/depth.hpp"
#include "opencv2/geometry/odometry.hpp"
#include "opencv2/geometry/odometry_frame.hpp"
#include "opencv2/geometry/odometry_settings.hpp"
#include "opencv2/geometry/volume.hpp"
#include "opencv2/geometry/ptcloud.hpp"
/**
@defgroup _3d 3D vision functionality
@@ -7,7 +7,7 @@
#include "opencv2/core/affine.hpp"
#include "opencv2/core/quaternion.hpp"
#include "opencv2/3d.hpp"
#include "opencv2/geometry/3d.hpp"
namespace cv
{
@@ -7,7 +7,7 @@
#include <opencv2/core.hpp>
#include <opencv2/core/affine.hpp>
#include "opencv2/3d/detail/optimizer.hpp"
#include "opencv2/geometry/detail/optimizer.hpp"
//TODO: remove it when it is rewritten to robust pose graph
#include "opencv2/core/dualquaternion.hpp"
@@ -7,7 +7,7 @@
#define OPENCV_3D_VOLUME_SETTINGS_HPP
#include <opencv2/core.hpp>
#include <opencv2/3d/volume.hpp>
#include <opencv2/geometry/volume.hpp>
namespace cv
{
@@ -1,10 +1,10 @@
package org.opencv.test.cv3d;
package org.opencv.test.geometry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.opencv.cv3d.Cv3d;
import org.opencv.geometry.Geometry;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
@@ -21,7 +21,7 @@ import org.opencv.core.RotatedRect;
import org.opencv.test.OpenCVTestCase;
import org.opencv.imgproc.Imgproc;
public class Cv3dTest extends OpenCVTestCase {
public class GeometryTest extends OpenCVTestCase {
Size size;
@@ -50,7 +50,7 @@ public class Cv3dTest extends OpenCVTestCase {
Mat outTvec = new Mat(3, 1, CvType.CV_32F);
outTvec.put(0, 0, 1.4560841, 1.0680628, 0.81598103);
Cv3d.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3);
Geometry.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3);
assertMatEqual(outRvec, rvec3, EPS);
assertMatEqual(outTvec, tvec3, EPS);
@@ -192,7 +192,7 @@ public class Cv3dTest extends OpenCVTestCase {
transformedPoints.put(i, 0, y, x);
}
Mat hmg = Cv3d.findHomography(originalPoints, transformedPoints);
Mat hmg = Geometry.findHomography(originalPoints, transformedPoints);
truth = new Mat(3, 3, CvType.CV_64F);
truth.put(0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1);
@@ -258,14 +258,14 @@ public class Cv3dTest extends OpenCVTestCase {
r.put(0, 0, Math.PI, 0, 0);
Cv3d.Rodrigues(r, R);
Geometry.Rodrigues(r, R);
truth = new Mat(3, 3, CvType.CV_32F);
truth.put(0, 0, 1, 0, 0, 0, -1, 0, 0, 0, -1);
assertMatEqual(truth, R, EPS);
Mat r2 = new Mat();
Cv3d.Rodrigues(R, r2);
Geometry.Rodrigues(R, r2);
assertMatEqual(r, r2, EPS);
}
@@ -313,7 +313,7 @@ public class Cv3dTest extends OpenCVTestCase {
Mat rvec = new Mat();
Mat tvec = new Mat();
Cv3d.solvePnP(points3d, points2d, intrinsics, new MatOfDouble(), rvec, tvec);
Geometry.solvePnP(points3d, points2d, intrinsics, new MatOfDouble(), rvec, tvec);
Mat truth_rvec = new Mat(3, 1, CvType.CV_64F);
truth_rvec.put(0, 0, 0, Math.PI / 2, 0);
@@ -391,7 +391,7 @@ public class Cv3dTest extends OpenCVTestCase {
Mat lines = new Mat();
Mat truth = new Mat(1, 1, CvType.CV_32FC3);
truth.put(0, 0, -0.70735186, 0.70686162, -0.70588124);
Cv3d.computeCorrespondEpilines(left, 1, fundamental, lines);
Geometry.computeCorrespondEpilines(left, 1, fundamental, lines);
assertMatEqual(truth, lines, EPS);
}
@@ -424,7 +424,7 @@ public class Cv3dTest extends OpenCVTestCase {
Mat reprojectionError = new Mat(2, 1, CvType.CV_64FC1);
Cv3d.solvePnPGeneric(points3d, points2d, intrinsics, new MatOfDouble(), rvecs, tvecs, false, Cv3d.SOLVEPNP_IPPE, rvec, tvec, reprojectionError);
Geometry.solvePnPGeneric(points3d, points2d, intrinsics, new MatOfDouble(), rvecs, tvecs, false, Geometry.SOLVEPNP_IPPE, rvec, tvec, reprojectionError);
Mat truth_rvec = new Mat(3, 1, CvType.CV_64F);
truth_rvec.put(0, 0, 0, Math.PI / 2, 0);
@@ -437,14 +437,14 @@ public class Cv3dTest extends OpenCVTestCase {
}
public void testGetDefaultNewCameraMatrixMat() {
Mat mtx = Cv3d.getDefaultNewCameraMatrix(gray0);
Mat mtx = Geometry.getDefaultNewCameraMatrix(gray0);
assertFalse(mtx.empty());
assertEquals(0, Core.countNonZero(mtx));
}
public void testGetDefaultNewCameraMatrixMatSizeBoolean() {
Mat mtx = Cv3d.getDefaultNewCameraMatrix(gray0, size, true);
Mat mtx = Geometry.getDefaultNewCameraMatrix(gray0, size, true);
assertFalse(mtx.empty());
assertFalse(0 == Core.countNonZero(mtx));
@@ -466,7 +466,7 @@ public class Cv3dTest extends OpenCVTestCase {
Mat map2 = new Mat();
// TODO: complete this test
Cv3d.initUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, CvType.CV_32F, map1, map2);
Geometry.initUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, CvType.CV_32F, map1, map2);
}
public void testInitWideAngleProjMapMatMatSizeIntIntMatMat() {
@@ -485,7 +485,7 @@ public class Cv3dTest extends OpenCVTestCase {
truth.put(1, 0, 0, 0, 0);
truth.put(2, 0, 0, 3, 0);
// TODO: No documentation for this function
// Cv3d.initWideAngleProjMap(cameraMatrix, distCoeffs, imageSize,
// Geometry.initWideAngleProjMap(cameraMatrix, distCoeffs, imageSize,
// 5, m1type, truthput1, truthput2);
}
@@ -512,7 +512,7 @@ public class Cv3dTest extends OpenCVTestCase {
}
};
Cv3d.undistort(src, dst, cameraMatrix, distCoeffs);
Geometry.undistort(src, dst, cameraMatrix, distCoeffs);
truth = new Mat(3, 3, CvType.CV_32F) {
{
@@ -540,7 +540,7 @@ public class Cv3dTest extends OpenCVTestCase {
};
Mat newCameraMatrix = new Mat(3, 3, CvType.CV_32F, new Scalar(1));
Cv3d.undistort(src, dst, cameraMatrix, distCoeffs, newCameraMatrix);
Geometry.undistort(src, dst, cameraMatrix, distCoeffs, newCameraMatrix);
truth = new Mat(3, 3, CvType.CV_32F, new Scalar(3));
assertMatEqual(truth, dst, EPS);
@@ -553,7 +553,7 @@ public class Cv3dTest extends OpenCVTestCase {
Mat cameraMatrix = Mat.eye(3, 3, CvType.CV_64FC1);
Mat distCoeffs = new Mat(8, 1, CvType.CV_64FC1, new Scalar(0));
Cv3d.undistortPoints(src, dst, cameraMatrix, distCoeffs);
Geometry.undistortPoints(src, dst, cameraMatrix, distCoeffs);
assertEquals(src.cols(), dst.rows());
assertEquals(src.rows(), dst.cols());
@@ -584,7 +584,7 @@ public class Cv3dTest extends OpenCVTestCase {
K_new_truth.put(1,1, 373.6673784974842);
K_new_truth.put(1,2, 538.794152656429);
Cv3d.fisheye_estimateNewCameraMatrixForUndistortRectify(K,D,new Size(1920,1080),
Geometry.fisheye_estimateNewCameraMatrixForUndistortRectify(K,D,new Size(1920,1080),
new Mat().eye(3, 3, CvType.CV_64F), K_new, 0.0, new Size(1920,1080));
assertMatEqual(K_new, K_new_truth, EPS);
@@ -595,7 +595,7 @@ public class Cv3dTest extends OpenCVTestCase {
MatOfPoint2f approxCurve = new MatOfPoint2f();
Cv3d.approxPolyDP(curve, approxCurve, EPS, true);
Geometry.approxPolyDP(curve, approxCurve, EPS, true);
List<Point> approxCurveGold = new ArrayList<Point>(3);
approxCurveGold.add(new Point(1, 3));
@@ -617,7 +617,7 @@ public class Cv3dTest extends OpenCVTestCase {
MatOfInt hull = new MatOfInt();
Cv3d.convexHull(points, hull);
Geometry.convexHull(points, hull);
MatOfInt expHull = new MatOfInt(
0, 1, 2, 3
@@ -637,7 +637,7 @@ public class Cv3dTest extends OpenCVTestCase {
MatOfInt hull = new MatOfInt();
Cv3d.convexHull(points, hull, true);
Geometry.convexHull(points, hull, true);
MatOfInt expHull = new MatOfInt(
3, 2, 1, 0
@@ -656,10 +656,10 @@ public class Cv3dTest extends OpenCVTestCase {
);
MatOfInt hull = new MatOfInt();
Cv3d.convexHull(points, hull);
Geometry.convexHull(points, hull);
MatOfInt4 convexityDefects = new MatOfInt4();
Cv3d.convexityDefects(points, hull, convexityDefects);
Geometry.convexityDefects(points, hull, convexityDefects);
assertMatEqual(new MatOfInt4(3, 0, 5, 3620), convexityDefects.reshape(4, convexityDefects.cols()));
}
@@ -668,7 +668,7 @@ public class Cv3dTest extends OpenCVTestCase {
MatOfPoint2f points = new MatOfPoint2f(new Point(0, 0), new Point(-1, 1), new Point(1, 1), new Point(1, -1), new Point(-1, -1));
RotatedRect rrect = new RotatedRect();
rrect = Cv3d.fitEllipse(points);
rrect = Geometry.fitEllipse(points);
double FIT_ELLIPSE_CENTER_EPS = 0.01;
double FIT_ELLIPSE_SIZE_EPS = 0.4;
@@ -686,7 +686,7 @@ public class Cv3dTest extends OpenCVTestCase {
Mat linePoints = new Mat(4, 1, CvType.CV_32FC1);
linePoints.put(0, 0, 0.53198653, 0.84675282, 2.5, 3.75);
Cv3d.fitLine(points, dst, Imgproc.DIST_L12, 0, 0.01, 0.01);
Geometry.fitLine(points, dst, Imgproc.DIST_L12, 0, 0.01, 0.01);
assertMatEqual(linePoints, dst, EPS);
}
@@ -694,11 +694,11 @@ public class Cv3dTest extends OpenCVTestCase {
public void testIsContourConvex() {
MatOfPoint contour1 = new MatOfPoint(new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(5, 4));
assertFalse(Cv3d.isContourConvex(contour1));
assertFalse(Geometry.isContourConvex(contour1));
MatOfPoint contour2 = new MatOfPoint(new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(5, 6));
assertTrue(Cv3d.isContourConvex(contour2));
assertTrue(Geometry.isContourConvex(contour2));
}
public void testMatchShapes() {
@@ -707,7 +707,7 @@ public class Cv3dTest extends OpenCVTestCase {
contour1.put(0, 0, 1, 1, 5, 1, 4, 3, 6, 2);
contour2.put(0, 0, 1, 1, 6, 1, 4, 1, 2, 5);
double distance = Cv3d.matchShapes(contour1, contour2, Imgproc.CONTOURS_MATCH_I1, 1);
double distance = Geometry.matchShapes(contour1, contour2, Imgproc.CONTOURS_MATCH_I1, 1);
assertEquals(2.81109697365334, distance, EPS);
}
@@ -715,7 +715,7 @@ public class Cv3dTest extends OpenCVTestCase {
public void testMinAreaRect() {
MatOfPoint2f points = new MatOfPoint2f(new Point(1, 1), new Point(5, 1), new Point(4, 3), new Point(6, 2));
RotatedRect rrect = Cv3d.minAreaRect(points);
RotatedRect rrect = Geometry.minAreaRect(points);
assertEquals(new Size(2, 5), rrect.size);
assertEquals(-90., rrect.angle);
@@ -727,7 +727,7 @@ public class Cv3dTest extends OpenCVTestCase {
Point actualCenter = new Point();
float[] radius = new float[1];
Cv3d.minEnclosingCircle(points, actualCenter, radius);
Geometry.minEnclosingCircle(points, actualCenter, radius);
assertEquals(new Point(0, 0), actualCenter);
assertEquals(100.0f, radius[0], 1.0);
@@ -735,10 +735,10 @@ public class Cv3dTest extends OpenCVTestCase {
public void testPointPolygonTest() {
MatOfPoint2f contour = new MatOfPoint2f(new Point(0, 0), new Point(1, 3), new Point(3, 4), new Point(4, 3), new Point(2, 1));
double sign1 = Cv3d.pointPolygonTest(contour, new Point(2, 2), false);
double sign1 = Geometry.pointPolygonTest(contour, new Point(2, 2), false);
assertEquals(1.0, sign1);
double sign2 = Cv3d.pointPolygonTest(contour, new Point(4, 4), true);
double sign2 = Geometry.pointPolygonTest(contour, new Point(4, 4), true);
assertEquals(-Math.sqrt(0.5), sign2);
}
}
@@ -1,9 +1,9 @@
package org.opencv.test.cv3d;
package org.opencv.test.geometry;
import org.opencv.core.MatOfFloat6;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.cv3d.Subdiv2D;
import org.opencv.geometry.Subdiv2D;
import org.opencv.test.OpenCVTestCase;
public class Subdiv2DTest extends OpenCVTestCase {
+37
View File
@@ -0,0 +1,37 @@
{
"whitelist":
{
"": [
"findHomography",
"drawFrameAxes",
"estimateAffine2D",
"getDefaultNewCameraMatrix",
"initUndistortRectifyMap",
"Rodrigues",
"solvePnP",
"solvePnPRansac",
"solvePnPRefineLM",
"projectPoints",
"undistort",
"fisheye_initUndistortRectifyMap",
"fisheye_projectPoints",
"approxPolyDP",
"approxPolyN",
"boundingRect",
"minAreaRect",
"minEnclosingCircle",
"minEnclosingTriangle",
"matchShapes",
"convexHull",
"convexityDefects",
"isContourConvex",
"intersectConvexConvex",
"fitEllipse",
"fitEllipseAMS",
"fitEllipseDirect",
"fitLine",
"pointPolygonTest"
],
"UsacParams": ["UsacParams"]
}
}
@@ -5,7 +5,7 @@
#define __OPENCV_PERF_PRECOMP_HPP__
#include "opencv2/ts.hpp"
#include "opencv2/3d.hpp"
#include "opencv2/geometry.hpp"
#ifdef HAVE_OPENCL
#include <opencv2/core/ocl.hpp>
@@ -2,10 +2,9 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#include <opencv2/3d.hpp>
#include <opencv2/geometry.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/3d.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/core/quaternion.hpp>
@@ -3,7 +3,7 @@
// of this distribution and at http://opencv.org/license.html
#include "precomp.hpp"
#include <opencv2/3d/mst.hpp>
#include <opencv2/geometry/mst.hpp>
#include <queue>
#include <tuple>
@@ -4,7 +4,7 @@
#include "precomp.hpp"
#include "octree.hpp"
#include "opencv2/3d.hpp"
#include "opencv2/geometry/3d.hpp"
namespace cv{
@@ -692,4 +692,4 @@ void Octree::KNNSearch(const Point3f &query, const int K, OutputArray points, Ou
Mat(outSqDists).copyTo(squareDists);
}
}
}
}
@@ -12,7 +12,7 @@
#include <vector>
#include "opencv2/core.hpp"
#include "octree.hpp"
#include "opencv2/3d.hpp"
#include "opencv2/geometry/3d.hpp"
namespace cv {

Some files were not shown because too many files have changed in this diff Show More