Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Eric.Lee2021
Azure_Kinect_Lab
提交
17317824
A
Azure_Kinect_Lab
项目概览
Eric.Lee2021
/
Azure_Kinect_Lab
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Azure_Kinect_Lab
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
17317824
编写于
8月 17, 2021
作者:
E
Eric.L
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
61dca37c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
2 deletion
+49
-2
Azure_Kinect_Lab/src/main.cpp
Azure_Kinect_Lab/src/main.cpp
+49
-2
未找到文件。
Azure_Kinect_Lab/src/main.cpp
浏览文件 @
17317824
...
...
@@ -199,7 +199,6 @@ static bool point_cloud_color_to_depth(k4a_transformation_t transformation_handl
float
z
=
depth
.
at
<
unsigned
short
>
(
row
,
col
);
if
(
z
>
0
)
{
v
.
z
=
(
float
)(
z
)
/
1000
;
// 转换为单位米
v
.
x
=
(
col
-
cx_d
)
*
v
.
z
/
fx_d
;
v
.
y
=
(
row
-
cy_d
)
*
v
.
z
/
fy_d
;
...
...
@@ -260,6 +259,8 @@ static bool point_cloud_color_to_depth(k4a_transformation_t transformation_handl
depth2color
.
at
<
float
>
(
2
,
1
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
7
];
depth2color
.
at
<
float
>
(
2
,
2
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
8
];
depth2color
.
at
<
float
>
(
2
,
3
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
translation
[
2
]
/
1000
;
//
for
(
it
=
pts_3d
.
begin
();
it
!=
pts_3d
.
end
();
it
++
)
{
...
...
@@ -421,7 +422,46 @@ int main()
fprintf
(
fpWrite
,
"%f,%f,%f,%f,%f,%f,%f,%f,%f
\n
"
,
fx_d
,
fy_d
,
cx_d
,
cy_d
,
k1
,
k2
,
k3
,
p1
,
p2
);
fprintf
(
fpWrite
,
"%f,%f,%f,%f,%f,%f,%f,%f,%f
\n
"
,
fx_c
,
fy_c
,
cx_c
,
cy_c
,
k1c
,
k2c
,
k3c
,
p1c
,
p2c
);
fclose
(
fpWrite
);
//----------------------- 记录外参
cv
::
Mat
depth2color
(
3
,
4
,
CV_32FC1
);
depth2color
.
at
<
float
>
(
0
,
0
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
0
];
depth2color
.
at
<
float
>
(
0
,
1
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
1
];
depth2color
.
at
<
float
>
(
0
,
2
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
2
];
depth2color
.
at
<
float
>
(
0
,
3
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
translation
[
0
]
/
1000
;
//depth2color(0, 3) = calib.color_camera_calibration.extrinsics.translation[0];
depth2color
.
at
<
float
>
(
1
,
0
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
3
];
depth2color
.
at
<
float
>
(
1
,
1
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
4
];
depth2color
.
at
<
float
>
(
1
,
2
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
5
];
depth2color
.
at
<
float
>
(
1
,
3
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
translation
[
1
]
/
1000
;
//depth2color(1, 3) = calib.color_camera_calibration.extrinsics.translation[1];
depth2color
.
at
<
float
>
(
2
,
0
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
6
];
depth2color
.
at
<
float
>
(
2
,
1
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
7
];
depth2color
.
at
<
float
>
(
2
,
2
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
rotation
[
8
];
depth2color
.
at
<
float
>
(
2
,
3
)
=
calibration
.
color_camera_calibration
.
extrinsics
.
translation
[
2
]
/
1000
;
FILE
*
fpWriteRT
=
fopen
(
"E:/git_quick/azure_kinect_lab/Azure_Kinect_Lab/Depth2RGB_RT.txt"
,
"w+"
);
if
(
fpWrite
==
NULL
)
{
return
0
;
}
// 记录 相机标定参数
fprintf
(
fpWriteRT
,
"%f,%f,%f,%f
\n
"
,
depth2color
.
at
<
float
>
(
0
,
0
),
depth2color
.
at
<
float
>
(
0
,
1
),
depth2color
.
at
<
float
>
(
0
,
2
),
depth2color
.
at
<
float
>
(
0
,
3
));
fprintf
(
fpWriteRT
,
"%f,%f,%f,%f
\n
"
,
depth2color
.
at
<
float
>
(
1
,
0
),
depth2color
.
at
<
float
>
(
1
,
1
),
depth2color
.
at
<
float
>
(
1
,
2
),
depth2color
.
at
<
float
>
(
1
,
3
));
fprintf
(
fpWriteRT
,
"%f,%f,%f,%f
\n
"
,
depth2color
.
at
<
float
>
(
2
,
0
),
depth2color
.
at
<
float
>
(
2
,
1
),
depth2color
.
at
<
float
>
(
2
,
2
),
depth2color
.
at
<
float
>
(
2
,
3
));
fclose
(
fpWriteRT
);
// ----------------------
// Camera capture and application specific code would go here
while
(
true
)
{
...
...
@@ -502,6 +542,9 @@ int main()
namedWindow
(
"color_show"
,
0
);
imshow
(
"color_show"
,
color_show
);
sprintf
(
buf
,
"E:/git_quick/azure_kinect_lab/Azure_Kinect_Lab/datasets/%06d-color.jpg"
,
img_id
);
imwrite
(
buf
,
color_show
);
_resolution_y
=
k4a_image_get_height_pixels
(
ir_image
);
_resolution_x
=
k4a_image_get_width_pixels
(
ir_image
);
cv
::
Mat
ir_show
(
_resolution_y
,
_resolution_x
,
CV_16UC1
);
...
...
@@ -513,6 +556,10 @@ int main()
namedWindow
(
"ir_show"
,
0
);
imshow
(
"ir_show"
,
ir_show_8u
);
sprintf
(
buf
,
"E:/git_quick/azure_kinect_lab/Azure_Kinect_Lab/datasets/%06d-ir.jpg"
,
img_id
);
imwrite
(
buf
,
ir_show_8u
);
int
ir_thr
=
25
;
// 用作三维点云分割辅助使用 ir 阈值
if
(
waitKey
(
10
)
==
27
){
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录