WiFi Video Streamer

This example streams JPEG or raw images from the GAP8 to the host where they are displayed and colorized.

Prerequisites

Configuration

To select which mode (RAW or JPEG) change the code below in the wifi-img-streamer.c file.

typedef enum
{
  RAW_ENCODING = 0,
  JPEG_ENCODING = 1
} __attribute__((packed)) StreamerMode_t;

static StreamerMode_t streamerMode = RAW_ENCODING;

Building and flashing the example

To build and flash the example run the following:

$ cd aideck-gap8-examples
$ docker run --rm -v ${PWD}:/module aideck-with-container tools/build/make-example examples/other/wifi-img-streamer image
$ cfloader flash examples/other/wifi-img-streamer/BUILD/GAP8_V2/GCC_RISCV_FREERTOS/target.board.devices.flash.img deck-bcAI:gap8-fw -w radio://0/80/2M

Note: if you get Unable to find image 'aideck-with-autotiler:latest' locally, make sure that you have done this step of the getting started guide properly. Or replace it with the autotiler-less docker image bitcraze/aideck

Starting the viewer

In order to start the viewer, you will need to the python package of opencv. Since this has a conflict with the opencv-python-headless that is a requirement for the CFclient, it is important to make a python virtual environment like venv or an alternative.

Install opencv python in that python environment as:

$ pip install opencv-python

In order to view the images from the GAP8 connect to the WiFi access point on the deck and run the following:

$ cd aideck-gap8-examples/examples/other/wifi-img-streamer
$ python opencv-viewer.py

Then you should be able to see the raw/color or jpeg image in the viewer like this:

opencv viewer

Note: If you like to save the images, you can run the opencv-viewer.py with the --save flag.

Note: If you enabled your aideck to connect to a wifi point, you would need to check the console tab of the CFclient to retrieve the ipaddress of the aideck. Then you will need to use the -n with the ip address with the viewer script.