Introduction: Computer Vision on Intel Edison Using Your Smartphone Camera
How about adding computer vision to your Internet of Things?
Intel Edison has enough processing power to run simple object or face detection, but it has no cameras.
This tutorial shows how to use a smartphone to bring vision to Edison boards
Step 1: Download the Latest Edison Firmware
Intel website has all the development tools and firmware images you need to start playing with your Edison board. Go to the following URL and download the latest firmware, under the section "Intel Edison Board Firmware Release" and get the zip file:
Step 2: Connect Edison to Your PC
Make sure the micro-switch on your Intel Edison Arduino board is set pointing to the two micro-USB ports
Connect Edison to your PC using the OTG port (Check images above). Windows shall recognize it as an external drive.
Then connect a second USB cable between your PC and the serial port on Edison
Step 3: Connect to Edison Via Serial Port
Use Putty or other terminal software to connect to Edison via serial port.
Make sure you use the same connection parameters that appear on the image (115200 baud, 8N1, no flow control)
After connecting, press ENTER some times until Edison starts responding. Log on using the user "root' and no password.
Step 4: Install the Firmware Image
Your computer shall recognize Edison as an external drive.
Open it and delete all files you found there.
Then uncompress all files inside the download zip image into the Edison drive
On the serial terminal, type the command "reboot ota" and press ENTER.
Edison will restart and update the firmware. This may take some time. Watch this process via serial port
Step 5: Configuring Edison
Once you got the firmware updated, use the following commands to configure Edison:
"configure_edison --name": To give a name to your Edison board
"configure_edison --password": To set a password
And, the most important one:
"configure_edison --wifi" to connect Edison to your WiFi network, so you can go on with this tutorial
Step 6: Check Your Connection
Use PING, on your computer, to test if Edison is really 'visible' on your network
From now on, you can disconnect the serial cable and use SSH (Also on Putty) to control your Edison board. Or you can stick with serial terminal. It's up to you.
Step 7: Adding OpenCV Packages to Edison
We're gonna use opkg to install all packages we need on Edison
Type these three command lines to add new repositories to opkg list:
echo "src/gz all http://repo.opkg.net /edison/repo/all" >> /etc/opkg/base-feeds.conf
echo "src/gz edison http://repo.opkg.net/edison/repo/edison" >> /etc/opkg/base-feeds.conf echo "src/gz core2-32 http://repo.opkg.net/edison/repo/edison" >> /etc/opkg/base-feeds.conf
Then type "opkg update" to update the repositories list
And type "opkg upgrade" to update the installed packages. It takes some time until it finishes this process.
Finally, install the packages we need for openCV:
opkg install python-numpy opencv python-opencv
Step 8: Transforming Your Android Smartphone Into a Webcam
Make sure your phone, Edison and your computer are connected to the same WiFi network. If your phone is connected via 3G/4G, it won't work. You need WiFi on your phone
Install the free app "IP WebCam" on your phone:
Open the app, click on "Configure video" and set video resolution to 640x480. Since Edison processing power is limited, we can't work with full camera resolution images on OpenCV. Also, smaller images will be transmitted faster via WiFi, improving the FPS on Edison.
Step 9: Testing IP WebCam
After configuring IP WebCam, click on "Start server". Check that your phone goes into "camera mode", and its IP address is shown at the bottom of the screen, as a URL
Type this URL in your computer browser and you shall be able to see the video streaming from the phone
Step 10: Capturing the Phone Video From Edison
Instead of using video on Edison, we'll work with sequences of images. This makes no difference on the final result, but makes a lot easier to grab the phone output
On Edison terminal (SSH or Serial), use wget to download the current camera image as a jpeg file:
Now you have a jpg file that you can use on OpenCV
This simple Python script shows how to grab the image from phone and use it on OpenCV
You can get an improved code to detect an object at my blog: