Cross-compilation development environment for host computer and camera

Percipio network cameras support to run the customized embedded applications within the camera, and allow users to fully utilize their internal computational resources for image pre-processing or application logic processing. For specific camera models that support embedded applications, please consult Percipio technical support. .. Percipio network cameras allow users to fully utilize their internal computational resources for image pre-processing or application logic processing.

Note

USB depth cameras do not support users running embedded applications within the camera.

Compiling sample programs

  1. Download Camport SOC SDK, link: https://github.com/percipioxyz/camport3_soc.git

  2. Execute ./build.sh in the SDK root directory. After execution is complete, you will find the generated executable file RawFetchFrame in the ./build/bin directory.

  3. Copy the executable file to the camera’s user application folder using scp or sftp. Please refer to Installation of programs and library files.

Compiling user programs

  1. Refer to the SDK’s ./Sample/RawFetchFrame, develop the application after creating a user program directory in the Sample directory.

  2. Modify ./Sample/CMakeLists.txt, add the user program directory path in ALL_SAMPLES.

  3. Execute ./build.sh, after execution is completed, an executable file will be generated in the ./build/bin directory.

  4. Copy the executable file to the user application folder of the camera using scp or sftp , please refer to Installation of programs and library files.

Compiling programs using Opencv

  1. Refer to the SDK’s ./Sample/RawFetchFrame, develop the application after creating a program directory using OpenCV in the Sample directory.

  2. Modify ./Sample/CMakeLists.txt, add the program directory path that uses OpenCV in ALL_SAMPLES.

  3. Execute ./build.sh opencv, after execution is completed, an executable file will be generated in the ./build/bin directory.

  4. Copy the executable file to the user application folder of the camera using scp or sftp . At the same time, copy the required OpenCV library to the camera. The OpenCV library is located in the ./ThirdPartyLib/Opencv-3.4/lib directory. Please refer to Installation of programs and library files.

Installing programs and library files

  1. Using scp or sftp command, copy the files that need to be installed to the camera’s /mnt/ram directory:

    scp ur_FILES percipio@XXX.XXX.XXX.XXX:/mnt/ram
    
  2. Use putty or other terminals to remotely log in to the camera:

    ssh percipio@XXX.XXX.XXX.XXX
    
  3. Extract the compressed file inside the camera, and copy the executable file and shared libraries to the corresponding directory under /usr/local :

    cd /mnt/ram
    cp ur_ELFS_FILENNAME /usr/local/bin
    cp ur_lib*.so /usr/local/lib/
    cp ur*config /usr/local/etc
    
  4. Execute the sync command to permanently save the modifications to the flash.

Note

  1. The copying process is divided into two steps. First, it is necessary to copy to the /mnt/ram directory to prevent errors due to insufficient file system space during the decompression process if the application is a compressed package.

  2. When there are few files, you can choose not to use compressed files. However, when there are many files, it is recommended to pack them and then copy them to the camera for decompression. Currently, the camera supports several types of compressed files: tar, tar.gz, tar.bz2, and unencrypted zip files. They can be decompressed using the following commands: tar -xvf, tar -xzvf, tar -xjvf and unzip.

  3. The maximum storage capacity for the user’s secondary development directory /usr/local is 25MB.

  4. After decompressing the file, be sure to copy it to the user directory, otherwise the content in /mnt/ram will be lost after rebooting.

  5. The library file libtycam.so used in development is already included in the camera file system, so users do not need to copy it again to /usr/local/lib.

  6. Users need to use the command chmod a+x ELFS_FILENNAME to grant execution permissions to applications or scripts.

  7. XXX.XXX.XXX.XXX is the IP address of the target camera.

Setting program to start up on boot

  1. Login camera

    ssh percipio@XXX.XXX.XXX.XXX
    
  2. Modify the startup script

    vi /usr/local/etc/start_app.sh
    
    1 #!/bin/bash
    2 # Created By:      Leon Zhou
    3 # Created Time:    2019-04-26 20:29:12
    4 # Modified Time:   2019-04-26 20:33:22
    5 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
    6 export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
    7
    8 #Add your app start command below
    

    Add the startup command for your app on line 8, for example:

    1 #!/bin/bash
    2 # Created By:      Leon Zhou
    3 # Created Time:    2019-04-26 20:29:12
    4 # Modified Time:   2019-04-26 20:33:22
    5 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
    6 export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
    7
    8 #Add your app start command below
    9 /usr/loca/bin/your_app
    
  3. Execute the sync command in the console to write to the storage system and reboot the device.

Warning

  1. If a reboot of gevcam is required during the debugging process, you need to run killall percipio_gev_disd.

  2. Do not add statements like reboot in the startup script!

Network Configuration

  1. IP settings

    By default, the system uses DHCP mode to obtain an IP address dynamically.

    • Static IP settings

      Log in to the camera to execute the instructions below, or modify the configuration file below in the application or script to configure the IP. It is not recommended to use ifconfig or other methods to directly modify the IP to avoid confusion in camera IP management. After modifying the configuration file using this method, it will be permanently stored in the camera and take effect after rebooting.

      echo "your_ip" > /etc/device_ip
      echo "your_gw" > /etc/device_gw
      echo "your_netmask" > /etc/device_netmask
      
    • Dynamic IP settings

    echo "" > /etc/device_ip
    echo "" > /etc/device_gw
    echo "" > /etc/device_netmask
    

    Warning

    1. Please be cautious when modifying the IP address, subnet mask, and gateway; setting incorrect values may result in being unable to connect to the camera.

    2. Be sure to execute the sync command in the console to write the changes to the storage system and reboot the device.

  2. NTP server configuration

    Tip

    Before configuring the NTP server, you need to set the camera’s time synchronization method to NTP time synchronization. For more details, please refer to Time synchronization settings.

    The camera supports NTP time synchronization and the default NTP servers used are: ‘cn.ntp.org.cn’, ‘0.ubuntu.pool.ntp.org’, ‘1.ubuntu.pool.ntp.org’.

    If the user has set up an NTP server, they can execute the following command to add the IP or domain name of the NTP server in /etc/ntp_server :

    echo your_ntp_server > /etc/ntp_server