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
Solved

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

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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