Showing posts with label Robotics. Show all posts
Showing posts with label Robotics. Show all posts

Accessing Camera using OpenCV

OpenCV is fast and customizable. So one can use it for real time image processing. Thus OpenCV comes out to be very useful for using in image processing Robotics applications. In many image processing based robotics applications, a camera is mounted in robot. Using input from mounted camera behavior of robot is controlled.

In this post we will access the camera of laptop or any webcam using opencv and produce live video stream. I am using opencv 2.1 with CodeBlocks IDE on Ubuntu 11.04. If you want help in installation and configurations, then refer here.

We will create a window using highgui, capture steam form webcam using cvCaptureFromCAM and convert it to image frames using IplImage. Compile and run the following code to get live stream from your webcam.