This document will provide a quick tour through the |lib_camera| repository. It will go through the process of building the example application and taking a photo in RAW8 format.
- xcore.ai evaluation kit (XK-EVK-XU316)
- Camera module
- Camera ribbon connector
- 2x Micro USB cable (Power supply and xTag)
- xTag debugger and cable
- XTC tools (15.2.1): `SW_TOOLS`_
- CMake
- Python 3.9 or later
This repository is structured as a sandbox. It will install dependencies above the current folder. So the folder structure should look like this:
sandbox
|
|--- lib_camera (current repository)
|--- xscope_fileio
|--- xcommon_cmake
|--- other_libs...
Clone the following repositories using the commands:
git clone https://github.com/xmos/lib_camera.git
git clone https://github.com/xmos/xscope_fileio.git ../xscope_fileio
git clone https://github.com/xmos/xcommon_cmake.git ../xcommon_cmake
Install a Python virtual environment and install the Python dependencies:
pip install -r requirements.txt
pip install -e ../xscope_fileio
This repository uses xcommon_cmake
and xmake
as a build system.
xcommon_cmake
is a collection of CMake functions and macros that are used to build XCORE.AI projects. xcommon_cmake/doc.xmake
is a fork of make, native to XTC tools. xmake-manual.
In order to build the examples, you need to set the XCOMMON_CMAKE_PATH
environment variable to the path of the xcommon_cmake
repository.
.. tab:: MacOS and Linux .. code-block:: console # MacOS and Linux export XMOS_CMAKE_PATH=/home/user/xcommon_cmake
.. tab:: Windows .. code-block:: console # Windows set XMOS_CMAKE_PATH=C:/Users/user/xcommon_cmake
On Windows the host app of xscope_fileio
is not built by default, the user needs to build it manually.
Ninja can be used as a build system for building the host application.
Please follow the steps below:
- Make sure you have a C compiler installed. We recommend using VS tools with a
cl
compiler. - Open a terminal or command prompt.
- Build the host app using the following commands:
cmake -G Ninja -S ../xscope_fileio/host -B ../xscope_fileio/host
ninja -C ../xscope_fileio/host
Your xscope_fileio
host app is now ready to use.
In order to build any example, go to the example that you want to build and follow the instructions in the README.rst
file.
Alternatively, you can build all the examples using the following command:
python examples/build_examples.py
Below we demonstrate how to build and run the take picture RAW camera demo.
This demo uses the RAW camera module to capture a RAW8 image and save it to a .raw file.
Then, this image can be decoded using the Python script python decode_raw8.py
.
- Ensure that the camera is connected to the board.
- Connect the Power Supply and xTag debugger.
- Build the example using the following command inside the
examples/take_picure_raw
folder:
cmake -G "Unix Makefiles" -B build
xmake -C build
- Run the example using the following command in the example folder:
python python/run_xscope_bin.py \
examples/take_picture_raw/bin/take_picture_raw.xe
- The camera should communicate with the host and save the image to a .raw file
- To decode the image use the following command:
python python/decode_raw8.py
- The decoded image should be displayed on the screen