Have trouble with getting frames from the camera..Simple read this post.This post would not only show you how to get the frames from the camera but i would it also shows you how many ways to do it…
In This section of the post we come to the basic thing which is being Increasingly used these days in many of Robotics Arenas(since I am from the Robotics Back ground I want to speak about the same).
From Robotics Point of View I have always seen that students try to always connect the ports of the computer to drive or direct the bot.But in most of the cases I have seen students using Matlab (which is not Open Source,apart from the other disadvantages).
This blog is also meant to satisfy Robotics Freaks which are looking for another tool to use in their Image Processing based Robotics Competitions.
Since OpenCV is used here the Newbies are also encouraged to learn some beginner tips before asking questions in the Yahoo Group of OpenCV.
Camera Access:
Frames from the camera can be accessed in Three ways.
Using High Gui,
Using CvCam,
Using Direct Show,
The use of Video for Windows(VFW) is Obsolete because of Some problems associated with it(which is not discussed here).
HighGui –Uses function calls to get new frames. This allows the user to request a
frame when they need one. HighGui by default does not have support for changing video
capture sizes, but there is a post on the Yahoo OpenCV user group that describes all of
the steps to make the needed changes (The link to this is Here). Also
HighGui cannot capture video faster than 15 frames per second.
CvCam – Uses a callback function to process and obtain frames. This means that
the CvCam library will call your function when it has a frame to give your function. It
has functions that can allow a user to pick which camera capture device they want to use
and change the size of the video obtained. It also can process at 30 frames a second.
DirectShow – It has many different methods, that you can use this in
conjunction with OpenCV to capture frames. You can use a callback function or a
function call. You will have to work with COM objects and Filters to implement this.
DirectShow will give you access to everything that you need, but you will have to do all
of the programming to set it up. (Go for this method only if you are familiar with this else try to use the above two methods.)
I have also found that HighGui had many problems with the messages which i Get in the OpenCV community.
With all the aforementioned things said, it can now be said that for most of the applications we can use CvCam.
Then where to look for help regarding the use of CvCam for Camera Access?
After We install OpenCV go to start, programs and in OpenCV you can find a documentation Help file and in the same you have a link called “CvCam Reference Manual”.Open this file and get started with CvCam.
*********************************
Update:CvCam removed from the latest version…you need to use the HighGui for the camera access(Updated by me on 1st April 09).

do u have any idea how to do canny edge detection and contour detection using a cam. if so plz do help me out.anyhelp will be really appreciated..thank you
Comment by D_E_A_R — September 17, 2008 @ 12:50 pm |
Hi, for contour detection you’ll need the following steps
1) gray-scale the image
2) threshold it or do canny ( cvCanny(
IplImage* image,
IplImage* edges,
double threshold1,
double threshold2,
int aperture_size (Aperture parameter for Sobel operator )
))
3)perform morphological operations such as Erotion/Dilation
4)find contours using findContours()
Comment by kirk — January 12, 2012 @ 9:32 am |
Hi, so even with cvcam, is 30 fps the most we can get out of opencv??? isn’t that kinda low? isn’t any other way to get more fps? I’ve read a lot of posts form the yahoo group, about how the fps were not enough (and highgui handles only 15 fps, wich only makes things worse). bye
Comment by Fabian Pinner — November 1, 2009 @ 8:33 am |
Now that there is no more cvcam in latest version, It means 15 FPS is the best FPS we can get from a camera?!
Comment by Ehsan — February 18, 2011 @ 10:57 pm |
Well now you just need to use highgui…there is only one method now..!!
Comment by colouredpages — March 11, 2011 @ 3:27 pm |
hi… i want to make hand and finger detection using laptop cam.. how could i do that?
Comment by iamswethaetha — February 16, 2012 @ 5:55 am |