
Sponsored by: NVIDIA
Image processing with the OKdo Nano C100 Developer Kit and CSI Cameras
The OKdo C100 Developer Kit (252-0055) is based on the NVIDIA® Jetson Nano™ module fitted to a custom development board.
This small, but powerful and affordable AI vision processing board is a great place to start for makers, learners, and embedded developers. It lets you run multiple neural networks in parallel for applications like image classification, object detection, segmentation, and speech processing.
Key features include a quad-core ARM A57 CPU, 128-core NVIDIA Maxwell GPU, 4GB 64-bit LPDDR4 RAM, 16GB on-board eMMC storage, dual MIPI-CSI camera connectors, Gigabit Ethernet and a 40-pin GPIO header plus an M.2 E key slot for optional WiFi support.
RS provides an official OS image download that is based on Ubuntu Bionic LTS with NVIDIA Jetpack tools pre-installed.
We previously showed you how to get started with the OKdo C100 Nano Developer Kit and CSI Cameras. This guide will help to familiarise you with AI Vision Processing through setting up your OKdo C100 with a CSI camera and demonstrates real-time video facial recognition with Python, C++ and OpenCV.
Difficulty: Medium | Time: 1 Hr | Steps: 8 | Credits: None | License: NVIDIA EULA |
Part | Description | RS Stock Number |
---|---|---|
Jetson Nano C100 | Okdo NVIDIA® Jetson Nano C100 Developer Kit Module | (252-0055) |
Power supply | RS PRO 24W Plug-In AC/DC Adapter 5V dc Output, 4A Output | (904-8474) |
Camera | Raspberry Pi, Camera Module , CSI-2 with 3280 x 2464 pixels Resolution | (913-2664) |
SD Card | Sandisk 32 GB MicroSDHC Micro SD Card | (283-6581) |
PC | Host computer Windows/Mac/Linux | — |
Step 1: Hardware
There aren’t many requirements for this initial setup.
Just connect a USB mouse and keyboard to the USB 3.0 sockets on the unit and attach a monitor using a full-size HDMI cable. I like to use the RS Portable 15.6 inch LCD monitor (231-4565) for my setups but you can use any HDMI-compatible monitor.
A power supply is not included with the kit. The minimum requirement is a 5V / 2A micro-USB supply but that will limit the speed and number of cores that you can use. For AI processing go for a good quality 5V / 4A supply like this one from RS Pro (904-8474) with a barrel jack connector. This will allow you to run the C100 in full power mode.
Finally, attach an Ethernet cable to your LAN/router so that you can update the software and access GitHub.
Step 2: OS
Visit the RS Software and Downloads Hub and download the latest C100 system image which is based on Ubuntu Bionic Long Term Release.
There is no need to decompress this if you flash it with BalenaEtcher.
Insert a good quality 32GB or larger (AI software is quite voluminous) microSD card into your card reader and flash the card. This takes a while as the image is just over 4GB in size.
When it’s finished, eject it properly from your PC system and pop it into the card socket underneath the large heatsink on the C100, ready to boot up, but don’t do this just yet.
Step 3: Camera
The C100 is compatible with the Raspberry Pi V2 camera modules which attach using the supplied FPC ribbon cables. I used an extra long one in my setup to make positioning the camera more flexible.
You can attach up to 2 cameras to the C100, I’m using the CAM0 CSI socket in the picture, which is closest to the barrel jack.
Pull gently on the white tab to open the connector and slip the cable in with the blue marker facing away from the board. Then press down evenly to locate the connector tab.
Step 4: Boot
Check that everything is connected and plug in the power supply to run the first boot. This can take a couple of minutes as the OS initialises for the first time, so be patient.
You should see the green power LED on and the Nvidia boot screen will appear on the monitor, then things may go dark for a while, just stay calm and let the OS do its thing.
When everything is finished you’ll be presented with the NVIDIA EULA which you must accept to proceed. The software contained in the kit is under licence from NVIDIA.
Now follow the prompts to setup your username and password etc. Accept the defaults for the system size and power settings as they are sane.
The system will then configure itself and when you log in you'll be landed on a very jazzy Ubuntu Bionic desktop running under Linux 4.9 with a whole sweetshop of NVIDIA AI tools pre-installed. Your AI vision processing journey is about to start!
Step 5: Camera Test
The Raspberry Pi camera module is supported out of the box with the drivers built into the C100 image so it should “just work” - let's hope so!
Just to make sure everything is in order before we get into something more complicated, run a basic test to stream video from your camera. This uses the Gstreamer library that is already installed, to open a window and display a live video stream.
The command is all one long string, but I have broken it up with the backslash line endings so you can see it on multiple lines.
gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! \
'video/x-raw(memory:NVMM), \
width=3280, height=2464, framerate=21/1, format=NV12' ! \
nvvidconv flip-method=2 ! 'video/x-raw, \
width=816, height=616' ! \
nvvidconv ! nvegltransform ! nveglglessink -e
Tip you can copy and paste it into the Terminal from here: https://github.com/milnepe/csi-camera/blob/master/gstreamer-csi-test.sh
If all’s well you will see yourself in the popup window on the screen
If the image is upside down or on its side change the flip-method to rotate it:
(0): none – Identity (no rotation)
(1): counter-clockwise – Rotate counter-clockwise 90 degrees
(2): rotate-180 – Rotate 180 degrees
(3): clockwise – Rotate clockwise 90 degrees
(4): horizontal-flip – Flip horizontally
(5): upper-right-diagonal – Flip across upper right/lower left diagonal
(6): vertical-flip – Flip vertically
(7): upper-left-diagonal – Flip across upper left/low
Use Ctrl + C to close the window.
Step 6: C++ IMAGE PROCESSING
Now we know the camera is working, it's time to test out some C++ video processing. If you can master this, it’s possible to program all sorts of applications to take a video feed, modify it and output the result. The code uses OpenCV which is, according to them, the world's biggest computer vision library.
Clone the samples from the Github to get all the latest code:
git clone https://github.com/LetsOKdo/csi-camera.git
In a Terminal, we will compile simple_camera.cpp (again the g++ text is all one long c++ incantation, split over several lines:
cd csi-camera
g++ -std=c++11 -Wall -I/usr/include/opencv4 simple_camera.cpp \
-L/usr/lib/aarch64-linux-gnu -lopencv_core -lopencv_highgui \
-lopencv_videoio -o simple_camera
You may need to open simple_camera.cpp with a Text Editor and edit the flip_method in the main function to get the right orientation for your camera mounting.
Click the top left green Finder icon on the desktop and type text to reveal the installed editors and take your pick from!
int main()
{
…
int framerate = 60 ;
int flip_method = 2;
Now run the output, simple_camera from the Terminal with:
./simple_camera
A new window will open displaying the video image. Hit Ctrl + C to terminate the application and close the window.
Step 7: PYTHON IMAGE PROCESSING
The final example to try is facial recognition. This uses several Python libraries and Gstreamer to recognise facial features, like the head, eyes, nose and mouth which it highlights with coloured bounding boxes in the video image.
This takes a powerful processor to do this in real-time, so it demonstrates some of the capabilities of the Jetson module that’s embedded on the C100 board.
We do need to install some Python libraries for this to work. Install numpy and libcanberra modules:
sudo apt install python3-numpy libcanberra-gtk-module
Now you should be able to run the face_detect.py script from the Terminal where the first parameter is the camera slot (0) and the second the flip-method (2) in this case:
python3 face_detect.py 0 2
Close window to exit
Step 8: SAFE SHUTDOWN
When you finish it’s important to shut down the system properly. Don’t just pull the plug if you want to avoid corrupting the SD card image.
Click the gear icon in the top RH side of the Title Bar and select Shutdown.
After a few seconds, the green power LED will go off and the power connector can be removed. The system is now powered off.
Tip: Allow the power supply to discharge before reconnecting otherwise the C100 will not boot
Summary
Congratulations! You should have successfully set up and configured your C100 Developer Kit.
The Pi Camera V2 module was connected and tested using Python & C++ code examples. Everything is now ready to start exploring the AI image processing capabilities and the world of AI vision processing!
NVIDIA produce very high-quality documentation for their products and you can find links to tutorials, how-to-guides and an active developer community to make your next steps at: https://developer.nvidia.com/
Comments