Ask Your Question

Video from IP camera can't find starting number cv::icvExtractPattern

asked 2019-10-26 19:23:42 -0500

adi1525 gravatar image

Hello, I have working C++ project for openCV 3.4.7 with GPU and CPU object detection with USB camera. Now I try use IP camera via http request. In openCV version 4.1.1 it's works but in 3.4.7 I get error:

OpenCV(3.4.7) Error: Bad argument (CAP_IMAGES: can't find starting number (in the name of file): in cv::icvExtractPattern, file C:\openCV\opencv-3.4.7\modules\videoio\src\cap_images.cpp, line 246 [ERROR:0] VIDEOIO(cvCreateFileCapture_Images(filename.c_str())): raised OpenCV exception:

OpenCV(3.4.7) C:\openCV\opencv-3.4.7\modules\videoio\src\cap_images.cpp:246: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): in function 'cv::icvExtractPattern'

This is camera from android app "IP webcam" and "DroidCam".

I use this camera with python scirpt and via web browser and it works.

I looked for this error but i didn't found any information about it.

Regards, Adrian

edit retag flag offensive close merge delete


I use openCV on windows 10 and I sharing an image from android via ip address.

adi1525 gravatar imageadi1525 ( 2019-10-27 02:12:37 -0500 )edit

I need to see the code for c++ and python for CAP_IMAGES I don't want to entire code. Just a single code.

supra56 gravatar imagesupra56 ( 2019-10-27 09:00:03 -0500 )edit

This code it`s build in opencv 4.1.1 and it's works, but in 3.4.7 not.

#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
    Mat image, dst;
    cv::VideoCapture vcap;
    const std::string videoStreamAddress = "";

    if (!
        std::cout << "Error opening video stream or file" << std::endl;
        return -1;
    else {
        cout << "Open." << endl;
    while (vcap.isOpened()) {
        vcap >> image;
        resize(image, dst, cv::Size(640, 320));
        imshow("Input", dst);
adi1525 gravatar imageadi1525 ( 2019-10-27 14:54:25 -0500 )edit

Python is almost the same:

import cv2

cap = cv2.VideoCapture('http://@')

    ret, frame =

    if cv2.waitKey(1) & 0xFF == ord('q'):

adi1525 gravatar imageadi1525 ( 2019-10-27 14:58:35 -0500 )edit

Don't use port and add some extension.

const std::string videoStreamAddress = "";


const std::string videoStreamAddress = "";
supra56 gravatar imagesupra56 ( 2019-10-27 21:28:44 -0500 )edit

Connection via http doesn't work. I was able to run camera only with rtsp protocol.

const std::string videoStreamAddress = "rtsp://";

Addisionaly when I try give address without specifying the port, opencv set default 80.

adi1525 gravatar imageadi1525 ( 2019-10-29 13:04:18 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2019-12-03 22:44:09 -0500

wmarbut gravatar image

I had this issue as well and it was a result of not having compiled with ffmpeg "-DWITH_FFMPEG=ON".

edit flag offensive delete link more


Hello,can you explain to me a little more that I did not understand, please

gersonmlb gravatar imagegersonmlb ( 2020-02-06 07:55:41 -0500 )edit

Question Tools

1 follower


Asked: 2019-10-26 19:23:42 -0500

Seen: 17,880 times

Last updated: Oct 26 '19