100% found this document useful (2 votes)
28 views66 pages

(Ebook) Raspberry Pi Image Processing Programming: With NumPy, SciPy, Matplotlib and OpenCV, 2nd Edition by Ashwin Pajankar ISBN 9781484282700, 9781484282694, 1484282698, 1484282701 - Download the ebook with all fully detailed chapters

The document provides information about various eBooks available for instant download at ebooknice.com, including titles related to Raspberry Pi programming and image processing. It highlights the second edition of 'Raspberry Pi Image Processing Programming' by Ashwin Pajankar, which offers comprehensive guidance for beginners in image processing using Python and associated libraries. The book includes numerous code examples and aims to facilitate understanding of image processing concepts and practical applications.

Uploaded by

frtunakirman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
28 views66 pages

(Ebook) Raspberry Pi Image Processing Programming: With NumPy, SciPy, Matplotlib and OpenCV, 2nd Edition by Ashwin Pajankar ISBN 9781484282700, 9781484282694, 1484282698, 1484282701 - Download the ebook with all fully detailed chapters

The document provides information about various eBooks available for instant download at ebooknice.com, including titles related to Raspberry Pi programming and image processing. It highlights the second edition of 'Raspberry Pi Image Processing Programming' by Ashwin Pajankar, which offers comprehensive guidance for beginners in image processing using Python and associated libraries. The book includes numerous code examples and aims to facilitate understanding of image processing concepts and practical applications.

Uploaded by

frtunakirman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

Instant Ebook Access, One Click Away – Begin at ebooknice.

com

(Ebook) Raspberry Pi Image Processing Programming:


With NumPy, SciPy, Matplotlib and OpenCV, 2nd
Edition by Ashwin Pajankar ISBN 9781484282700,
9781484282694, 1484282698, 1484282701

https://ebooknice.com/product/raspberry-pi-image-processing-
programming-with-numpy-scipy-matplotlib-and-opencv-2nd-
edition-44555732

OR CLICK BUTTON

DOWLOAD EBOOK

Get Instant Ebook Downloads – Browse at https://ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Raspberry Pi Image Processing Programming: With NumPy, SciPy, Matplotlib,


and OpenCV by Ashwin Pajankar ISBN 9781484282694, 1484282698

https://ebooknice.com/product/raspberry-pi-image-processing-programming-with-
numpy-scipy-matplotlib-and-opencv-44512010

ebooknice.com

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James ISBN
9781459699816, 9781743365571, 9781925268492, 1459699815, 1743365578, 1925268497

https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374

ebooknice.com

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena Alfredsson, Hans Heikne, Sanna
Bodemyr ISBN 9789127456600, 9127456609

https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312

ebooknice.com

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT II Success) by Peterson's
ISBN 9780768906677, 0768906679

https://ebooknice.com/product/sat-ii-success-math-1c-and-2c-2002-peterson-s-sat-
ii-success-1722018

ebooknice.com
(Ebook) Cambridge IGCSE and O Level History Workbook 2C - Depth Study: the United
States, 1919-41 2nd Edition by Benjamin Harrison ISBN 9781398375147, 9781398375048,
1398375144, 1398375047

https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

ebooknice.com

(Ebook) Raspberry Pi Image Processing Programming: Develop Real-Life Examples with


Python, Pillow, and SciPy by Ashwin Pajankar ISBN 9781484227305, 1484227301

https://ebooknice.com/product/raspberry-pi-image-processing-programming-develop-
real-life-examples-with-python-pillow-and-scipy-50195000

ebooknice.com

(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master the SAT Subject Test: Math
Levels 1 & 2) by Arco ISBN 9780768923049, 0768923042

https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-arco-master-
the-sat-subject-test-math-levels-1-2-2326094

ebooknice.com

(Ebook) Raspberry Pi Supercomputing and Scientific Programming: MPI4PY, NumPy, and


SciPy for Enthusiasts by Ashwin Pajankar (auth.) ISBN 9781484228777, 9781484228784,
1484228774, 1484228782

https://ebooknice.com/product/raspberry-pi-supercomputing-and-scientific-
programming-mpi4py-numpy-and-scipy-for-enthusiasts-5880908

ebooknice.com

(Ebook) Raspberry PI Computer Vision Programming by Pajankar, Ashwin ISBN


9781784398286, 1784398284

https://ebooknice.com/product/raspberry-pi-computer-vision-programming-55322632

ebooknice.com
Ashwin Pajankar

Raspberry Pi Image Processing


Programming
With NumPy, SciPy, Matplotlib, and OpenCV
2nd ed.
Ashwin Pajankar
Nashik, Maharashtra, India

ISBN 978-1-4842-8269-4 e-ISBN 978-1-4842-8270-0


https://doi.org/10.1007/978-1-4842-8270-0

© Ashwin Pajankar 2017, 2022

Apress Standard

The use of general descriptive names, registered names, trademarks,


service marks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for general
use.

The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, express or implied, with respect to the material
contained herein or for any errors or omissions that may have been
made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.

This Apress imprint is published by the registered company APress


Media, LLC, part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
This book is dedicated to the memory of Prof. Govindarajulu Regeti(July 9,
1945 to March 18, 2021)

Popularly known to everyone as RGR, Prof. Govindarajulu obtained a


Bachelor of Technology degree in electrical and electronic engineering
from JNTU Kakinada. He also earned a master’s degree and Ph.D. from IIT
Kanpur. Prof. Govindarajulu was an early faculty member of IIIT
Hyderabad and played a significant role in making IIIT Hyderabad the
top-class institution that it is today. He was by far the most loved and
cheered for faculty member of the institute. He was full of energy to teach
and full of old-fashioned charm. There is no doubt he cared for every
student as an individual, taking care to know about and to guide them.
He has taught, guided, and mentored many batches of students at IIIT
Hyderabad (including the author of this book).
Introduction
I want to keep this introduction short, concise, and precise. I have been
working with the domain of image processing for quite a while now. I
was introduced to Python more than 15 years ago. When I first worked
with image processing using Raspberry Pi, I found it a bit tedious to
comb through all the literature available as printed books, video
tutorials, and online tutorials, as most lacked a step-by-step yet
comprehensive guide for a beginner getting started. It was then that I
resolved to write a book, and then I published the first edition of this
book. It has been almost five years since the first edition was published
and it needed a lot of updates.
This book is the fruit of my efforts and cumulative experience of
thousands of hours (apart from the ones spent writing the actual book)
spent going through technical documentation, watching training videos,
writing code with the help of different tools, debugging faulty code
snippets, posting questions, and participating in discussions on various
question-answer and technical forums online, and referring to various
code repositories for directions. I have written this edition of the book
in such a way that beginners will find it easy to understand the topics.
This book has hundreds of code examples and images (of outputs of
code execution and screenshots) so readers can understand each
concept perfectly. All the code examples are adequately explained.
The book begins with a general discussion of Raspberry Pi and
Python programming. It is followed by a discussion of concepts related
to the domain of image processing. Then, it explores the libraries Pillow
and TKinter. The following few chapters focus on the scientific Python
ecosystem and image processing with libraries such as NumPy, SciPy,
and Matplotlib. The last chapter discusses how OpenCV can be used for
applying image-processing routines on a live webcam feed. The
appendix briefly discusses the pgmagik library, which can be used for
generating sample images. It also has plenty of tips and tricks for using
a Raspberry Pi board effectively.
As a final note, we started and finished working on this project at a
very turbulent time (early 2022) when much of the world was facing
yet another wave of fresh infections brought by new variants of the
virus causing the COVID pandemic. Everyone around us is still
recovering from the impact of the pandemic. This book offered me a
sense of purpose. I hope that all the readers enjoy reading this book as
much as I enjoyed writing it.
Any source code or other supplementary material referenced by the
author in this book is available to readers on GitHub
(github.com/apress) For more detailed information, please visit
http://www.apress.com/source-code.
Acknowledgments
I would like to thank my friend Anuradha for encouraging me to share
my knowledge with the world. I would like to thank my longtime
mentors from Apress, Celestin and Aditee, for giving me an opportunity
to share my knowledge and experience with readers. I thank Mark
Powers and James Markham for helping me to shape this book as per
Apress standards. I am in debt to the technical reviewer, Lentin Joseph.
I also thank Prof. Govindrajulu Sir’s family, Srinivas (son) and Amy
(daughter-in-law), for allowing me to dedicate this book to his memory
and sharing with us Govindrajulu Sir’s biographical information and his
photograph for publication. I would also like to thank all the people
associated with Apress who have been instrumental in bringing this
project to reality.
Table of Contents
Chapter 1:​Introduction to Single-Board Computers and Raspberry
Pi
Single-Board Computers (SBCs)
Differences Between SBCs and Regular Computers
System on Chips (SoCs)
SoC versus Regular CPU
History of SBCs
Popular SBC Families
The Raspberry Pi
Raspberry Pi Setup
Prepare the microSD Card
Booting Up Raspberry Pi
Accessing Raspberry Pi Remotely
Configuring Raspberry Pi
The Raspberry Pi OS
The config.​txt File
Updating the RPi
Summary
Chapter 2:​Introduction to Python and Digital Image Processing
A Brief History of the Python Programming Language
Features of Python
Python 3
Python 2 and Python 3 on Raspberry Pi OS
Running a Python Program and Python Modes
IDEs for Python
IDLE
Geany
Thonny IDE
Introduction to Digital Image Processing
Signal Processing
Image Processing
Using Raspberry Pi and Python for Digital Image Processing
(DIP)
Exercise
Summary
Chapter 3:​Getting Started
Image Sources
Using a Webcam
guvcview
fswebcam
The Pi Camera Module
raspistill
Python 3 for Digital Image Processing
Working with Images
Summary
Chapter 4:​Basic Operations on Images
Image Module
Image Channels
Colorspace Conversion
Image Blending
Resizing an Image
Rotating an Image
Crop and Paste Operations
Copying and Saving Images to a File
Knowing the Value of a Particular Pixel
Mandelbrot Set
Julia Set
Noise and Gradients
ImageChops Module
ImageOps
Summary
Chapter 5:​Advanced Operations on Images
ImageFilter Module
The ImageEnhance Module
Color Quantization
Histograms and Equalization
Histogram Equalization
Summary
Chapter 6:​Introduction to the Scientific Python Ecosystem
The Scientific Python Ecosystem
Simple Examples
Matplotlib
Image Channels
Conversion Between PIL Image Objects and NumPy ndarrays
Summary
Chapter 7:​Transformations and Measurements
Transformations
Measurements
Summary
Chapter 8:​Filters
Kernels, Convolution, and Correlation
Low-Pass Filters
Blurring
Noise Reduction
High-Pass Filters
Fourier Filters
Summary
Chapter 9:​Morphology, Thresholding, and Segmentation
Distance Transforms
Morphology and Morphological Operations
Structuring Element
Binary Morphological Operations
Grayscale Morphological Operations
Thresholding and Segmentation
Summary
Chapter 10:​Video Processing
Introduction to OpenCV Library
Converting the Colorspace of Image
Separating Color Channels in Live Webcam Stream
More Operations on Live Webcam Stream
Geometric Transformation
Convolution
Correlation
Filtering
Morphological Operations
Summary
Conclusion
Appendix
pgmagick Image Processing
Connecting a Display
Using a VGA Display
Booting Up After Connecting a Display
Connecting to Ethernet/​Wired Network
Remote Desktop with VNC
Index
About the Author
Ashwin Pajankar
earned a master of technology in computer science engineering from
IIIT Hyderabad and has over 25 years of experience in the area of
programming. He started his journey in programming and electronics
at the tender age of seven with an MS-DOS computer and BASIC
programming language. He is now proficient in Assembly
programming, C, C++, Java, shell scripting, JavaScript, Go Programming,
HTML, and Python. His other technical expertise includes single-board
computers such as Raspberry Pi and Banana Pro, microcontroller
boards such as Arduino, and embedded boards such as BBC Micro Bit.
He has extensively worked on domains such as software/product
testing, software automation, databases, data analytics and
visualization, computer vision, and web development.
He is currently a freelance online instructor teaching programming
and electronics to more than 82,000 professionals. He also regularly
conducts live programming bootcamps for software professionals. His
growing YouTube channel has an audience of more than 11,000
subscribers. He has published more than 20 books on programming
and electronics with many international publishers and is writing more
books with Apress. He also regularly reviews books on the topics of
programming and electronics written by other authors.
Apart from his work in the area of technology, he is active in the
community as a leader and volunteer for many social causes. He has
won several awards at his university (IIIT Hyderabad) and also at past
workplaces for his leadership in community service for uplifting the
underpriviledged with education and skill-based training and
employment assistance. He has also participated in many industry
institute linkage programs and connected his past employers with his
alma maters. During the COVID-19 pandemic (which was continuing at
the time of writing of this book), he participated in and led many
initiatives to distribute essential supplies such as food, clothes, and
medicine to the needy people in his local community. He regularly
conducts initiatives for assisting homeless people with clothes,
essential supplies, and medical care.
About the Technical Reviewer
Lentin Joseph
is an author, roboticist, and robotics
entrepreneur from India. He runs a
robotics software company called
Qbotics Labs in Kochi/Kerala. He has ten
years of experience in the robotics
domain, primarily in the Robot
Operating System, OpenCV, and PCL.
He has authored ten books on ROS,
namely, Learning Robotics Using Python,
first and second editions; Mastering ROS
for Robotics Programming, first and
second editions; ROS Robotics Projects,
first and second editions; ROS
Programming: Building
Powerful Robots; and Robot
Operating System (ROS) for Absolute
Beginners first and second editions.
He is also co-editor of the book
Autonomous Driving and Advanced Driver-Assistance Systems (ADAS):
Applications, Development, Legal Issues, and Testing.
He obtained his masters in robotics and automation from India and
has also worked at the Robotics Institute, Carnegie Mellon University,
USA. He is also a TEDx speaker.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2022
A. Pajankar, Raspberry Pi Image Processing Programming
https://doi.org/10.1007/978-1-4842-8270-0_1

1. Introduction to Single-Board
Computers and Raspberry Pi
Ashwin Pajankar1

(1) Nashik, Maharashtra, India

Let’s start this exciting journey of exploring the scientific domain of


digital image processing with Raspberry Pi. To begin, we must be
comfortable with the basics of single-board computers (SBCs) and the
Raspberry Pi. This chapter discusses the definition, history, and
philosophy of SBCs. It compares SBCs to regular computers, then moves
toward the most popular and bestselling SBC of all time, the Raspberry
Pi. By the end of this chapter, we will have adequate knowledge to
independently set up our own Raspberry Pi. This chapter aims to make
us comfortable with the basic concepts of SBCs and Raspberry Pi setup.

Single-Board Computers (SBCs)


A single-board computer (referred to as an SBC from now on) is a fully
functional computer system built around a single printed circuit board.
An SBC has a microprocessor(s), memory, input/output, and other
features required of a minimally functioning computer. Unlike with
desktop personal computers (PC), most SBCs do not have expansion
slots for peripheral functions or expansion. As all components—
processor(s), RAM, GPU, etc.—are integrated on a single printed circuit
board (PCB), we cannot upgrade an SBC.
Few SBCs are made to plug into a backplane for system expansion.
SBCs come in many varieties, sizes, shapes, form factors, and feature
sets. Due to advances in electronics and semiconductor technologies,
most SBC prices are very low. With a price of around $50 a piece, we
have in our hands a development tool suitable for new applications,
hacking, debugging, testing, hardware development, and automation
systems.
SBCs are usually manufactured with the following form factors:
Pico-ITX
PXI
Qseven
VMEbus
VPX
VXI
AdvancedTCA
CompactPCI
Embedded Compact Extended (ECX)
Mini-ITX
PC/104
PICMG

Differences Between SBCs and Regular Computers


Table 1-1 lists the differences between SBCs and regular computers.

Table 1-1 Differences Between SBCs and Regular Computers

Single-Board Computer Regular Computer


Not modular Modular
Components cannot be upgraded or Components can be upgraded or
replaced replaced
A system on chip Not a system on chip
Has a small form factor Has a large form factor
Is mostly non-portable or semi-
Is portable
portable
Consumes less power Consumes more power
Single-Board Computer Regular Computer
Cheaper than a regular computer Costs more than an SBC

System on Chips (SoCs)


SBCs are predominantly systems on chips (SoCs). A system on a chip
(SoC) is an integrated circuit (IC) that has all the components of a
computer on a single chip. SoCs are very common with mobile
electronic devices because of their low power consumption and
versatility. SoCs are widely used in mobile phones, SBCs, and embedded
hardware. An SoC includes all the hardware and software needed for its
operation.

SoC versus Regular CPU


The biggest advantage of using an SoC is its size. If we use a CPU, it’s
very hard to make a compact computer because of the number of
individual chips and other components that we need to arrange on a
board. However, when using SoCs, we can place complete application-
specific computing systems in smartphones and tablets, and still have
plenty of space for batteries, the antenna, and other add-ons required
for remote telephony and data communication.
Due to the very high level of integration and the compact size, an
SoC uses considerably less power than a regular CPU. This is a
significant advantage of SoCs when it comes to mobile and portable
systems. Also, reducing the number of chips by eliminating redundant
ICs on a computer board results in a compact board size.

History of SBCs
Dyna-Micro was the first true SBC. It was based on the Intel C8080A
and used Intel’s first EPROM, the C1702A. The Dyna-Micro was
rebranded and marketed by E&L Instruments of Derby, Connecticut, in
1976 as the MMD-1 (Mini-Micro Designer 1). It became famous as the
leading example of a microcomputer. SBCs were very popular in the
earlier days of computing, as many home computers were actually
SBCs. However, with the rise of PCs, the popularity of SBCs declined.
Since 2010, there has been a resurgence in the popularity of SBCs due
to their lower production costs.
Apart from the MMD-1, here are a few other popular historical
SBCs:
The BBC Micro was built around an MOS technology 6502A
processor running at 2MHz.
The Ferguson Big Board II was a Zilog Z80-based computer running
at 4MHz.
The Nascom was another Zilog Z80-based computer.

Popular SBC Families


Based on their manufacturers and designers, SBCs are grouped into
families, models, and generations. Here are a few popular SBC families:
Raspberry Pi by the Raspberry Pi Foundation
Banana Pi and Banana Pro
Intel Up Squared Kits
CubieBoard
BeagleBone

The Raspberry Pi
The Raspberry Pi is a family of credit card–sized SBCs developed in the
United Kingdom by the Raspberry Pi Foundation. The Raspberry Pi
Foundation was formed by Eben Upton in 2009. The aim in developing
the Raspberry Pi was to promote the teaching of basic computer
science in schools and developing countries by providing a low-cost
computing platform.
Raspberry Pi Foundation’s Raspberry Pi was released in 2012. It
was a massive hit and sold over two million units in two years.
Subsequently, the Raspberry Pi Foundation released revised versions of
the Raspberry Pi. They also released other accessories for the Pi.
More information about the Raspberry Pi Foundation can be found
on their website at https://www.raspberrypi.org.
The product page for Raspberry Pi's current production models and
other accessories can be found at
https://www.raspberrypi.org/products.
I have written, executed, and tested all the code examples in this
book on Raspberry Pi 4 Model B units with 8GB RAM. Table 1-2 lists the
specifications of the Raspberry Pi 4 Model B.
Table 1-2 Specifications of the Raspberry Pi 4 Model B

Release Date June 2019


Architecture ARMv8
SoC broadcom BCM2711
CPU Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
GPU Broadcom VideoCore IV
Memory 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
USB 2 USB 3.0 ports, 2 USB 2.0 ports
2 × micro-HDMI ports (up to 4kp60 supported)
Video output
2-lane MIPI DSI display port
On-board storage Micro SDHC slot
2.4 GHz and 5.0 GHz IEEE 802.11ac wireless
On-board network Bluetooth 5.0, BLE
Gigabit Ethernet
Power source 3A 5V via MicroUSB

Figure 1-1 shows the front view of the Raspberry Pi 4 Model B.


Figure 1-1 The front view of Raspberry Pi 4 Model B board1
The image clearly shows all the important components of the board.
It shows USB ports, Ethernet port, micro-HDMI ports, 3.5mm audio
jack, USB type C port for power, and connectors for CSI and DSI.
Figure 1-2 shows the top view of the board.
Figure 1-2 The top view of Raspberry Pi 4 Model B board2
We can see the microSD card slot clearly in the bottom view (Figure
1-3).
Figure 1-3 The bottom view of a Raspberry Pi 4 Model B board with a microSD card
Raspberry Pi Setup
We have to set up Raspberry Pi before we can use it for exploration and
adventure. As mentioned earlier, I am using a Raspberry Pi 4 Model B
for this setup. Make sure that you use a model of RPi board that has
built-in Wi-Fi. The setup process is almost the same for all models.
We are going to use the Raspberry Pi board in headless mode. This
means that we will not connect any keyboard, mouse, or display. We
will just connect it to the Wi-Fi network and access it remotely. So, we
are not going to need a lot of hardware for this. Apart from the RPi
board itself, we will need the following things:
A computer – We will need a computer with a Windows, macOS,
Linux, UNIX, or BSD operating system. We need it for preparing the
microSD card for the RPi board.
Wi-Fi connection with internet – We need the internet to install the
operating system on the microSD card. We will need it further to
connect the RPi to the internet and install necessary software on the
RPi.
microSD card – We will need a microSD card. I usually recommend
at least a 32GB Class 10 microSD card for the best experience. If you
wish to know more about the classes of microSD cards, please visit
the following URL on the web:
https://www.sdcard.org/developers/sd-standard-
overview/speed-class/
microSD card reader – We need this so that the computer can read
from and write to the microSD card. We need to modify the contents
of the microSD card for headless setup. There are many variations of
microSD card reader. The following (Figure 1-4) is an image of a
universal card reader.
Figure 1-4 Universal card reader3
A power supply – We need a power supply to power the RPi board.
RPi 4B uses a USB Type C power supply like the one at
https://www.raspberrypi.com/products/type-c-
power-supply/, and a few other models use a micro USB power
supply like the one at
https://www.raspberrypi.com/products/micro-usb-
power-supply/.
We can procure all these things and the RPi boards at online
marketplaces or local hobby electronics stores.

Prepare the microSD Card


Following are the steps to prepare the card:
1) Insert the card into the card reader and connect it to the computer.

2) Install the Raspberry Pi Imager software from


https://www.raspberrypi.com/software/. For Debian
and derivatives, run the following command in the terminal
emulator:
sudo apt install rpi-imager

3) Open the installed Raspberry Pi Imager program. It looks as


shown in Figure 1-5.

Figure 1-5 Raspberry Pi Imager

4) Click on the CHOOSE OS button. It opens options as shown in


Figure 1-6.
Figure 1-6 Choosing the OS
Choose the option Raspberry Pi OS (other) by clicking on it. It
shows another list of options, as shown in Figure 1-7.
Figure 1-7 Choosing the OS
Choose Raspberry Pi OS (Legacy). It is a very well-maintained
flavor of Debian Buster that supports command-line utilities for the
Raspberry Pi camera.
5) Now, click on the CHOOSE STORAGE button. It will show the
microSD card connected to the computer, as shown in Figure 1-8.
Figure 1-8 Choosing the storage
6) It will enable the WRITE button, as shown in Figure 1-9.
Figure 1-9 Write button enabled
Click the WRITE button. It will show a warning message, as shown
in Figure 1-10.
Figure 1-10 Warning message
Don’t worry about the message. Click the YES button. It starts
downloading the files from the internet and writing them to the
microSD card. A progress bar will appear, as shown in Figure 1-11.
Figure 1-11 Progress bar
Once the entire process completes, it shows the following (Figure 1-
12) message.
Figure 1-12 Final message
Click the CONTINUE button. Disconnect the card reader and
reconnect it again.
7) Once we reconnect it, it will show in the filesystem as a drive
labeled boot. The OS may automatically assign a letter to that.
Create an empty file in the location boot and name it ssh. Don’t use
any extension. This will enable remote login.

8) Create another file and name it wpa_supplicant.conf. It is


necessary to connect the RPi board to the Wi-Fi after booting up.
Add the following contents to the file and save it:

country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant
GROUP=netdev
update_config=1

network={
scan_ssid=1
ssid="TP-Link_710E"
psk="internet1"
}
Remember to change the SSID and PSK sections with the name
and the password of your Wi-Fi.

9) Now, safely disconnect the microSD card reader.

Booting Up Raspberry Pi
This is the easiest part. Following these steps:
1) Remove the microSD card from the card reader and insert it into
the microSD card slot of the RPi board.

2) Make sure that the main power switch is in the OFF position at this
point. Connect the RPi to the power supply.

3) Switch on the power switch.

We can see the lights on the RPi board blinking at this point. This
means that the RPi is booting up. Wait for a couple of minutes for the
boot process to complete.

Accessing Raspberry Pi Remotely


We have booted up the RPi board in headless mode. This means that we
have not directly connected any I/O devices such as display, keyboard,
or mouse to it. Let’s connect to it remotely. First, we must know its IP
address. Since we enabled the SSH and provided it the settings of our
Wi-Fi before booting up, it is connected to the Wi-Fi at the time of the
booting process. There are many ways to find out the IP address. If you
are a part of an organization (workplace, research lab, or university),
check with your network/system administrator to find out the IP
address of the RPi board. If it is your personal Wi-Fi, then on all the
UNIX-like systems (Linux, BSD, macOS), you can run a command to find
out the IP address. For Debian and derivatives (Ubuntu, Raspberry Pi
OS, etc.), we can install the following command:
sudo apt install nmap -y
This utility (NMAP) scans the network. The command to find out all
the IP addresses connected to the network is as follows:

sudo nmap -sn 192.168.0.*

Change the numbers to represent your own network. It produces


the following output:

Starting Nmap 7.80 ( https://nmap.org ) at 2022-


02-01 11:26 IST
Nmap scan report for 192.168.0.1
Host is up (0.0025s latency).
Nmap scan report for 192.168.0.100
Host is up (0.0023s latency).
Nmap scan report for 192.168.0.102
Host is up (0.091s latency).
Nmap done: 256 IP addresses (3 hosts up) scanned
in 2.72 seconds

You can find the IP address of your own system with the commands
ipconfig (Windows) or ifconfig (UNIX-like systems). From this
list, we can eliminate all the known devices with known IP addresses. If
there are too many devices attached to the home network, then turn off
the Wi-Fi of all the unnecessary devices. In my case, the IP address of
the RPi board is 192.168.0.100.
On a Windows computer, we can install the Zenmap utility, which is
the graphical interface for the nmap. We can download and install it
from https://nmap.org/zenmap/. It is also available for UNIX-like
systems. Install the utility and open it. It looks as shown in Figure 1-13.
Figure 1-13 Zenmap GUI
We can easily use it. Mention 192.168.0.* in the Target text box.
Mention the command that we used earlier (nmap -sn 192.168.0.*) in
the Command text box. And then click the Scan button. It takes some
time for the scan to finish. Sometimes the scan fails prematurely. In
such cases, keep trying, and it will work after a couple of attempts. It is
all open source and free, so we cannot complain. It produces the result
shown in Figure 1-13 once finished. Sometimes, it also shows the
names of the manufacturers of the connected devices beside their MAC
addresses. This makes it easy to identify the RPi board.
Once we have the IP address of the RPi board, we can log in
remotely. We can use a variety of SSH tools, such as the built-in ssh
utility on UNIX-like operating systems, to remotely log in to the RPi
board. Just run the following command in the terminal emulator of your
operating system:

ssh [email protected]

The pi is the username. It will prompt for the password. It is


raspberry. This way, we can remotely log in to the RPi board and run
commands.
PuTTY and Bitvise SSH clients are a few popular ones on Windows.
However, I find MobaXterm very handy for this. It has the options for
remote terminal, file transfer, and X-11 forwarding. We do not have to
install anything else if we have this tool. Install it from
https://mobaxterm.mobatek.net/. Once installed, open it. The
window looks as shown in Figure 1-14.

Figure 1-14 MobaXterm

In this window, click on the Start local terminal button. It launches


a local terminal window. There, we can run the following command to
connect to the RPi board:

ssh [email protected]

The pi is the username. It will prompt for the password. It is


raspberry. This way, we can remotely log in to the RPi board and run
commands.
Now, it is time to brush up on the UNIX concepts and commands
that we learned in school. We can run all the Linux/UNIX commands on
this remote terminal. One of the best things about the MobaXterm is it
has a built-in XServer program that is automatically launched when we
launch this utility. We can see the symbol for that in the top-right
corner of the window. UNIX-like systems allow us to access the GUI
applications remotely with X-11 forwarding. In RPi, it is enabled by
default. We just need an XServer utility at the other end (the computer
from which we are connecting to the RPi, or any other UNIX-like
system). As discussed already, we have it with the MobaXterm. Just run
the following command in the terminal:

nohup pcmanfm &


It opens a window for the File Explorer utility, as shown in Figure
1-15.

Figure 1-15 File Explorer accessed with X-11 forwarding

Keep in mind that this File Explorer utility is running on the RPi.
We are accessing its GUI using X-11 Forwarding. This way, with the
combination of nohup (no hangup) and &, we can launch any GUI
utility from the terminal. & makes sure that the control of the terminal
is returned back to us, and nohup keeps the process running even
when the user logs out.

Configuring Raspberry Pi
Now, type sudo raspi-config in the prompt and press Enter. It
opens the tool raspi-config, which is the configuration tool for the
Raspberry Pi OS. First, update it, as shown in Figure 1-16.

Figure 1-16 Updating the raspi-config tool

It will take some time to update. Once updated, go to the fifth option
for Localization. It looks as follows (Figure 1-17).
Figure 1-17 Localization
Set all these options as per your choice, and in the main menu
choose Finish. It will ask to reboot. Choose Yes, and it will reboot the
RPi.

The Raspberry Pi OS
An operating system is the set of basic programs and utilities that make
a computer work. It is an interface between the user and the computer.
Raspberry Pi OS is a free operating system based on the popular Linux
distribution Debian. It is optimized for the Raspberry Pi family of SBCs.
It is even ported to the other, similar SBCs like Banana Pro.

The config.txt File


Raspberry Pi does not have a conventional BIOS or UEFI. The BIOS
(basic input/output system) is the program that a computer’s
microprocessor uses to get the computer system started after it is
turned on. It also manages data flow between the computer’s operating
system and attached peripheral devices, such as the hard disk, video
adapter, keyboard, mouse, and printer.
Since the Raspberry Pi does not have a BIOS/UEFI, the various
system configuration parameters that are normally stored and modified
using the BIOS/UEFI are instead stored in a text file called config.txt.
The Raspberry Pi config.txt file is on the boot partition of the
Raspberry Pi. It is normally accessible as /boot/config.txt from Linux.
However, from Windows and MacOS, it is seen as a file in the accessible
part of the microSD card. The accessible part of the card, as we already
know, is labeled boot.
On a Raspberry Pi, you can edit this file with the following
command:

sudo nano /boot/config.txt

Note nano is a simple and easy-to-learn terminal-based text editor


for Linux. Visit its home page at https://www.nano-
editor.org to learn more about it. I find it easier to use than vi or
vim editors.
To learn more about config.txt, visit the page
http://elinux.org/RPiconfig. A sample configuration can
also be found at http://elinux.org/R-
Pi_configuration_file.

Updating the RPi


The Raspberry Pi must be connected to the internet in order to update
it successfully. Let’s update the firmware and the Raspberry Pi OS.

Updating the Firmware


To update the firmware, run the command sudo rpi-update.

Updating and Upgrading Raspberry Pi OS


We will use APT for this. APT (Advanced Package Tool) is a program
that handles the installation and removal of software on Debian and
other Debian derivatives. APT simplifies the process of managing
software on Debian systems by automating the fetching, configuration,
and installation of software packages. We need an internet connection
for this too.
First, update the system’s package list by entering the following
command in the terminal:

sudo apt update


This downloads the package lists from the respective remote
repositories and updates them in the local computer so that
information on the newest versions of packages and their dependencies
is available for the installation and update. It should be run before
running the install or upgrade commands.
Next, upgrade all the installed packages to their latest versions
using this command:

sudo apt full-upgrade -y

This fetches new versions of the packages on the local machine that
are marked for upgrade. It also detects and installs any dependencies. It
also removes obsolete packages.
Doing this regularly will keep the Raspberry Pi OS up to date. After
entering these commands, it will take a while to update the OS, because
these commands fetch the data and the packages from remote
repositories on the internet.

Note The command apt help will list all the options associated
with the APT utility.

Shutting Down and Restarting RPi


We can shut down the RPi safely using either of the following
commands:

sudo shutdown -h
sudo init 0

We can reboot the RPi using either of the following commands:

sudo reboot -h
sudo init 6

Summary
In this chapter, we learned how to set up and access RPi in headless
mode over Wi-Fi. We are comfortable with this part now.
The next chapter will focus on the concepts involved with digital
image processing. We will also write basic programs with Python 3.

Footnotes
1 Image provided by Laserlicht under a CC-by-SA 4.0 license
(https://creativecommons.org/licenses/by-sa/4.0/deed.en)

2 Image provided by Laserlicht under a CC-by-SA 4.0 license


(https://creativecommons.org/licenses/by-sa/4.0/deed.en)

3 Image provided by Alen under a CC0 1.0 Universal (CC0 1.0) license
(https://creativecommons.org/publicdomain/zero/1.0/)
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2022
A. Pajankar, Raspberry Pi Image Processing Programming
https://doi.org/10.1007/978-1-4842-8270-0_2

2. Introduction to Python and Digital


Image Processing
Ashwin Pajankar1

(1) Nashik, Maharashtra, India

In the last chapter, we explored the amazing world of single-board


computers and Raspberry Pi. We booted up the Raspberry Pi,
connected it to the internet, and updated the Raspberry Pi OS.
In this chapter, we will get started with Python and the concepts of
digital image processing (DIP). Let’s begin with an introduction to
Python. I personally find Python amazing and have been enchanted by
it. Python is a simple yet powerful programming language. When
programmers use Python, it’s easy to focus on solving a given problem
as they do not have to worry about the syntax. Python perfectly fits the
philosophy of Raspberry Pi, which is programming for everyone. That’s
why it’s the most preferred programming platform for Raspberry Pi
and other computers.
The following is a list of topics we will learn in this chapter:
History of Python
Features of Python
Python 3
IDEs for Python
Introduction to digital image processing
By the end of this chapter, we will be comfortable with the concepts
of digital image processing and Python 3 basics.
Random documents with unrelated
content Scribd suggests to you:
"What have I done?" Lanfierre asked in the monotone of shock.
Fownes took the wheel. It was off a 1995 Studebaker.
"I'm not sure what's going to come of this," he said to Lanfierre with
an astonishing amount of objectivity, "but the entire dome air supply
is now coming through my bedroom."
The wind screamed.
"Is there something I can turn?" Lanfierre asked.
"Not any more there isn't."
They started down the stairs carefully, but the wind caught them
and they quickly reached the bottom in a wet heap.
Recruiting Lieutenant MacBride from behind his sofa, the men
carefully edged out of the house and forced the front door shut.
The wind died. The fog dispersed. They stood dripping in the
Optimum Dome Conditions of the bright avenue.
"I never figured on this," Lanfierre said, shaking his head.
With the front door closed the wind quickly built up inside the house.
They could see the furnishing whirl past the windows. The house did
a wild, elated jig.
"What kind of a place is this?" MacBride said, his courage beginning
to return. He took out his notebook but it was a soggy mess. He
tossed it away.
"Sure, he was different," Lanfierre murmured. "I knew that much."
When the roof blew off they weren't really surprised. With a certain
amount of equanimity they watched it lift off almost gracefully,
standing on end for a moment before toppling to the ground. It was
strangely slow motion, as was the black twirling cloud that now rose
out of the master bedroom, spewing shorts and socks and cases
every which way.
"Now what?" MacBride said, thoroughly exasperated, as this strange
black cloud began to accelerate, whirling about like some malevolent
top....

Humphrey Fownes took out the dust jacket he'd found in the library.
He held it up and carefully compared the spinning cloud in his
bedroom with the illustration. The cloud rose and spun, assuming
the identical shape of the illustration.
"It's a twister," he said softly. "A Kansas twister!"
"What," MacBride asked, his bravado slipping away again, "what ...
is a twister?"
The twister roared and moved out of the bedroom, out over the rear
of the house toward the side of the dome. "It says here," Fownes
shouted over the roaring, "that Dorothy traveled from Kansas to Oz
in a twister and that ... and that Oz is a wonderful and mysterious
land beyond the confines of everyday living."
MacBride's eyes and mouth were great zeros.
"Is there something I can turn?" Lanfierre asked.
Huge chunks of glass began to fall around them.
"Fownes!" MacBride shouted. "This is a direct order! Make it go
back!"
But Fownes had already begun to run on toward the next house,
dodging mountainous puffs of glass as he went. "Mrs. Deshazaway!"
he shouted. "Yoo-hoo, Mrs. Deshazaway!"
The dome weevils were going berserk trying to keep up with the
precipitation. They whirred back and forth at frightful speed, then,
emptied of molten glass, rushed to the Trough which they quickly
emptied and then rushed about empty-handed. "Yoo-hoo!" he yelled,
running. The artificial sun vanished behind the mushrooming twister.
Optimum temperature collapsed. "Mrs. Deshazaway! Agnes, will you
marry me? Yoo-hoo!"
Lanfierre and Lieutenant MacBride leaned against their car and
waited, dazed.
There was quite a large fall of glass.
*** END OF THE PROJECT GUTENBERG EBOOK A FALL OF GLASS
***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

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. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

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.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• 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 provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like