Problems on OpenCV with IP Camera - c++

Recently I am working on OpenCV to complete a design, I now have got an IP camera and just by typing the IP address of the camera and the port in my browser, like 192.168.1.1:8080, I can watch the video.
I have installed VS2010 and correctly complete the setting. I now can deal with pictures in my computer and capture videos of the camera on my computer. But when I tried to capture videos from IP camera by
VideoCapture cap;
cap.open("http://192.168.137.235:8082/index.html")
there is an error:
Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:545)
so how can I solve the problem. Can anyone tell me specifically how to solve this problem?

I've tried to capture video directly from my IP camera to OpenCV-based application directly via RTSP as it was advised previously. It works, but ffmpeg decoder works very unstable with RTSP stream from some cameras.
I found the next solution.
Some people like to perform live streaming of their PC screen to youtube. The standard tool for it is a XSplit Broadcaster.
This tool has a side-effect. It's able to create a virtual usb-webcam via RTSP-compatible IP camera.
OpenCV captures video from usb-webcams perfectly.
And basic license of XSplit Broadcaster is absolutely free.
Unfortunately this solution has a limitation. With no dependence on real resolution of your IP camera, resolution of virtual webcam will be 640*480

The page "index.html" could be only the main page of your video camera, the page where a human uses to navigate the camera and to watch the live.
The ip cameras are very different each of the others. If your ip camera is "onvif" it should have a rtsp socket. For example I can watch my ip camera using this path:
rtsp://address:554/onvif1
If you camera implements the mjpeg stream you shoult use the right path, for example
http://192.168.137.235:8082/live.html
To know wich is the righ way to connect to your camera, it is necessary to know wich is your camera.

Related

How to use external HD video camera as input for a Visual Studio, OpenCV project?

I am doing a project regarding image processing and multiple person counting and was wondering, how exactly can I plug my ION AIR PRO PLUS video recording device (similar to a goPro), and use it as my 'webcam'? Basically, I want to plug it in and then access it via a live feed using Microsoft Visual Studio 2010 and OpenCV, and then do real time tracking of people walking.
What I am struggling with is accessing the external camera from my program. Anyone know how to do this?
The video camera has no wifi, only an hdmi output, RGB cable output and a USB.
Attach the USB cable and instantiate cv::VideoCaputre(0). In Linux local cameras have number indices I think in Windows should be the same.
Peter, In the past I have worked on camera products on Windows XP & 7. On windows usb cameras can be accessed using directshow.
You can implement a directshow filter for people tracking algorithm and fit it in the direct show pipeline soon after your camera plugin.
Here is a link to an application stack that may suit your use case(to give you an idea):
http://www.e-consystems.com/blog/camera/?p=1302
The recent windows operating systems that run WinRT, use a latest framework called MediaFoundation. As its very new there are some limitations we found when we tried to build similar applications.
To quickly see a preview out of your camera, pls google for "graphedit" and install it on a Windows 7 pc. Its a fairly simple tool. You can drag and drop your camera, if directshow is supported, then render its output pin and play for preview.
I do not think this is a standard webcam, it appears to work only as a mass storage device. One thing you can try is removing the micro sd card and connect it to the computer. This works on some cameras.
Assuming this does not work, one option would be to purchase an HDMI capture card. The YK762H PCI-E card costs around $40, and will allow you to use the camera with OpenCV, the videoInput library, or DirectShow.
The other option is to use the WiFi live preview. You would have to figure out the commands sent to the camera. This has already been done with the SJCam wifi cameras, the GoPro models, and Sony cameras such as the QX-10 and HDR-AS100V.

Can OPENCV access a analog camera using a video capture device

I have been trying to access my analog camera via a EasyCap video capture device. Any code I try only picks the usb webcam or internal webcam. I guess that since video capture device is a video controller, opencv doesnt recognize it as a imaging device.
Can anyone conform if you cannot access analog cameras with opencv via a video capture device.
If so, then what other method can be used.
i struggled with the same problem (in my case within python instead of C++, although I am certain it will be the same root cause) and hope it helps!
the original thread + ANSWER
also relevant XKCD
Even for digital devices, OpenCV isn't good at reading them, it is good at processing them. The library has supply for generic webcams, of course; however it does not supply most of the commercial or industrial cameras.
In short, to decode, you should try using "video for linux" or "video for windows" libraries; or the device SDK itself. Since you are using a video2usb converter, you shouldn't have any problem accessing the analog camera through these software.

Programming webcam pan/tilt/zoom functions in C/C++ on linux?

I'm able to capture images from my webcam, but I want to be able to pan and tilt the camera as well as zoom the lens, but there doesn't seem to be much clear documentation on these functions and no tutorials. Is anyone aware of some resources out there on this subject?
I guess this really depends on your setup. Is your camera already attached to a pan and tilt rig?
If not, check out this tutorial from Sparkfun:
http://www.sparkfun.com/tutorials/304
This option requires some servos, an arduino, and some code written in Processing.
If the zoom and gimbals are already under driver control then you may be able to access them via the VIDIOC_*_EXT_CTRLS V4L2 ioctls; see the driver source for details.
If the webcam follows Pelco-D/P protocol,
just use the char string in c/c++ program and set the required bits for pan-tilt-zoom and send this string through the port. (generally USB port since serial/parallel port webcams are outdated)
The magnitude of pan-tilt-zoom can also be adjusted.

Getting a snapshot from an rtsp video stream from an IP camera

Normally, I can get a still snapshot from an IP camera with a vendor provided url. However, the jpegs served this way are not of good enough quality and the vendor says there is no facility provided for serving snapshots in other image formats or smaller/lossless compression.
I noticed when I open an rtsp h264 stream from the camera with VLC then manually take a screenshot, the resulting image has none of the jpeg artifacts observed previously.
The question is, how would I obtain these superior snapshots from an h264 stream with a c++ program? I need to perform multiple operations on the image (annotations, cropping, face recognition) but those have to come after getting as high quality as possible initial image.
(note that this is related to my previous question. I obtained jpeg images with CURL but would now like to replace the snapshot getter with this new one if possible. I am again running on linux, Fedora 11)
You need an RTSP client implementation to connect to the camera, start receiving video feed, defragment/depacketize the video frame and then you will get it and save/process/present as needed.
You might want to look towards live555 library as a well known RTSP library/implemetnation.

Capturing real time images from a network camera

What is the best way to capture streamed MJPEG from a network IP camera?
I'd like to get frames and process them, using c++ (or python extended with c++).
Is OpenCV my best option?
Appart from OpenCV, you can use mplayer with -vo yuv4mpeg redirected to a pipe to get a stream of uncompressed yuv images. You can create the mplayer process and pipe from C++.
Another way is to use a RTSP library (your IP camera probably uses it as protocol)