Python

This section will show you how to run a Python sample in Windows.

Sample List

Samples are divided into five categories, Basic, Advanced, Util, Laser and UHP.

  • Basic: camera connection and basic capturing functions.

  • Advanced: advanced capturing functions.

  • Util: obtain information from a camera and set camera parameters.

  • Laser: for Laser, LSR and DEEP series cameras only.

  • UHP: for UHP series cameras only.

Requirements

  1. Download and install Mech-Eye SDK

  2. Download samples from GitHub: select Code ‣ Download as ZIP.

    ../../../_images/python_sample_download1.png
  3. Make sure that the version of Python installed is between 3.6.5 and 3.10

    Attention

    If Add Python to PATH was not selected during installation, please add the following two directories to the Path environment variable:

    • xxx\AppData\LocalProgramsPython\Python36\

    • xxx\AppData\LocalProgramsPython\Python36\Scripts\

  4. Connect a functioning camera

Instructions

Setting up Python

Press Win + R on the keyboard to open Run box. Type “PowerShell” and then press Ctrl+Shift+Enter to run PowerShell as Administrator.

  • Required: MechEyeAPI.

    pip install MechEyeAPI
    

    If an error occurs, please enter the command as below:

    pip install MechEyeAPI -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
    
  • Optional: open3d and opencv-python.

Samples

open3d

opencv-python

CaptureColorMap

CaptureDepthMap

CapturePointCloud

CaptureHDRPointCloud

CapturePointCloudROI

CapturePointCloudFromTextureMask

CaptureCloudFromDepth

pip install opencv-python

Run Sample Program

The example below shows how to run CaptureColorMap.py.

  1. Navigate to the directory where CaptureColorMap.py is located.

    cd  xxx\mecheye_python_samples\source\Basic
    
  2. Run the sample.

    python.exe CaptureColorMap.py
    
  3. After running the program, you will get colorMap in samples directory.

    ../../../_images/python_color.png