Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I find if a camera is connected

My software is connected to a camera through the NI framegrabber card. How can the software know if the camera is connected or power on?

Thanks.
0 Kudos
Message 1 of 4
(3,757 Views)
Hello,

There are several ways that you could implement this functionality. If you attempt to perform a snap function, you could read the error cluster output of the initialization VIs to determine if the interface specified is valid. If no error occurs, then the camera is connected and functioning. If the error indicates that the framegrabber could not lock onto the video signal or a timeout error results, then you know that there is something wrong with the power or connection to the camera.

What programming environment are you using (LabVIEW, CVI, Visual Basic, etc)? What framegrabber are you using? What type of camera are you using? What are you trying to achieve by determining if the camera is connected? Is this a preventive test before trying to acquire images?

Please let me know more about your setup and what your goal is.

Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,744 Views)
Hello,

I use VB .Net/IMAQ PCI-1405/LCL-211H camera. I also use few controls from Measurement Studio like CWIMAQ and CWIMAQVision. The statement MyIMAQ.AcquireImage() will get me a camera image, however, if the camera is disconnected, it will cause an exception. So I want to check the camera availability before the call.

I don't use CWIMAQViewer in my software, I get the image and load the image into a VB .Net control called PictureBox. Is there any way I can feed the PictureBox with live images?

Thanks.
0 Kudos
Message 3 of 4
(3,733 Views)
Hello,

You could call the CWIMAQ.Configure() function and look at its return value to determine if the interface that has been specified is valid. This would involve implementing your own error checking method to check the error type and then perhaps display a message asking the user to check the power and signal connections for the camera.

You could also try using a DLL to call the imgInterfaceQueryNames(uInt32 index, char* name) function. This function returns the interface name identified by the index parameter. In order to obtain a list of all the available interface names, call this function several times until the function returns an error. Each time, the index input will be incremented.

I would suggest using one of those methods to determine if the camera is properly connected and powered.

There is no way to attach your acquisition to the PictureBox control so that it will display images as they are acquired. With that control, you could acquire images and then update that display programmatically, but there is no way to do it without additional code. The CWIMAQViewer control was developed specifically so that an image acquisition could be directly attached to it.

Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,722 Views)