Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
9817252b
Commit
9817252b
authored
Nov 28, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added addTextOpenGl function
parent
2a4fb155
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
6 deletions
+81
-6
highgui.hpp
modules/highgui/include/opencv2/highgui/highgui.hpp
+5
-0
highgui_c.h
modules/highgui/include/opencv2/highgui/highgui_c.h
+8
-1
window.cpp
modules/highgui/src/window.cpp
+39
-0
window_w32.cpp
modules/highgui/src/window_w32.cpp
+0
-0
point_cloud.cpp
samples/cpp/point_cloud.cpp
+29
-5
No files found.
modules/highgui/include/opencv2/highgui/highgui.hpp
View file @
9817252b
...
...
@@ -151,6 +151,11 @@ CV_EXPORTS void pointCloudShow(const string& winname, const gpu::GlCamera& camer
CV_EXPORTS
void
pointCloudShow
(
const
string
&
winname
,
const
gpu
::
GlCamera
&
camera
,
InputArray
points
,
InputArray
colors
=
noArray
());
CV_EXPORTS
void
addTextOpenGl
(
const
string
&
winname
,
const
string
&
text
,
Point
org
,
Scalar
color
=
Scalar
::
all
(
255
),
const
string
&
fontName
=
"Courier New"
,
int
fontHeight
=
12
,
int
fontWeight
=
CV_FONT_NORMAL
,
int
fontStyle
=
CV_STYLE_NORMAL
);
CV_EXPORTS
void
clearTextOpenGl
(
const
string
&
winname
);
//Only for Qt
CV_EXPORTS
CvFont
fontQt
(
const
string
&
nameFont
,
int
pointSize
=-
1
,
...
...
modules/highgui/include/opencv2/highgui/highgui_c.h
View file @
9817252b
...
...
@@ -63,7 +63,8 @@ enum { CV_FONT_LIGHT = 25,//QFont::Light,
enum
{
CV_STYLE_NORMAL
=
0
,
//QFont::StyleNormal,
CV_STYLE_ITALIC
=
1
,
//QFont::StyleItalic,
CV_STYLE_OBLIQUE
=
2
//QFont::StyleOblique
CV_STYLE_OBLIQUE
=
2
,
//QFont::StyleOblique
CV_STYLE_UNDERLINE
=
4
};
/* ---------*/
...
...
@@ -257,6 +258,12 @@ CVAPI(void) cvCreateOpenGLCallback( const char* window_name, CvOpenGLCallback ca
CVAPI
(
void
)
cvSetOpenGlContext
(
const
char
*
window_name
);
CVAPI
(
void
)
cvUpdateWindow
(
const
char
*
window_name
);
CVAPI
(
void
)
cvAddTextOpenGl
(
const
char
*
winname
,
const
char
*
text
,
CvPoint
org
,
CvScalar
color
CV_DEFAULT
(
cvScalar
(
255
.
0
,
255
.
0
,
255
.
0
,
255
.
0
)),
const
char
*
fontName
CV_DEFAULT
(
"Courier New"
),
int
fontHeight
CV_DEFAULT
(
12
),
int
fontWeight
CV_DEFAULT
(
CV_FONT_NORMAL
),
int
fontStyle
CV_DEFAULT
(
CV_STYLE_NORMAL
));
CVAPI
(
void
)
cvClearTextOpenGl
(
const
char
*
winname
);
/****************************************************************************************\
* Working with Video Files and Cameras *
\****************************************************************************************/
...
...
modules/highgui/src/window.cpp
View file @
9817252b
...
...
@@ -597,6 +597,35 @@ void cv::pointCloudShow(const string& winname, const gpu::GlCamera& camera, Inpu
#endif
}
// OpenGL text
void
cv
::
addTextOpenGl
(
const
string
&
winname
,
const
string
&
text
,
Point
org
,
Scalar
color
,
const
string
&
fontName
,
int
fontHeight
,
int
fontWeight
,
int
fontStyle
)
{
cvAddTextOpenGl
(
winname
.
c_str
(),
text
.
c_str
(),
org
,
color
,
fontName
.
c_str
(),
fontHeight
,
fontWeight
,
fontStyle
);
}
void
cv
::
clearTextOpenGl
(
const
string
&
winname
)
{
cvClearTextOpenGl
(
winname
.
c_str
());
}
#if (!defined WIN32 && !defined _WIN32) || defined HAVE_QT
CV_IMPL
void
cvAddTextOpenGl
(
const
char
*
,
const
char
*
,
CvPoint
,
CvScalar
,
const
char
*
,
int
,
int
,
int
)
{
CV_Error
(
CV_OpenGlNotSupported
,
"This function works only under WIN32"
);
}
CV_IMPL
void
cvClearTextOpenGl
(
const
char
*
)
{
CV_Error
(
CV_OpenGlNotSupported
,
"This function works only under WIN32"
);
}
#endif // (!defined WIN32 && !defined _WIN32) || defined HAVE_QT
// Without OpenGL
#ifndef HAVE_OPENGL
#ifndef HAVE_QT
...
...
@@ -616,6 +645,16 @@ CV_IMPL void cvUpdateWindow(const char*)
CV_Error
(
CV_OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
}
CV_IMPL
void
cvAddTextOpenGl
(
const
char
*
,
const
char
*
,
CvPoint
,
CvScalar
,
const
char
*
,
int
,
int
,
int
)
{
CV_Error
(
CV_OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
}
CV_IMPL
void
cvClearTextOpenGl
(
const
char
*
)
{
CV_Error
(
CV_OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
}
void
icvSetOpenGlCleanCallback
(
const
char
*
,
CvOpenGlCleanCallback
,
void
*
)
{
CV_Error
(
CV_OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
...
...
modules/highgui/src/window_w32.cpp
View file @
9817252b
This diff is collapsed.
Click to expand it.
samples/cpp/point_cloud.cpp
View file @
9817252b
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include "opencv2/core/core.hpp"
#include "opencv2/core/gpumat.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/contrib/contrib.hpp"
using
namespace
std
;
using
namespace
cv
;
...
...
@@ -187,13 +189,15 @@ int main(int argc, const char* argv[])
reprojectImageTo3D
(
disp
,
points
,
Q
);
namedWindow
(
"OpenGL Sample"
,
WINDOW_OPENGL
);
const
string
windowName
=
"OpenGL Sample"
;
namedWindow
(
windowName
,
WINDOW_OPENGL
);
int
fov
=
0
;
createTrackbar
(
"Fov"
,
"OpenGL Sample"
,
&
fov
,
100
);
createTrackbar
(
"Fov"
,
windowName
,
&
fov
,
100
);
int
mouse
[
2
]
=
{
0
,
0
};
setMouseCallback
(
"OpenGL Sample"
,
mouseCallback
,
mouse
);
setMouseCallback
(
windowName
,
mouseCallback
,
mouse
);
GlArrays
pointCloud
;
...
...
@@ -211,8 +215,14 @@ int main(int argc, const char* argv[])
const
Point3d
leftVec
(
-
1.0
,
0.0
,
0.0
);
Point3d
pos
;
TickMeter
tm
;
const
int
step
=
20
;
int
frame
=
0
;
while
(
true
)
{
tm
.
start
();
int
key
=
waitKey
(
1
);
if
(
key
>=
0
)
key
=
key
&
0xff
;
...
...
@@ -220,7 +230,7 @@ int main(int argc, const char* argv[])
if
(
key
==
27
)
break
;
double
aspect
=
getWindowProperty
(
"OpenGL Sample"
,
WND_PROP_ASPECT_RATIO
);
double
aspect
=
getWindowProperty
(
windowName
,
WND_PROP_ASPECT_RATIO
);
const
double
posStep
=
0.1
;
...
...
@@ -256,7 +266,21 @@ int main(int argc, const char* argv[])
camera
.
setCameraPos
(
pos
,
yaw
,
pitch
,
0.0
);
pointCloudShow
(
"OpenGL Sample"
,
camera
,
pointCloud
);
pointCloudShow
(
windowName
,
camera
,
pointCloud
);
tm
.
stop
();
if
(
frame
++
>=
step
)
{
ostringstream
fps
;
fps
<<
"FPS: "
<<
step
/
tm
.
getTimeSec
();
clearTextOpenGl
(
windowName
);
addTextOpenGl
(
windowName
,
fps
.
str
(),
Point
(
0
,
0
),
Scalar
::
all
(
255
),
"Courier New"
,
16
);
frame
=
0
;
tm
.
reset
();
}
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment