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
7f73b105
Commit
7f73b105
authored
Aug 23, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: std::string more changes
parent
ae8dcdf4
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
47 additions
and
30 deletions
+47
-30
cvstd.hpp
modules/core/include/opencv2/core/cvstd.hpp
+33
-0
persistence.hpp
modules/core/include/opencv2/core/persistence.hpp
+0
-1
command_line_parser.cpp
modules/core/src/command_line_parser.cpp
+1
-6
ocl.cpp
modules/core/src/ocl.cpp
+1
-6
persistence_cpp.cpp
modules/core/src/persistence_cpp.cpp
+0
-5
system.cpp
modules/core/src/system.cpp
+1
-1
dnn.cpp
modules/dnn/src/dnn.cpp
+5
-5
detection_output_layer.cpp
modules/dnn/src/layers/detection_output_layer.cpp
+1
-1
eltwise_layer.cpp
modules/dnn/src/layers/eltwise_layer.cpp
+1
-1
pooling_layer.cpp
modules/dnn/src/layers/pooling_layer.cpp
+1
-1
recurrent_layers.cpp
modules/dnn/src/layers/recurrent_layers.cpp
+3
-3
No files found.
modules/core/include/opencv2/core/cvstd.hpp
View file @
7f73b105
...
...
@@ -452,6 +452,39 @@ class CV_EXPORTS FileNode; //for string constructor from FileNode
typedef
std
::
string
String
;
#ifndef OPENCV_DISABLE_STRING_LOWER_UPPER_CONVERSIONS
//! @cond IGNORED
namespace
details
{
// std::tolower is int->int
static
inline
char
char_tolower
(
char
ch
)
{
return
(
char
)
std
::
tolower
((
int
)
ch
);
}
// std::toupper is int->int
static
inline
char
char_toupper
(
char
ch
)
{
return
(
char
)
std
::
toupper
((
int
)
ch
);
}
}
// namespace details
//! @endcond
static
inline
std
::
string
toLowerCase
(
const
std
::
string
&
str
)
{
std
::
string
result
(
str
);
std
::
transform
(
result
.
begin
(),
result
.
end
(),
result
.
begin
(),
details
::
char_tolower
);
return
result
;
}
static
inline
std
::
string
toUpperCase
(
const
std
::
string
&
str
)
{
std
::
string
result
(
str
);
std
::
transform
(
result
.
begin
(),
result
.
end
(),
result
.
begin
(),
details
::
char_toupper
);
return
result
;
}
#endif // OPENCV_DISABLE_STRING_LOWER_UPPER_CONVERSIONS
//! @} core_basic
}
// cv
...
...
modules/core/include/opencv2/core/persistence.hpp
View file @
7f73b105
...
...
@@ -719,7 +719,6 @@ CV_EXPORTS void writeScalar( FileStorage& fs, const String& value );
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
int
&
value
,
int
default_value
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
float
&
value
,
float
default_value
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
double
&
value
,
double
default_value
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
String
&
value
,
const
String
&
default_value
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
std
::
string
&
value
,
const
std
::
string
&
default_value
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
Mat
&
mat
,
const
Mat
&
default_mat
=
Mat
()
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
SparseMat
&
mat
,
const
SparseMat
&
default_mat
=
SparseMat
()
);
...
...
modules/core/src/command_line_parser.cpp
View file @
7f73b105
...
...
@@ -72,14 +72,9 @@ static const char* get_type_name(int type)
return
"unknown"
;
}
// std::tolower is int->int
static
char
char_tolower
(
char
ch
)
{
return
(
char
)
std
::
tolower
((
int
)
ch
);
}
static
bool
parse_bool
(
std
::
string
str
)
{
std
::
transform
(
str
.
begin
(),
str
.
end
(),
str
.
begin
(),
char_tolower
);
std
::
transform
(
str
.
begin
(),
str
.
end
(),
str
.
begin
(),
details
::
char_tolower
);
std
::
istringstream
is
(
str
);
bool
b
;
is
>>
(
str
.
size
()
>
1
?
std
::
boolalpha
:
std
::
noboolalpha
)
>>
b
;
...
...
modules/core/src/ocl.cpp
View file @
7f73b105
...
...
@@ -1691,11 +1691,6 @@ static cl_device_id selectOpenCLDevice()
return
NULL
;
}
#else
// std::tolower is int->int
static
char
char_tolower
(
char
ch
)
{
return
(
char
)
std
::
tolower
((
int
)
ch
);
}
static
cl_device_id
selectOpenCLDevice
()
{
std
::
string
platform
,
deviceName
;
...
...
@@ -1780,7 +1775,7 @@ static cl_device_id selectOpenCLDevice()
{
int
deviceType
=
0
;
std
::
string
tempStrDeviceType
=
deviceTypes
[
t
];
std
::
transform
(
tempStrDeviceType
.
begin
(),
tempStrDeviceType
.
end
(),
tempStrDeviceType
.
begin
(),
char_tolower
);
std
::
transform
(
tempStrDeviceType
.
begin
(),
tempStrDeviceType
.
end
(),
tempStrDeviceType
.
begin
(),
details
::
char_tolower
);
if
(
tempStrDeviceType
==
"gpu"
||
tempStrDeviceType
==
"dgpu"
||
tempStrDeviceType
==
"igpu"
)
deviceType
=
Device
::
TYPE_GPU
;
...
...
modules/core/src/persistence_cpp.cpp
View file @
7f73b105
...
...
@@ -667,11 +667,6 @@ void read(const FileNode& node, double& value, double default_value)
CV_NODE_IS_REAL
(
node
.
node
->
tag
)
?
node
.
node
->
data
.
f
:
std
::
numeric_limits
<
double
>::
max
();
}
void
read
(
const
FileNode
&
node
,
String
&
value
,
const
String
&
default_value
)
{
value
=
!
node
.
node
?
default_value
:
CV_NODE_IS_STRING
(
node
.
node
->
tag
)
?
String
(
node
.
node
->
data
.
str
.
ptr
)
:
String
();
}
void
read
(
const
FileNode
&
node
,
std
::
string
&
value
,
const
std
::
string
&
default_value
)
{
value
=
!
node
.
node
?
default_value
:
CV_NODE_IS_STRING
(
node
.
node
->
tag
)
?
std
::
string
(
node
.
node
->
data
.
str
.
ptr
)
:
default_value
;
...
...
modules/core/src/system.cpp
View file @
7f73b105
...
...
@@ -1970,7 +1970,7 @@ public:
const
Ipp64u
minorFeatures
=
0
;
#endif
env
=
env
.
toLowerCase
(
);
env
=
toLowerCase
(
env
);
if
(
env
.
substr
(
0
,
2
)
==
"ne"
)
{
useIPP_NE
=
true
;
...
...
modules/dnn/src/dnn.cpp
View file @
7f73b105
...
...
@@ -3329,7 +3329,7 @@ void LayerFactory::registerLayer(const String &type, Constructor constructor)
CV_TRACE_ARG_VALUE
(
type
,
"type"
,
type
.
c_str
());
cv
::
AutoLock
lock
(
getLayerFactoryMutex
());
String
type_
=
t
ype
.
toLowerCase
(
);
String
type_
=
t
oLowerCase
(
type
);
LayerFactory_Impl
::
iterator
it
=
getLayerFactoryImpl
().
find
(
type_
);
if
(
it
!=
getLayerFactoryImpl
().
end
())
...
...
@@ -3347,7 +3347,7 @@ void LayerFactory::unregisterLayer(const String &type)
CV_TRACE_ARG_VALUE
(
type
,
"type"
,
type
.
c_str
());
cv
::
AutoLock
lock
(
getLayerFactoryMutex
());
String
type_
=
t
ype
.
toLowerCase
(
);
String
type_
=
t
oLowerCase
(
type
);
LayerFactory_Impl
::
iterator
it
=
getLayerFactoryImpl
().
find
(
type_
);
if
(
it
!=
getLayerFactoryImpl
().
end
())
...
...
@@ -3365,7 +3365,7 @@ Ptr<Layer> LayerFactory::createLayerInstance(const String &type, LayerParams& pa
CV_TRACE_ARG_VALUE
(
type
,
"type"
,
type
.
c_str
());
cv
::
AutoLock
lock
(
getLayerFactoryMutex
());
String
type_
=
t
ype
.
toLowerCase
(
);
String
type_
=
t
oLowerCase
(
type
);
LayerFactory_Impl
::
const_iterator
it
=
getLayerFactoryImpl
().
find
(
type_
);
if
(
it
!=
getLayerFactoryImpl
().
end
())
...
...
@@ -3402,7 +3402,7 @@ BackendWrapper::~BackendWrapper() {}
Net
readNet
(
const
String
&
_model
,
const
String
&
_config
,
const
String
&
_framework
)
{
String
framework
=
_framework
.
toLowerCase
(
);
String
framework
=
toLowerCase
(
_framework
);
String
model
=
_model
;
String
config
=
_config
;
const
std
::
string
modelExt
=
model
.
substr
(
model
.
rfind
(
'.'
)
+
1
);
...
...
@@ -3447,7 +3447,7 @@ Net readNet(const String& _model, const String& _config, const String& _framewor
Net
readNet
(
const
String
&
_framework
,
const
std
::
vector
<
uchar
>&
bufferModel
,
const
std
::
vector
<
uchar
>&
bufferConfig
)
{
String
framework
=
_framework
.
toLowerCase
(
);
String
framework
=
toLowerCase
(
_framework
);
if
(
framework
==
"caffe"
)
return
readNetFromCaffe
(
bufferConfig
,
bufferModel
);
else
if
(
framework
==
"tensorflow"
)
...
...
modules/dnn/src/layers/detection_output_layer.cpp
View file @
7f73b105
...
...
@@ -163,7 +163,7 @@ public:
void
getCodeType
(
const
LayerParams
&
params
)
{
String
codeTypeString
=
params
.
get
<
String
>
(
"code_type"
).
toLowerCase
(
);
String
codeTypeString
=
toLowerCase
(
params
.
get
<
String
>
(
"code_type"
)
);
if
(
codeTypeString
==
"center_size"
)
_codeType
=
"CENTER_SIZE"
;
else
...
...
modules/dnn/src/layers/eltwise_layer.cpp
View file @
7f73b105
...
...
@@ -71,7 +71,7 @@ public:
op
=
SUM
;
if
(
params
.
has
(
"operation"
))
{
String
operation
=
params
.
get
<
String
>
(
"operation"
).
toLowerCase
(
);
String
operation
=
toLowerCase
(
params
.
get
<
String
>
(
"operation"
)
);
if
(
operation
==
"prod"
)
op
=
PROD
;
else
if
(
operation
==
"sum"
)
...
...
modules/dnn/src/layers/pooling_layer.cpp
View file @
7f73b105
...
...
@@ -76,7 +76,7 @@ public:
if
(
params
.
has
(
"pool"
)
||
params
.
has
(
"kernel_size"
)
||
params
.
has
(
"kernel_w"
)
||
params
.
has
(
"kernel_h"
))
{
String
pool
=
params
.
get
<
String
>
(
"pool"
,
"max"
).
toLowerCase
(
);
String
pool
=
toLowerCase
(
params
.
get
<
String
>
(
"pool"
,
"max"
)
);
if
(
pool
==
"max"
)
type
=
MAX
;
else
if
(
pool
==
"ave"
)
...
...
modules/dnn/src/layers/recurrent_layers.cpp
View file @
7f73b105
...
...
@@ -349,16 +349,16 @@ Ptr<LSTMLayer> LSTMLayer::create(const LayerParams& params)
int
LSTMLayer
::
inputNameToIndex
(
String
inputName
)
{
if
(
inputName
.
toLowerCase
(
)
==
"x"
)
if
(
toLowerCase
(
inputName
)
==
"x"
)
return
0
;
return
-
1
;
}
int
LSTMLayer
::
outputNameToIndex
(
const
String
&
outputName
)
{
if
(
outputName
.
toLowerCase
(
)
==
"h"
)
if
(
toLowerCase
(
outputName
)
==
"h"
)
return
0
;
else
if
(
outputName
.
toLowerCase
(
)
==
"c"
)
else
if
(
toLowerCase
(
outputName
)
==
"c"
)
return
1
;
return
-
1
;
}
...
...
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