Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv
提交
f77fdc0c
O
opencv
项目概览
OpenCV
/
opencv
上一次同步 10 个月
通知
995
Star
71100
Fork
55580
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f77fdc0c
编写于
10月 19, 2021
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
samples: fix build without threading support
上级
bd0732b1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
6 deletion
+11
-6
samples/CMakeLists.txt
samples/CMakeLists.txt
+1
-0
samples/dnn/object_detection.cpp
samples/dnn/object_detection.cpp
+10
-6
未找到文件。
samples/CMakeLists.txt
浏览文件 @
f77fdc0c
...
...
@@ -114,6 +114,7 @@ else()
find_package
(
Threads
)
endif
()
if
((
TARGET Threads::Threads OR HAVE_THREADS
)
AND NOT OPENCV_EXAMPLES_DISABLE_THREADS
)
set
(
HAVE_THREADS 1
)
add_definitions
(
-DHAVE_THREADS=1
)
endif
()
...
...
samples/dnn/object_detection.cpp
浏览文件 @
f77fdc0c
...
...
@@ -5,7 +5,11 @@
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#ifdef CV_CXX11
#if defined(CV_CXX11) && defined(HAVE_THREADS)
#define USE_THREADS 1
#endif
#ifdef USE_THREADS
#include <mutex>
#include <thread>
#include <queue>
...
...
@@ -51,7 +55,7 @@ void drawPred(int classId, float conf, int left, int top, int right, int bottom,
void
callback
(
int
pos
,
void
*
userdata
);
#ifdef
CV_CXX11
#ifdef
USE_THREADS
template
<
typename
T
>
class
QueueFPS
:
public
std
::
queue
<
T
>
{
...
...
@@ -101,7 +105,7 @@ private:
TickMeter
tm
;
std
::
mutex
mutex
;
};
#endif //
CV_CXX11
#endif //
USE_THREADS
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -166,7 +170,7 @@ int main(int argc, char** argv)
else
cap
.
open
(
parser
.
get
<
int
>
(
"device"
));
#ifdef
CV_CXX11
#ifdef
USE_THREADS
bool
process
=
true
;
// Frames capturing thread
...
...
@@ -266,7 +270,7 @@ int main(int argc, char** argv)
framesThread
.
join
();
processingThread
.
join
();
#else //
CV_CXX11
#else //
USE_THREADS
if
(
async
)
CV_Error
(
Error
::
StsNotImplemented
,
"Asynchronous forward is supported only with Inference Engine backend."
);
...
...
@@ -297,7 +301,7 @@ int main(int argc, char** argv)
imshow
(
kWinName
,
frame
);
}
#endif //
CV_CXX11
#endif //
USE_THREADS
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录