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
c71dc78c
Commit
c71dc78c
authored
Jan 08, 2018
by
Alessandro de Oliveira Faria (A.K.A.CABELO)
Committed by
Alexander Alekhin
Jan 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge pull request #10502 from cabelo/save-dnn-yolo
Save video file (#10502)
parent
da0904df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
yolo_object_detection.cpp
samples/dnn/yolo_object_detection.cpp
+14
-0
No files found.
samples/dnn/yolo_object_detection.cpp
View file @
c71dc78c
...
@@ -26,6 +26,8 @@ static const char* params =
...
@@ -26,6 +26,8 @@ static const char* params =
"{ model | | model weights }"
"{ model | | model weights }"
"{ camera_device | 0 | camera device number}"
"{ camera_device | 0 | camera device number}"
"{ source | | video or image for detection}"
"{ source | | video or image for detection}"
"{ save | | file name output}"
"{ fps | 3 | frame per second }"
"{ style | box | box or line style draw }"
"{ style | box | box or line style draw }"
"{ min_confidence | 0.24 | min confidence }"
"{ min_confidence | 0.24 | min confidence }"
"{ class_names | | File with class names, [PATH-TO-DARKNET]/data/coco.names }"
;
"{ class_names | | File with class names, [PATH-TO-DARKNET]/data/coco.names }"
;
...
@@ -59,6 +61,9 @@ int main(int argc, char** argv)
...
@@ -59,6 +61,9 @@ int main(int argc, char** argv)
}
}
VideoCapture
cap
;
VideoCapture
cap
;
VideoWriter
writer
;
int
codec
=
CV_FOURCC
(
'M'
,
'J'
,
'P'
,
'G'
);
double
fps
=
parser
.
get
<
float
>
(
"fps"
);
if
(
parser
.
get
<
String
>
(
"source"
).
empty
())
if
(
parser
.
get
<
String
>
(
"source"
).
empty
())
{
{
int
cameraDevice
=
parser
.
get
<
int
>
(
"camera_device"
);
int
cameraDevice
=
parser
.
get
<
int
>
(
"camera_device"
);
...
@@ -79,6 +84,11 @@ int main(int argc, char** argv)
...
@@ -79,6 +84,11 @@ int main(int argc, char** argv)
}
}
}
}
if
(
!
parser
.
get
<
String
>
(
"save"
).
empty
())
{
writer
.
open
(
parser
.
get
<
String
>
(
"save"
),
codec
,
fps
,
Size
((
int
)
cap
.
get
(
CAP_PROP_FRAME_WIDTH
),(
int
)
cap
.
get
(
CAP_PROP_FRAME_HEIGHT
)),
1
);
}
vector
<
String
>
classNamesVec
;
vector
<
String
>
classNamesVec
;
ifstream
classNamesFile
(
parser
.
get
<
String
>
(
"class_names"
).
c_str
());
ifstream
classNamesFile
(
parser
.
get
<
String
>
(
"class_names"
).
c_str
());
if
(
classNamesFile
.
is_open
())
if
(
classNamesFile
.
is_open
())
...
@@ -164,6 +174,10 @@ int main(int argc, char** argv)
...
@@ -164,6 +174,10 @@ int main(int argc, char** argv)
FONT_HERSHEY_SIMPLEX
,
0.5
,
Scalar
(
0
,
0
,
0
));
FONT_HERSHEY_SIMPLEX
,
0.5
,
Scalar
(
0
,
0
,
0
));
}
}
}
}
if
(
writer
.
isOpened
())
{
writer
.
write
(
frame
);
}
imshow
(
"YOLO: Detections"
,
frame
);
imshow
(
"YOLO: Detections"
,
frame
);
if
(
waitKey
(
1
)
>=
0
)
break
;
if
(
waitKey
(
1
)
>=
0
)
break
;
...
...
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