Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
08b6abd7
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
08b6abd7
编写于
12月 11, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19068 from alalek:issue_18157
上级
33761ee0
3e5d7e17
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
82 addition
and
4 deletion
+82
-4
modules/imgproc/misc/java/test/ImgprocTest.java
modules/imgproc/misc/java/test/ImgprocTest.java
+2
-2
modules/imgproc/src/rotcalipers.cpp
modules/imgproc/src/rotcalipers.cpp
+1
-1
modules/imgproc/test/test_convhull.cpp
modules/imgproc/test/test_convhull.cpp
+78
-0
modules/python/test/test_legacy.py
modules/python/test/test_legacy.py
+1
-1
未找到文件。
modules/imgproc/misc/java/test/ImgprocTest.java
浏览文件 @
08b6abd7
...
...
@@ -1405,8 +1405,8 @@ public class ImgprocTest extends OpenCVTestCase {
RotatedRect
rrect
=
Imgproc
.
minAreaRect
(
points
);
assertEquals
(
new
Size
(
2
,
5
),
rrect
.
size
);
assertEquals
(
-
9
0
.,
rrect
.
angle
);
assertEquals
(
new
Size
(
5
,
2
),
rrect
.
size
);
assertEquals
(
0
.,
rrect
.
angle
);
assertEquals
(
new
Point
(
3.5
,
2
),
rrect
.
center
);
}
...
...
modules/imgproc/src/rotcalipers.cpp
浏览文件 @
08b6abd7
...
...
@@ -352,7 +352,7 @@ cv::RotatedRect cv::minAreaRect( InputArray _points )
Point2f
out
[
3
];
RotatedRect
box
;
convexHull
(
_points
,
hull
,
tru
e
,
true
);
convexHull
(
_points
,
hull
,
fals
e
,
true
);
if
(
hull
.
depth
()
!=
CV_32F
)
{
...
...
modules/imgproc/test/test_convhull.cpp
浏览文件 @
08b6abd7
...
...
@@ -2306,5 +2306,83 @@ TEST(Imgproc_ConvexHull, overflow)
ASSERT_EQ
(
hull
,
hullf
);
}
static
bool
checkMinAreaRect
(
const
RotatedRect
&
rr
,
const
Mat
&
c
,
double
eps
=
0.5
f
)
{
int
N
=
c
.
rows
;
Mat
rr_pts
;
boxPoints
(
rr
,
rr_pts
);
double
maxError
=
0.0
;
int
nfailed
=
0
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
double
d
=
pointPolygonTest
(
rr_pts
,
c
.
at
<
Point2f
>
(
i
),
true
);
maxError
=
std
::
max
(
-
d
,
maxError
);
if
(
d
<
-
eps
)
nfailed
++
;
}
if
(
nfailed
)
std
::
cout
<<
"nfailed="
<<
nfailed
<<
" (total="
<<
N
<<
") maxError="
<<
maxError
<<
std
::
endl
;
return
nfailed
==
0
;
}
TEST
(
Imgproc_minAreaRect
,
reproducer_18157
)
{
const
int
N
=
168
;
float
pts_
[
N
][
2
]
=
{
{
1903
,
266
},
{
1897
,
267
},
{
1893
,
268
},
{
1890
,
269
},
{
1878
,
275
},
{
1875
,
277
},
{
1872
,
279
},
{
1868
,
282
},
{
1862
,
287
},
{
1750
,
400
},
{
1748
,
402
},
{
1742
,
407
},
{
1742
,
408
},
{
1740
,
410
},
{
1738
,
412
},
{
1593
,
558
},
{
1590
,
560
},
{
1588
,
562
},
{
1586
,
564
},
{
1580
,
570
},
{
1443
,
709
},
{
1437
,
714
},
{
1435
,
716
},
{
1304
,
848
},
{
1302
,
850
},
{
1292
,
860
},
{
1175
,
979
},
{
1172
,
981
},
{
1049
,
1105
},
{
936
,
1220
},
{
933
,
1222
},
{
931
,
1224
},
{
830
,
1326
},
{
774
,
1383
},
{
769
,
1389
},
{
766
,
1393
},
{
764
,
1396
},
{
762
,
1399
},
{
760
,
1402
},
{
757
,
1408
},
{
757
,
1410
},
{
755
,
1413
},
{
754
,
1416
},
{
753
,
1420
},
{
752
,
1424
},
{
752
,
1442
},
{
753
,
1447
},
{
754
,
1451
},
{
755
,
1454
},
{
757
,
1457
},
{
757
,
1459
},
{
761
,
1467
},
{
763
,
1470
},
{
765
,
1473
},
{
767
,
1476
},
{
771
,
1481
},
{
779
,
1490
},
{
798
,
1510
},
{
843
,
1556
},
{
847
,
1560
},
{
851
,
1564
},
{
863
,
1575
},
{
907
,
1620
},
{
909
,
1622
},
{
913
,
1626
},
{
1154
,
1866
},
{
1156
,
1868
},
{
1158
,
1870
},
{
1207
,
1918
},
{
1238
,
1948
},
{
1252
,
1961
},
{
1260
,
1968
},
{
1264
,
1971
},
{
1268
,
1974
},
{
1271
,
1975
},
{
1273
,
1977
},
{
1283
,
1982
},
{
1286
,
1983
},
{
1289
,
1984
},
{
1294
,
1985
},
{
1300
,
1986
},
{
1310
,
1986
},
{
1316
,
1985
},
{
1320
,
1984
},
{
1323
,
1983
},
{
1326
,
1982
},
{
1338
,
1976
},
{
1341
,
1974
},
{
1344
,
1972
},
{
1349
,
1968
},
{
1358
,
1960
},
{
1406
,
1911
},
{
1421
,
1897
},
{
1624
,
1693
},
{
1788
,
1528
},
{
1790
,
1526
},
{
1792
,
1524
},
{
1794
,
1522
},
{
1796
,
1520
},
{
1798
,
1518
},
{
1800
,
1516
},
{
1919
,
1396
},
{
1921
,
1394
},
{
2038
,
1275
},
{
2047
,
1267
},
{
2048
,
1265
},
{
2145
,
1168
},
{
2148
,
1165
},
{
2260
,
1052
},
{
2359
,
952
},
{
2434
,
876
},
{
2446
,
863
},
{
2450
,
858
},
{
2453
,
854
},
{
2455
,
851
},
{
2457
,
846
},
{
2459
,
844
},
{
2460
,
842
},
{
2460
,
840
},
{
2462
,
837
},
{
2463
,
834
},
{
2464
,
830
},
{
2465
,
825
},
{
2465
,
809
},
{
2464
,
804
},
{
2463
,
800
},
{
2462
,
797
},
{
2461
,
794
},
{
2456
,
784
},
{
2454
,
781
},
{
2452
,
778
},
{
2450
,
775
},
{
2446
,
770
},
{
2437
,
760
},
{
2412
,
734
},
{
2410
,
732
},
{
2408
,
730
},
{
2382
,
704
},
{
2380
,
702
},
{
2378
,
700
},
{
2376
,
698
},
{
2372
,
694
},
{
2370
,
692
},
{
2368
,
690
},
{
2366
,
688
},
{
2362
,
684
},
{
2360
,
682
},
{
2252
,
576
},
{
2250
,
573
},
{
2168
,
492
},
{
2166
,
490
},
{
2085
,
410
},
{
2026
,
352
},
{
1988
,
315
},
{
1968
,
296
},
{
1958
,
287
},
{
1953
,
283
},
{
1949
,
280
},
{
1946
,
278
},
{
1943
,
276
},
{
1940
,
274
},
{
1936
,
272
},
{
1934
,
272
},
{
1931
,
270
},
{
1928
,
269
},
{
1925
,
268
},
{
1921
,
267
},
{
1915
,
266
}
};
Mat
contour
(
N
,
1
,
CV_32FC2
,
(
void
*
)
pts_
);
RotatedRect
rr
=
cv
::
minAreaRect
(
contour
);
EXPECT_TRUE
(
checkMinAreaRect
(
rr
,
contour
))
<<
rr
.
center
<<
" "
<<
rr
.
size
<<
" "
<<
rr
.
angle
;
}
}}
// namespace
/* End of file. */
modules/python/test/test_legacy.py
浏览文件 @
08b6abd7
...
...
@@ -76,7 +76,7 @@ class Hackathon244Tests(NewOpenCVTests):
mc
,
mr
=
cv
.
minEnclosingCircle
(
a
)
be0
=
((
150.2511749267578
,
150.77322387695312
),
(
158.024658203125
,
197.57696533203125
),
37.57804489135742
)
br0
=
((
161.2974090576172
,
154.41793823242188
),
(
199.2301483154297
,
207.7177734375
),
-
9.164555549621582
)
br0
=
((
161.2974090576172
,
154.41793823242188
),
(
207.7177734375
,
199.2301483154297
),
80.83544921875
)
mc0
,
mr0
=
(
160.41790771484375
,
144.55152893066406
),
136.713500977
self
.
check_close_boxes
(
be
,
be0
,
5
,
15
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录