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
b11b08b4
Commit
b11b08b4
authored
Oct 11, 2014
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3265 from BKNio:putText_develop
parents
a5e89bf7
5a797ae7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
5 deletions
+52
-5
drawing.cpp
modules/core/src/drawing.cpp
+52
-5
No files found.
modules/core/src/drawing.cpp
View file @
b11b08b4
...
@@ -1925,7 +1925,11 @@ static const int HersheyComplex[] = {
...
@@ -1925,7 +1925,11 @@ static const int HersheyComplex[] = {
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
,
2024
,
2025
,
2026
,
2223
,
2084
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
,
2024
,
2025
,
2026
,
2223
,
2084
,
2224
,
2247
,
587
,
2249
,
2101
,
2102
,
2103
,
2104
,
2105
,
2106
,
2107
,
2108
,
2109
,
2110
,
2111
,
2224
,
2247
,
587
,
2249
,
2101
,
2102
,
2103
,
2104
,
2105
,
2106
,
2107
,
2108
,
2109
,
2110
,
2111
,
2112
,
2113
,
2114
,
2115
,
2116
,
2117
,
2118
,
2119
,
2120
,
2121
,
2122
,
2123
,
2124
,
2125
,
2126
,
2112
,
2113
,
2114
,
2115
,
2116
,
2117
,
2118
,
2119
,
2120
,
2121
,
2122
,
2123
,
2124
,
2125
,
2126
,
2225
,
2229
,
2226
,
2246
};
2225
,
2229
,
2226
,
2246
,
2801
,
2802
,
2803
,
2804
,
2805
,
2806
,
2807
,
2808
,
2809
,
2810
,
2811
,
2812
,
2813
,
2814
,
2815
,
2816
,
2817
,
2818
,
2819
,
2820
,
2821
,
2822
,
2823
,
2824
,
2825
,
2826
,
2827
,
2828
,
2829
,
2830
,
2831
,
2832
,
2901
,
2902
,
2903
,
2904
,
2905
,
2906
,
2907
,
2908
,
2909
,
2910
,
2911
,
2912
,
2913
,
2914
,
2915
,
2916
,
2917
,
2918
,
2919
,
2920
,
2921
,
2922
,
2923
,
2924
,
2925
,
2926
,
2927
,
2928
,
2929
,
2930
,
2931
,
2932
};
static
const
int
HersheyComplexItalic
[]
=
{
static
const
int
HersheyComplexItalic
[]
=
{
(
9
+
12
*
16
)
+
FONT_ITALIC_ALPHA
+
FONT_ITALIC_DIGIT
+
FONT_ITALIC_PUNCT
+
(
9
+
12
*
16
)
+
FONT_ITALIC_ALPHA
+
FONT_ITALIC_DIGIT
+
FONT_ITALIC_PUNCT
+
...
@@ -2017,6 +2021,51 @@ static const int* getFontData(int fontFace)
...
@@ -2017,6 +2021,51 @@ static const int* getFontData(int fontFace)
return
ascii
;
return
ascii
;
}
}
inline
void
readCheck
(
int
&
c
,
int
&
i
,
const
string
&
text
,
int
fontFace
)
{
int
leftBoundary
=
' '
,
rightBoundary
=
127
;
if
(
c
>=
0x80
&&
fontFace
==
FONT_HERSHEY_COMPLEX
)
{
if
(
c
>=
0xC0
&&
c
<=
0xDF
)
//2 bytes utf
{
if
(
c
&
1
)
{
c
=
(
uchar
)
text
[
++
i
]
+
47
;
leftBoundary
=
175
;
rightBoundary
=
191
;
}
else
{
c
=
(
uchar
)
text
[
++
i
]
-
17
;
leftBoundary
=
127
;
rightBoundary
=
175
;
}
}
else
{
if
(
c
>=
0xE0
)
//3 bytes utf
i
++
;
if
(
c
>=
0xF0
)
//4 bytes utf
i
++
;
if
(
c
>=
0xF8
)
//5 bytes utf
i
++
;
if
(
c
>=
0xFC
)
//6 bytes utf
i
++
;
i
++
;
c
=
'?'
;
}
}
if
(
c
>=
rightBoundary
||
c
<
leftBoundary
)
c
=
'?'
;
}
void
putText
(
Mat
&
img
,
const
string
&
text
,
Point
org
,
void
putText
(
Mat
&
img
,
const
string
&
text
,
Point
org
,
int
fontFace
,
double
fontScale
,
Scalar
color
,
int
fontFace
,
double
fontScale
,
Scalar
color
,
...
@@ -2048,8 +2097,7 @@ void putText( Mat& img, const string& text, Point org,
...
@@ -2048,8 +2097,7 @@ void putText( Mat& img, const string& text, Point org,
int
c
=
(
uchar
)
text
[
i
];
int
c
=
(
uchar
)
text
[
i
];
Point
p
;
Point
p
;
if
(
c
>=
127
||
c
<
' '
)
readCheck
(
c
,
i
,
text
,
fontFace
);
c
=
'?'
;
const
char
*
ptr
=
faces
[
ascii
[(
c
-
' '
)
+
1
]];
const
char
*
ptr
=
faces
[
ascii
[(
c
-
' '
)
+
1
]];
p
.
x
=
(
uchar
)
ptr
[
0
]
-
'R'
;
p
.
x
=
(
uchar
)
ptr
[
0
]
-
'R'
;
...
@@ -2096,8 +2144,7 @@ Size getTextSize( const string& text, int fontFace, double fontScale, int thickn
...
@@ -2096,8 +2144,7 @@ Size getTextSize( const string& text, int fontFace, double fontScale, int thickn
int
c
=
(
uchar
)
text
[
i
];
int
c
=
(
uchar
)
text
[
i
];
Point
p
;
Point
p
;
if
(
c
>=
127
||
c
<
' '
)
readCheck
(
c
,
i
,
text
,
fontFace
);
c
=
'?'
;
const
char
*
ptr
=
faces
[
ascii
[(
c
-
' '
)
+
1
]];
const
char
*
ptr
=
faces
[
ascii
[(
c
-
' '
)
+
1
]];
p
.
x
=
(
uchar
)
ptr
[
0
]
-
'R'
;
p
.
x
=
(
uchar
)
ptr
[
0
]
-
'R'
;
...
...
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