twistedfall / opencv-rust

Rust bindings for OpenCV 3 & 4
MIT License
1.86k stars 144 forks source link

unable to open ip camera #566

Closed learncodingforweb closed 2 months ago

learncodingforweb commented 2 months ago

I am using usb camera, it is working fine. using

let cam = videoio::VideoCapture::new(0, videoio::CAP_ANY)?; 

But how can i open ip camera with url rtsp://admin:admin@192.168.1.10:554?

opencv = "0.91"

rustc --version rustc 1.77.2 (25ef9e3d8 2024-04-09)

twistedfall commented 2 months ago

Does it work with Python or C++ code?

learncodingforweb commented 2 months ago

yes, it works with python as

cam = cv2.VideoCapture("rtsp://admin:admin@192.168.1.10:554")
twistedfall commented 2 months ago

I see, then using VideoCapture::from_file should do the trick.

learncodingforweb commented 2 months ago

Yes, it is working fine for

let cam = videoio::VideoCapture::from_file("rtsp://admin:admin@192.168.1.10:554", videoio::CAP_ANY)?;