Immediate download Raspberry Pi Image Processing Programming: Develop Real-Life Examples with Python, Pillow, and SciPy 1st Edition Ashwin Pajankar ebooks 2024
Immediate download Raspberry Pi Image Processing Programming: Develop Real-Life Examples with Python, Pillow, and SciPy 1st Edition Ashwin Pajankar ebooks 2024
com
https://ebookmeta.com/product/raspberry-pi-image-processing-
programming-develop-real-life-examples-with-python-pillow-
and-scipy-1st-edition-ashwin-pajankar/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmeta.com/product/raspberry-pi-image-processing-
programming-with-numpy-scipy-matplotlib-and-opencv-2nd-edition-ashwin-
pajankar-2/
ebookmeta.com
https://ebookmeta.com/product/raspberry-pi-image-processing-
programming-with-numpy-scipy-matplotlib-and-opencv-2nd-edition-ashwin-
pajankar/
ebookmeta.com
https://ebookmeta.com/product/practical-linux-with-raspberry-pi-os-
quick-start-1st-edition-ashwin-pajankar/
ebookmeta.com
https://ebookmeta.com/product/marine-protected-areas-in-international-
law-an-arctic-perspective-1st-edition-ingvild-ulrikke-jakobsen/
ebookmeta.com
https://ebookmeta.com/product/curious-encounters-with-the-natural-
world-from-grumpy-spiders-to-hidden-tigers-jeffords/
ebookmeta.com
https://ebookmeta.com/product/marked-by-shadows-gay-mm-paranormal-
romance-a-simply-crafty-paranormal-mystery-book-2-1st-edition-lissa-
kasey/
ebookmeta.com
https://ebookmeta.com/product/mexican-american-civil-rights-in-
texas-1st-edition-robert-brischetto-j-richard-avena/
ebookmeta.com
https://ebookmeta.com/product/iron-dads-managing-family-work-and-
endurance-sport-identities-1st-edition-diana-tracy-cohen/
ebookmeta.com
Mass Customization and Customer Centricity: In Honor of
the Contributions of Cipriano Forza Thomas Aichner
(Editor)
https://ebookmeta.com/product/mass-customization-and-customer-
centricity-in-honor-of-the-contributions-of-cipriano-forza-thomas-
aichner-editor/
ebookmeta.com
TECHNOLOGY IN AC TION™
Raspberry Pi
Image Processing
Programming
Develop Real-Life Examples with
Python, Pillow, and SciPy
—
Ashwin Pajankar
Raspberry Pi
Image Processing
Programming
Develop Real-Life Examples with
Python, Pillow, and SciPy
Ashwin Pajankar
Raspberry Pi Image Processing Programming: Develop Real-Life Examples with Python,
Pillow, and SciPy
Ashwin Pajankar
Nashik, Maharashtra, India
ISBN-13 (pbk): 978-1-4842-2730-5 ISBN-13 (electronic): 978-1-4842-2731-2
DOI 10.1007/978-1-4842-2731-2
Library of Congress Control Number: 2017936370
Copyright © 2017 by Ashwin Pajankar
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part
of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission
or information storage and retrieval, electronic adaptation, computer software, or by similar or
dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol
with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only
in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of
the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are
not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject
to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for
any errors or omissions that may be made. The publisher makes no warranty, express or implied, with
respect to the material contained herein.
Managing Director: Welmoed Spahr
Lead Editor: Celestin Suresh John
Technical Reviewer: Lentin Joseph
Editorial Board: Steve Anglin, Pramila Balan, Laura Berendson, Aaron Black,
Louise Corrigan, Jonathan Gennick, Robert Hutchinson, Celestin Suresh John,
Nikhil Karkal, James Markham, Susan McDermott, Matthew Moodie, Natalie Pao,
Gwenan Spearing
Coordinating Editor: Sanchita Mandal
Copy Editor: Kezia Endsley
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505,
e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional
use. eBook versions and licenses are also available for most titles. For more information, reference
our Special Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales.
Any source code or other supplementary materials referenced by the author in this text are
available to readers at www.apress.com. For detailed information about how to locate your book’s
source code, go to www.apress.com/source-code/. Readers can also access source code at
SpringerLink in the Supplementary Material section for each chapter.
Index���������������������������������������������������������������������������������������������� 123
iii
Contents
v
■ Contents
vi
■ Contents
Python 3������������������������������������������������������������������������������������������������ 29
The Differences Between Python 2 and Python 3�������������������������������������������������� 30
Why Use Python 3��������������������������������������������������������������������������������������������������� 31
Conclusion��������������������������������������������������������������������������������������������� 39
■
■Chapter 3: Getting Started������������������������������������������������������������ 41
Image Sources�������������������������������������������������������������������������������������� 41
Using the Webcam�������������������������������������������������������������������������������������������������� 42
The Pi Camera Module�������������������������������������������������������������������������������������������� 44
Using Python 3 for Digital Image Processing���������������������������������������� 46
Working with Images���������������������������������������������������������������������������������������������� 47
Conclusion��������������������������������������������������������������������������������������������� 50
■
■Chapter 4: Basic Operations on Images��������������������������������������� 51
Image Module���������������������������������������������������������������������������������������� 51
Splitting and Merging Image Channels������������������������������������������������������������������� 51
Image Mode Conversion����������������������������������������������������������������������������������������� 53
Image Blending������������������������������������������������������������������������������������������������������� 53
Resizing an Image�������������������������������������������������������������������������������������������������� 55
vii
■ Contents
Rotating an Image�������������������������������������������������������������������������������������������������� 56
Crop and Paste Operations������������������������������������������������������������������������������������� 57
Copying and Saving Images to a File���������������������������������������������������������������������� 58
Knowing the Value of a Particular Pixel������������������������������������������������������������������ 58
ImageChops Module������������������������������������������������������������������������������ 59
ImageOps Module��������������������������������������������������������������������������������� 61
Conclusion��������������������������������������������������������������������������������������������� 63
■
■Chapter 5: Advanced Operations on Images�������������������������������� 65
The ImageFilter Module������������������������������������������������������������������������ 65
The ImageEnhance Module������������������������������������������������������������������� 74
Color Quantization��������������������������������������������������������������������������������� 76
Histograms and Equalization����������������������������������������������������������������� 77
Histogram Equalization������������������������������������������������������������������������������������������� 78
Conclusion��������������������������������������������������������������������������������������������� 79
■
■Chapter 6: Introduction to Scientific Python�������������������������������� 81
The Scientific Python Stack������������������������������������������������������������������ 81
Installing the SciPy Stack��������������������������������������������������������������������������������������� 82
A Simple Program��������������������������������������������������������������������������������������������������� 82
Simple Image Processing��������������������������������������������������������������������������������������� 83
Introduction to NumPy�������������������������������������������������������������������������������������������� 84
Matplotlib���������������������������������������������������������������������������������������������������������������� 86
Image Channels������������������������������������������������������������������������������������� 89
Conversion Between PIL Image Objects
and NumPy ndarrays����������������������������������������������������������������������������� 91
Conclusion��������������������������������������������������������������������������������������������� 92
viii
■ Contents
■
■Chapter 7: Transformations and Measurements�������������������������� 93
Transformations������������������������������������������������������������������������������������ 93
Measurements�������������������������������������������������������������������������������������� 95
Conclusion��������������������������������������������������������������������������������������������� 98
■
■Chapter 8: Filters and Their Application��������������������������������������� 99
Filters���������������������������������������������������������������������������������������������������� 99
Low-Pass Filters��������������������������������������������������������������������������������������������������� 100
High-Pass Filters�������������������������������������������������������������������������������������������������� 105
Fourier Filters������������������������������������������������������������������������������������������������������� 108
Conclusion������������������������������������������������������������������������������������������� 110
■
■Chapter 9: Morphology, Thresholding, and Segmentation���������� 111
Distance Transforms���������������������������������������������������������������������������� 111
Morphology and Morphological Operations����������������������������������������� 113
Structuring Element���������������������������������������������������������������������������������������������� 113
Various Morphological Operations������������������������������������������������������������������������ 113
Grayscale Morphological Operations�������������������������������������������������������������������� 115
Index���������������������������������������������������������������������������������������������� 123
ix
About the Author
xi
About the Technical
Reviewer
xiii
■ About the Technical Reviewer
He also reviewed one book about the Robot Operating System called Effective
Robotics Programming Using ROS (https://www.packtpub.com/hardware-and-
creative/effective-robotics-programming-ros-third-edition).
Lentin and his team were also winners of the HRATC 2016 challenge conducted
as part of ICRA 2016. He was also a finalist in the ICRA 2015 challenge, HRATC
(see http://www.icra2016.org/conference/challenges/).
xiv
Acknowledgments
Writing a book is a journey that I am glad I undertook. First, I want to thank my wife
Kavitha, without whose support the journey would never have been possible. The journey
spanned a few months but the experience will last a lifetime. I had my wife Kavitha with
me onboard this journey and I wish to express my deepest gratitude to her. Without her
unwavering support and affection, I couldn’t have pulled it off.
I am grateful to the community of professionals, students, trainers, and teachers
who, with their continual bombardment of queries, impelled me to learn more, simplify
my knowledge and findings, and place it neatly in the book. This book is for all of them.
I want to thank my friends and colleagues—the practitioners from the industry and
experts from academia—for their good counsel and filling me in with the knowledge
on the latest in the fields of single board computers, computer vision, digital image
processing, and Python.
I want to thank the technical reviewer for his vigilant reviews, suggestions,
corrections, and expert opinion.
I consider myself very fortunate for the editorial assistance provided by Apress
Media. This is my second book with Apress and collaborating with them on both the
books has been fabulous. I am thankful to Celestin Suresh John, Senior Manager, Editorial
Acquisition, Apress and Springer Science and Business Media Company, for giving me a
long-desired opportunity to collaborate and write for Apress. I also want to acknowledge
Sanchita Mandal, coordinating editor, Anila Vincent, development editor, and the team
of associates from Apress Media who adeptly guided me through the entire process of
preparation and publication.
xv
Introduction
xvii
■ Introduction
xviii
Other documents randomly have
different content
PRINTERS
121-123 Olive Street
New Haven, Conn.
John F. Fitzgerald
Hotel Taft Bldg.
NEW HAVEN, CONN.
Lyra Levis
By Edward Bliss Reed
In this attractive little volume Mr. Reed describes in humorous
verse the faculty, the undergraduates, and the life in an American
university town. The book will appeal to anyone who knows
college communities.
Price $1.00
Hidden Waters
By Bernard Raymund
Attitudes
By Paul Tanaquil
The collected verse of the young West Point cadet who in a fit of
despondency probably took his own life.
Price $1.50
Yankee Notions
By George S. Bryan
These diverting poems are by none other than the G. S. B. who
—by his initials—is known to thousands through his association
with F. P. A.’s column in the New York Tribune.
*** END OF THE PROJECT GUTENBERG EBOOK THE YALE
LITERARY MAGAZINE (VOL. LXXXVIII, NO. 1, OCTOBER 1922) ***
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must, at
no additional cost, fee or expense to the user, provide a copy, a
means of exporting a copy, or a means of obtaining a copy upon
request, of the work in its original “Plain Vanilla ASCII” or other
form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.