'How to fix an error with connecting an IP camera using opencv in java?
I downloaded the app to the IP camera phone and I want to get the video via opencv,but it gives an error
public class Main {
static {System.loadLibrary(Core.NATIVE_LIBRARY_NAME);}
public static void main(String[] args) {
JFrame window = new JFrame();
JLabel screen = new JLabel();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);
VideoCapture camera = new VideoCapture("http://192.168.31.101:8080/video");
Mat frame = new Mat();
MatOfByte buf = new MatOfByte();
ImageIcon ic;
while (camera.grab()){
camera.read(frame);
Imgcodecs.imencode(".png",frame,buf);
ic = new ImageIcon(buf.toArray());
screen.setIcon(ic);
window.setContentPane(screen);
window.pack();
}
camera.release();
window.dispatchEvent(new WindowEvent(window , WindowEvent.WINDOW_CLOSING));
}
}
OpenCV(4.5.5) C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): http://192.168.31.101:8080/video in function 'cv::icvExtractPattern'
P.S. getBuildInformation
OpenCV modules:
To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java ml objdetect photo python2 stitching video videoio
Disabled: python3 world
Disabled by dependency: -
Unavailable: ts
Applications: apps
Documentation: NO
Non-free algorithms: NO
Windows RT support: NO
GUI: WIN32UI
Win32 UI: YES
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.11)
JPEG: build-libjpeg-turbo (ver 2.1.2-62)
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.2.0)
JPEG 2000: build (ver 2.4.0)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (58.134.100)
avformat: YES (58.76.100)
avutil: YES (56.70.100)
swscale: YES (5.9.100)
avresample: YES (4.0.0)
GStreamer: NO
DirectShow: YES
Media Foundation: YES
DXVA: NO
Parallel framework: Concurrency
Trace: YES (with Intel ITT)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
