Python Image Processing
Learn Image Processing with Python 3, NumPy,
Matplotlib, and Scikit-image
By
Ashwin Pajankar
FIRST EDITION 2019
Copyright BPB Publications, INDIA
ISBN: 978-93-88511-72-8
All Rights Reserved. No part of this publication can be stored in a retrieval system or reproduced in any form or by any means without the prior written permission of the publishers
LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY
The Author and Publisher of this book have tried their best to ensure that the programmes, procedures and functions described in the book are correct. However, the author and the publishers make no warranty of any kind, expressed or implied, with regard to these programmes or the documentation contained in the book. The author and publisher shall not be liable in any event of any damages, incidental or consequential, in connection with, or arising out of the furnishing, performance or use of these programmes, procedures and functions. Product name mentioned are used for identification purposes only and may be trademarks of their respective companies.
All trademarks referred to in the book are acknowledged as properties of their respective owners.
Distributors:
BPB PUBLICATIONS
20, Ansari Road, Darya Ganj
New Delhi-110002
Ph: 23254990/23254991
MICRO MEDIA
Shop No. 5, Mahendra Chambers,
DN Rd. Next to Capital Cinema,
V.T. (C.S.T.) Station, MUMBAI-400
Ph: 22078296/22078297
BPB BOOK CENTRE
Old Lajpat Rai Market,
Delhi-110006
Ph: 23861747
DECCAN AGENCIES
4-3-329, Bank Street,
Hyderabad-500195
Ph: 24756967/24756400
Published by Manish Jain for BPB Publications, 20, Ansari Road, Darya Ganj, New Delhi-110002 and Printed by Repro India Pvt Ltd, Mumbai
Dedicated To
Dr Vijay Bhatkar
Architect of Indias first Supercomputer, PARAM
Preface
The author is confident that the present work in form of this book will come as a relief to the students, makers, and professionals alike wishing to go through a comprehensive work explaining difficult concepts related to Image Processing, the scientific Python ecosystem, and scikit-image in the laymans language. The book offers a variety of practical image processing programs with scikit-image. Also, this is the one of the very first printed books on the area of image processing that offers detailed instructions on scikit-image and Jupyter notebook combination.
This book promises to be a very good starting point for complete novice learners and is quiet an asset to advanced readers too. The author has written the book so that the beginners will learn the concepts related to scientific Python ecosystem and image processing in a step-by-step approach.
Though this book is not written according to syllabus of any University, students pursuing science and engineering degrees (B.E./B.Tech/B.Sc./ M.E./M.Tech./M.Sc.) in Computer Science, Electronics, and Electrical streams will find this book immensely beneficial and helpful for their projects and practical work. Software and Information Technology Professionals who are beginning to learn scientific computing or want to switch their careers to computer vision will also benefit from this book.
It is said err is human, to forgive is In this light the author wishes that the shortcomings of the book will be forgiven. At the same time, the author is open to any kind of constructive criticisms, feedback, corrections, and suggestions for further improvement. All intelligent suggestions are welcome and the author will try his best to incorporate such in valuable suggestions in the subsequent editions of this book.
Acknowledgement
No task is a single mans effort. Cooperation and Coordination of various peoples at different levels go into successful implementation of this book.
There is always a sense of gratitude, which everyone expresses to the others for the help they render during difficult phases of life and to achieve the goal already set. It is impossible to thank individually but I am hereby making a humble effort to thank and acknowledge some of them.
I would like to thank Mr. Manish Jain for giving me an opportunity to write for BPB Publications. Writing for BPB has been my dream for me for last years as I grew up reading books authored by Yashavant Kanetkar. I have published more than a dozen books with the publishers around the globe till now and this is my third book for BPB Publications.
Finally, I want to thank everyone who has directly or indirectly contributed to complete this authentic piece of work.
About the Author
Ashwin Pajankar is a polymath. He has more than two decades of programming experience. He is a Science Popularizer, a Programmer, a Maker, an Author, and a Youtuber. He is passionate about STEM (Science-Technology-Education-Mathematics) education. He is also a freelance software developer and technology trainer. He graduated from IIIT Hyderabad with M.Tech. in Computer Science and Engineering. He has worked in a few multinational corporations including Cisco Systems and Cognizant for more than a decade.
Ashwin is also an online trainer with various eLearning platforms like BPBOnline, Udemy, and Skillshare. In his free time, he consults on the topics of Python programming and data science to the local software companies in the city of Nasik. He is actively involved in various social initiatives and has won many accolades during his student life and at his past workplaces.
Table of Content
Preface
Acknowledgements
Concepts in Image Processing
1.1 Signal and Signal Processing
1.2 Images and Image Processing
1.3 Summary
Exercise
Installing Python on Windows
2.1 Python Website
2.2 Summary
Exercise
Introduction to Raspberry Pi
3.1 Single Board Computers
3.1.1 Advantages and Disadvantages of Single Board Computers
3.1.2 Popular SBC Families
3.2 Raspberry Pi
3.3 Raspbian Operating System
3.4 Setting Up and Booting a Raspberry Pi
3.4.1 Hardware Required for Setup
3.4.2 Software Required for Setup
3.4.3 Write OS to Microsd Card
3.4.4 Boot up the Pi
3.5 config.txt and raspi-config
3.6 Connect to Network
3.6.1 Connect to WiFi
3.6.2 Connect to Wired Network
3.6.3 Check the Status of Connection
3.7 Remote Connection to Raspberry Pi
3.7.1 Accessing Command Prompt with PuTTY and Bitwise SSH Client
3.7.2 Remote Desktop with RDP and VNC
3.8 Updating Raspberry Pi
3.9 Shutting Down and Restarting Raspberry Pi
3.10 Why to use Raspberry Pi
3.11 Summary
Exercise
Python Basics
4.1 History of Python Programming Language
4.2 Why Python
4.3 Features and Benefits of Python Programming Language
4.4 IDLE and Hello World!
4.5 Python Interpreter Mode
4.6 Python on Raspberry Pi Raspbian OS
4.7 Other editors in the Raspbian
4.8 Summary
Exercise
Introduction to the Scientific Python Ecosystem