Solved

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

Posted on 2003-10-28
2
1,220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

719 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