Python (Windows 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

Install Python (V3.8)

  1. Download Python (V3.8) from Python Official Website .

  2. Double click the installation package, select “Add Python to PATH”, and click “Install Now”.

    ../_images/python-load.png

    Install Python

Install Numpy and OpenCV

pip install numpy
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

Install SWIG (V4.0.2)

  1. Download the Windows pre-built library from SWIG Official Website .

  2. Unzip the downloaded file and configure the system environment variable.

    Right click This PC > Properties > Advanced System Properties > Environment Variables, then add the local SWIG executable file path to the Path variable in the Environment Variables window.

    ../_images/setpathforswig-en.gif

    SWIG Environment Configuration

Install CMake (V3.15.0)

  1. Download Windows installation package from CMake Official Website .

  2. Double click the downloaded .msi installer file and follow the wizard to complete the installation. Important: Select the option “Add CMake to PATH” during the installation process to configure system environment variables automatically.

Cmake-configuration

CMake Environment Configuration

  1. Open Command Prompt and execute the following command to validate installation success by checking the version information:

    cmake --version
    

Install Visual Studio

Download and install Visual Studio .

Compile Sample Programs

Follow the steps below to compile the sample programs:

  1. Open the CMakeLists.txt in the “camport_multi_language” directory, set the target language to PYTHON, set the Python version to match the local Python version, and set the SWIG’s local path.

    ../_images/editcmakelistpython.png

    Tip

    If the compilation is interrupted due to SWIG path or version issues, you can manually select the correct SWIG path or version. Once configured, you can proceed with the compilation without needing to exit.

    ../_images/Selectionpath.png
  2. Create a new folder in the “camport_multi_language” directory and name it python_build_x64.

  3. Start cmake-gui, specify the source code directory as camport_multi_language, and specify the build output directory as camport_multi_language/python_build_x64.

    ../_images/specifydirectorypython.png
  4. Click on Configure, select the Visual Studio version and X86/X64 version settings.

    ../_images/clickcongifure_CP.png
  5. Click on Generate.

  6. Click on Open Project to open the project, then select Release in the Visual Studio menu bar and click on Build > Build Solution in order.

    ../_images/pythonmake-en.png

After compilation, copy the generated dynamic libraries pcammls.py and _pcammls.pyd, as well as the tycam.dll, to the camport_multi_language/python directory. Open Windows PowerShell and run the generated python file.

  • pcammls.py: “python_build_x64/swig/swig/_output”

  • _pcammls.pyd: “python_build_x64/swig/Release”

  • tycam.dll: “camport3/lib/win/hostapp/x64”

../_images/pythonrun.png