5. Python (Ubuntu)

This section describes how to run Python samples on Ubuntu.

5.1. 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 series cameras only.

  • UHP: for UHP series cameras only.

5.2. Requirements

5.3. Instructions

5.3.1. Environment Required for Installing and Running the Samples

  1. Install pip.

    sudo apt install python3-pip
    
  2. Install MechEyeApi.

    sudo pip3 install MechEyeApi
    
  3. Download and install Mech-Eye SDK

  4. Install OpenCV.

    sudo apt-get install libopencv-dev
    sudo apt-get install python3-opencv
    
  5. Install Open3D.

    sudo pip install open3d
    

5.3.2. Run the Samples

  1. Download the samples

    cd ~
    git clone https://github.com/MechMindRobotics/mecheye_python_samples.git
    
  2. Go to the folder of a sample. run the sample (taking ConnectToCamera.py as an example).

    cd ~/mecheye_python_samples/source/Basic
    sudo python3 ConnectToCamera.py
    

    The output is as follows:

       Find Mech-Eye device...
       Mech-Eye device index : 0
       ............................
       Camera Model Name: Mech-Eye Pro M Enhanced
       Camera ID:         NEC15221A3000001
       Camera IP Address: 192.168.xx.xx
       Hardware Version:  Vx.x.x
       Firmware Version:  Vx.x.x
       ............................
    
       Please enter the device index you want to connect: 0
       Connected to the Mech-Eye device successfully.
       Disconnected from the Mech-Eye device successfully.
    
    
    When running the sample, please select the number of the camera to connect according to the prompt, and wait for the sample to finish running.
    

    Attention

    • For samples that involve point cloud capturing, a regular user is unable to write point cloud files, so please use the sudo command to run the sample as the admin.

    • For samples that involve image and point cloud capturing, when finish running the sample, the image and point cloud data is by default saved to the folder of the sample.