↑ Return to Computer Vision

Print this Page

OpenCV

The field of computer vision has become an interesting research area between the years.  The main idea of this is to acquire a signal, process and do any control or analytical action… in other way, computer vision uses the acquired image to process and produce numerical data and form decisions.

Of course, there are a huge ammount of applications that you can apply to computer vision:

  • Automated Inspection
  • Robot navigation and localization
  • Telemedicine
  • Detecting strange behaviours
  • Process Control
  • Gesture Recognition, and more.

This is a complex thing.  So if you want to simplify your life you could use a stack of functions developed by Intel and now maintained by Willow Garage named OpenCV.

OpenCVYou can understand make complex algorithms based on a structure of functions that you can reuse to make new developments of vision applications.

OpenCV can be used with your favorite IDE and can be programmed in languages like:

  • C/C++
  • C#
  • Java
  • Phyton
  • Even using an extension of this tool in Matlab (you can use Matlab Computer Vision System Toolbox or OpenCV)

I do not cover how to install the IDE in this entry but i will post some basic code for displaying a simple image.

This code displays the Camera Input from any USB Camera connected.

#include <opencv.hpp>

int main( int argc, char** argv ) {
const char *window;                                                   // name of window
CvCapture* capture;                                                   // video
IplImage* frame;                                                        // frame

window = “Camera Input”;                                          // reference of camera window
capture = cvCaptureFromCAM(1);
cvNamedWindow(window, CV_WINDOW_AUTOSIZE);  // construct a window
for(;;) {                                                                       // repeat forever
frame = cvQueryFrame(capture);                              // get the first frame
if(!frame || cvWaitKey(10) >= 0) {                         // if no frame or a keypress event
break; // break event
}
cvShowImage(window, frame );                               // show the image in window
}
cvReleaseCapture(&capture);                                      // destroy captured data
cvDestroyWindow(window); // destroy referenced window
return 0;
}

The output display of your current webcam, will look like this, if you have one:

CameraInputSo, there is a world to explore in Computer Vision, hope you have opened your eyes to the posibilities of the things that you can do or make research by your own in your I+D department.

A very more complex example is a Canny Edge detector.  I leave you the video here:


Permanent link to this article: http://cerescontrols.com/computer-vision/opencv/

Leave a Reply

Your email address will not be published. Required fields are marked *