Close

OpenCV 3, Python 2.7 and a Raspberry Pi 2

A project log for Wild Eye

To capture the image and breed of the animal using OpenCV and Node-RED Watson Visual Recognition

brenda-armourBrenda Armour 05/27/2017 at 15:580 Comments

Adrian Rosebrook writes code and blogs about OpenCV. His blogs are clear and informative. He is highly regarded as an expert. His website can be found here and if you are interested in installing OpenCV I would highly recommend you take a look. I have included the links to his code and tutorials. Yes I must change the "room status occupied" in the frame. As you can see...Ozzy loves playing catch.

1. Install OpenCV 3 on your Raspberry Pi 2

Be prepared to spend some time with your console. Compiling the code took more than 2 hours but I have to use WiFi. Do not skip a step because the install will fail. Make sure you test your installation as the last step ! I did not use my Raspberry Pi 3 because it performs well for Live Streaming to You Tube.

2. Install and test your Raspberry Pi camera on OpenCV

The code he uses may be downloaded at the bottom of the page. You can transfer the code to your Pi using Filezilla. Although I have used the camera on other projects , I went through the tutorial and found it very useful.

3. Setting up Motion detection and Connecting to Dropbox

Again the code may be downloaded at the bottom of the page.

My biggest challenge was to get the Dropbox integration to work. Dropbox authentication website would not display and I knew Dropbox had changed since 2015. This was a Go or No Go to complete the project. I needed Dropbox to process the image. The access token for Wild Eye is available in Dropbox so the solution was to hard code this in. I left the original code and commented the lines out.

# check to see if the Dropbox should be used
if conf["use_dropbox"]:
        # connect to dropbox and start the session authorization process
        flow = DropboxOAuth2FlowNoRedirect(conf["dropbox_key"], conf["dropbox_secret"])
        #print "[INFO] Authorize this application: {}".format(flow.start())
        #authCode = raw_input("Enter auth code here: ").strip()
        # finish the authorization and grab the Dropbox client
        #(accessToken, userID) = flow.finish(authCode)
        accessToken = ("Your Access Token Goes here")
        client = DropboxClient(accessToken)
        print "[SUCCESS] dropbox account linked"

I'll have more in pictures and videos soon. I'm hoping to catch some birds , cats or foxes with the camera.

Discussions