Skip to content

Commit 159ea22

Browse files
committed
dnn: add a check for webcam properties in ssd_mobilenet sample
1 parent 7ae1946 commit 159ea22

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

samples/dnn/ssd_mobilenet_object_detection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,12 @@ int main(int argc, char** argv)
115115
(inVideoSize.height - cropSize.height) / 2),
116116
cropSize);
117117

118+
double fps = cap.get(CV_CAP_PROP_FPS);
119+
int fourcc = static_cast<int>(cap.get(CV_CAP_PROP_FOURCC));
118120
VideoWriter outputVideo;
119121
outputVideo.open(parser.get<String>("out") ,
120-
static_cast<int>(cap.get(CV_CAP_PROP_FOURCC)),
121-
cap.get(CV_CAP_PROP_FPS), cropSize, true);
122+
(fourcc != 0 ? fourcc : VideoWriter::fourcc('M','J','P','G')),
123+
(fps != 0 ? fps : 10.0), cropSize, true);
122124

123125
for(;;)
124126
{

0 commit comments

Comments
 (0)