Table of contents
Introduction
Here we will explain the steps to build a development environment for the iPRO Camera SDK application using a Docker image. Also, in this tutorial, the SDK installation directory is described as ${SDK_DIR}
.
This tutorial only supports SDK ver.1.80 or later. Please note that it cannot be used with versions earlier than SDK ver.1.80.
Advance preparation
First, select the OS for development. Choose between Linux OS and Windows OS.
Development with SDK ver.1.80 is only supported in the GUI environment of Linux OS. We cannot support development in Windows OS or CUI environments even if problems occur. Please use it for trial purposes until you install Linux OS.
Preparing the Docker environment on Linux OS
The steps here are performed in the following environment.
OS: Ubuntu 22.04.2 LTS (Jammy Jellyfish)
Docker Engine version: 23.0.1
If your environment is connected to the Internet via a proxy, please configure the proxy server settings.
Before installing Docker, uninstall the old version.
sudo apt-get remove docker docker-engine docker.io containerd runc
Please check in advance whether your environment allows uninstallation.
Install an app that allows you to install Docker.
sudo apt-get update sudo apt-get install ca-certificates curl gnupg lsb-release
Add Docker's official GPG key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
If you get a curl certificate error here, ca-certificates may not be up to date or may not have been installed correctly.
sudo apt-get install --reinstall ca-certificates
Please check if reinstalling ca-certificates using the above command fixes the problem.
Set up a stable Docker repository.
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker Engine.
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
The docker command requires root privileges by default, so add the user to the docker group so that it can be executed with user privileges.
sudo gpasswd -a $(whoami) docker
Restart docker daemon or if that doesn't work, restart your PC.
sudo systemctl restart docker
Grant group write permission to docker.sock.
sudo chgrp docker /var/run/docker.sock
Test whether Docker can be used.
docker run --rm hello-world
If the following is displayed, the installation is successful.
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:ffb13da98453e0f04d33a6eee5bb8e46ee50d08ebe17735fc0779d0349e889e9 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
If not, please check if it succeeds below.
sudo docker run --rm hello-world
Now restart your PC. (Be sure to reboot.)
Next, copy the SDK zip file inside Ubuntu. Get the SDK here.
Copy the [SDK ZIP file] to any location such as home/[username]. Install unzip on Ubuntu.
sudo apt install unzip
The preparation of the Docker environment on Linux OS is now complete. Proceed to "Prepare the build environment".
Preparing the Docker environment on Windows OS(Windows + Docker Desktop)
When using Docker Desktop, there may be a fee depending on the number of employees and annual income of the company using it. Please see here(Japanese) for accurate information.
If you wish to use it, please refer to the following.
Reference official document(Japanese)
As of 2022/11/02, we have a track record of building a Windows + Docker Desktop environment in the Windows 10 21H2 environment. Please search for information on external sites to create an environment after 2022/11/02.
Preparing the Docker environment on Windows OS(Windows + WSL + Docker Engine)
Install WSL. WSL requires Windows 10 version 2004 or higher (build 19041 or higher) or Windows 11. Please see here(Japanese) for details.
Start Powershell and install WSL.
wsl --install
Install Ubuntu 20.04LTS.
wsl --install -d Ubuntu-20.04
Once the installation is complete, an Ubuntu window will appear, allowing you to set your username and password. Here the username is “ipro” and the password is “iPRO12345”.
Install Docker Engine according to the instructions on the site(Japanese) below. At this time, please perform the steps up to the 「Docker Engineのインストール」 chapter. (will not work after that)
Docker Engine インストール(Ubuntu 向け) | Docker ドキュメント (matsuand.github.io)
The startup method for Ubuntu installed with WSL is different because the startup software is sysvinit rather than systemd.
The docker command requires root privileges by default, so add the user to the docker group so that it can be executed with user privileges.
sudo gpasswd -a $(whoami) docker
Start docker with the following command.
sudo /etc/init.d/docker start
Execute the following command to check the operation. The PC you are running it on must be able to connect to the internet.
docker run --rm hello-world
It is OK if the result is displayed as shown below.
ipro@PC-HP2208N0013R:~$ docker run --rm hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 719385e32844: Pull complete Digest: sha256:fc6cf906cbfa013e80938cdf0bb199fbdbb86d6e3e013783e5a766f50f5dbce0 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
To automatically start docker when Ubuntu boots, configure the following settings. You can use the editor of your choice.
nano ~/.bashrc
Add the following line at the end:
sudo /etc/init.d/docker start sleep 3 sudo docker run --privileged --rm tonistiigi/binfmt --install all
When booting Ubuntu via WSL, we have confirmed a phenomenon where the qemu association disappears when the image is rebooted. The two lines below are provisional responses. If you configure this setting, you will be asked to enter your password when you start Ubuntu with WSL.
Copy the SDK zip file inside Ubuntu. Get the SDK here.
Open Windows Explorer and click Linux → Ubuntu-20.04 from the tree on the left.
Copy the [SDK ZIP file] to any location such as home/[username].
Install unzip on Ubuntu.
sudo apt install unzip
The preparation of the Docker environment on Windows OS is now complete. Proceed to "Prepare the build environment."
To shut down Ubuntu, open powershell and type “wsl --shutdown”.
Prepare the build environment
After installing Docker, prepare the environment for building the app. For a GUI environment, use Visual Studio Code.
・We cannot support operation in a CUI environment even if you contact us.
・If you develop using anything other than Visual Studio Code in a GUI environment, we cannot support it, so we recommend using Visual Studio Code.
・You must use Visual Studio Code 1.85 or earlier. Please obtain 1.85 from here. You will also need to downgrade the .devcontainer extension to 0.327.0.
For Windows, please download from the link below.
Visual Studio Code - Code Editing. Redefined
For Linux, download using the command below.
sudo snap install --classic code
You can downgrade the .devcontainer extension from below.
Next, install the Visual Studio Code Dev Containers extension. First, start Visual Studio Code. On Linux, you can start it by typing code in the terminal. Select extensions from the left menu and enter "Dev Containers" in the search window.
Select Dev Containers displayed in the list and press the Install button.
Reference information: Please refer to Developing inside a Container using Visual Studio Code Remote Development “Getting started”.
How to build the app
Extract the SDK file.
Since the SDK zip file has already been placed in any folder, extract it to any folder.
cd [any folder] unzip iPRO_CAMERA_SDK_Vx_xx_Container.zip
Please replace the zip file name with the obtained SDK file.
Change to the extracted directory.
cd ${SDK_DIR}
Using Visual Studio Code in a GUI environment
Start Visual Studio Code in ${SDK_DIR}
.
code .
Click the >< mark at the bottom left of the screen to open the command palette, then select "Reopen in Container".
Building the Docker image will begin according to .devcontainer/Dockerfile.
You can check the progress by clicking "Starting Dev container (Show logs)" at the bottom right.
Please be patient as it may take some time the first time.
Preparation is complete when "Dev Container: iPRO Camera SDK" is displayed to the right of the >< mark at the bottom left of the screen.
Open the Terminal tab at the bottom right. Make sure that "bash" is displayed on the right side.
If bash is not displayed, press the "+" to the right of the section that says "Dev Containers" and select bash.
Configure the environment before making.
If you want to build an extension app for ambaCV2X
source setup_env.sh ipro-ambaCV2X
If you want to build an extension app for ambaCV5X
source setup_env.sh ipro-ambaCV5X
When restarting the PC, you will need to configure the environment again before making. If you cannot make, please make sure that you have configured the environment.
Now you can build the app. As an example, if you want to build C/C++ skeleton_sample_app, move to the target directory and run make as shown below.
cd ${SDK_DIR}/src/adamapp/skeleton_sample_app/ make
Build the ambaCV2X and ambaCV5X extension apps into one file
This article explains how to combine ambaCV2X and ambaCV5X applications into one file. If there is no need to combine them into one file, there is no problem if you do not perform this. Build the ambaCV2X and ambaCV5X apps in advance. As an example, if you build Python's sqlite_app, the following files will be generated.
SQLiteSampleAppPy_V0_1_ambaCV2X.ext
SQLiteSampleAppPy_V0_1_ambaCV2X.zip
SQLiteSampleAppPy_V0_1_ambaCV5X.ext
SQLiteSampleAppPy_V0_1_ambaCV5X.zip
Now, move to the target directory as shown below and run make pack.
cd ${SDK_DIR}/src/adamapp-py/sqlite_app/ make pack
If successful, the ambaCV2X and ambaCV5X apps will be combined into one file.
SQLiteSampleAppPy_V0_1_ambaCV2X5X.ext
SQLiteSampleAppPy_V0_1_ambaCV2X5X.zip
The above files are available for ambaCV2X and ambaCV5X cameras.
If the ambaCV2X and ambaCV5X apps are combined into one file, the file size will increase accordingly. The app may not work if the file size is large. Please note that the file size limit varies depending on the camera model and condition.