Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

I am running the NI-IMAQ\Sample\MSVC\Grab examples but a "no interface found" error message appears although I have connected my webcam.

Hello.
 
I am running the NI-IMAQ\Sample\MSVC\Grab examples but a "no interface found" error message appears although I have connected my webcam.
I need to develop my project using this example as a guide.
Do I need to configure my webcam using NI Measurement & Automation Tool? But seems like I'm having problem in doing so.
In NI MAX, under the Devices tree, there's nothing being listed. And I can't add new device.
But my webcam works well in Vision Assistant.
 
Thank you in advance. 
0 Kudos
Message 1 of 16
(9,421 Views)

Hi,

The reason you are getting the "no interface found" message is because USB cameras use the NI-IMAQ for USB Cameras drivers, which are only supported in LabVIEW, Vision Assistant, and Vision Builder for AI.  If you would like to program in C++ with a USB camera, one option would be to create your own DirectShow driver for use with the code.  Also, webcams (USB) will not show up in Measurement and Automation Explorer, so it is expected that you will not see it in the MAX devices but will be able to use it in Vision Assistant.  Hope this info was helpful!

 

Message Edited by Carlton H on 10-02-2007 11:45 AM

Carlton
CLA
0 Kudos
Message 2 of 16
(9,392 Views)

Thanks for the answer.

Can you guide me how  to create DirectShow for my webcam step-by-step?

I'm a noob..Smiley Happy 

How am I going to know if my webcam supports DirectShow or not?

 

0 Kudos
Message 3 of 16
(9,377 Views)

Hi looky,

DirectShow is an interface that Microsoft uses for media types.  NI-IMAQ for USB drivers are written to do the communication between LabVIEW and DirectShow, so that's why it is going to take a custom driver to do this communication for programs outside of LabVIEW.  Although I have never tried this before, it may be possible to create a VISA driver to control the webcam in C++.  Here is a link to a tutorial that steps through the process of creating this driver:

http://zone.ni.com/devzone/cda/tut/p/id/4478

Is there any reason you need to stick with text-base coding for your application rather than LabVIEW?

Carlton
CLA
0 Kudos
Message 4 of 16
(9,366 Views)

Thanks Charlton for the explaination. I'll try to use NI-VISA after this.

I need to use C because I want to integrate my system with some other C functions like creating output file etc.

Do we have feature of creating output file (records the output in a text-file format) in LabVIEW? In that case, my problem would be easier to solve then.

0 Kudos
Message 5 of 16
(9,358 Views)

What kind of data are you wanting to write to the text file?  LabVIEW has built in VIs and examples that can write data to a spreadsheet or .txt file format.  A good simple example to look at is the "Write to Text File.vi" example.

Hope this helps you!

Carlton
CLA
0 Kudos
Message 6 of 16
(9,349 Views)
Thank you for the idea, Charlton!
 
I've viewed the Write To Text File.vi example. Can this example being applied if I want to have only the T/F values being recorded in the text file?
 
Here I attached my program. I plan to have kind of output like this:
 
14:12:00     B
14:12:01     G
14:12:02     B
14:12:03     Y
14:12:04     R
 
The left row shows the time and the right row shows the color of the output (B for Blue, G for Green, Y for Yellow and R for Red).
 
Currently the program has the flag for each color. If that particular color is detected, the flag will turn up showing that there is a hit.
How can I record those outputs?
 
 
Thanks!
0 Kudos
Message 7 of 16
(9,333 Views)

Hello looky,

One solution would be to have four separate case structures which, if true, will write that color code to a string variable.  Using the Write to Text File VI you will be able to write the value of that string to file each iteration.  You can also add the Get Date and Time VI and add the timestamp.  You would also need to add a 5th structure that would choose to either write or not write on that specific iteration if you have cases in which an image is none of the four colors you have specified.  If an image was all black then none of the cases would trigger and it would write the value from the previous iteration.  Hope this helps!

Carlton
CLA
0 Kudos
Message 8 of 16
(9,323 Views)

Hello Charlton,

I'm sorry I couldn't be able to solve the case structures. I have problem to wire them.

Do you have any example on how to use the case structure? I'm really new with LabVIEW and depend a lot on example programs.

 

Thanks!

0 Kudos
Message 9 of 16
(9,312 Views)

Hello looky,

I understand where you are coming from, I rely heavily on examples as well.  I have attached a quick and dirty example VI that demonstrates the case structures.  In this example, a random number (0 to 10) is generated every second and depending on what range the number falls into, the program writes either Red, Blue, Green, or Yellow to the front panel and a text file.  I hope this spurs some ideas.

p.s.  I wrote the code in LabVIEW 8.5 so if you need me to repost it for an earlier version, just let me know.

Carlton
CLA
0 Kudos
Message 10 of 16
(9,306 Views)