Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
38f7cd71
O
Opencv
项目概览
Greenplum
/
Opencv
9 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
38f7cd71
编写于
12月 27, 2022
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
上级
f637629c
eab7faf5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
34 deletion
+56
-34
modules/calib3d/misc/java/test/Calib3dTest.java
modules/calib3d/misc/java/test/Calib3dTest.java
+4
-4
modules/calib3d/src/fisheye.cpp
modules/calib3d/src/fisheye.cpp
+2
-2
modules/calib3d/test/test_fisheye.cpp
modules/calib3d/test/test_fisheye.cpp
+50
-28
未找到文件。
modules/calib3d/misc/java/test/Calib3dTest.java
浏览文件 @
38f7cd71
...
...
@@ -835,10 +835,10 @@ public class Calib3dTest extends OpenCVTestCase {
D
.
put
(
2
,
0
,-
0.021509225493198905
);
D
.
put
(
3
,
0
,
0.0043378096628297145
);
K_new_truth
.
put
(
0
,
0
,
387.
4809086880343
);
K_new_truth
.
put
(
0
,
2
,
103
6.669802754649
);
K_new_truth
.
put
(
1
,
1
,
373.6
375700303157
);
K_new_truth
.
put
(
1
,
2
,
538.
8373261247601
);
K_new_truth
.
put
(
0
,
0
,
387.
5118215642316
);
K_new_truth
.
put
(
0
,
2
,
103
3.936556777084
);
K_new_truth
.
put
(
1
,
1
,
373.6
673784974842
);
K_new_truth
.
put
(
1
,
2
,
538.
794152656429
);
Calib3d
.
fisheye_estimateNewCameraMatrixForUndistortRectify
(
K
,
D
,
new
Size
(
1920
,
1080
),
new
Mat
().
eye
(
3
,
3
,
CvType
.
CV_64F
),
K_new
,
0.0
,
new
Size
(
1920
,
1080
));
...
...
modules/calib3d/src/fisheye.cpp
浏览文件 @
38f7cd71
...
...
@@ -403,7 +403,7 @@ void cv::fisheye::undistortPoints( InputArray distorted, OutputArray undistorted
if
(
!
isEps
||
fabs
(
theta_d
)
>
criteria
.
epsilon
)
{
// compensate distortion iteratively
// compensate distortion iteratively
using Newton method
for
(
int
j
=
0
;
j
<
maxCount
;
j
++
)
{
...
...
@@ -611,7 +611,7 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input
:
K
.
getMat
().
at
<
double
>
(
0
,
0
)
/
K
.
getMat
().
at
<
double
>
(
1
,
1
);
// convert to identity ratio
cn
[
0
]
*=
aspect_ratio
;
cn
[
1
]
*=
aspect_ratio
;
for
(
size_t
i
=
0
;
i
<
points
.
total
();
++
i
)
pptr
[
i
][
1
]
*=
aspect_ratio
;
...
...
modules/calib3d/test/test_fisheye.cpp
浏览文件 @
38f7cd71
...
...
@@ -152,6 +152,15 @@ TEST_F(fisheyeTest, distortUndistortPoints)
TEST_F
(
fisheyeTest
,
undistortImage
)
{
// we use it to reduce patch size for images in testdata
auto
throwAwayHalf
=
[](
Mat
img
)
{
int
whalf
=
img
.
cols
/
2
,
hhalf
=
img
.
rows
/
2
;
Rect
tl
(
0
,
0
,
whalf
,
hhalf
),
br
(
whalf
,
hhalf
,
whalf
,
hhalf
);
img
(
tl
)
=
0
;
img
(
br
)
=
0
;
};
cv
::
Matx33d
theK
=
this
->
K
;
cv
::
Mat
theD
=
cv
::
Mat
(
this
->
D
);
std
::
string
file
=
combine
(
datasets_repository_path
,
"/calib-3_stereo_from_JY/left/stereo_pair_014.jpg"
);
...
...
@@ -161,32 +170,41 @@ TEST_F(fisheyeTest, undistortImage)
newK
(
0
,
0
)
=
100
;
newK
(
1
,
1
)
=
100
;
cv
::
fisheye
::
undistortImage
(
distorted
,
undistorted
,
theK
,
theD
,
newK
);
cv
::
Mat
correct
=
cv
::
imread
(
combine
(
datasets_repository_path
,
"new_f_100.png"
));
if
(
correct
.
empty
())
CV_Assert
(
cv
::
imwrite
(
combine
(
datasets_repository_path
,
"new_f_100.png"
),
undistorted
));
else
EXPECT_MAT_NEAR
(
correct
,
undistorted
,
1e-10
);
std
::
string
imageFilename
=
combine
(
datasets_repository_path
,
"new_f_100.png"
);
cv
::
Mat
correct
=
cv
::
imread
(
imageFilename
);
ASSERT_FALSE
(
correct
.
empty
())
<<
"Correct image "
<<
imageFilename
.
c_str
()
<<
" can not be read"
<<
std
::
endl
;
throwAwayHalf
(
correct
);
throwAwayHalf
(
undistorted
);
EXPECT_MAT_NEAR
(
correct
,
undistorted
,
1e-10
);
}
{
double
balance
=
1.0
;
cv
::
fisheye
::
estimateNewCameraMatrixForUndistortRectify
(
theK
,
theD
,
distorted
.
size
(),
cv
::
noArray
(),
newK
,
balance
);
cv
::
fisheye
::
undistortImage
(
distorted
,
undistorted
,
theK
,
theD
,
newK
);
cv
::
Mat
correct
=
cv
::
imread
(
combine
(
datasets_repository_path
,
"balance_1.0.png"
));
if
(
correct
.
empty
())
CV_Assert
(
cv
::
imwrite
(
combine
(
datasets_repository_path
,
"balance_1.0.png"
),
undistorted
));
else
EXPECT_MAT_NEAR
(
correct
,
undistorted
,
1e-10
);
std
::
string
imageFilename
=
combine
(
datasets_repository_path
,
"balance_1.0.png"
);
cv
::
Mat
correct
=
cv
::
imread
(
imageFilename
);
ASSERT_FALSE
(
correct
.
empty
())
<<
"Correct image "
<<
imageFilename
.
c_str
()
<<
" can not be read"
<<
std
::
endl
;
throwAwayHalf
(
correct
);
throwAwayHalf
(
undistorted
);
EXPECT_MAT_NEAR
(
correct
,
undistorted
,
1e-10
);
}
{
double
balance
=
0.0
;
cv
::
fisheye
::
estimateNewCameraMatrixForUndistortRectify
(
theK
,
theD
,
distorted
.
size
(),
cv
::
noArray
(),
newK
,
balance
);
cv
::
fisheye
::
undistortImage
(
distorted
,
undistorted
,
theK
,
theD
,
newK
);
cv
::
Mat
correct
=
cv
::
imread
(
combine
(
datasets_repository_path
,
"balance_0.0.png"
));
if
(
correct
.
empty
())
CV_Assert
(
cv
::
imwrite
(
combine
(
datasets_repository_path
,
"balance_0.0.png"
),
undistorted
));
else
EXPECT_MAT_NEAR
(
correct
,
undistorted
,
1e-10
);
std
::
string
imageFilename
=
combine
(
datasets_repository_path
,
"balance_0.0.png"
);
cv
::
Mat
correct
=
cv
::
imread
(
imageFilename
);
ASSERT_FALSE
(
correct
.
empty
())
<<
"Correct image "
<<
imageFilename
.
c_str
()
<<
" can not be read"
<<
std
::
endl
;
throwAwayHalf
(
correct
);
throwAwayHalf
(
undistorted
);
EXPECT_MAT_NEAR
(
correct
,
undistorted
,
1e-10
);
}
}
...
...
@@ -288,7 +306,9 @@ TEST_F(fisheyeTest, undistortAndDistortImage)
EXPECT_MAT_NEAR
(
dist_point_4
,
dist_point_4_gt
,
1e-2
);
EXPECT_MAT_NEAR
(
dist_point_5
,
dist_point_5_gt
,
1e-2
);
CV_Assert
(
cv
::
imwrite
(
combine
(
datasets_repository_path
,
"new_distortion.png"
),
image_projected
));
// Add the "--test_debug" to arguments for file output
if
(
cvtest
::
debugLevel
>
0
)
cv
::
imwrite
(
combine
(
datasets_repository_path
,
"new_distortion.png"
),
image_projected
);
}
TEST_F
(
fisheyeTest
,
jacobians
)
...
...
@@ -619,19 +639,19 @@ TEST_F(fisheyeTest, stereoRectify)
0.002076471801477729
,
0.006463478587068991
,
0.9999769555891836
);
cv
::
Matx34d
P1_ref
(
420.
8551870450913
,
0
,
586.501617798451
,
0
,
0
,
420.
8551870450913
,
374.7667511986098
,
0
,
420.
9684016542647
,
0
,
586.3059567784627
,
0
,
0
,
420.
9684016542647
,
374.8571836462291
,
0
,
0
,
0
,
1
,
0
);
cv
::
Matx34d
P2_ref
(
420.
8551870450913
,
0
,
586.501617798451
,
-
41.77758076597302
,
0
,
420.
8551870450913
,
374.7667511986098
,
0
,
420.
9684016542647
,
0
,
586.3059567784627
,
-
41.78881938824554
,
0
,
420.
9684016542647
,
374.8571836462291
,
0
,
0
,
0
,
1
,
0
);
cv
::
Matx44d
Q_ref
(
1
,
0
,
0
,
-
586.
501617798451
,
0
,
1
,
0
,
-
374.
7667511986098
,
0
,
0
,
0
,
420.
8551870450913
,
1
,
0
,
0
,
-
586.
3059567784627
,
0
,
1
,
0
,
-
374.
8571836462291
,
0
,
0
,
0
,
420.
9684016542647
,
0
,
0
,
10.07370889670733
,
-
0
);
...
...
@@ -686,7 +706,9 @@ TEST_F(fisheyeTest, stereoRectify)
cv
::
Mat
rectification
;
merge4
(
l
,
r
,
lundist
,
rundist
,
rectification
);
cv
::
imwrite
(
cv
::
format
(
"fisheye_rectification_AB_%03d.png"
,
i
),
rectification
);
// Add the "--test_debug" to arguments for file output
if
(
cvtest
::
debugLevel
>
0
)
cv
::
imwrite
(
cv
::
format
(
"fisheye_rectification_AB_%03d.png"
,
i
),
rectification
);
}
}
...
...
@@ -987,13 +1009,13 @@ TEST_F(fisheyeTest, estimateNewCameraMatrixForUndistortRectify)
cv
::
Mat
K_new_truth
(
3
,
3
,
cv
::
DataType
<
double
>::
type
);
K_new_truth
.
at
<
double
>
(
0
,
0
)
=
387.
4809086880343
;
K_new_truth
.
at
<
double
>
(
0
,
0
)
=
387.
5118215642316
;
K_new_truth
.
at
<
double
>
(
0
,
1
)
=
0.0
;
K_new_truth
.
at
<
double
>
(
0
,
2
)
=
103
6.669802754649
;
K_new_truth
.
at
<
double
>
(
0
,
2
)
=
103
3.936556777084
;
K_new_truth
.
at
<
double
>
(
1
,
0
)
=
0.0
;
K_new_truth
.
at
<
double
>
(
1
,
1
)
=
373.6
375700303157
;
K_new_truth
.
at
<
double
>
(
1
,
2
)
=
538.
8373261247601
;
K_new_truth
.
at
<
double
>
(
1
,
1
)
=
373.6
673784974842
;
K_new_truth
.
at
<
double
>
(
1
,
2
)
=
538.
794152656429
;
K_new_truth
.
at
<
double
>
(
2
,
0
)
=
0.0
;
K_new_truth
.
at
<
double
>
(
2
,
1
)
=
0.0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录