Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
aa997199
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
285
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
aa997199
编写于
3月 26, 2020
作者:
S
sjtubinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs
上级
41606c13
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
7 deletion
+10
-7
contrib/RealTimeHumanSeg/humanseg.cc
contrib/RealTimeHumanSeg/humanseg.cc
+2
-2
contrib/RealTimeHumanSeg/humanseg_postprocess.cc
contrib/RealTimeHumanSeg/humanseg_postprocess.cc
+1
-1
contrib/RealTimeHumanSeg/humanseg_postprocess.h
contrib/RealTimeHumanSeg/humanseg_postprocess.h
+1
-1
contrib/RealTimeHumanSeg/main.cc
contrib/RealTimeHumanSeg/main.cc
+6
-3
未找到文件。
contrib/RealTimeHumanSeg/humanseg.cc
浏览文件 @
aa997199
...
@@ -87,8 +87,8 @@ cv::Mat HumanSeg::Postprocess(const cv::Mat& im) {
...
@@ -87,8 +87,8 @@ cv::Mat HumanSeg::Postprocess(const cv::Mat& im) {
im_scoremap
.
convertTo
(
im_scoremap
,
CV_32FC1
,
1
/
255.0
);
im_scoremap
.
convertTo
(
im_scoremap
,
CV_32FC1
,
1
/
255.0
);
float
*
pblob
=
reinterpret_cast
<
float
*>
(
im_scoremap
.
data
);
float
*
pblob
=
reinterpret_cast
<
float
*>
(
im_scoremap
.
data
);
int
out_buff_
len
=
im
.
cols
*
im
.
rows
*
sizeof
(
uchar
);
int
out_buff_
capacity
=
10
*
im
.
cols
*
im
.
rows
*
sizeof
(
float
);
segout_data_
.
resize
(
out_buff_
len
);
segout_data_
.
resize
(
out_buff_
capacity
);
unsigned
char
*
seg_result
=
segout_data_
.
data
();
unsigned
char
*
seg_result
=
segout_data_
.
data
();
MergeProcess
(
im
.
data
,
pblob
,
im
.
rows
,
im
.
cols
,
seg_result
);
MergeProcess
(
im
.
data
,
pblob
,
im
.
rows
,
im
.
cols
,
seg_result
);
cv
::
Mat
seg_mat
(
im
.
rows
,
im
.
cols
,
CV_8UC1
,
seg_result
);
cv
::
Mat
seg_mat
(
im
.
rows
,
im
.
cols
,
CV_8UC1
,
seg_result
);
...
...
contrib/RealTimeHumanSeg/humanseg_postprocess.cc
浏览文件 @
aa997199
...
@@ -254,7 +254,7 @@ cv::Mat MergeSegMat(const cv::Mat& seg_mat,
...
@@ -254,7 +254,7 @@ cv::Mat MergeSegMat(const cv::Mat& seg_mat,
int
ThresholdMask
(
const
cv
::
Mat
&
fg_cfd
,
int
ThresholdMask
(
const
cv
::
Mat
&
fg_cfd
,
const
float
fg_thres
,
const
float
fg_thres
,
const
float
bg_thres
,
const
float
bg_thres
,
cv
::
Mat
fg_mask
)
{
cv
::
Mat
&
fg_mask
)
{
if
(
fg_cfd
.
type
()
!=
CV_32FC1
)
{
if
(
fg_cfd
.
type
()
!=
CV_32FC1
)
{
printf
(
"ThresholdMask: type is not CV_32FC1.
\n
"
);
printf
(
"ThresholdMask: type is not CV_32FC1.
\n
"
);
return
-
1
;
return
-
1
;
...
...
contrib/RealTimeHumanSeg/humanseg_postprocess.h
浏览文件 @
aa997199
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
int
ThresholdMask
(
const
cv
::
Mat
&
fg_cfd
,
int
ThresholdMask
(
const
cv
::
Mat
&
fg_cfd
,
const
float
fg_thres
,
const
float
fg_thres
,
const
float
bg_thres
,
const
float
bg_thres
,
cv
::
Mat
fg_mask
);
cv
::
Mat
&
fg_mask
);
cv
::
Mat
MergeSegMat
(
const
cv
::
Mat
&
seg_mat
,
cv
::
Mat
MergeSegMat
(
const
cv
::
Mat
&
seg_mat
,
const
cv
::
Mat
&
ori_frame
);
const
cv
::
Mat
&
ori_frame
);
...
...
contrib/RealTimeHumanSeg/main.cc
浏览文件 @
aa997199
...
@@ -41,13 +41,16 @@ int VideoPredict(const std::string& video_path, HumanSeg& seg)
...
@@ -41,13 +41,16 @@ int VideoPredict(const std::string& video_path, HumanSeg& seg)
printf
(
"create video writer failed!
\n
"
);
printf
(
"create video writer failed!
\n
"
);
return
-
1
;
return
-
1
;
}
}
cv
::
Mat
frame
;
cv
::
Mat
frame
;
while
(
capture
.
read
(
frame
))
{
while
(
capture
.
read
(
frame
))
{
if
(
frame
.
empty
())
{
break
;
}
cv
::
Mat
out_im
=
seg
.
Predict
(
frame
);
cv
::
Mat
out_im
=
seg
.
Predict
(
frame
);
video_out
.
write
(
out_im
);
video_out
.
write
(
out_im
);
}
}
capture
.
release
();
capture
.
release
();
video_out
.
release
();
return
0
;
return
0
;
}
}
...
@@ -79,10 +82,10 @@ int main(int argc, char* argv[]) {
...
@@ -79,10 +82,10 @@ int main(int argc, char* argv[]) {
// Call ImagePredict while input_path is a image file path
// Call ImagePredict while input_path is a image file path
// The output will be saved as result.jpeg
// The output will be saved as result.jpeg
ImagePredict
(
input_path
,
seg
);
//
ImagePredict(input_path, seg);
// Call VideoPredict while input_path is a video file path
// Call VideoPredict while input_path is a video file path
// The output will be saved as result.avi
// The output will be saved as result.avi
//
VideoPredict(input_path, seg);
VideoPredict
(
input_path
,
seg
);
return
0
;
return
0
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录