JeVois Tutorials  1.14
JeVois Smart Embedded Machine Vision Tutorials
Share this page:
Programming a live JeVois camera using Python

In this tutorial, we modify some existing sandbox machine vision module written in Python and already pre-installed on the standard JeVois microSD image. We do this by accessing the microSD inside JeVois live over the USB connection.

For this tutorial, you do not need to install any software (except for a video capture program, if you do not already have one): We will directly edit the Python code on the microSD card that is inside JeVois.


Here, we will focus on step-by-step instructions for how to make all of this work.

Getting started

# Convert BGR to HSV
hsv = cv2.cvtColor(inimg, cv2.COLOR_BGR2HSV)
# define range of blue color in HSV
lower_blue = np.array([80,50,50])
upper_blue = np.array([150,255,255])
# Threshold the HSV image to get only blue colors
mask = cv2.inRange(hsv, lower_blue, upper_blue)
# Bitwise-AND mask and original image
outimg = cv2.bitwise_and(inimg, inimg, mask= mask)

Make sure your indentation is correct as Python is picky about that. The lines you paste in place of the old line 59 should be indented by the same amount as the lines immediatly above and below.

Here is the result (you need to show a blue object to JeVois, here we showed our favorite USB flash drive):


We now have something that is beginning to ressemble the basic color tracker of Tuning the color-based object tracker using a python graphical interface, in just a few lines of Python code.


As always, you can connect to JeVois using the serial-over-USB port and issue a setpar serlog USB to see any error messages that might occur if your code has mistakes.

In addition, we have worked very hard to add a new feature that displays these errors directly in the video stream. For example, insert the line:


say, at line 59. Then try to capture video from JeVois, you should see: