ACQUIRING IMAGES BY USING THE PYTHON SAMPLE WITH PYTHON SCRIPT USING PYCHARM

How to use a Python sample to acquire images with Python script using PyCharm

Python is a programming language that can be used for creating machine vision programs. This article guides you through downloading, installing, and using a Python sample to acquire images using the program PyCharm. Follow these simple steps to get started.

DOWNLOAD AND INSTALL REQUIRED SOFTWARE

To get started, download and install our Windows SDK to acquire images from the camera. Follow the instructions provided in this guide to make sure you have the SDK installed: https://www.get-cameras.com/QuickStart-5-steps-to-easily-install-a-machine-vision-camera-and-acquire-an-image.

Once the Daheng SDK is installed, you can find several samples in the directory C:\Program Files\Daheng Imaging\GalaxySDK\Samples\Python SDK

DOWNLOAD PYTHON 3.8 EXECUTABLE INSTALLER AND INSTALL IT.

Next, download the Python 3.8 executable installer from https://www.python.org/downloads/release/python-380/ and select the “Windows x86-64 executable installer” option.

Double-click the downloaded file to open it and ensure that the “Install launcher for all users (recommended)” and “Add Python 3.8 to PATH” options are selected.



Click “Install NOW” and wait for the installation process to complete.


Close the next window, Python is now installed.
 

INSTALL PYCHARM, THE PROGRAM USED TO RUN PYTHON SCRIPTS.

Download and install PyCharm, the program used to run Python scripts. Make sure to download the community (free) edition of PyCharm from https://www.jetbrains.com/pycharm/download/#section=windows.


Once downloaded, double-click on the file to run the installer.
Follow the prompts to install PyCharm.
 


Ensure that the options “64-bit launcher,” “Add launchers dir to the PATH,” and “.py” are selected.


Click on Install. Once installation is complete, reboot the PC.


 
After reboot, open PyCharm. 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”.
 

RUN THE PYTHON SCRIPT SAMPLE WITH PYCHARM

Now that PyCharm is installed, you can run the Python script sample. Click on the button + New Project button and ensure that all the options are selected.


 
Wait for the program to finish “Creating Virtual Environment”
In the top toolbar go to file > settings and expand the menu for Project

In the top toolbar go to file > settings and expand the menu for Project: python Project.

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”:

  1.     Numpy
  2.     Pillow
  3.     opencv-python

 

Here you can see all packages installed.

When done close the interpreter packages window, click ok.

WE CAN NOW RUN THE PYTHON SAMPLE

Next, go to File > Open and select C:\Program Files\Daheng Imaging\GalaxySDK\Samples\Python SDK\GxSingleCamColor.py. Click OK and execute the script by selectin Run > GxSingleCamColor.py from the Menu toolbar.

Click OK and execute the script by selectin Run > GxSingleCamColor.py from the Menu toolbar.
*Please note that GXIPY folder should be on the location of the scripts
 
The Python script sample will run, showing the result of the operation within PyCharm. Any errors or warnings will also be displayed. 



If you have followed these steps you are now able to acquire 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