Introduction: Computer Vision on Intel Edison Using Your Smartphone Camera

Picture of 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:

https://software.intel.com/en-us/iot/hardware/edis...

Step 2: Connect Edison to Your PC

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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:

https://play.google.com/store/apps/details?id=com....

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

Picture of 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

Picture of 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:

"wget :8080/shot.jpg"

Now you have a jpg file that you can use on OpenCV

Step 11:

Picture of

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:

http://alexporto.com/blog/computer-vision-edison-opencv

Comments

xpsheng (author)2015-07-11

Very good instructable.
Could you add more details from step 7 to the end?
i tried to follow you install OpenCV on Edison, but not succeeded.

y2kdiy (author)xpsheng2016-03-16

I'm sure you have figured it out by now but if not.

nano /etc/opkg/base-feeds.conf

change the third line src/gz core2-32 http://repo.opkg.net/edison/repo/edison to

src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32/

and save (ctrl x then y then enter)

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

i like to use nano over vi

if nano is not installed

wget http://www.nano-editor.org/dist/v2.2/nano-2.2.6.t... && tar xvf nano-2.2.6.tar.gz && cd nano-2.2.6 && ./configure && make && make install

hmunshi (author)2015-10-05

i'm getting the following error.

copy_file_chunk: write: no more space left on device

after opkg upgrade. kindly help

DaleM7 (author)2015-08-31

Link above for core2-32 is correct, but Text is not as it points to repo edison rather than repo core2-32. This will prevent the python and opencv packages from being available to opkg install command.

Maldrax (author)2015-06-22

Amazing Instructable. Thanks for share!

Euclas (author)2015-06-21

Parabens Alex!!!!

Gostei muito do seu post.

Euclas.