Python (Linux Platform)

Download Camport Multi_language SDK

Choose any of the following methods to download Camport Multi_language SDK:

  • Access https://github.com/percipioxyz/camport_multi_language.git using a browser and download the Camport Multi_language SDK.

  • Use the git command to obtain a local copy: Open the terminal, switch to the working directory where the SDK should be stored, and enter the git clone command to clone the remote repository.

    git clone https://github.com/percipioxyz/camport_multi_language.git
    

Sample Program Descriptions

The sample programs are stored in the python folder in the root directory of the SDK. For detailed descriptions of the sample programs, refer to Sample Program Descriptions: Python.

Install Dependencies

Before compiling, please:

  1. Install Python.

  2. Open the terminal and run the following commands to install NumPy and OpenCV:

    pip install numpy
    pip install opencv-python
    
  3. Download the SWIG source code (https://www.swig.org/download.html) to your host computer, extract it, and switch to the source code directory. Then, execute the following commands in order:

    ./configure
    make
    sudo make install
    

Compile Sample Programs

To compile the sample programs, do the following:

  1. Open CMakeLists.txt in the camport_multi_language directory, set the target language to PYTHON, and set the Python version to match the local Python version.

    ../_images/editcmakelistpythonlinux.png
  2. Open the terminal in the camport_multi_language directory and execute the following commands:

    mkdir build
    cd build
    cmake ..
    make
    sudo make install
    
    ../_images/pythonlinuxmake.png
  3. Switch to the camport_multi_language/camport3 directory and execute the following command:

    sudo cp lib/linux/lib_x64/libtycam.so* /usr/lib/
    

After compilation, switch to the /usr/local/PYTHON directory according to the interface prompt and run the generated python file.

../_images/linuxrunpython.png