Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
7ed5284a
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,发现更多精彩内容 >>
提交
7ed5284a
编写于
11月 19, 2014
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3432 from taka-no-me:wintitle
上级
32348604
f4ba8b13
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
123 addition
and
9 deletion
+123
-9
CMakeLists.txt
CMakeLists.txt
+5
-0
modules/highgui/include/opencv2/highgui.hpp
modules/highgui/include/opencv2/highgui.hpp
+2
-0
modules/highgui/src/window.cpp
modules/highgui/src/window.cpp
+8
-1
modules/highgui/src/window_QT.cpp
modules/highgui/src/window_QT.cpp
+35
-8
modules/highgui/src/window_QT.h
modules/highgui/src/window_QT.h
+1
-0
modules/highgui/src/window_carbon.cpp
modules/highgui/src/window_carbon.cpp
+17
-0
modules/highgui/src/window_cocoa.mm
modules/highgui/src/window_cocoa.mm
+21
-0
modules/highgui/src/window_gtk.cpp
modules/highgui/src/window_gtk.cpp
+17
-0
modules/highgui/src/window_w32.cpp
modules/highgui/src/window_w32.cpp
+17
-0
未找到文件。
CMakeLists.txt
浏览文件 @
7ed5284a
...
@@ -38,6 +38,11 @@ if(POLICY CMP0022)
...
@@ -38,6 +38,11 @@ if(POLICY CMP0022)
cmake_policy
(
SET CMP0022 OLD
)
cmake_policy
(
SET CMP0022 OLD
)
endif
()
endif
()
if
(
POLICY CMP0026
)
# silence cmake 3.0+ warnings about reading LOCATION attribute
cmake_policy
(
SET CMP0026 OLD
)
endif
()
# must go before the project command
# must go before the project command
set
(
CMAKE_CONFIGURATION_TYPES
"Debug;Release"
CACHE STRING
"Configs"
FORCE
)
set
(
CMAKE_CONFIGURATION_TYPES
"Debug;Release"
CACHE STRING
"Configs"
FORCE
)
if
(
DEFINED CMAKE_BUILD_TYPE
)
if
(
DEFINED CMAKE_BUILD_TYPE
)
...
...
modules/highgui/include/opencv2/highgui.hpp
浏览文件 @
7ed5284a
...
@@ -136,6 +136,8 @@ CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
...
@@ -136,6 +136,8 @@ CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
CV_EXPORTS_W
void
setWindowProperty
(
const
String
&
winname
,
int
prop_id
,
double
prop_value
);
CV_EXPORTS_W
void
setWindowProperty
(
const
String
&
winname
,
int
prop_id
,
double
prop_value
);
CV_EXPORTS_W
void
setWindowTitle
(
const
String
&
winname
,
const
String
&
title
);
CV_EXPORTS_W
double
getWindowProperty
(
const
String
&
winname
,
int
prop_id
);
CV_EXPORTS_W
double
getWindowProperty
(
const
String
&
winname
,
int
prop_id
);
//! assigns callback for mouse events
//! assigns callback for mouse events
...
...
modules/highgui/src/window.cpp
浏览文件 @
7ed5284a
...
@@ -379,7 +379,8 @@ CV_IMPL void cvUpdateWindow(const char*)
...
@@ -379,7 +379,8 @@ CV_IMPL void cvUpdateWindow(const char*)
cv
::
QtFont
cv
::
fontQt
(
const
String
&
nameFont
,
int
pointSize
,
Scalar
color
,
int
weight
,
int
style
,
int
/*spacing*/
)
cv
::
QtFont
cv
::
fontQt
(
const
String
&
nameFont
,
int
pointSize
,
Scalar
color
,
int
weight
,
int
style
,
int
/*spacing*/
)
{
{
CvFont
f
=
cvFontQt
(
nameFont
.
c_str
(),
pointSize
,
color
,
weight
,
style
);
CvFont
f
=
cvFontQt
(
nameFont
.
c_str
(),
pointSize
,
color
,
weight
,
style
);
return
*
(
cv
::
QtFont
*
)(
&
f
);
void
*
pf
=
&
f
;
// to suppress strict-aliasing
return
*
(
cv
::
QtFont
*
)
pf
;
}
}
void
cv
::
addText
(
const
Mat
&
img
,
const
String
&
text
,
Point
org
,
const
QtFont
&
font
)
void
cv
::
addText
(
const
Mat
&
img
,
const
String
&
text
,
Point
org
,
const
QtFont
&
font
)
...
@@ -490,6 +491,12 @@ int cv::createButton(const String&, ButtonCallback, void*, int , bool )
...
@@ -490,6 +491,12 @@ int cv::createButton(const String&, ButtonCallback, void*, int , bool )
// version with a more capable one without a need to recompile dependent
// version with a more capable one without a need to recompile dependent
// applications or libraries.
// applications or libraries.
void
cv
::
setWindowTitle
(
const
String
&
,
const
String
&
)
{
CV_Error
(
Error
::
StsNotImplemented
,
"The function is not implemented. "
"Rebuild the library with Windows, GTK+ 2.x or Carbon support. "
"If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script"
);
}
#define CV_NO_GUI_ERROR(funcname) \
#define CV_NO_GUI_ERROR(funcname) \
cvError( CV_StsError, funcname, \
cvError( CV_StsError, funcname, \
...
...
modules/highgui/src/window_QT.cpp
浏览文件 @
7ed5284a
...
@@ -181,6 +181,18 @@ void cvSetPropWindow_QT(const char* name,double prop_value)
...
@@ -181,6 +181,18 @@ void cvSetPropWindow_QT(const char* name,double prop_value)
Q_ARG
(
double
,
prop_value
));
Q_ARG
(
double
,
prop_value
));
}
}
void
cv
::
setWindowTitle
(
const
String
&
winname
,
const
String
&
title
)
{
if
(
!
guiMainThread
)
CV_Error
(
Error
::
StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
"setWindowTitle"
,
autoBlockingConnection
(),
Q_ARG
(
QString
,
QString
(
winname
.
c_str
())),
Q_ARG
(
QString
,
QString
(
title
.
c_str
())));
}
void
cvSetModeWindow_QT
(
const
char
*
name
,
double
prop_value
)
void
cvSetModeWindow_QT
(
const
char
*
name
,
double
prop_value
)
{
{
...
@@ -371,7 +383,7 @@ static CvWindow* icvFindWindowByName(QString name)
...
@@ -371,7 +383,7 @@ static CvWindow* icvFindWindowByName(QString name)
if
(
temp
->
type
==
type_CvWindow
)
if
(
temp
->
type
==
type_CvWindow
)
{
{
CvWindow
*
w
=
(
CvWindow
*
)
temp
;
CvWindow
*
w
=
(
CvWindow
*
)
temp
;
if
(
w
->
windowTitl
e
()
==
name
)
if
(
w
->
objectNam
e
()
==
name
)
{
{
window
=
w
;
window
=
w
;
break
;
break
;
...
@@ -527,7 +539,7 @@ CV_IMPL const char* cvGetWindowName(void* window_handle)
...
@@ -527,7 +539,7 @@ CV_IMPL const char* cvGetWindowName(void* window_handle)
if
(
!
window_handle
)
if
(
!
window_handle
)
CV_Error
(
CV_StsNullPtr
,
"NULL window handler"
);
CV_Error
(
CV_StsNullPtr
,
"NULL window handler"
);
return
((
CvWindow
*
)
window_handle
)
->
windowTitl
e
().
toLatin1
().
data
();
return
((
CvWindow
*
)
window_handle
)
->
objectNam
e
().
toLatin1
().
data
();
}
}
...
@@ -871,6 +883,22 @@ void GuiReceiver::setPropWindow(QString name, double arg2)
...
@@ -871,6 +883,22 @@ void GuiReceiver::setPropWindow(QString name, double arg2)
w
->
setPropWindow
(
flags
);
w
->
setPropWindow
(
flags
);
}
}
void
GuiReceiver
::
setWindowTitle
(
QString
name
,
QString
title
)
{
QPointer
<
CvWindow
>
w
=
icvFindWindowByName
(
name
);
if
(
!
w
)
{
cvNamedWindow
(
name
.
toLatin1
().
data
());
w
=
icvFindWindowByName
(
name
);
}
if
(
!
w
)
return
;
w
->
setWindowTitle
(
title
);
}
double
GuiReceiver
::
isFullScreen
(
QString
name
)
double
GuiReceiver
::
isFullScreen
(
QString
name
)
{
{
...
@@ -1494,7 +1522,7 @@ void CvWinProperties::showEvent(QShowEvent* evnt)
...
@@ -1494,7 +1522,7 @@ void CvWinProperties::showEvent(QShowEvent* evnt)
//no value pos was saved so we let Qt move the window in the middle of its parent (event ignored).
//no value pos was saved so we let Qt move the window in the middle of its parent (event ignored).
//then hide will save the last position and thus, we want to retreive it (event accepted).
//then hide will save the last position and thus, we want to retreive it (event accepted).
QPoint
mypos
(
-
1
,
-
1
);
QPoint
mypos
(
-
1
,
-
1
);
QSettings
settings
(
"OpenCV2"
,
windowTitl
e
());
QSettings
settings
(
"OpenCV2"
,
objectNam
e
());
mypos
=
settings
.
value
(
"pos"
,
mypos
).
toPoint
();
mypos
=
settings
.
value
(
"pos"
,
mypos
).
toPoint
();
if
(
mypos
.
x
()
>=
0
)
if
(
mypos
.
x
()
>=
0
)
...
@@ -1511,7 +1539,7 @@ void CvWinProperties::showEvent(QShowEvent* evnt)
...
@@ -1511,7 +1539,7 @@ void CvWinProperties::showEvent(QShowEvent* evnt)
void
CvWinProperties
::
hideEvent
(
QHideEvent
*
evnt
)
void
CvWinProperties
::
hideEvent
(
QHideEvent
*
evnt
)
{
{
QSettings
settings
(
"OpenCV2"
,
windowTitl
e
());
QSettings
settings
(
"OpenCV2"
,
objectNam
e
());
settings
.
setValue
(
"pos"
,
pos
());
//there is an offset of 6 pixels (so the window's position is wrong -- why ?)
settings
.
setValue
(
"pos"
,
pos
());
//there is an offset of 6 pixels (so the window's position is wrong -- why ?)
evnt
->
accept
();
evnt
->
accept
();
}
}
...
@@ -1520,7 +1548,7 @@ void CvWinProperties::hideEvent(QHideEvent* evnt)
...
@@ -1520,7 +1548,7 @@ void CvWinProperties::hideEvent(QHideEvent* evnt)
CvWinProperties
::~
CvWinProperties
()
CvWinProperties
::~
CvWinProperties
()
{
{
//clear the setting pos
//clear the setting pos
QSettings
settings
(
"OpenCV2"
,
windowTitl
e
());
QSettings
settings
(
"OpenCV2"
,
objectNam
e
());
settings
.
remove
(
"pos"
);
settings
.
remove
(
"pos"
);
}
}
...
@@ -1540,9 +1568,9 @@ CvWindow::CvWindow(QString name, int arg2)
...
@@ -1540,9 +1568,9 @@ CvWindow::CvWindow(QString name, int arg2)
//setAttribute(Qt::WA_DeleteOnClose); //in other case, does not release memory
//setAttribute(Qt::WA_DeleteOnClose); //in other case, does not release memory
setContentsMargins
(
0
,
0
,
0
,
0
);
setContentsMargins
(
0
,
0
,
0
,
0
);
setWindowTitle
(
name
);
setWindowTitle
(
name
);
setObjectName
(
name
);
setObjectName
(
name
);
setFocus
(
Qt
::
PopupFocusReason
);
//#1695 arrow keys are not received without the explicit focus
setFocus
(
Qt
::
PopupFocusReason
);
//#1695 arrow keys are not received without the explicit focus
resize
(
400
,
300
);
resize
(
400
,
300
);
setMinimumSize
(
1
,
1
);
setMinimumSize
(
1
,
1
);
...
@@ -1702,7 +1730,6 @@ void CvWindow::setPropWindow(int flags)
...
@@ -1702,7 +1730,6 @@ void CvWindow::setPropWindow(int flags)
}
}
}
}
void
CvWindow
::
toggleFullScreen
(
int
flags
)
void
CvWindow
::
toggleFullScreen
(
int
flags
)
{
{
if
(
isFullScreen
()
&&
flags
==
CV_WINDOW_NORMAL
)
if
(
isFullScreen
()
&&
flags
==
CV_WINDOW_NORMAL
)
...
...
modules/highgui/src/window_QT.h
浏览文件 @
7ed5284a
...
@@ -132,6 +132,7 @@ public slots:
...
@@ -132,6 +132,7 @@ public slots:
double
isFullScreen
(
QString
name
);
double
isFullScreen
(
QString
name
);
double
getPropWindow
(
QString
name
);
double
getPropWindow
(
QString
name
);
void
setPropWindow
(
QString
name
,
double
flags
);
void
setPropWindow
(
QString
name
,
double
flags
);
void
setWindowTitle
(
QString
name
,
QString
title
);
double
getRatioWindow
(
QString
name
);
double
getRatioWindow
(
QString
name
);
void
setRatioWindow
(
QString
name
,
double
arg2
);
void
setRatioWindow
(
QString
name
,
double
arg2
);
void
saveWindowParameters
(
QString
name
);
void
saveWindowParameters
(
QString
name
);
...
...
modules/highgui/src/window_carbon.cpp
浏览文件 @
7ed5284a
...
@@ -833,6 +833,23 @@ void cvSetModeWindow_CARBON( const char* name, double prop_value)//Yannick Verdi
...
@@ -833,6 +833,23 @@ void cvSetModeWindow_CARBON( const char* name, double prop_value)//Yannick Verdi
__END__
;
__END__
;
}
}
void
cv
::
setWindowTitle
(
const
String
&
winname
,
const
String
&
title
)
{
CvWindow
*
window
=
icvFindWindowByName
(
winname
.
c_str
());
if
(
!
window
)
{
namedWindow
(
winname
);
window
=
icvFindWindowByName
(
winname
.
c_str
());
}
if
(
!
window
)
CV_Error
(
Error
::
StsNullPtr
,
"NULL window"
);
if
(
noErr
!=
SetWindowTitleWithCFString
(
window
->
window
,
CFStringCreateWithCString
(
NULL
,
title
.
c_str
(),
kCFStringEncodingASCII
)))
CV_Error_
(
Error
::
StsError
,
(
"Failed to set
\"
%s
\"
window title to
\"
%s
\"
"
,
winname
.
c_str
(),
title
.
c_str
()));
}
CV_IMPL
int
cvNamedWindow
(
const
char
*
name
,
int
flags
)
CV_IMPL
int
cvNamedWindow
(
const
char
*
name
,
int
flags
)
{
{
int
result
=
0
;
int
result
=
0
;
...
...
modules/highgui/src/window_cocoa.mm
浏览文件 @
7ed5284a
...
@@ -603,6 +603,27 @@ void cvSetModeWindow_COCOA( const char* name, double prop_value )
...
@@ -603,6 +603,27 @@ void cvSetModeWindow_COCOA( const char* name, double prop_value )
__END__
;
__END__
;
}
}
void
cv
::
setWindowTitle
(
const
String
&
winname
,
const
String
&
title
)
{
CVWindow
*
window
=
cvGetWindow
(
winname
.
c_str
());
if
(
window
==
NULL
)
{
namedWindow
(
winname
);
window
=
cvGetWindow
(
winname
.
c_str
());
}
if
(
window
==
NULL
)
CV_Error
(
Error
::
StsNullPtr
,
"NULL window"
);
NSAutoreleasePool
*
localpool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
windowTitle
=
[
NSString
stringWithFormat
:
@"%s"
,
title
.
c_str
()];
[
window
setTitle
:
windowTitle
];
[
localpool
drain
];
}
@implementation
CVWindow
@implementation
CVWindow
@synthesize
mouseCallback
;
@synthesize
mouseCallback
;
...
...
modules/highgui/src/window_gtk.cpp
浏览文件 @
7ed5284a
...
@@ -732,6 +732,23 @@ void cvSetModeWindow_GTK( const char* name, double prop_value)//Yannick Verdie
...
@@ -732,6 +732,23 @@ void cvSetModeWindow_GTK( const char* name, double prop_value)//Yannick Verdie
__END__
;
__END__
;
}
}
void
cv
::
setWindowTitle
(
const
String
&
winname
,
const
String
&
title
)
{
CvWindow
*
window
=
icvFindWindowByName
(
winname
.
c_str
());
if
(
!
window
)
{
namedWindow
(
winname
);
window
=
icvFindWindowByName
(
winname
.
c_str
());
}
if
(
!
window
)
CV_Error
(
Error
::
StsNullPtr
,
"NULL window"
);
CV_LOCK_MUTEX
();
gtk_window_set_title
(
GTK_WINDOW
(
window
->
frame
),
title
.
c_str
());
CV_UNLOCK_MUTEX
();
}
double
cvGetPropWindowAutoSize_GTK
(
const
char
*
name
)
double
cvGetPropWindowAutoSize_GTK
(
const
char
*
name
)
{
{
...
...
modules/highgui/src/window_w32.cpp
浏览文件 @
7ed5284a
...
@@ -483,6 +483,23 @@ void cvSetModeWindow_W32( const char* name, double prop_value)//Yannick Verdie
...
@@ -483,6 +483,23 @@ void cvSetModeWindow_W32( const char* name, double prop_value)//Yannick Verdie
__END__
;
__END__
;
}
}
void
cv
::
setWindowTitle
(
const
String
&
winname
,
const
String
&
title
)
{
CvWindow
*
window
=
icvFindWindowByName
(
winname
.
c_str
());
if
(
!
window
)
{
namedWindow
(
winname
);
window
=
icvFindWindowByName
(
winname
.
c_str
());
}
if
(
!
window
)
CV_Error
(
Error
::
StsNullPtr
,
"NULL window"
);
if
(
!
SetWindowText
(
window
->
frame
,
title
.
c_str
()))
CV_Error_
(
Error
::
StsError
,
(
"Failed to set
\"
%s
\"
window title to
\"
%s
\"
"
,
winname
.
c_str
(),
title
.
c_str
()));
}
double
cvGetPropWindowAutoSize_W32
(
const
char
*
name
)
double
cvGetPropWindowAutoSize_W32
(
const
char
*
name
)
{
{
double
result
=
-
1
;
double
result
=
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录