With todays computing power (including embedded and hobby board computers), the commoditisation of web cameras, and the maturity of computer vision software and object detection algorithms, anyone can play around computer vision for negligible cost.
In this guide I'll give you a rough start to streaming content from an IP camera to OpenCV (tested on v2.4.10) for building your own computer vision projects. Although the code in this guide is written in Python there are many other languages supported by OpenCV.
- In order to configure your camera to work over the Internet you will need to configure what is called Port Forwarding. Port Forwarding allows for you to access the camera from a remote location by forwarding the network ports used by the camera onto the Internet.
- Connect your DVR to your router. Using an Ethernet cable, plug one end of the cable into the back of your DVR, then plug the other end of the cable into a free 'Internet' port on the back of your router. 4 Connect the DVR to a monitor.
It will find the camera‘s IP. Select the device on the tool and create a new password to activate it. The new password should contain 8-16 characters with at least two combinations of numbers, lowercase, uppercase, and special characters. Access camera by its IP on the browser. You had better use IE.
TL;DR
Just give me the code: GitHub
IP camera streaming into OpenCV
As getting vision from an IP camera into OpenCV is an unnecessarily tricky stumbling block, we'll only concentrate on the code that streams vision from an IP camera to OpenCV which then simply displays that stream.
Ip Camera Stream Url
How to download xbox. webcam-opencv-example.py
Congratulations, you're now streaming content into OpenCV. NB: Change the url to suit your particular camera.
Please explain.
I've had trouble with OpenCV and mpeg streams (even though OpenCV has support for this) as was the case in this instance with an Ai-Ball Wi-Fi camera. The code here deals with the camera's mpeg stream directly and passes each image in that stream to OpenCV for consumption. As each (jpeg) image in the stream is binary encoded and each image frame contains a start marker 'xffxd8'
and an end marker 'xffxd9'
we can easily detect those markers and segment our stream into individual images. Many other people seem to have a similar problem so there are many other explanations and examples out there.
Examples
Here are a couple of examples of what you might want to do using OpenCV and some very lightweight built-in object detection algorithms (nothing fancy, just some crude knock-ups I've made for demo purposes):
First up, with relatively little extra code, and no other equipment, we can use fiducials to track position and orientation of objects:
Feature Matching + Homography to find Objects using OpenCV and the ORB (oriented BRIEF) keypoint detector and descriptor extractor.Determines the (x,y,z) of the centre point of a marker in order to determine where it is in 3D space relative to the camera.
Details:
- OpenCV
- ORB (oriented BRIEF) keypoint detector and descriptor extractor (one of many OpenCV object detection algorithms)
- Ai-Ball web camera
Below is a more complex example that utilises an SMI Red 500 eye-tracker and PyViewX. NOTE: Eye-trackers are rapidly becoming a commodity item, and at the time of writing, the Tobii EyeX developer kit was available for $99USD. I have achieved very good results with this particular eye-tracker and the development SDK (C# only at this point in time) provides gaze and fixation event streams out of the box allowing you to build working models pretty quickly.
Feature Matching + Homography + Eye Tracking and Gaze Fixation to identify objects and locate them in space.
Determines fixation start and end points, and for the duration, draws a bounding box around the fixation area of interest (AOI) on the screen. If a recognised marker is within that box (i.e. we're looking at an object) determine the (x,y,z) of the centre point of that marker in order to determine where it is in 3D space relative to the camera. NOTE: The fixation bounding box is for demonstration purposes only. In a real deployment you would not want to display the fixation bounding box as it distracts the user, which in turn changes their gaze point.
Details:
- OpenCV
- ORB (oriented BRIEF) keypoint detector and descriptor extractor (one of many OpenCV object detection algorithms)
- SMI Red 500 eye tracker
- PyViewX (remote streaming client for SMI eye tracker)
- Ai-Ball web camera
Opportunities
The purpose of this rough and ready example is to get you started with getting IP camera streams into OpenCV. As shown in the second example in this article, eye-tracking can be easily integrated into computer vision projects and with the present day commoditisation of eye-trackers for the consumer market (including embedded in phones), the application for products combining computer vision and eye-tracking, along with other now commonly available technology like GPS, accelerometers, IMU's, etc. is opening up many new development opportunities in computer vision.
Today's security cameras do far more than just monitor their surroundings for threats. We're seeing more and more businesses wanting to make their live videos available to the public. From hotels using their online camera connection to show the beauty of their surroundings to tourists, to public infrastructure companies monitoring the traffic situation at intersections to re-direct motorists who may get stuck in jams, and even wildlife enthusiasts broadcasting images of bird nests, all these people are looking for a simple solution to share their live streams.
In the past, if you wanted to have a live camera on your website, you needed the necessary encoder, a dedicated computer, or your own streaming server, or you needed some cloud streaming service with a player. But since popular platforms such as YouTube and Facebook began to support direct video streams, the solution is rather more simple. These platforms allow free broadcasting/streaming regardless of whether your video is watched by one viewer or by 50,000 viewers at the same time. The interface is regularly updated so it is optimised for the widest range of viewers, so there is usually no need to address viewer complaints that they cannot play the video.
But how can you get the video from your camera and onto these platforms without an IT specialist or complicated infrastructure?
Streaming applications directly from the camera
By using the ACAP platform you can choose from a wide range of third-party software applications that enable your camera to perform specific functions – just like the applications in your smartphone. In 2014, we introduced CamStreamer App designed by NetRex, Czech Republic (CamStreamer is now an independent company), which has been specifically designed for video streaming. The application allows you to transfer video from your camera directly to the most often used platforms, such as YouTube, Facebook, Vimeo, Twitch.tv, DaCast, Ustream, Wowza or other streaming services.
The advantage is a low price and easyset up – you need only one Axis camera, an internet connection and an unlimited CamStreamer App license to configure your stream in just a few clicks. If you add a simple toggle switch with LED indicator, you can start and stop the live stream by just pushing the button. The LED indicator lets you know when the live stream is up and running.
Display Dynamic Infographics
How To Stream Ip Camera Over Internet Camera
What if you need add more information to your broadcast? In addition to CamStreamer App, a sister application called CamOverlay App, can use the camera and add dynamic graphics directly into the live stream. This gives you the ability to show viewers the actual weather, score, display ads for your products or even playful animated GIFs, enriching your video content. The overlay graphics and its timing can be controlled and managed via API, as well as external hardware button.
Insert external data
When you need to add particular data into your video – such as data from temperature sensors, counter machines, access systems etc – CamStreamer offers CamScripter App. This application allows you to run micro apps directly on an IP camera.
As applications' functionality can be also controlled using API – which gives you almost unlimited integration possibilities – this provides the flexibility to stream sporting events, online classes, church services, traffic, wildlife, zoo enclosures and much more.
Learn more about live streaming cameras for professional use
Stream Ip Camera To Website
Article by: David Capousek CEO of CamStreamer |