USA-Flag European-Flag

3 year camera warranty

Strong and reliable machine vision cameras

Cameras certified by TÜV Rheinland

Excellent support

Fair prices


Getting Started with our Python SDK

How to use a Python sample to acquire images with Python script using PyCharm Python is a programming language you can use to create your machine vision program. In this article we show you how to download, install and use a python sample to acquire images. We are using the program PyCharm.

Prerequisites:

First follow this guide to make sure you have our windows SDK installed and you are able to acquire images from the camera using it: Quickstart 5 steps to easily install a machine vision camera

After installing the Daheng SDK several samples are provided, those are placed in the directory C:\Program Files\Daheng Imaging\GalaxySDK\Samples\Python SDK

Download Python (3.8 in this example)

You can download Python 3.8 executable installer at the address below. Please make sure you select the “Windows x86-64 executable installer”
https://www.python.org/downloads/release/python-380/
 

Once the file is downloaded, double click to open it. At the following pop-up window, make sure the 2 options at the bottom are flagged: “Install launcher for all users (recommended) and Add Python 3.8 to PATH”.



Click “Install NOW”
 


Close the next window, Python is now installed.
 

Install Pycharm (Optional)

Download and install PyCharm: https://www.jetbrains.com/pycharm/download/#section=windows

Make sure you download the community (free) edition of PyCharm.
 


Once downloaded, double click on the file to run the installer.
When you see the window as shown below, click on next.
 

 
After that, the second window will pop up. If you want, you can change the installation location. When the location is good, click on next.
 


On the following page make sure the correct options are selected:
  1.     64-bit launcher
  2.     Add launchers dir to the PATH
  3.     .py
If these options are selected, continue by clicking "next"




Click on Install. When the installation is completed reboot the pc.


 
After reboot, open Pycharm. You must agree to the Privacy Policy and click continue.
 


You can choose now whether you do or do not want to send Statistics.
 


You will be shown the customization page, you can choose the theme for PyCharm, or click on “Skip remaining and set Defaults”.
 

Running our Samples

Now click on the button + New Project:


 
Make sure all the options are selected like here below (beside username in the paths course), click “create”


 
Wait for the program to finish “Creating Virtual Environment”
In the top toolbar go to file/settings/


 
Expand the menu Project: pythonProject and click on Python Interpreter:
 


Click on the + sign on the right side of the page.
 


Add the following modules by searching them by name, selecting them one by one and clicking “install package” on the bottom
  1.     Numpy
  2.     Pillow
  3.     opencv-python
 

Here you can see all packages installed as you should have:


 
When done close the interpreter packages window, click ok.

Within Pycharm > go to File, Open, and select C:\Program Files\Daheng Imaging\GalaxySDK\Samples\Python SDK\GxSingleCamColor.py press OK.
 


Execute it Selecting in the Menu toolbar Run and again run. Choose GxSingleCamColor.py
(allow trough firewall if asked)
*Please note that GXIPY folder should be on the location of the scripts
 


The sample will run. Besides performing the action in the sample (take picture, show it, etc.) it will also show the result of the operation within Pycharm. Return errors or warnings If any.
 


If you have followed these steps you are now able to aquere images by running python scripts in Pycharm.

If you have any questions about downloading, installing and running Python and PyCharm, make sure to contact our Technical Support division. They are always happy to help you out.
Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
January,February,March,April,May,June,July,August,September,October,November,December
Not enough items available. Only [max] left.
Add to WishlistBrowse WishlistRemove Wishlist
Shopping cart

Your cart is empty.

Return To Shop

Add Order Note Edit Order Note
Estimate Shipping
Add A Coupon

Estimate Shipping

Add A Coupon

Coupon code will work on checkout page