How to install a machine vision camera and acquire an image in 5 steps

We explain in 5 simple steps how to install a machine vision camera from Daheng Imaging. We will use a windows pc, USB3, and GigE Machine Vision Camera to explain the installation. If you are using an operating system other than Windows to connect a machine vision camera, please check our other articles.

Step 1: Windows SDK installation for a machine vision camera

!!! Before or during SDK's installation, DO NOT connect a Machine Vision Camera !!!

Start by downloading the SDK for our Machine Vision Cameras. The latest version of our Windows SDK is located in our download section. As soon as the download is completed you can install the Windows SDK.

After the windows SDK is finished the following documentation and programs are installed:

  • The software Galaxy viewer
  • All camera documentation is located in the folder: C:\Program Files\Daheng Imaging\GalaxySDK\Doc
  • Programming examples are located on C:\Program Files\Daheng Imaging\GalaxySDK\Samples

For more programming examples in different languages for our Machine Vision Cameras, check our download page.

Step 2: Connect and setup machine vision camera to pc

Now that the SDK is installed, you may connect the Machine Vision Camera to the PC.

  • USB3 vision cameras: please double check that your PC has a USB3 port.
  • GigE vision cameras: please double check that the GigE camera is powered. When the LED light on the backside of the GigE camera is blinking / on, the camera is powered.  


Step 2b: Setup of industrial GigE Vision camera

This step is only applicable for GigE machine vision cameras.

  • program the correct IP address, using the GigE IP Configurator GxGigeIPConfig.


  • Double check the firewall settings. The firewall should not block the Galaxy SDK software.

    If you are using the default windows firewall you can check it by following these steps:
    - 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.


Now the setup of the industrial machine vision camera is completed and you are ready to program it.


Step 3: Setting the machine vision camera exposure time

Start the Daheng Galaxy Viewer software and double click on the machine vision camera you want to connect to. This is found under the appropriate device interface type highlighted in blue below.


Next, double click on the machine vision camera you are connected to within the Galaxy SDK. You can start acquiring images by pressing the play button (scroll down for the screenshot, where it is marked in yellow, in the top left corner). Your image is most likely too dark or too light, so we first have to setup the exposure time of the Machine Vision Camera. Please make sure you have mounted a lens on the machine vision camera and removed the lens cover.

If you just want to get familiar with the machine vision camera, we advise to use the camera in a well illuminated environment. When the camera is built into the final product, please use the light source of the final product.

There are 2 options to set the exposure time of the machine vision camera:

Option 1: Use autoexposure of machine vision camera
The camera will automatically change the exposure time depending on the environment. You have to set the ExposureAuto feature to once or continuous. This setting can be found under: Remote device>Acquisition control>ExposureAuto

Option 2: Set a fixed exposure time of machine vision camera
The camera will be set to a fixed exposure time. This setting can be found under Remote device>Acquisition control>ExposureTime.

Please note that the exposure time is in us. So 40000us = 40ms. When increasing the exposure time the image will get brighter. However, it can influence the framerate and motion blur.

The calculation of the max framerate of Camera is:  1000/exposuretime (ms). If you take an exposure time of 40ms, the max framerate will be 1000/40=25fps. If you are capturing an image of a still object, please increase the exposure time until you have the desired brightness.

Note: Motion blur of Machine Vision Camera
When the product you are inspecting is moving, the machine vision cameras exposure time is critical. If the exposure time is too long the image will get blurry. When calculating the motion blur of the moving object, many customers set their maximum movement as no larger than half a pixel. For example, if you have a field of view of 1000x600mm and the Machine Vision Camera has a resolution of 1000x600pixels, you will have 1pixel/1mm. If the product moves 1m/second this will be 1000mm/second. Motion blur will occur if the object moves with more than 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. In this example you should set the ExposureTime value of the Machine Vision camera to 0.5x1000=500us.

Note: GigE Vision Camera does not provide live image
If you are experiencing the following issues with your GigE Vision camera, the packets size and packets delay can be the problem:

  • You don't have live images.
  • You have frames overlapping, so the previous image is partially over-imposed on the new one.
  • In your programming software you have errors like failed to get imagegetting image failedincomplete frame.

In our Galaxy SDK you can optimize these values by slowly increasing them until you receive live images or no longer have problems with image acquisition. See yellow marking in screenshot below.

In Python code you can set the values by adding these lines:
**(8192/1000 are sample values)

When using multiple cameras you need to change GevSCPS and GevSCPD to specific values. Please refer to this page (bottom): FRAME CALCULATOR;

More information can also be found in our article about connecting multiple GigE Vision cameras to one ethernet-port.

Step 4: Setup gain of machine vision camera 

Typically you only need to have the exposure time set to get a sufficient image using the machine vision camera. However, in low light or short exposure time situations you need to use the gain. When the gain is increased too much, the image quality will decrease and noise will become visible.

There are 2 ways to set the gain of a machine vision camera.

Option 1: Use autogain of the machine vision camera (under Remote Device>AnalogControl>GainAuto). You can set this value to once or continuous.

Option 2: Set fixed gain of the machine vision camera (under Remote Device>AnalogControl>Gain) by changing the Gain value. 0 Gain is the default value.

Step 5: Setting the machine vision camera white balance (only for color cameras)

A color machine vision camera has an option to calibrate the white balance. The color representation of a Machine vision camera depends on the light source that is used. LED’s produce a different color than a traditional light bulb or the sun. With factory settings the image looks very green when the white balance is not set. You can set the BalanceWhiteAuto feature to once or continuous (Under RemoteDevice>AnalogControl>BalanceWhiteAuto).

As soon as the white balance is performed you will notice that the colors of the machine vision camera are more realistic.

Now you have acquired a nice image with you machine vision camera. If you have further questions, don’t hesitate to contact us.