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
8cc09f17
Commit
8cc09f17
authored
Oct 13, 2016
by
Pavel Rojtberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
highgui: allow wrapping cv::addText
also correctly forward spacing parameter in fontQt
parent
a799cc13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
11 deletions
+43
-11
highgui.hpp
modules/highgui/include/opencv2/highgui.hpp
+17
-0
window.cpp
modules/highgui/src/window.cpp
+26
-11
No files found.
modules/highgui/include/opencv2/highgui.hpp
View file @
8cc09f17
...
...
@@ -670,6 +670,23 @@ The function addText draws *text* on the image *img* using a specific font *font
*/
CV_EXPORTS
void
addText
(
const
Mat
&
img
,
const
String
&
text
,
Point
org
,
const
QtFont
&
font
);
/** @brief Draws a text on the image.
@param img 8-bit 3-channel image where the text should be drawn.
@param text Text to write on an image.
@param org Point(x,y) where the text should start on an image.
@param nameFont Name of the font. The name should match the name of a system font (such as
*Times*). If the font is not found, a default one is used.
@param pointSize Size of the font. If not specified, equal zero or negative, the point size of the
font is set to a system-dependent default value. Generally, this is 12 points.
@param color Color of the font in BGRA where A = 255 is fully transparent.
@param weight Font weight. Available operation flags are : cv::QtFontWeights You can also specify a positive integer for better control.
@param style Font style. Available operation flags are : cv::QtFontStyles
@param spacing Spacing between characters. It can be negative or positive.
*/
CV_EXPORTS_W
void
addText
(
const
Mat
&
img
,
const
String
&
text
,
Point
org
,
const
String
&
nameFont
,
int
pointSize
=
-
1
,
Scalar
color
=
Scalar
::
all
(
0
),
int
weight
=
QT_FONT_NORMAL
,
int
style
=
QT_STYLE_NORMAL
,
int
spacing
=
0
);
/** @brief Displays a text on a window image as an overlay for a specified duration.
The function displayOverlay displays useful information/tips on top of the window for a certain
...
...
modules/highgui/src/window.cpp
View file @
8cc09f17
...
...
@@ -391,9 +391,9 @@ CV_IMPL void cvUpdateWindow(const char*)
#if defined (HAVE_QT)
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
,
spacing
);
void
*
pf
=
&
f
;
// to suppress strict-aliasing
return
*
(
cv
::
QtFont
*
)
pf
;
}
...
...
@@ -404,6 +404,14 @@ void cv::addText( const Mat& img, const String& text, Point org, const QtFont& f
cvAddText
(
&
_img
,
text
.
c_str
(),
org
,
(
CvFont
*
)
&
font
);
}
void
cv
::
addText
(
const
Mat
&
img
,
const
String
&
text
,
Point
org
,
const
String
&
nameFont
,
int
pointSize
,
Scalar
color
,
int
weight
,
int
style
,
int
spacing
)
{
CvFont
f
=
cvFontQt
(
nameFont
.
c_str
(),
pointSize
,
color
,
weight
,
style
,
spacing
);
CvMat
_img
=
img
;
cvAddText
(
&
_img
,
text
.
c_str
(),
org
,
&
f
);
}
void
cv
::
displayStatusBar
(
const
String
&
name
,
const
String
&
text
,
int
delayms
)
{
cvDisplayStatusBar
(
name
.
c_str
(),
text
.
c_str
(),
delayms
);
...
...
@@ -441,51 +449,58 @@ int cv::createButton(const String& button_name, ButtonCallback on_change, void*
#else
static
const
char
*
NO_QT_ERR_MSG
=
"The library is compiled without QT support"
;
cv
::
QtFont
cv
::
fontQt
(
const
String
&
,
int
,
Scalar
,
int
,
int
,
int
)
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
return
QtFont
();
}
void
cv
::
addText
(
const
Mat
&
,
const
String
&
,
Point
,
const
QtFont
&
)
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
}
void
cv
::
addText
(
const
Mat
&
,
const
String
&
,
Point
,
const
String
&
,
int
,
Scalar
,
int
,
int
,
int
)
{
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
}
void
cv
::
displayStatusBar
(
const
String
&
,
const
String
&
,
int
)
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
}
void
cv
::
displayOverlay
(
const
String
&
,
const
String
&
,
int
)
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
}
int
cv
::
startLoop
(
int
(
*
)(
int
argc
,
char
*
argv
[]),
int
,
char
**
)
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
return
0
;
}
void
cv
::
stopLoop
()
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
}
void
cv
::
saveWindowParameters
(
const
String
&
)
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
}
void
cv
::
loadWindowParameters
(
const
String
&
)
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
}
int
cv
::
createButton
(
const
String
&
,
ButtonCallback
,
void
*
,
int
,
bool
)
{
CV_Error
(
CV_StsNotImplemented
,
"The library is compiled without QT support"
);
CV_Error
(
CV_StsNotImplemented
,
NO_QT_ERR_MSG
);
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