Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
e810f305
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
e810f305
编写于
9月 14, 2014
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3206 from stonier:parallel_qt
上级
46718cae
d3ad2692
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
55 addition
and
50 deletion
+55
-50
modules/highgui/src/window_QT.cpp
modules/highgui/src/window_QT.cpp
+55
-50
未找到文件。
modules/highgui/src/window_QT.cpp
浏览文件 @
e810f305
...
...
@@ -76,6 +76,17 @@ static const unsigned int threshold_zoom_img_region = 30;
static
CvWinProperties
*
global_control_panel
=
NULL
;
//end static and global
// Declaration
Qt
::
ConnectionType
autoBlockingConnection
();
// Implementation - this allows us to do blocking whilst automatically selecting the right
// behaviour for in-thread and out-of-thread launches of cv windows. Qt strangely doesn't
// cater for this, but does for strictly queued connections.
Qt
::
ConnectionType
autoBlockingConnection
()
{
return
(
QThread
::
currentThread
()
!=
QApplication
::
instance
()
->
thread
())
?
Qt
::
BlockingQueuedConnection
:
Qt
::
DirectConnection
;
}
CV_IMPL
CvFont
cvFontQt
(
const
char
*
nameFont
,
int
pointSize
,
CvScalar
color
,
int
weight
,
int
style
,
int
spacing
)
{
...
...
@@ -104,7 +115,7 @@ CV_IMPL void cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont*
QMetaObject
::
invokeMethod
(
guiMainThread
,
"putText"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
void
*
,
(
void
*
)
img
),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
QPoint
,
QPoint
(
org
.
x
,
org
.
y
)),
...
...
@@ -120,8 +131,7 @@ double cvGetRatioWindow_QT(const char* name)
double
result
=
-
1
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
"getRatioWindow"
,
//Qt::DirectConnection,
Qt
::
AutoConnection
,
autoBlockingConnection
(),
Q_RETURN_ARG
(
double
,
result
),
Q_ARG
(
QString
,
QString
(
name
)));
...
...
@@ -137,7 +147,7 @@ void cvSetRatioWindow_QT(const char* name,double prop_value)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"setRatioWindow"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
double
,
prop_value
));
}
...
...
@@ -151,8 +161,7 @@ double cvGetPropWindow_QT(const char* name)
double
result
=
-
1
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
"getPropWindow"
,
//Qt::DirectConnection,
Qt
::
AutoConnection
,
autoBlockingConnection
(),
Q_RETURN_ARG
(
double
,
result
),
Q_ARG
(
QString
,
QString
(
name
)));
...
...
@@ -167,7 +176,7 @@ void cvSetPropWindow_QT(const char* name,double prop_value)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"setPropWindow"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
double
,
prop_value
));
}
...
...
@@ -180,7 +189,7 @@ void cvSetModeWindow_QT(const char* name, double prop_value)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"toggleFullScreen"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
double
,
prop_value
));
}
...
...
@@ -195,7 +204,7 @@ double cvGetModeWindow_QT(const char* name)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"isFullScreen"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_RETURN_ARG
(
double
,
result
),
Q_ARG
(
QString
,
QString
(
name
)));
...
...
@@ -210,8 +219,7 @@ CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"displayInfo"
,
Qt
::
AutoConnection
,
//Qt::DirectConnection,
autoBlockingConnection
(),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
int
,
delayms
));
...
...
@@ -225,7 +233,7 @@ CV_IMPL void cvSaveWindowParameters(const char* name)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"saveWindowParameters"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
name
)));
}
...
...
@@ -237,7 +245,7 @@ CV_IMPL void cvLoadWindowParameters(const char* name)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"loadWindowParameters"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
name
)));
}
...
...
@@ -249,8 +257,7 @@ CV_IMPL void cvDisplayStatusBar(const char* name, const char* text, int delayms)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"displayStatusBar"
,
Qt
::
AutoConnection
,
//Qt::DirectConnection,
autoBlockingConnection
(),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
int
,
delayms
));
...
...
@@ -328,7 +335,6 @@ CV_IMPL int cvWaitKey(int delay)
guiMainThread
->
bTimeOut
=
false
;
}
return
result
;
}
...
...
@@ -400,7 +406,6 @@ static CvBar* icvFindBarByName(QBoxLayout* layout, QString name_bar, typeBar typ
static
CvTrackbar
*
icvFindTrackBarByName
(
const
char
*
name_trackbar
,
const
char
*
name_window
,
QBoxLayout
*
layout
=
NULL
)
{
QString
nameQt
(
name_trackbar
);
if
((
!
name_window
||
!
name_window
[
0
])
&&
global_control_panel
)
//window name is null and we have a control panel
layout
=
global_control_panel
->
myLayout
;
...
...
@@ -470,17 +475,18 @@ CV_IMPL int cvNamedWindow(const char* name, int flags)
{
if
(
!
guiMainThread
)
guiMainThread
=
new
GuiReceiver
;
if
(
multiThreads
)
if
(
QThread
::
currentThread
()
!=
QApplication
::
instance
()
->
thread
())
{
multiThreads
=
true
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
"createWindow"
,
Qt
::
BlockingQueuedConnection
,
Qt
::
BlockingQueuedConnection
,
// block so that we can do useful stuff once we confirm it is created
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
int
,
flags
));
else
}
else
{
guiMainThread
->
createWindow
(
QString
(
name
),
flags
);
}
return
1
;
//Dummy value
return
1
;
//Dummy value
- probably should return the result of the invocation.
}
...
...
@@ -491,8 +497,7 @@ CV_IMPL void cvDestroyWindow(const char* name)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"destroyWindow"
,
//Qt::BlockingQueuedConnection,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
// if another thread is controlling, let it handle it without blocking ourselves here
Q_ARG
(
QString
,
QString
(
name
)));
}
...
...
@@ -501,11 +506,10 @@ CV_IMPL void cvDestroyAllWindows()
{
if
(
!
guiMainThread
)
return
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
"destroyAllWindow"
,
//Qt::BlockingQueuedConnection,
Qt
::
AutoConnection
);
Qt
::
AutoConnection
// if another thread is controlling, let it handle it without blocking ourselves here
);
}
...
...
@@ -531,26 +535,21 @@ CV_IMPL void cvMoveWindow(const char* name, int x, int y)
{
if
(
!
guiMainThread
)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
"moveWindow"
,
//Qt::BlockingQueuedConnection,
Qt
::
AutoConnection
,
autoBlockingConnection
(),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
int
,
x
),
Q_ARG
(
int
,
y
));
}
CV_IMPL
void
cvResizeWindow
(
const
char
*
name
,
int
width
,
int
height
)
{
if
(
!
guiMainThread
)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
"resizeWindow"
,
//Qt::BlockingQueuedConnection,
Qt
::
AutoConnection
,
autoBlockingConnection
(),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
int
,
width
),
Q_ARG
(
int
,
height
));
...
...
@@ -564,7 +563,7 @@ CV_IMPL int cvCreateTrackbar2(const char* name_bar, const char* window_name, int
QMetaObject
::
invokeMethod
(
guiMainThread
,
"addSlider2"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
name_bar
)),
Q_ARG
(
QString
,
QString
(
window_name
)),
Q_ARG
(
void
*
,
(
void
*
)
val
),
...
...
@@ -589,7 +588,7 @@ CV_IMPL int cvCreateTrackbar(const char* name_bar, const char* window_name, int*
QMetaObject
::
invokeMethod
(
guiMainThread
,
"addSlider"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
name_bar
)),
Q_ARG
(
QString
,
QString
(
window_name
)),
Q_ARG
(
void
*
,
(
void
*
)
value
),
...
...
@@ -610,7 +609,7 @@ CV_IMPL int cvCreateButton(const char* button_name, CvButtonCallback on_change,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"addButton"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
button_name
)),
Q_ARG
(
int
,
button_type
),
Q_ARG
(
int
,
initial_button_state
),
...
...
@@ -660,13 +659,17 @@ CV_IMPL void cvShowImage(const char* name, const CvArr* arr)
{
if
(
!
guiMainThread
)
guiMainThread
=
new
GuiReceiver
;
if
(
QThread
::
currentThread
()
!=
QApplication
::
instance
()
->
thread
())
{
multiThreads
=
true
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
"showImage"
,
//Qt::BlockingQueuedConnection,
Qt
::
DirectConnection
,
autoBlockingConnection
(),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
void
*
,
(
void
*
)
arr
));
Q_ARG
(
void
*
,
(
void
*
)
arr
)
);
}
else
{
guiMainThread
->
showImage
(
QString
(
name
),
(
void
*
)
arr
);
}
}
...
...
@@ -679,7 +682,7 @@ CV_IMPL void cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallba
QMetaObject
::
invokeMethod
(
guiMainThread
,
"setOpenGlDrawCallback"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
window_name
)),
Q_ARG
(
void
*
,
(
void
*
)
callback
),
Q_ARG
(
void
*
,
userdata
));
...
...
@@ -693,7 +696,7 @@ CV_IMPL void cvSetOpenGlContext(const char* window_name)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"setOpenGlContext"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
window_name
)));
}
...
...
@@ -705,7 +708,7 @@ CV_IMPL void cvUpdateWindow(const char* window_name)
QMetaObject
::
invokeMethod
(
guiMainThread
,
"updateWindow"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_ARG
(
QString
,
QString
(
window_name
)));
}
...
...
@@ -720,7 +723,7 @@ double cvGetOpenGlProp_QT(const char* name)
{
QMetaObject
::
invokeMethod
(
guiMainThread
,
"isOpenGl"
,
Qt
::
AutoConnection
,
autoBlockingConnection
()
,
Q_RETURN_ARG
(
double
,
result
),
Q_ARG
(
QString
,
QString
(
name
)));
}
...
...
@@ -741,6 +744,9 @@ GuiReceiver::GuiReceiver() : bTimeOut(false), nb_windows(0)
timer
=
new
QTimer
(
this
);
QObject
::
connect
(
timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
timeOut
()));
timer
->
setSingleShot
(
true
);
if
(
doesExternalQAppExist
)
{
moveToThread
(
QApplication
::
instance
()
->
thread
());
}
}
...
...
@@ -964,6 +970,7 @@ void GuiReceiver::showImage(QString name, void* arr)
void
GuiReceiver
::
destroyWindow
(
QString
name
)
{
QPointer
<
CvWindow
>
w
=
icvFindWindowByName
(
name
);
if
(
w
)
...
...
@@ -1525,7 +1532,6 @@ CvWinProperties::~CvWinProperties()
CvWindow
::
CvWindow
(
QString
name
,
int
arg2
)
{
type
=
type_CvWindow
;
moveToThread
(
qApp
->
instance
()
->
thread
());
param_flags
=
arg2
&
0x0000000F
;
param_gui_mode
=
arg2
&
0x000000F0
;
...
...
@@ -2365,7 +2371,6 @@ void DefaultViewPort::updateImage(const CvArr* arr)
//use to compute mouse coordinate, I need to update the ratio here and in resizeEvent
ratioX
=
width
()
/
float
(
image2Draw_mat
->
cols
);
ratioY
=
height
()
/
float
(
image2Draw_mat
->
rows
);
updateGeometry
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录