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
623de337
Commit
623de337
authored
Jun 26, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnn: fix build warnings
parent
ee54bafe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
26 deletions
+26
-26
shape_utils.hpp
modules/dnn/include/opencv2/dnn/shape_utils.hpp
+4
-4
caffe_googlenet.cpp
samples/dnn/caffe_googlenet.cpp
+2
-2
fcn_semsegm.cpp
samples/dnn/fcn_semsegm.cpp
+4
-4
squeezenet_halide.cpp
samples/dnn/squeezenet_halide.cpp
+2
-2
ssd_object_detection.cpp
samples/dnn/ssd_object_detection.cpp
+8
-8
torch_enet.cpp
samples/dnn/torch_enet.cpp
+6
-6
No files found.
modules/dnn/include/opencv2/dnn/shape_utils.hpp
View file @
623de337
...
@@ -60,7 +60,7 @@ inline std::ostream &operator<< (std::ostream &s, cv::Range &r)
...
@@ -60,7 +60,7 @@ inline std::ostream &operator<< (std::ostream &s, cv::Range &r)
struct
_Range
:
public
cv
::
Range
struct
_Range
:
public
cv
::
Range
{
{
_Range
(
const
Range
&
r
)
:
cv
::
Range
(
r
)
{}
_Range
(
const
Range
&
r
)
:
cv
::
Range
(
r
)
{}
_Range
(
int
start
,
int
size
=
1
)
:
cv
::
Range
(
start
,
start
+
size
)
{}
_Range
(
int
start
_
,
int
size_
=
1
)
:
cv
::
Range
(
start_
,
start_
+
size_
)
{}
};
};
static
inline
Mat
slice
(
const
Mat
&
m
,
const
_Range
&
r0
)
static
inline
Mat
slice
(
const
Mat
&
m
,
const
_Range
&
r0
)
...
@@ -148,13 +148,13 @@ static inline MatShape shape(int a0, int a1=-1, int a2=-1, int a3=-1)
...
@@ -148,13 +148,13 @@ static inline MatShape shape(int a0, int a1=-1, int a2=-1, int a3=-1)
static
inline
int
total
(
const
MatShape
&
shape
,
int
start
=
-
1
,
int
end
=
-
1
)
static
inline
int
total
(
const
MatShape
&
shape
,
int
start
=
-
1
,
int
end
=
-
1
)
{
{
if
(
start
==
-
1
)
start
=
0
;
if
(
start
==
-
1
)
start
=
0
;
if
(
end
==
-
1
)
end
=
shape
.
size
();
if
(
end
==
-
1
)
end
=
(
int
)
shape
.
size
();
if
(
shape
.
empty
())
if
(
shape
.
empty
())
return
0
;
return
0
;
int
elems
=
1
;
int
elems
=
1
;
CV_Assert
(
start
<
shape
.
size
()
&&
end
<=
shape
.
size
()
&&
CV_Assert
(
start
<
(
int
)
shape
.
size
()
&&
end
<=
(
int
)
shape
.
size
()
&&
start
<=
end
);
start
<=
end
);
for
(
int
i
=
start
;
i
<
end
;
i
++
)
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
{
...
@@ -187,7 +187,7 @@ inline int clamp(int ax, int dims)
...
@@ -187,7 +187,7 @@ inline int clamp(int ax, int dims)
inline
int
clamp
(
int
ax
,
const
MatShape
&
shape
)
inline
int
clamp
(
int
ax
,
const
MatShape
&
shape
)
{
{
return
clamp
(
ax
,
shape
.
size
());
return
clamp
(
ax
,
(
int
)
shape
.
size
());
}
}
}
}
...
...
samples/dnn/caffe_googlenet.cpp
View file @
623de337
...
@@ -50,7 +50,7 @@ using namespace cv::dnn;
...
@@ -50,7 +50,7 @@ using namespace cv::dnn;
using
namespace
std
;
using
namespace
std
;
/* Find best class for the blob (i. e. class with maximal probability) */
/* Find best class for the blob (i. e. class with maximal probability) */
void
getMaxClass
(
const
Mat
&
probBlob
,
int
*
classId
,
double
*
classProb
)
static
void
getMaxClass
(
const
Mat
&
probBlob
,
int
*
classId
,
double
*
classProb
)
{
{
Mat
probMat
=
probBlob
.
reshape
(
1
,
1
);
//reshape the blob to 1x1000 matrix
Mat
probMat
=
probBlob
.
reshape
(
1
,
1
);
//reshape the blob to 1x1000 matrix
Point
classNumber
;
Point
classNumber
;
...
@@ -59,7 +59,7 @@ void getMaxClass(const Mat &probBlob, int *classId, double *classProb)
...
@@ -59,7 +59,7 @@ void getMaxClass(const Mat &probBlob, int *classId, double *classProb)
*
classId
=
classNumber
.
x
;
*
classId
=
classNumber
.
x
;
}
}
std
::
vector
<
String
>
readClassNames
(
const
char
*
filename
=
"synset_words.txt"
)
st
atic
st
d
::
vector
<
String
>
readClassNames
(
const
char
*
filename
=
"synset_words.txt"
)
{
{
std
::
vector
<
String
>
classNames
;
std
::
vector
<
String
>
classNames
;
...
...
samples/dnn/fcn_semsegm.cpp
View file @
623de337
...
@@ -33,9 +33,9 @@ static vector<cv::Vec3b> readColors(const string &filename = "pascal-classes.txt
...
@@ -33,9 +33,9 @@ static vector<cv::Vec3b> readColors(const string &filename = "pascal-classes.txt
string
name
;
ss
>>
name
;
string
name
;
ss
>>
name
;
int
temp
;
int
temp
;
cv
::
Vec3b
color
;
cv
::
Vec3b
color
;
ss
>>
temp
;
color
[
0
]
=
temp
;
ss
>>
temp
;
color
[
0
]
=
(
uchar
)
temp
;
ss
>>
temp
;
color
[
1
]
=
temp
;
ss
>>
temp
;
color
[
1
]
=
(
uchar
)
temp
;
ss
>>
temp
;
color
[
2
]
=
temp
;
ss
>>
temp
;
color
[
2
]
=
(
uchar
)
temp
;
colors
.
push_back
(
color
);
colors
.
push_back
(
color
);
}
}
}
}
...
@@ -64,7 +64,7 @@ static void colorizeSegmentation(const Mat &score, const vector<cv::Vec3b> &colo
...
@@ -64,7 +64,7 @@ static void colorizeSegmentation(const Mat &score, const vector<cv::Vec3b> &colo
if
(
ptrScore
[
col
]
>
ptrMaxVal
[
col
])
if
(
ptrScore
[
col
]
>
ptrMaxVal
[
col
])
{
{
ptrMaxVal
[
col
]
=
ptrScore
[
col
];
ptrMaxVal
[
col
]
=
ptrScore
[
col
];
ptrMaxCl
[
col
]
=
ch
;
ptrMaxCl
[
col
]
=
(
uchar
)
ch
;
}
}
}
}
}
}
...
...
samples/dnn/squeezenet_halide.cpp
View file @
623de337
...
@@ -19,7 +19,7 @@ using namespace cv::dnn;
...
@@ -19,7 +19,7 @@ using namespace cv::dnn;
#include <cstdlib>
#include <cstdlib>
/* Find best class for the blob (i. e. class with maximal probability) */
/* Find best class for the blob (i. e. class with maximal probability) */
void
getMaxClass
(
const
Mat
&
probBlob
,
int
*
classId
,
double
*
classProb
)
static
void
getMaxClass
(
const
Mat
&
probBlob
,
int
*
classId
,
double
*
classProb
)
{
{
Mat
probMat
=
probBlob
.
reshape
(
1
,
1
);
//reshape the blob to 1x1000 matrix
Mat
probMat
=
probBlob
.
reshape
(
1
,
1
);
//reshape the blob to 1x1000 matrix
Point
classNumber
;
Point
classNumber
;
...
@@ -28,7 +28,7 @@ void getMaxClass(const Mat &probBlob, int *classId, double *classProb)
...
@@ -28,7 +28,7 @@ void getMaxClass(const Mat &probBlob, int *classId, double *classProb)
*
classId
=
classNumber
.
x
;
*
classId
=
classNumber
.
x
;
}
}
std
::
vector
<
std
::
string
>
readClassNames
(
const
char
*
filename
=
"synset_words.txt"
)
st
atic
st
d
::
vector
<
std
::
string
>
readClassNames
(
const
char
*
filename
=
"synset_words.txt"
)
{
{
std
::
vector
<
std
::
string
>
classNames
;
std
::
vector
<
std
::
string
>
classNames
;
...
...
samples/dnn/ssd_object_detection.cpp
View file @
623de337
...
@@ -13,22 +13,22 @@ using namespace std;
...
@@ -13,22 +13,22 @@ using namespace std;
const
size_t
width
=
300
;
const
size_t
width
=
300
;
const
size_t
height
=
300
;
const
size_t
height
=
300
;
Mat
getMean
(
const
size_t
&
imageHeight
,
const
size_t
&
imageWidth
)
static
Mat
getMean
(
const
size_t
&
imageHeight
,
const
size_t
&
imageWidth
)
{
{
Mat
mean
;
Mat
mean
;
const
int
meanValues
[
3
]
=
{
104
,
117
,
123
};
const
int
meanValues
[
3
]
=
{
104
,
117
,
123
};
vector
<
Mat
>
meanChannels
;
vector
<
Mat
>
meanChannels
;
for
(
size_
t
i
=
0
;
i
<
3
;
i
++
)
for
(
in
t
i
=
0
;
i
<
3
;
i
++
)
{
{
Mat
channel
(
imageHeight
,
imageWidth
,
CV_32F
,
Scalar
(
meanValues
[
i
]));
Mat
channel
(
(
int
)
imageHeight
,
(
int
)
imageWidth
,
CV_32F
,
Scalar
(
meanValues
[
i
]));
meanChannels
.
push_back
(
channel
);
meanChannels
.
push_back
(
channel
);
}
}
cv
::
merge
(
meanChannels
,
mean
);
cv
::
merge
(
meanChannels
,
mean
);
return
mean
;
return
mean
;
}
}
Mat
preprocess
(
const
Mat
&
frame
)
static
Mat
preprocess
(
const
Mat
&
frame
)
{
{
Mat
preprocessed
;
Mat
preprocessed
;
frame
.
convertTo
(
preprocessed
,
CV_32F
);
frame
.
convertTo
(
preprocessed
,
CV_32F
);
...
@@ -124,7 +124,7 @@ int main(int argc, char** argv)
...
@@ -124,7 +124,7 @@ int main(int argc, char** argv)
if
(
confidence
>
confidenceThreshold
)
if
(
confidence
>
confidenceThreshold
)
{
{
size_t
objectClass
=
detectionMat
.
at
<
float
>
(
i
,
1
);
size_t
objectClass
=
(
size_t
)(
detectionMat
.
at
<
float
>
(
i
,
1
)
);
float
xLeftBottom
=
detectionMat
.
at
<
float
>
(
i
,
3
)
*
frame
.
cols
;
float
xLeftBottom
=
detectionMat
.
at
<
float
>
(
i
,
3
)
*
frame
.
cols
;
float
yLeftBottom
=
detectionMat
.
at
<
float
>
(
i
,
4
)
*
frame
.
rows
;
float
yLeftBottom
=
detectionMat
.
at
<
float
>
(
i
,
4
)
*
frame
.
rows
;
...
@@ -139,9 +139,9 @@ int main(int argc, char** argv)
...
@@ -139,9 +139,9 @@ int main(int argc, char** argv)
<<
" "
<<
xRightTop
<<
" "
<<
xRightTop
<<
" "
<<
yRightTop
<<
std
::
endl
;
<<
" "
<<
yRightTop
<<
std
::
endl
;
Rect
object
(
xLeftBottom
,
yLeftBottom
,
Rect
object
(
(
int
)
xLeftBottom
,
(
int
)
yLeftBottom
,
xRightTop
-
xLeftBottom
,
(
int
)(
xRightTop
-
xLeftBottom
)
,
yRightTop
-
yLeftBottom
);
(
int
)(
yRightTop
-
yLeftBottom
)
);
rectangle
(
frame
,
object
,
Scalar
(
0
,
255
,
0
));
rectangle
(
frame
,
object
,
Scalar
(
0
,
255
,
0
));
}
}
...
...
samples/dnn/torch_enet.cpp
View file @
623de337
...
@@ -141,7 +141,7 @@ static void colorizeSegmentation(const Mat &score, Mat &segm, Mat &legend, vecto
...
@@ -141,7 +141,7 @@ static void colorizeSegmentation(const Mat &score, Mat &segm, Mat &legend, vecto
if
(
ptrScore
[
col
]
>
ptrMaxVal
[
col
])
if
(
ptrScore
[
col
]
>
ptrMaxVal
[
col
])
{
{
ptrMaxVal
[
col
]
=
ptrScore
[
col
];
ptrMaxVal
[
col
]
=
ptrScore
[
col
];
ptrMaxCl
[
col
]
=
ch
;
ptrMaxCl
[
col
]
=
(
uchar
)
ch
;
}
}
}
}
}
}
...
@@ -161,8 +161,8 @@ static void colorizeSegmentation(const Mat &score, Mat &segm, Mat &legend, vecto
...
@@ -161,8 +161,8 @@ static void colorizeSegmentation(const Mat &score, Mat &segm, Mat &legend, vecto
if
(
classNames
.
size
()
==
colors
.
size
())
if
(
classNames
.
size
()
==
colors
.
size
())
{
{
int
blockHeight
=
30
;
int
blockHeight
=
30
;
legend
.
create
(
blockHeight
*
classNames
.
size
(),
200
,
CV_8UC3
);
legend
.
create
(
blockHeight
*
(
int
)
classNames
.
size
(),
200
,
CV_8UC3
);
for
(
int
i
=
0
;
i
<
classNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
classNames
.
size
();
i
++
)
{
{
cv
::
Mat
block
=
legend
.
rowRange
(
i
*
blockHeight
,
(
i
+
1
)
*
blockHeight
);
cv
::
Mat
block
=
legend
.
rowRange
(
i
*
blockHeight
,
(
i
+
1
)
*
blockHeight
);
block
=
colors
[
i
];
block
=
colors
[
i
];
...
@@ -194,9 +194,9 @@ static vector<Vec3b> readColors(const String &filename, vector<String>& classNam
...
@@ -194,9 +194,9 @@ static vector<Vec3b> readColors(const String &filename, vector<String>& classNam
string
name
;
ss
>>
name
;
string
name
;
ss
>>
name
;
int
temp
;
int
temp
;
cv
::
Vec3b
color
;
cv
::
Vec3b
color
;
ss
>>
temp
;
color
[
0
]
=
temp
;
ss
>>
temp
;
color
[
0
]
=
(
uchar
)
temp
;
ss
>>
temp
;
color
[
1
]
=
temp
;
ss
>>
temp
;
color
[
1
]
=
(
uchar
)
temp
;
ss
>>
temp
;
color
[
2
]
=
temp
;
ss
>>
temp
;
color
[
2
]
=
(
uchar
)
temp
;
classNames
.
push_back
(
name
);
classNames
.
push_back
(
name
);
colors
.
push_back
(
color
);
colors
.
push_back
(
color
);
}
}
...
...
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