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.
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.
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:
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”.
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
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 through 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 or fill in the form below. They are always happy to help you out.