Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SNNF demo includes the following model samples

...

If you plan to use it, you must make the following modifications.

  1. Modify the linux/kernel/arch/arm64/boot/dts/sunplus/sp7350-dm.dts before building the C3V image, enable OV5640_IN4.

Code Block
languagediff
@@ -19,7 +19,7 @@
 //#define IMX708_IN5
 //#define OV5640_IN2
 //#define OV5640_IN3
-//#define OV5640_IN4
+#define OV5640_IN4
 //#define OV5640_IN5
 //#define OV5647_IN2
 //#define OV5647_IN3

...

Code Block
languagebash
root@ubuntu:/snnf_demo_release# echo 1 > /sys/module/videobuf2_dma_contig/parameters/remap
root@ubuntu:/snnf_demo_release# cat /sys/module/videobuf2_dma_contig/parameters/remap
Y

USB

The USB Camera supports USB 2.0 and USB 3.0. If you want to use USB 3.0, Set the jump cap in the figure below to the OFF state.

...

Set the jump cap in the above figure to the ON state and unplug the HDMI cable.

...

Set the jump cap in the above figure to OFF, power off the Panel connected to MIPI, and plug in the HDMI cable.

...

Code Block
languageplain
root@ubuntu:/snnf_demo_release# ls -al
total 24
drwxr-xr-x  5 10860 11400 4096 Nov  7 11:30 .
drwxr-xr-x  4 root  root  4096 Nov  7 11:17 ..
drwxr-xr-x  3 10860 11400 4096 Nov  7 10:52 bin
drwxr-xr-x 13 10860 11400 4096 Nov  7 10:54 dependency_libraries
-rw-r--r--  1 10860 11400 1887 Nov  7 11:30 snnf_demo_env.sh
drwxr-xr-x  5 10860 11400 4096 Nov  7 12:09 snnf_demo_src
  1. cd snnf_demo_src

Code Block
languageplain
root@ubuntu:/snnf_demo_release/snnf_demo_src# ls -al
total 80
drwxr-xr-x 5 10860 11400  4096 Nov  7 12:09 .
drwxr-xr-x 5 10860 11400  4096 Nov  7 11:30 ..
-rw-r--r-- 1 10860 11400  6770 Nov  7 11:00 main.cpp
-rw-r--r-- 1 root  root  40776 Nov  7 12:09 main.o
-rw-r--r-- 1 10860 11400  4653 Nov  7 11:00 makefile
drwxr-xr-x 2 10860 11400  4096 Nov  7 12:09 out
drwxr-xr-x 5 10860 11400  4096 Nov  7 10:53 snnf_demo
-rw-r--r-- 1 10860 11400  1803 Nov  7 11:00 snnf_demo_env.sh
drwxr-xr-x 5 10860 11400  4096 Nov  7 10:44 src
  1. Ensure that "CROSS_COMPILE" in the makefile is set to "NO"

Code Block
languagebash
PLATFORM_ROOT = ../../../../../../
PROJECT_ROOT = ../
OUT_DIR = out

CROSS_COMPILE := NO

ifeq ($(CROSS_COMPILE), YES)
###config toolchain
# TOOLCHAIN_PREFIX = $(PLATFORM_ROOT)/crossgcc/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
include $(PLATFORM_ROOT)/crossgcc/toolchain.config
TOOLCHAIN_PREFIX=$(TOOLCHAIN_AARCH64_PATH)/bin/$(TOOLCHAIN_AARCH64_PREFIX)-
CC = ${TOOLCHAIN_PREFIX}gcc
CXX = ${TOOLCHAIN_PREFIX}g++
else
CC = gcc
CXX = g++
endif
  1. make

  2. Run snnf_demo, please refer to the How to run SNNF Demo.

...

Code Block
languageplain
root@ubuntu:/snnf_demo_release# ls -al
total 24
drwxr-xr-x  5 10860 11400 4096 Nov  7 11:30 .
drwxr-xr-x  4 root  root  4096 Nov  7 11:17 ..
drwxr-xr-x  3 10860 11400 4096 Nov  7 10:52 bin
drwxr-xr-x 13 10860 11400 4096 Nov  7 10:54 dependency_libraries
-rw-r--r--  1 10860 11400 1887 Nov  7 11:30 snnf_demo_env.sh
drwxr-xr-x  5 10860 11400 4096 Nov  7 12:09 snnf_demo_src
  1. cd snnf_demo_src

Code Block
languageplain
root@ubuntu:/snnf_demo_release/snnf_demo_src# ls -al
total 80
drwxr-xr-x 5 10860 11400  4096 Nov  7 12:09 .
drwxr-xr-x 5 10860 11400  4096 Nov  7 11:30 ..
-rw-r--r-- 1 10860 11400  6770 Nov  7 11:00 main.cpp
-rw-r--r-- 1 root  root  40776 Nov  7 12:09 main.o
-rw-r--r-- 1 10860 11400  4653 Nov  7 11:00 makefile
drwxr-xr-x 2 10860 11400  4096 Nov  7 12:09 out
drwxr-xr-x 5 10860 11400  4096 Nov  7 10:53 snnf_demo
-rw-r--r-- 1 10860 11400  1803 Nov  7 11:00 snnf_demo_env.sh
drwxr-xr-x 5 10860 11400  4096 Nov  7 10:44 src
  1. Ensure that "CROSS_COMPILE" in the makefile is set to "YES", and modify the toolchain path("TOOLCHAIN_PREFIX") in the makefile

Code Block
languagebash
PLATFORM_ROOT = ../../../../../../
PROJECT_ROOT = ../
OUT_DIR = out

CROSS_COMPILE := YES

ifeq ($(CROSS_COMPILE), YES)
###config toolchain
# TOOLCHAIN_PREFIX = $(PLATFORM_ROOT)/crossgcc/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
include $(PLATFORM_ROOT)/crossgcc/toolchain.config
TOOLCHAIN_PREFIX=$(TOOLCHAIN_AARCH64_PATH)/bin/$(TOOLCHAIN_AARCH64_PREFIX)-
CC = ${TOOLCHAIN_PREFIX}gcc
CXX = ${TOOLCHAIN_PREFIX}g++
else
CC = gcc
CXX = g++
endif
  1. make

  2. Copy the newly compiled snnf_demo program and the folder named "dependency_libraries" from the snnf_demo_delease folder to C3V Linux.

Code Block
languagebash
/snnf_demo_release# cp snnf_demo_src/out/snnf_demo ==> <C3V Platform>/snnf_demo_release
/snnf_demo_release# cp snnf_demo_env.sh  ==>  <C3V Platform>/snnf_demo_release
/snnf_demo_release# cp dependency_libraries ==> <C3V Platform>/snnf_demo_release
  1. Run snnf_demo, please refer to the How to run SNNF Demo.

Setup the running environment

  1. Copy the newly compiled snnf_demo program and the folder named "dependency_libraries" from the snnf_demo_release folder to C3V Linux.

Code Block
languagebash
/snnf_demo_release# cp snnf_demo_src/out/snnf_demo ==> <C3V Platform>/snnf_demo_release
/snnf_demo_release# cp snnf_demo_env.sh  ==>  <C3V Platform>/snnf_demo_release
/snnf_demo_release# cp dependency_libraries ==> <C3V Platform>/snnf_demo_release

...

The path of resource files:dependency_libraries/snnf_release/resource

Code Block
languagebash
#cp dependency_libraries/snnf_release/resource/* ==> <C3V Platform>/etc/snnf/

...

Switch to the directory where the dependency_libraries are located, then set the environment variable.

...

  1. Before running snnf_demo, please refer to Setup the running environment.

  2. Run snnf_demo.

    Code Block
    languagebash
    root@ubuntu:/snnf_demo_release# ./snnf_demo -h
    Usage: ./snnf_demo [options]
    Options:
      -h, --help                Print this help message and exit
      -v, --video ARG           Specify the video file or device (default: /dev/video0, e.g., /dev/video40, /mnt/test.mp4)
      -f, --format ARG          Specify the video capture format (default: YUYV, only YUYV, UYVY, YUY2 are supported)
      -s, --size ARG            Specify the video capture size (default: 640x480, e.g., 1920x1080, 1280x720)
      -r, --framerate ARG       Specify the video capture frame rate (default: 30)
    1. Obtaining input data through the camera

      • Use default param

        Code Block
        languagebash
        root@ubuntu:/snnf_demo_release# ./snnf_demo
      • Set the video size/fps/YUV format by cmd.

        Code Block
        languagebash
        root@ubuntu:/snnf_demo_release# ./snnf_demo -v /dev/video40 -s 1280x720 -f UYVY -r 30
      • How to get the format supported by the camera?

        Code Block
        languagebash
        root@ubuntu:/snnf_demo_release# v4l2-ctl --list-formats-ext -d 40
        snnf_demo_camera_format.png
    2. Obtaining input data through the video file

      Code Block
      languagebash
      root@ubuntu:/snnf_demo_release# ./snnf_demo -v /etc/snnf/video/humanCount.mp4
  3. See the demo's effects please refer to the SNNF Demo Introduction.