Solved

Need to access an image from my webcam (WDM compliant)

Posted on 2003-10-28
2
1,213 Views
Last Modified: 2007-12-19
Background:
I'm building a robot for my senior design that carries a laptop and a webcam.  It will be doing some basic line following with the webcam input.  That means I will need a good frame rate.  I tried using some shareware utility that captures jpeg images from my webcam.  The problem is the utility only captures about 2 frames per second and on top of that I have to convert the jpegs to a format I can easily put into a matrix.

So naturally I want to write a program that will access my webcam directly.  I'm not sure what the heck to use though.  I know I want to use C#.  But as for what API to use I'm clueless.  I tried reading on the MSDN site about Direct Show and Windows Image Acquisition (WIA), but I am not a windows programmer.  I don’t know the first think about the windows SDK.  So I’m finding it hard to find a place to start especially with my time constraint of about another month.  Don’t get me wrong, I’m a very good programmer (both in Java and C++), but being a student I haven’t had the opportunity to do anything with windows libraries.

My robotics class professors (EE guys) are idiots, they say that windows programming is garbage and I should use linux.  Sure linux is probably easier to use then a windows API, but the support for webcams under linux is pathetic.  I want to use my Logitech 3000 pro and prove them wrong ;p

The Question:
What is an easy, but efficient way to get a raw image from my webcam, which is WDM compliant?

Thanks in advance,
Juzzam
0
Comment
Question by:Juzzam
2 Comments
 
LVL 4

Accepted Solution

by:
Xikilm earned 340 total points
ID: 9635836
Greetings Juzzam:

You'll want to research DirectX video capture with C#.  Basically, you want to poll the device at a set interval and capture the current video.  Here are some samples that may provide a good start:

http://www.codeproject.com/csharp/webcamservice.asp
http://www.codeproject.com/cs/media/directxcapture.asp


HTH,
Xikilm
0
 

Author Comment

by:Juzzam
ID: 9644667
This first tutorial was excellent.  I was able to compile the source and modify it.

Even when I change the sleep time between captures to 1ms, I can't get a reading from the webcam any faster than 1 snapshot per second.  Is this a limitation of DirectShow for capturing an image?

My robot can't possibly figure out which way to go with only 1fps.  I guess I will need video, but in order to process an image I am putting it into a matrix.  So I guess I need a way to capture video from my webcam and then a way to grab a frame and map it to a matrix?

Again, I don't know where to start :(
Juzzam
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now