mirror of
https://github.com/opencv/opencv.git
synced 2026-07-26 22:03:04 +04:00
40ddc700aa
Inverted imgproc-geometry dependency and moved more functions to geometry #29230 Fixes: https://github.com/opencv/opencv/issues/20267 Continues: https://github.com/opencv/opencv/pull/29175 OpenCV Contrib: https://github.com/opencv/opencv_contrib/pull/4137 OpenCV Extra: https://github.com/opencv/opencv_extra/pull/1377 Summary: - LSD returned back to imgproc - drawing functions moved to imgproc - undistort image and related perf-pixel functions moved to imgproc - moments moved to geometry - estimateXXXtransform moved to geometry After the patch the geometry module depends on code and Flann and may be used everywhere without potential circular dependencies ### 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 - [ ] 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
52 lines
1.6 KiB
Java
52 lines
1.6 KiB
Java
package org.opencv.test.geometry;
|
|
|
|
import org.opencv.test.OpenCVTestCase;
|
|
import org.opencv.core.Core;
|
|
import org.opencv.core.Mat;
|
|
import org.opencv.core.CvType;
|
|
import org.opencv.core.Scalar;
|
|
import org.opencv.geometry.Geometry;
|
|
import org.opencv.geometry.Moments;
|
|
|
|
public class MomentsTest extends OpenCVTestCase {
|
|
|
|
Mat data;
|
|
|
|
@Override
|
|
protected void setUp() throws Exception {
|
|
super.setUp();
|
|
|
|
data = new Mat(3,3, CvType.CV_8UC1, new Scalar(1));
|
|
data.row(1).setTo(new Scalar(5));
|
|
}
|
|
|
|
public void testAll() {
|
|
Moments res = Geometry.moments(data);
|
|
assertEquals(res.m00, 21.0, EPS);
|
|
assertEquals(res.m10, 21.0, EPS);
|
|
assertEquals(res.m01, 21.0, EPS);
|
|
assertEquals(res.m20, 35.0, EPS);
|
|
assertEquals(res.m11, 21.0, EPS);
|
|
assertEquals(res.m02, 27.0, EPS);
|
|
assertEquals(res.m30, 63.0, EPS);
|
|
assertEquals(res.m21, 35.0, EPS);
|
|
assertEquals(res.m12, 27.0, EPS);
|
|
assertEquals(res.m03, 39.0, EPS);
|
|
assertEquals(res.mu20, 14.0, EPS);
|
|
assertEquals(res.mu11, 0.0, EPS);
|
|
assertEquals(res.mu02, 6.0, EPS);
|
|
assertEquals(res.mu30, 0.0, EPS);
|
|
assertEquals(res.mu21, 0.0, EPS);
|
|
assertEquals(res.mu12, 0.0, EPS);
|
|
assertEquals(res.mu03, 0.0, EPS);
|
|
assertEquals(res.nu20, 0.031746031746031744, EPS);
|
|
assertEquals(res.nu11, 0.0, EPS);
|
|
assertEquals(res.nu02, 0.013605442176870746, EPS);
|
|
assertEquals(res.nu30, 0.0, EPS);
|
|
assertEquals(res.nu21, 0.0, EPS);
|
|
assertEquals(res.nu12, 0.0, EPS);
|
|
assertEquals(res.nu03, 0.0, EPS);
|
|
}
|
|
|
|
}
|