Opencv With Python By Example Prateek Joshi download
Opencv With Python By Example Prateek Joshi download
download
https://ebookbell.com/product/opencv-with-python-by-example-
prateek-joshi-36155310
https://ebookbell.com/product/opencv-with-python-by-example-prateek-
joshi-10833448
https://ebookbell.com/product/learn-opencv-with-python-by-
examples-2nd-edition-james-chen-53046722
https://ebookbell.com/product/learn-opencv-with-python-by-examples-
implement-computer-vision-algorithms-provided-by-opencv-with-python-
for-image-processing-object-detection-and-machine-learning-2nd-
edition-james-chen-50883868
https://ebookbell.com/product/building-computer-vision-applications-
using-artificial-neural-networks-with-stepbystep-examples-in-opencv-
and-tensorflow-with-python-1st-edition-shamshad-ansari-50195836
Opencv With Python Blueprints Design And Develop Advanced Computer
Vision Projects Using Opencv With Python 1st Edition Michael Beyeler
https://ebookbell.com/product/opencv-with-python-blueprints-design-
and-develop-advanced-computer-vision-projects-using-opencv-with-
python-1st-edition-michael-beyeler-20640218
https://ebookbell.com/product/mastering-opencv-with-python-use-numpy-
scikit-tensorflow-and-matplotlib-to-learn-advanced-algorithms-for-
machine-learning-through-a-set-of-practical-projects-ayush-
vaishya-53747356
https://ebookbell.com/product/opencv-4-with-python-blueprints-build-
creative-computer-vision-projects-with-the-latest-version-of-
opencv-4-and-python-3-menua-gevorgyan-57677018
Opencv Computer Vision Projects With Python Get Savvy With Opencv And
Actualize Cool Computer Vision Applications A Course In Three Modules
Michael Beyeler
https://ebookbell.com/product/opencv-computer-vision-projects-with-
python-get-savvy-with-opencv-and-actualize-cool-computer-vision-
applications-a-course-in-three-modules-michael-beyeler-10834122
https://ebookbell.com/product/mastering-opencv-4-with-python-alberto-
fernndez-villn-53956916
OpenCV with Python By Example
Table of Contents
OpenCV with Python By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Applying Geometric Transformations to Images
Installing OpenCV-Python
Windows
Mac OS X
Linux (for Ubuntu)
Reading, displaying, and saving images
What just happened?
Loading and saving an image
Image color spaces
Converting between color spaces
What just happened?
Image translation
What just happened?
Image rotation
What just happened?
Image scaling
What just happened?
Affine transformations
What just happened?
Projective transformations
What just happened?
Image warping
Summary
2. Detecting Edges and Applying Image Filters
2D convolution
Blurring
The size of the kernel versus the blurriness
Edge detection
Motion blur
Under the hood
Sharpening
Understanding the pattern
Embossing
Erosion and dilation
Afterthought
Creating a vignette filter
What’s happening underneath?
How do we move the focus around?
Enhancing the contrast in an image
How do we handle color images?
Summary
3. Cartoonizing an Image
Accessing the webcam
Under the hood
Keyboard inputs
Interacting with the application
Mouse inputs
What’s happening underneath?
Interacting with a live video stream
How did we do it?
Cartoonizing an image
Deconstructing the code
Summary
4. Detecting and Tracking Different Body Parts
Using Haar cascades to detect things
What are integral images?
Detecting and tracking faces
Understanding it better
Fun with faces
Under the hood
Detecting eyes
Afterthought
Fun with eyes
Positioning the sunglasses
Detecting ears
Detecting a mouth
It’s time for a moustache
Detecting a nose
Detecting pupils
Deconstructing the code
Summary
5. Extracting Features from an Image
Why do we care about keypoints?
What are keypoints?
Detecting the corners
Good Features To Track
Scale Invariant Feature Transform (SIFT)
Speeded Up Robust Features (SURF)
Features from Accelerated Segment Test (FAST)
Binary Robust Independent Elementary Features (BRIEF)
Oriented FAST and Rotated BRIEF (ORB)
Summary
6. Creating a Panoramic Image
Matching keypoint descriptors
How did we match the keypoints?
Understanding the matcher object
Drawing the matching keypoints
Creating the panoramic image
Finding the overlapping regions
Stitching the images
What if the images are at an angle to each other?
Why does it look stretched?
Summary
7. Seam Carving
Why do we care about seam carving?
How does it work?
How do we define “interesting”?
How do we compute the seams?
Can we expand an image?
Can we remove an object completely?
How did we do it?
Summary
8. Detecting Shapes and Segmenting an Image
Contour analysis and shape matching
Approximating a contour
Identifying the pizza with the slice taken out
How to censor a shape?
What is image segmentation?
How does it work?
Watershed algorithm
Summary
9. Object Tracking
Frame differencing
Colorspace based tracking
Building an interactive object tracker
Feature based tracking
Background subtraction
Summary
10. Object Recognition
Object detection versus object recognition
What is a dense feature detector?
What is a visual dictionary?
What is supervised and unsupervised learning?
What are Support Vector Machines?
What if we cannot separate the data with simple straight lines?
How do we actually implement this?
What happened inside the code?
How did we build the trainer?
Summary
11. Stereo Vision and 3D Reconstruction
What is stereo correspondence?
What is epipolar geometry?
Why are the lines different as compared to SIFT?
Building the 3D map
Summary
12. Augmented Reality
What is the premise of augmented reality?
What does an augmented reality system look like?
Geometric transformations for augmented reality
What is pose estimation?
How to track planar objects?
What happened inside the code?
How to augment our reality?
Mapping coordinates from 3D to 2D
How to overlay 3D objects on a video?
Let’s look at the code
Let’s add some movements
Summary
Index
OpenCV with Python By Example
OpenCV with Python By Example
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its
dealers and distributors will be held liable for any damages caused or alleged to be caused
directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2015
Production reference: 1150915
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-393-2
www.packtpub.com
Credits
Author
Prateek Joshi
Reviewers
Will Brennan
Gabriel Garrido Calvo
Pavan Kumar Pavagada Nagaraja
Marvin Smith
Commissioning Editor
Deepika Gaonkar
Acquisition Editor
Tushar Gupta
Content Development Editor
Sumeet Sawant
Technical Editor
Ryan Kochery
Copy Editors
Merilyn Pereira
Angad Singh
Project Coordinator
Shweta H Birwatkar
Proofreader
Safis Editing
Indexer
Tejal Daruwale Soni
Graphics
Jason Monteiro
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph
About the Author
Prateek Joshi is a computer vision researcher with a primary focus on content-based
analysis. He is particularly interested in intelligent algorithms that can understand images
to produce scene descriptions in terms of constituent objects. He has a master’s degree
from the University of Southern California, specializing in computer vision. He was
elected to become a member of the Honor Society for academic excellence and an
ambassador for the School of Engineering. Over the course of his career, he has worked
for companies such as Nvidia, Microsoft Research, Qualcomm, and a couple of early stage
start-ups in Silicon Valley.
His work in this field has resulted in multiple patents, tech demos, and research papers at
major IEEE conferences. He has won many hackathons using a wide variety of
technologies related to image recognition. He enjoys blogging about topics such as
artificial intelligence, abstract mathematics, and cryptography. His blog has been visited
by users in more than 200 countries, and he has been featured as a guest author in
prominent tech magazines.
About the Reviewers
Will Brennan is a software consultant based in London with experience in machine
learning, image processing, and data mining. He is currently managing a start-up called
SkyTales Ltd, which is a cloud-based 3D mapping and analytics service. SkyTales Ltd can
work on a single video stream; the service is able to perform asset detection and tracking
across large environments. You can also reach him on GitHub at
https://www.github.com/WillBrennan.
Gabriel Garrido Calvo was born in 1986 in a small town called Burguillos del Cerro,
located in Spain. In 2011, he was awarded a degree in software engineering by the
University of Granada, Spain. He is passionate about programming languages and
technologies.
Gabriel is currently working as a software engineer and team leader at trivago, which is
one of the biggest hotel metasearch engines in the world, based in Düsseldorf, Germany.
Pavan Kumar Pavagada Nagaraja is currently working as a chief technology officer at
Wearless Tech Inc., which is a start-up based in San Francisco, California. Here, Pavan is
leading the development of “Cocoon Cam”, which is a non-contact computer-vision-based
camera system made to reliably monitor the heart rate, temperature, and breathing of
infant patients. The product has received multiple awards, including the US National
Science Foundation Innovation Corps award, Zahn Prize from The Moxie Foundation, and
the Most Practical Solution award.
Pavan has a master’s degree in computer science from the University of California, San
Diego, and a bachelor’s degree in electronics and communication from MSRIT, India. He
has worked as a software programmer at the Apple headquarters in Cupertino, California,
and as a technical marketing engineer at NetApp Inc., which is in Bangalore, India. He has
technical experience in the fields of computer vision and machine learning, having
published works in both of these areas.
Marvin Smith is currently a software engineer in the defense industry, specializing in
photogrammetry and remote sensing. He received his BS degree in computer science from
the University of Nevada, Reno, USA. His technical interests include high-performance
computing, distributed image processing, and multispectral imagery exploitation. Prior to
working in defense, Marvin held internships with the Intelligent Robotics Group at the
NASA Ames Research Center and the Nevada Automotive Test Center.
www.PacktPub.com
Support files, eBooks, discount offers, and
more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as
a print book customer, you are entitled to a discount on the eBook copy. Get in touch with
us at <service@packtpub.com> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt’s online digital
book library. Here, you can search, access, and read Packt’s entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.
Preface
Computer vision is found everywhere in modern technology. OpenCV for Python enables
us to run computer vision algorithms in real time. With the advent of powerful machines,
we are getting more processing power to work with. Using this technology, we can
seamlessly integrate our computer vision applications into the cloud. Web developers can
develop complex applications without having to reinvent the wheel. This book is a
practical tutorial that covers various examples at different levels, teaching you about the
different functions of OpenCV and their actual implementations.
What this book covers
Chapter 1, Applying Geometric Transformations to Images, explains how to apply
geometric transformations to images. In this chapter, we will discuss affine and projective
transformations, and see how we can use them to apply cool geometric effects to photos.
The chapter will begin with the procedure to install OpenCV-Python on multiple platforms
such as Mac OS X, Linux, and Windows. We will also learn how to manipulate an image
in various ways, such as resizing, changing color spaces, and so on.
Chapter 2, Detecting Edges and Applying Image Filters, shows how to use fundamental
image-processing operators and how we can use them to build bigger projects. We will
discuss why we need edge detection and how it can be used in various different ways in
computer vision applications. We will discuss image filtering and how we can use it to
apply various visual effects to photos.
Chapter 3, Cartoonizing an Image, shows how to cartoonize a given image using image
filters and other transformations. We will see how to use the webcam to capture a live
video stream. We will discuss how to build a real-time application, where we extract
information from each frame in the stream and display the result.
Chapter 4, Detecting and Tracking Different Body Parts, shows how to detect and track
faces in a live video stream. We will discuss the face detection pipeline and see how we
can use it to detect and track different body parts, such as eyes, ears, mouth, nose, and so
on.
Chapter 5, Extracting Features from an Image, is about detecting the salient points (called
keypoints) in an image. We will discuss why these salient points are important and how
we can use them to understand the image content. We will talk about the different
techniques that can be used to detect salient points and extract features from an image.
Chapter 6, Creating a Panoramic Image, shows how to create a panoramic image by
stitching multiple images of the same scene together.
Chapter 7, Seam Carving, shows how to do content-aware image resizing. We will discuss
how to detect “interesting” parts in an image and see how we can resize a given image
without deteriorating those interesting parts.
Chapter 8, Detecting Shapes and Segmenting an Image, shows how to perform image
segmentation. We will discuss how to partition a given image into its constituent parts in
the best possible way. You will also learn how to separate the foreground from the
background in an image.
Chapter 9, Object Tracking, shows you how to track different objects in a live video
stream. At the end of this chapter, you will be able to track any object in a live video
stream that is captured through the webcam.
Chapter 10, Object Recognition, shows how to build an object recognition system. We will
discuss how to use this knowledge to build a visual search engine.
Chapter 11, Stereo Vision and 3D Reconstruction, shows how to reconstruct the depth map
using stereo images. You will learn how to achieve a 3D reconstruction of a scene from a
set of images.
Chapter 12, Augmented Reality, shows how to build an augmented reality application. By
the end of this chapter, you will be able to build a fun augmented reality project using the
webcam.
What you need for this book
You’ll need the following software:
OpenCV 2.4.9
numpy 1.9.2
scipy 0.15.1
scikit-learn 0.16.1
The hardware specifications requirement is any computer with at least 4GB DDR3 RAM.
Who this book is for
This book is intended for Python developers who are new to OpenCV and want to develop
computer vision applications with OpenCV-Python. This book is also useful for generic
software developers who want to deploy computer vision applications on the cloud. It
would be helpful to have some familiarity with basic mathematical concepts, such as
vectors, matrices, and so on.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds
of information. Here are some examples of these styles and an explanation of their
meaning.
Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows: “We use
a function called getPerspectiveTransform to get the transformation matrix.”
A block of code is set as follows:
cv2.imshow('Input', img)
cv2.imshow('Output', img_output)
cv2.waitKey()
New terms and important words are shown in bold. Words that you see on the screen,
for example, in menus or dialog boxes, appear in the text like this: “The tx and ty values
are the X and Y translation values.”
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or disliked. Reader feedback is important for us as it helps us
develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <feedback@packtpub.com>, and mention the
book’s title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or
contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help
you to get the most from your purchase.
Downloading the example code
You can download the example code files from your account at http://www.packtpub.com
for all the Packt Publishing books you have purchased. If you purchased this book
elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-
mailed directly to you.
Downloading the color images of this book
We also provide you with a PDF file that has color images of the screenshots/diagrams
used in this book. The color images will help you better understand the changes in the
output. You can download this file from
https://www.packtpub.com/sites/default/files/downloads/B04554_Graphics.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do
happen. If you find a mistake in one of our books—maybe a mistake in the text or the
code—we would be grateful if you could report this to us. By doing so, you can save other
readers from frustration and help us improve subsequent versions of this book. If you find
any errata, please report them by visiting http://www.packtpub.com/submit-errata,
selecting your book, clicking on the Errata Submission Form link, and entering the
details of your errata. Once your errata are verified, your submission will be accepted and
the errata will be uploaded to our website or added to any list of existing errata under the
Errata section of that title.
To view the previously submitted errata, go to
https://www.packtpub.com/books/content/support and enter the name of the book in the
search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At
Packt, we take the protection of our copyright and licenses very seriously. If you come
across any illegal copies of our works in any form on the Internet, please provide us with
the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com> with a link to the suspected pirated
material.
We appreciate your help in protecting our authors and our ability to bring you valuable
content.
Questions
If you have a problem with any aspect of this book, you can contact us at
<questions@packtpub.com>, and we will do our best to address the problem.
Chapter 1. Applying Geometric
Transformations to Images
In this chapter, we are going to learn how to apply cool geometric effects to images.
Before we get started, we need to install OpenCV-Python. We will discuss how to install
the necessary tools and packages as well.
By the end of this chapter, you will know:
How to install OpenCV-Python
How to read, display, and save images
How to convert between multiple color spaces
How to apply geometric transformations like translation, rotation, and scaling
How to use affine and projective transformations to apply funny geometric effects on
photos
Installing OpenCV-Python
Let’s see how to install OpenCV with Python support on multiple platforms.
Windows
In order to get OpenCV-Python up and running, we need to perform the following steps:
1. Install Python: Make sure you have Python 2.7.x installed on your machine. If you
don’t have it, you can install it from https://www.python.org/downloads/windows/
2. Install NumPy: NumPy is a great package to do numerical computing in Python. It is
very powerful and has a wide variety of functions. OpenCV-Python plays nicely with
NumPy, and we will be using this package a lot, during the course of this book. You
can install the latest version from http://sourceforge.net/projects/numpy/files/NumPy/
We need to install all these packages in their default locations. Once we install Python and
NumPy, we need to ensure that they’re working fine. Open up the Python shell and type
the following:
>>> import numpy
If the installation has gone well, this shouldn’t throw any error. Once you confirm it, you
can go ahead and download the latest OpenCV version from
http://opencv.org/downloads.html.
Once you finish downloading it, double-click to install it. We need to make a couple of
changes, as follows:
1. Navigate to opencv/build/python/2.7/
2. You will see a file named cv2.pyd. Copy this file to C:/Python27/lib/site-
packages
You’re all set! Let’s make sure that OpenCV is working. Open up the Python shell and
type the following:
>>> import cv2
If you don’t see any errors, then you are good to go! You are now ready to use OpenCV-
Python.
Mac OS X
To install OpenCV-Python, we will be using Homebrew. Homebrew is a great package
manager for Mac OS X and it will come in handy when you are installing various libraries
and utilities on OS X. If you don’t have Homebrew, you can install it by running the
following command on your terminal:
$ ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
Even though OS X comes with inbuilt Python, we need to install Python using Homebrew
to make our lives easier. This version is called brewed Python. Once you install
Homebrew, the next step is to install brewed Python. Open up the terminal and type the
following:
$ brew install python
This will automatically install pip as well. Pip is a package management tool to install
packages in Python and we will be using it to install other packages. Let’s make sure the
brewed Python is working correctly. Go to your terminal and type the following:
$ which python
You should see /usr/local/bin/python printed on the terminal. This means that we are
using the brewed Python and not the inbuilt system Python. Now that we have installed
brewed Python, we can go ahead and add the repository, homebrew/science, which is
where OpenCV is located. Open the terminal and run the following command:
$ brew tap homebrew/science
Make sure the package NumPy is installed. If not, run the following in your terminal:
$ pip install numpy
Now, we are ready to install OpenCV. Go ahead and run the following command from
your terminal:
$ brew install opencv --with-tbb --with-opengl
You’re all set! Let’s see if it’s installed properly. Open up the Python shell and type the
following:
>>> import cv2
If the installation went well, you will not see any error message. You are now ready to use
OpenCV in Python.
Another Random Scribd Document
with Unrelated Content
The Project Gutenberg eBook of La lotta
politica in Italia, Volume 2 (of 3)
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.
Language: Italian
Note:
La lotta politica
in Italia
Q U I N TA E D I Z I O N E
Curata e riveduta sul manoscritto da A. Malavani e G. Fumagalli
VOLUME II.
FIRENZE
SOC. ANONIMA EDITRICE «LA VOCE»
—
1921
INDICE
Influenze europee.
L'Europa era anche più agitata dell'Italia dai moti sotterranei del
liberalismo.
Il patto della Santa Alleanza uscito da una tragedia pareva prossimo
ad attirarsi gli scherni di una farsa: il dispotismo dei re, per quanto
agguerrito, non bastava ad atterrire la libertà dei popoli. La
individualità civile e politica creata dalla rivoluzione francese col
dogma della sovranità popolare, sorpassata la necessaria antitesi
della dittatura napoleonica, passava dal cittadino alla nazione, dalla
Francia all'Europa. Un nuovo diritto era proclamato tutti i giorni dai
giornali e dalle cattedre, dalle esigenze industriali e commerciali,
politiche e sociali. La rivoluzione francese avendo più o meno rivelato
se medesima a tutti i popoli, ognuno di essi impadronendosi del
proprio problema badava a trovarne la soluzione. E il problema era il
medesimo per tutti attraverso ogni differenza di grado: emanciparsi
dal passato costituendosi nell'indipendenza e nella libertà e mutando
i propri despoti in funzionari.
La Carta conquistata dalla Francia nella propria sconfitta metteva il
principio dell'elettorato popolare al disopra della monarchia: questa
per combatterlo si logorerebbe fatalmente; mentre la nazione,
percorrendo in mezzo secolo tutta la gamma delle monarchie
costituzionali quasi a convincere il mondo della loro inconciliabilità
colla moderna libertà, riconquisterebbe la republica. L'Inghilterra,
rappresentante di un parlamentarismo nel quale la sovranità
nazionale era ancora limitata al doppio patriziato dei lords e dei
ricchi, guadagnata al contagio della democrazia francese, si
preparava con discussioni di popoli e reazioni di governo alla grande
rivoluzione legale del 1829; l'Irlanda s'insanguinava nell'eroica
caparbietà di una emancipazione mal definita; interclusi dalla Russia
dall'Austria e dalla Turchia, i Principati Danubiani, quasi anella
fracassate dell'immenso dragone slavo, erano agitati da moti
convulsi di congiunzione e cercavano sottrarsi alla tirannia turca
invocando la libertà francese. Erano popolazioni quasi barbare che si
avventuravano alla libertà coll'energia di una indipendenza selvaggia,
mescolando sentimenti e tradizioni medioevali ad istinti meravigliosi
di modernità. Dopo l'antica civiltà del Mediterraneo e del Baltico
fermentava in essi quella del mar Nero. La Slavia del sud,
avanguardia della Slavia del nord, combatteva precipuamente
Turchia ed Austria, il potere più barbaro e la potenza più dispotica
d'Europa, le due negazioni più assurde dell'individualità cristiana e
moderna.
La Grecia, piccola, smembrata, appena colla popolazione d'una
grande città, senza denaro e senz'armi, si scagliava sull'immane
colosso dei Dardanelli: tutti i suoi figli erano eroi. Gli antichi poemi di
Omero ammutolivano agli echi delle nuove gesta: le vecchie storie
leggendarie diventavano pedestri dinanzi ai racconti delle presenti
imprese; persino la tragedia napoleonica nella sua vastità non
uguagliava questa angusta epopea, nella quale tutto un popolo si
mutava in esercito, mentre tutte le sue città affogavano nel sangue,
e flottiglie di brulotti incendiavano le armate nemiche
incalcolabilmente numerose, e falangi di donne superavano
d'ardimento gl'invincibili battaglioni dei klefti.
La Spagna si ribellava contro il tradimento di Ferdinando VII, re così
ribaldo che al suo paragone quelli d'Italia sembravano magnanimi.
Quiroga e Riego alla testa di una insurrezione militare lo forzano al
rispetto della costituzione proclamata spontaneamente dalla nazione
nel 1812 durante l'interregno e da lui accettata al ritorno nel 1814.
Ma il costituzionalismo è impossibile anche alla Spagna troppo
incolta e bigotta; quindi il partito liberale si spezza e, mentre i
moderati aggirati dalla corte e dal clero mirano a sminuire
rivoluzione e costituzione, i radicali esasperati mantengono la rivolta.
La guerra civile avvampa sublime di orrore e di eroismo. Il moto si
propaga al Portogallo: il colonnello Sepulveda vi si solleva, i
costituzionali entrano trionfanti a Lisbona, e Giovanni VII vi sbarca
dal Brasile per accettare la costituzione, lasciando quello emanciparsi
e proclamare don Pedro imperatore.
L'Europa freme. La Polonia, ostinata nel sogno assurdo d'una
rivoluzione aristocratica, nella quale al popolo viene sempre offerto il
dispotismo dei propri signori in cambio della tirannide russa, affila le
armi; la Germania si agita nelle società segrete, scuotendo con
brividi poderosi i limiti dei propri molteplici stati come disadatte
congiunture di troppo vecchia armatura.
La rivoluzione napoletana.
Rivoluzione piemontese.
Repressioni assolutiste.
ebookbell.com