HomeQuickStart, 5 steps to easily install a machine vision camera and acquire an image
QuickStart, 5 steps to easily install a machine vision camera and acquire an image
In this QuickStart we explain in 5 simple steps how to install a machine vision camera from Daheng Imaging. This article is based on a setup with a windows pc and a USB3 or GigE Machine Vision Camera. For all other operating systems use the the manuals in our download section.
Products needed: Machine vision camera, Lens, data cable. (external power if GigE non POE camera).
Step 1: Install Windows SDK for Machine Vision Camera
**Please don't connect the Machine Vision Camera before or during SDK's installation**
Please download the SDK for our Machine Vision Cameras.
You can find the latest version of our Windows SDK (Windows SDK USB2+USB3+GigE (including Directshow) Galaxy) in our download section. After downloading the SDK please install it.
Once Sdk is installed:
The software Galaxy viewer will be installed.
All camera documentation will be available in the folder: C:\Program Files\Daheng Imaging\GalaxySDK\Doc
Programming examples will be available on C:\Program Files\Daheng Imaging\GalaxySDK\Samples
Step 2: Connect to the Machine Vision Camera
After installation of the SDK, you can connect the Machine Vision Camera.
In case you are using a USB3 Vision camera, please make sure you have connected it to a USB3 port of the PC.
In case of a GigE camera, please verify that the GigE camera has power and that the LED on the backside of the GigE camera is blinking / on. In case of a GigE Camera, first start the GigE IP Configurator to setup the correct IP address
Now the Machine Vision Camera is connected you can start the Daheng Galaxy Viewer software and double click on the machine vision camera you want to connect to, found under the appropriate device interface type, below highlighted in blue.
GigE Camera:
In case of a GigE camera, please make sure that the firewall is not blocking the software.
For default windows firewall you can check it by:
- Open Windows Defender Security Center.
- Click on Firewall & network protection.
- Click the Allow an app through firewall link. ...
- Click the Change settings button.
- Check that both GalaxyView.exe and GxGigeIPConfig Applications have access to private and Public network
Step 3: Setup Exposure Time of the Machine Vision Camera
Now you have made connection to the Machine Vision Camera. First start acquiring images by pressing the play button (In the screenshot below marked in yellow, in the top left corner). There is a chance that the image you see is too dark; Therefore we first have to setup the exposure time of the Machine Vision Camera. Also, make sure you have the correct lens on the camera (see Lenscalculator).
If you just want to get familiar with the machine vision camera, we advise to point to a light source like your computer screen. If the camera is built into the final product, please make sure that the ambient lighting of the final product is being used.
There are 2 options to proceed.
Option 1: Use autoexposure
This is the most easy option. Therefore set the ExposureAuto feature to Once or continuous. (Under: Remote device>Acquisition control>ExposureAuto)
Option 2: Set a fixed exposure time
(Under: Remote device>Acquisition control>ExposureTime)
Please note that the exposure time is in us. So 40000us = 40ms. By increasing the exposure time the image will get brighter but it can influence the framerate and motionblur.
The max framerate of the Machine Vision Camera is 1000/exposuretime (ms). With an exposure time of 40ms the max framerate is 1000/40=25fps. If you are imaging a still object please increase the exposure time till you have the desired brightness.
For moving objects the exposure time of the Machine Vision Camera is critical. If the exposure time is too long the image will get blurry.
A common calculation states that the maximum movement of the object should not be larger then half a pixel. To calculate we assume the following. Our field of view is 1000x600mm and our Machine Vision Camera has 1000x600pixels resolution. So 1pixel/1mm. If an object moves with 1m/second this will be 1000mm/second. We will start noticing motion blur if the object moves with more then half a pixel so that is 0,5 * 1pixel/1mm= 0.5mm. The maximum exposure time is then (max object movement=0.5mm) / (object speed = 1000mm) = 0.0005seconds = 0.5ms. So in that case you should set the ExposureTime value of the Machine Vision camera to 0.5x1000=500us
GigE Camera
When using one (or more) ethernet GigE camera and you don't have live images, the packets size and packets delay can be the problem.
Sometime you can encounter issues such as frames overlapping, so the previous image is partially over-imposed on the new one.
From programming software you may see errors such as failed to get image, getting image failed, incomplete frame.
Please optimize these values by slowly increasing them until you receive live images or no longer have problems with image.
On the galaxy software:
From Python you can set the values by adding these lines:
self.cam.GevSCPSPacketSize.set(8192) self.cam.GevSCPD.set(1000)
**(8192/1000 are sample values)
When using multiple camera you need to change the GevSCPS and GevSCPD to specific values, please refer to this page (bottom):Frame rate calculator
In best case situations, you where able to set the exposure time of the Machine Vision Camera to a value that your image is already bright enough. However in some cases this is not possible because there is not enough light or an object is moving and therefore the max exposure time is limited. In these cases you can use the gain. When the gain is increased too much, the image quality will degrade and noise will become visible.
You have 2 options:
Option 1: Use autogain (under Remote Device>AnalogControl>GainAuto) ,You can set this value to once or continuous.
Option 2: Set fixed gain (under Remote Device>AnalogControl>Gain) , by changing the Gain value. 0 Gain is the default value.
Step 5: setup the white balance of the Machine Vision Camera (only for color cameras)
A color Machine Vision Camera has a white calibration option. Color representation of a Machine vision camera is depending on the lightsource that is used. LED’s have a different color spectrum then a traditional light bulb or the sun. Often the image looks very green if the white balance is not correct. Therefore set the BalanceWhiteAuto feature to once or continuous. (Under RemoteDevice>AnalogControl>BalanceWhiteAuto)
As soon as the whitebalance is performed you will notice that the colors of the Machine Vision Camera are more realistic.