Book Image

Raspberry Pi Robotics Essentials

By : Richard Grimmett
Book Image

Raspberry Pi Robotics Essentials

By: Richard Grimmett

Overview of this book

Table of Contents (14 chapters)
Raspberry Pi Robotics Essentials
About the Author
About the Reviewers

Edge Detection and OpenCv

Fortunately, one of the examples in the OpenCV Python set is a program named The following is that file (with blank lines removed):

This program uses the Canny image detection algorithm implemented by OpenCV to find the edges in any image. For more on the Canny edge algorithm, refer to or You captured an image earlier; you can use this program to look at the edges and to also see how setting a different threshold can show more/less edges. Run the program with the image captured earlier and you will see the following:

You will notice that there is a threshold slide bar setting at the top. If you adjust this threshold up, it will find fewer edges—the edges that have a larger threshold. The picture for a setting of 30 is as follows:

Now you can see how this process could be translated...