16th anniversary offer
Working-with-See3CAM

Working with See3CAM – USB3 Cameras and OpenCV

Published on June 25, 2015

Brief on OpenCV

Open Computer Vision (OpenCV) is an open source BSD licensed image processing bundle that contains functions for all type of image processing functionality from basic image decoding, enhancement, color space conversion, object detection, object tracking and so on. It even has capability to perform complex decision making through mathematical models like Eigen Vectors, Support Vector Machine are few.

Prerequisites

This section explains tools and software to be installed for accessing frames from See3CAM through OpenCV. Since all e-con USB cameras are UVC compatible, there needs no additional drivers to be installed.

It is always recommended to install e-con USB camera streaming application prior to evaluating with OpenCV.

Installing e-con Systems™’ streaming application

i. For Windows – Installing eCAMView (Mandatory)

Install eCAMView received in the deliverable. Extract the package and run the setup inside windows package. This will register all required Directshow filters and eCAMView application. Launch eCAMView and verify whether the camera is streaming.

ii. For Linux – Installing see3camguvcview

Install see3camguvcview received in the deliverable. Follow the installation procedure specified in the document (See3CAM-GUVCView_Build_&_Install_Guide_Rev_1_8.pdf). Launch see3camguvcview and verify whether the camera is streaming.

Installing OpenCV

Download latest OpenCV for package

Refer to http://docs.opencv.org/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.html for installing OpenCV on Windows and Linux.

Accessing See3CAM USB cameras through OpenCV (Common for Windows and Linux)

OpenCV has an underlying media device access layer written in Directshow for Windows and V4L2 for Linux to access all media data and information. It is easier to access camera through OpenCV with just few lines of code. OpenCV starts streaming with default supported resolution by camera.

Accessing See3CAM-USB cameras-through OpenCV

Application Layer

Underlying media framework

Code Sample

This is a sample OpenCV code that opens the first available camera device, retrieves the frame and converts to gray scale.

     #include "opencv2/video/tracking.hpp"
     #include "opencv2/imgproc/imgproc.hpp"
     #include "opencv2/highgui/highgui.hpp"
 
     #include <iostream>
     #include <ctype.h>
 
     using namespace cv;
     using namespace std;
 
    int main()
    {
    Mat CameraFrame;
    Mat Grey;
 
    VideoCapture cap;
    char keypressed;
 
    //Opens the first imaging device.
    cap.open(0);
 
    //Check whether user selected camera is opened successfully.
    if( !cap.isOpened() )
    {
    cout << "***Could not initialize capturing...***\n";
   return -1;
   }
 
   //Create a windows to display camera preview.
   namedWindow("Camera Preview", CV_WINDOW_AUTOSIZE);
   namedWindow("Camera Preview - Grayscale", CV_WINDOW_AUTOSIZE);
 
   //Loop infinitely to fetch frame from camera and display it.
   for(;;)
   {
   //Fetch frame from camera. So simple, isn't;-)
   cap >> CameraFrame;
 
   //Check whether received frame has valid pointer.
   if( CameraFrame.empty() )
   break;
 
   cvtColor(CameraFrame, Grey, CV_RGB2GRAY);
 
   //Display the received frame
   imshow("Camera Preview", CameraFrame);
   //Display the grey scale converted frame
   imshow("Camera Preview - Grayscale", Grey);
 
   //Wait for Escape keyevent to exit from loop
   keypressed = (char)waitKey(10);
   if( keypressed == 27 )
   break;
   }
 
   //Release the camera interface.
   cap.release();
 
   return 0;
   }

Screenshots

Live streaming from camera

Recently Published