I am trying to use a USB webcam to communicate with an engineering software; that is MATLAB: Simulink. I am trying to do so with the C S-Function. The C S-Function is a method that uses C programming as well but in a special format.

Pointers can be used to refer to a memory address, get into it and retrieve the data. I have used Device Monitoring Studio and find that the endpoint address of the webcam is 0x82. So i tried to set a pointer with the address and retrieve the data.

However i only get 0 values all the time. Can anyone explain where and what is wrong with my technique?

Thanks in advance.

ang_ks.

07-09-2007

Salem

> and find that the endpoint address of the webcam is 0x82
That's going to be the USB address, not the memory address.

You can't simply do something like
char *data = (char*)0x82;
and expect to be able to read the camera data.

Which operating system?
Which compiler?
Which webcam?

Your best bet is to find a DLL (windows may already have one) which can read a frame from the webcam, and store that frame in memory. Your 'C' code then takes that image and reformats it into a form suitable for MATLAB.

07-09-2007

ang_ks

Hi,

No wonder it would not work.

i am using windows XP SP2 with a real-time operating software installed.

The compiler i am with MATLAB (a setting "mex -setup" to set up MATLAB to use the compiler) is Microsoft Visual Studio 2003.