Reader small image

You're reading from  Mastering Beaglebone Robotics

Product typeBook
Published inDec 2014
Reading LevelBeginner
Publisher
ISBN-139781783988907
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Richard Grimmett
Richard Grimmett
author image
Richard Grimmett

Richard Grimmett has more fun that should be allowed working on robotics projects while teaching Computer Science and Electrical Engineering at Brigham Young University Idaho. He has a Bachelors and Masters degree in Electrical Engineering and a PhD in Leadership Studies. He also has 26 years of experience in the Radar and Telecommunications industries, and even has one of the original brick phones. He has written books on the basics of using the BeagleBone Black for robotics projects, and another for the Raspberry PI and yet another for the Arduino.
Read more about Richard Grimmett

Right arrow

Finding movement in your vision system


Another interesting behavior of your tracked robot is the ability to find motion. Here is the first part of the code to use the OpenCV library and your webcam to follow motion:

The following is the second part of the code to use the OpenCV library and your webcam to follow motion:

It is useful to look at the code in detail. This first section of the code is very similar to the setup code you used in the colored object section:

  • #!/usr/bin/env python: This line allows the program to be executed as a regular program.

  • import cv: This line imports the OpenCV library.

  • capture = cv.CaptureFromCAM(0): This opens the connection to webcam(0).

  • cv.NamedWindow("Target", 1): This creates a window on the display with the name as Target.

  • frame = cv.QueryFrame(capture): This grabs an image from the webcam and sticks it in the variable frame.

  • frame_size = cv.GetSize(frame): This returns the frame size of the image as a tuple (set of two numbers) of width and height.

  • color_image...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering Beaglebone Robotics
Published in: Dec 2014Publisher: ISBN-13: 9781783988907

Author (1)

author image
Richard Grimmett

Richard Grimmett has more fun that should be allowed working on robotics projects while teaching Computer Science and Electrical Engineering at Brigham Young University Idaho. He has a Bachelors and Masters degree in Electrical Engineering and a PhD in Leadership Studies. He also has 26 years of experience in the Radar and Telecommunications industries, and even has one of the original brick phones. He has written books on the basics of using the BeagleBone Black for robotics projects, and another for the Raspberry PI and yet another for the Arduino.
Read more about Richard Grimmett