Solved

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

Posted on 2003-10-28
2
1,208 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

20 Experts available now in Live!

Get 1:1 Help Now