Solved

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

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 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