100% found this document useful (2 votes)
43 views

MATLAB Computer Vision Toolbox User s Guide The Mathworks - Read the ebook now with the complete version and no limits

The document provides access to various MATLAB User's Guides for different toolboxes, including Computer Vision, Econometrics, Bioinformatics, and others, available for download at textbookfull.com. It includes installation instructions and examples for using the toolboxes effectively. The document also contains contact information for MathWorks and details about licensing and trademarks.

Uploaded by

luukkomsaod
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)
43 views

MATLAB Computer Vision Toolbox User s Guide The Mathworks - Read the ebook now with the complete version and no limits

The document provides access to various MATLAB User's Guides for different toolboxes, including Computer Vision, Econometrics, Bioinformatics, and others, available for download at textbookfull.com. It includes installation instructions and examples for using the toolboxes effectively. The document also contains contact information for MathWorks and details about licensing and trademarks.

Uploaded by

luukkomsaod
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/ 69

Explore the full ebook collection and download it now at textbookfull.

com

MATLAB Computer Vision Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-computer-vision-
toolbox-user-s-guide-the-mathworks/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

MATLAB Econometrics Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-econometrics-toolbox-user-s-
guide-the-mathworks/

textbookfull.com

MATLAB Bioinformatics Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-bioinformatics-toolbox-user-s-
guide-the-mathworks/

textbookfull.com

MATLAB Mapping Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-mapping-toolbox-user-s-guide-
the-mathworks/

textbookfull.com

MATLAB Optimization Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-optimization-toolbox-user-s-
guide-the-mathworks/

textbookfull.com
MATLAB Trading Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-trading-toolbox-user-s-guide-
the-mathworks/

textbookfull.com

MATLAB Curve Fitting Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-curve-fitting-toolbox-user-s-
guide-the-mathworks/

textbookfull.com

MATLAB Fuzzy Logic Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-fuzzy-logic-toolbox-user-s-
guide-the-mathworks/

textbookfull.com

MATLAB Global Optimization Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-global-optimization-toolbox-
user-s-guide-the-mathworks/

textbookfull.com

MATLAB Image Processing Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-image-processing-toolbox-user-
s-guide-the-mathworks/

textbookfull.com
Computer Vision Toolbox™
User's Guide

R2020a
How to Contact MathWorks

Latest news: www.mathworks.com

Sales and services: www.mathworks.com/sales_and_services

User community: www.mathworks.com/matlabcentral

Technical support: www.mathworks.com/support/contact_us

Phone: 508-647-7000

The MathWorks, Inc.


1 Apple Hill Drive
Natick, MA 01760-2098
Computer Vision Toolbox™ User's Guide
© COPYRIGHT 2004–2020 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied
only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form
without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through
the federal government of the United States. By accepting delivery of the Program or Documentation, the government
hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer
software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014.
Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain
to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government) and shall
supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is
inconsistent in any respect with federal procurement law, the government agrees to return the Program and
Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be
trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for
more information.
Revision History
July 2004 First printing New for Version 1.0 (Release 14)
October 2004 Second printing Revised for Version 1.0.1 (Release 14SP1)
March 2005 Online only Revised for Version 1.1 (Release 14SP2)
September 2005 Online only Revised for Version 1.2 (Release 14SP3)
November 2005 Online only Revised for Version 2.0 (Release 14SP3+)
March 2006 Online only Revised for Version 2.1 (Release 2006a)
September 2006 Online only Revised for Version 2.2 (Release 2006b)
March 2007 Online only Revised for Version 2.3 (Release 2007a)
September 2007 Online only Revised for Version 2.4 (Release 2007b)
March 2008 Online only Revised for Version 2.5 (Release 2008a)
October 2008 Online only Revised for Version 2.6 (Release 2008b)
March 2009 Online only Revised for Version 2.7 (Release 2009a)
September 2009 Online only Revised for Version 2.8 (Release 2009b)
March 2010 Online only Revised for Version 3.0 (Release 2010a)
September 2010 Online only Revised for Version 3.1 (Release 2010b)
April 2011 Online only Revised for Version 4.0 (Release 2011a)
September 2011 Online only Revised for Version 4.1 (Release 2011b)
March 2012 Online only Revised for Version 5.0 (Release 2012a)
September 2012 Online only Revised for Version 5.1 (Release R2012b)
March 2013 Online only Revised for Version 5.2 (Release R2013a)
September 2013 Online only Revised for Version 5.3 (Release R2013b)
March 2014 Online only Revised for Version 6.0 (Release R2014a)
October 2014 Online only Revised for Version 6.1 (Release R2014b)
March 2015 Online only Revised for Version 6.2 (Release R2015a)
September 2015 Online only Revised for Version 7.0 (Release R2015b)
March 2016 Online only Revised for Version 7.1 (Release R2016a)
September 2016 Online only Revised for Version 7.2 (Release R2016b)
March 2017 Online only Revised for Version 7.3 (Release R2017a)
September 2017 Online only Revised for Version 8.0 (Release R2017b)
March 2018 Online only Revised for Version 8.1 (Release R2018a)
September 2018 Online only Revised for Version 8.2 (Release R2018b)
March 2019 Online only Revised for Version 9.0 (Release R2019a)
September 2019 Online only Revised for Version 9.1 (Release R2019b)
March 2020 Online only Revised for Version 9.2 (Release R2020a)
Contents

Featured Examples
1
Localize and Read Multiple Barcodes in Image . . . . . . . . . . . . . . . . . . . . . 1-2

Monocular Visual Odometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-22

Track Vehicles Using Lidar: From Point Cloud to Track List . . . . . . . . . . 1-35

Semantic Segmentation Using Dilated Convolutions . . . . . . . . . . . . . . . . 1-55

Define Custom Pixel Classification Layer with Tversky Loss . . . . . . . . . . 1-59

Track a Face in Scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-66

Create 3-D Stereo Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-71

Measure Distance from Stereo Camera to a Face . . . . . . . . . . . . . . . . . . . 1-72

Reconstruct 3-D Scene from Disparity Map . . . . . . . . . . . . . . . . . . . . . . . 1-74

Visualize Stereo Pair of Camera Extrinsic Parameters . . . . . . . . . . . . . . . 1-77

Remove Distortion from an Image Using the Camera Parameters Object


......................................................... 1-80

Point Cloud Processing


2
Getting Started with Point Clouds Using Deep Learning . . . . . . . . . . . . . . 2-2
Import Point Cloud Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Augment Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Encode Point Cloud Data to Image-like Format . . . . . . . . . . . . . . . . . . . . . 2-3
Train a Deep Learning Classification Network with Encoded Point Cloud
Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3

Point Cloud Registration Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4


Point Cloud Registration Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Point Cloud Registration Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6

The PLY Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8


File Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8

v
Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Common Elements and Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10

Using the Installer for Computer Vision System Toolbox


Product
3
Install Computer Vision Toolbox Add-on Support Files . . . . . . . . . . . . . . . 3-2

Install OCR Language Data Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3


Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Pretrained Language Data and the ocr function . . . . . . . . . . . . . . . . . . . . 3-3

Install and Use Computer Vision Toolbox OpenCV Interface . . . . . . . . . . . 3-6


Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Support Package Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Create MEX-File from OpenCV C++ file . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Use the OpenCV Interface C++ API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Create Your Own OpenCV MEX-files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Run OpenCV Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8

Install and Use Computer Vision Toolbox OpenCV Interface for Simulink
......................................................... 3-10
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
Import OpenCV Code into Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18

Smile Detection by Using OpenCV Code in Simulink . . . . . . . . . . . . . . . . 3-19


Required Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Set Up Your C++ Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Model Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
Step 1: Import OpenCV Function to Create a Simulink Library . . . . . . . . 3-20
Step 2: Use Generated Subsystem in Simulink Model . . . . . . . . . . . . . . . 3-25
Step 3: Simulate the Smile Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-26
Step 4: Generate C++ Code from the Smile Detector Model . . . . . . . . . . 3-26
Deploy the Smile Detector on the Raspberry Pi Hardware . . . . . . . . . . . . 3-27

Convert RGB Image to Grayscale Image by Using OpenCV Importer . . . 3-29


Required Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29
Set Up Your C++ Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29
Model Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29
Step 1: Import OpenCV Function to Create a Simulink Library . . . . . . . . 3-30
Step 2: Use Generated Subsystem in Simulink Model . . . . . . . . . . . . . . . 3-33
Step 3: Simulate the RGB to Gray Convertor . . . . . . . . . . . . . . . . . . . . . . 3-34

Draw Different Shapes by Using OpenCV Code in Simulink . . . . . . . . . . 3-36


Required Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-36
Set Up Your C++ Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-36
Model Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-36
Step 1: Import OpenCV Function to Create a Simulink Library . . . . . . . . 3-37
Step 2: Use Generated Subsystem in Simulink Model . . . . . . . . . . . . . . . 3-38
Draw Atom on Image by Using C Caller Block . . . . . . . . . . . . . . . . . . . . . 3-38

vi Contents
Input, Output, and Conversions
4
Export to Video Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Setting Block Parameters for this Example . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Configuration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

Import from Video Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4


Setting Block Parameters for this Example . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Configuration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5

Batch Process Image Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6


Configuration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

Convert R'G'B' to Intensity Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

Process Multidimensional Color Video Signals . . . . . . . . . . . . . . . . . . . . . 4-10

Video Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12


Defining Intensity and Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
Video Data Stored in Column-Major Format . . . . . . . . . . . . . . . . . . . . . . 4-12

Image Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13


Binary Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
Intensity Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
RGB Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13

Display and Graphics


5
Display, Stream, and Preview Videos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
View Streaming Video in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Preview Video in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
View Video in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

Draw Shapes and Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4


Rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
Line and Polyline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
Polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Circle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6

Registration and Stereo Vision


6
Fisheye Calibration Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Fisheye Camera Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Fisheye Camera Calibration in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4

vii
Single Camera Calibrator App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8
Camera Calibrator Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8
Single Camera Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8
Open the Camera Calibrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9
Prepare the Pattern, Camera, and Images . . . . . . . . . . . . . . . . . . . . . . . . . 6-9
Add Images and Select Camera Model . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11
Calibrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15
Evaluate Calibration Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17
Improve Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-20
Export Camera Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23

Stereo Camera Calibrator App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-25


Stereo Camera Calibrator Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-25
Stereo Camera Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-25
Open the Stereo Camera Calibrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-26
Prepare Pattern, Camera, and Images . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-26
Add Image Pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-29
Calibrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31
Evaluate Calibration Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31
Improve Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-35
Export Camera Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-37

What Is Camera Calibration? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-39


Camera Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-39
Pinhole Camera Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-40
Camera Calibration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-41
Distortion in Camera Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-42

Structure from Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-45


Structure from Motion from Two Views . . . . . . . . . . . . . . . . . . . . . . . . . 6-45
Structure from Motion from Multiple Views . . . . . . . . . . . . . . . . . . . . . . 6-46

Object Detection
7
Getting Started with SSD Multibox Detection . . . . . . . . . . . . . . . . . . . . . . 7-2
Predict Objects in the Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Transfer Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Design an SSD Detection Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Train an Object Detector and Detect Objects with an SSD Model . . . . . . . 7-4
Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Label Training Data for Deep Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4

Getting Started with Object Detection Using Deep Learning . . . . . . . . . . 7-6


Create Training Data for Object Detection . . . . . . . . . . . . . . . . . . . . . . . . 7-6
Create Object Detection Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
Train Detector and Evaluate Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
Detect Objects Using Deep Learning Detectors . . . . . . . . . . . . . . . . . . . . . 7-7

How Labeler Apps Store Exported Pixel Labels . . . . . . . . . . . . . . . . . . . . . 7-9


Location of Pixel Label Data Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
View Exported Pixel Label Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9

viii Contents
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10

Anchor Boxes for Object Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14


What Is an Anchor Box? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
Advantage of Using Anchor Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
How Do Anchor Boxes Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15
Anchor Box Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18

Getting Started with YOLO v2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19


Predicting Objects in the Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19
Transfer Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20
Design a YOLO v2 Detection Network . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20
Train an Object Detector and Detect Objects with a YOLO v2 Model . . . . 7-21
Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-21
Label Training Data for Deep Learning . . . . . . . . . . . . . . . . . . . . . . . . . . 7-21

Getting Started with R-CNN, Fast R-CNN, and Faster R-CNN . . . . . . . . . 7-23
Object Detection Using R-CNN Algorithms . . . . . . . . . . . . . . . . . . . . . . . 7-23
Comparison of R-CNN Object Detectors . . . . . . . . . . . . . . . . . . . . . . . . . 7-24
Transfer Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-25
Design an R-CNN, Fast R-CNN, and a Faster R-CNN Model . . . . . . . . . . . 7-25
Label Training Data for Deep Learning . . . . . . . . . . . . . . . . . . . . . . . . . . 7-27

Getting Started with Semantic Segmentation Using Deep Learning . . . 7-29


Train a Semantic Segmentation Network . . . . . . . . . . . . . . . . . . . . . . . . 7-29
Label Training Data for Semantic Segmentation . . . . . . . . . . . . . . . . . . . 7-29

Training Data for Object Detection and Semantic Segmentation . . . . . . 7-31

Create Automation Algorithm for Labeling . . . . . . . . . . . . . . . . . . . . . . . . 7-35


Create New Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-35
Import Existing Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-36
Custom Algorithm Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-36

Label Pixels for Semantic Segmentation . . . . . . . . . . . . . . . . . . . . . . . . . . 7-39


Start Pixel Labeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-39
Label Pixels Using Flood Fill Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-40
Label Pixels Using Smart Polygon Tool . . . . . . . . . . . . . . . . . . . . . . . . . . 7-41
Label Pixels Using Polygon Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-43
Label Pixels Using Assisted Freehand Tool . . . . . . . . . . . . . . . . . . . . . . . 7-44
Replace Pixel Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-45
Refine Labels Using Brush Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-45
Visualize Pixel Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-46
Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-47

Get Started with the Image Labeler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-49


Load Unlabeled Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-49
Create Label Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-49
Label Ground Truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-56
Export Labeled Ground Truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-58
Save App Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-60

Choose an App to Label Ground Truth Data . . . . . . . . . . . . . . . . . . . . . . . 7-62

ix
Get Started with the Video Labeler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-64
Load Unlabeled Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-64
Set Time Interval to Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-64
Create Label Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-65
Label Ground Truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-72
Export Labeled Ground Truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-74
Label Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-76
Save App Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-77

Use Custom Image Source Reader for Labeling . . . . . . . . . . . . . . . . . . . . 7-79


Create Custom Reader Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-79
Import Data Source into Video Labeler App . . . . . . . . . . . . . . . . . . . . . . 7-79
Import Data Source into Ground Truth Labeler App . . . . . . . . . . . . . . . . 7-80

Use Sublabels and Attributes to Label Ground Truth Data . . . . . . . . . . . 7-81


When to Use Sublabels vs. Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-81
Draw Sublabels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-81
Copy and Paste Sublabels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-82
Delete Sublabels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-83
Sublabel Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-84

Temporal Automation Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-85


Create Temporal Automation Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 7-85
Run Temporal Automation Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-85

View Summary of Ground Truth Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-87


View Label Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-87
Compare Selected Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-89

Share and Store Labeled Ground Truth Data . . . . . . . . . . . . . . . . . . . . . . 7-91


Share Ground Truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-91
Move Ground Truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-94
Store Ground Truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-95

Keyboard Shortcuts and Mouse Actions for Image Labeler . . . . . . . . . . . 7-97


Label Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-97
Image Browsing and Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-97
Labeling Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-97
Polyline Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-98
Polygon Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-98
Zooming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-99
App Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-99

Keyboard Shortcuts and Mouse Actions for Video Labeler . . . . . . . . . . 7-100


Label Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-100
Frame Navigation and Time Interval Settings . . . . . . . . . . . . . . . . . . . . 7-100
Labeling Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-100
Polyline Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-101
Polygon Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-101
Zooming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-102
App Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-102

Point Feature Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-103


Functions That Return Points Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 7-103
Functions That Accept Points Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 7-105

x Contents
Local Feature Detection and Extraction . . . . . . . . . . . . . . . . . . . . . . . . . 7-109
What Are Local Features? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-109
Benefits and Applications of Local Features . . . . . . . . . . . . . . . . . . . . . 7-109
What Makes a Good Local Feature? . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-110
Feature Detection and Feature Extraction . . . . . . . . . . . . . . . . . . . . . . 7-110
Choose a Feature Detector and Descriptor . . . . . . . . . . . . . . . . . . . . . . 7-111
Use Local Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-112
Image Registration Using Multiple Features . . . . . . . . . . . . . . . . . . . . . 7-114

Train a Cascade Object Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-122


Why Train a Detector? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-122
What Kinds of Objects Can You Detect? . . . . . . . . . . . . . . . . . . . . . . . . 7-122
How Does the Cascade Classifier Work? . . . . . . . . . . . . . . . . . . . . . . . . 7-122
Create a Cascade Classifier Using the trainCascadeObjectDetector . . . 7-123
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-126
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-128
Train Stop Sign Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-132

Train Optical Character Recognition for Custom Fonts . . . . . . . . . . . . . 7-135


Open the OCR Trainer App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-135
Train OCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-135
App Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-137

Troubleshoot ocr Function Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-139


Performance Options with the ocr Function . . . . . . . . . . . . . . . . . . . . . 7-139

Create a Custom Feature Extractor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-140


Example of a Custom Feature Extractor . . . . . . . . . . . . . . . . . . . . . . . . 7-140

Image Retrieval with Bag of Visual Words . . . . . . . . . . . . . . . . . . . . . . . 7-143


Retrieval System Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-144
Evaluate Image Retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-145

Image Classification with Bag of Visual Words . . . . . . . . . . . . . . . . . . . . 7-146


Step 1: Set Up Image Category Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-146
Step 2: Create Bag of Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-146
Step 3: Train an Image Classifier With Bag of Visual Words . . . . . . . . . 7-147
Step 4: Classify an Image or Image Set . . . . . . . . . . . . . . . . . . . . . . . . . 7-148

Motion Estimation and Tracking


8
Multiple Object Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Data Association . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
Track Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4

Video Mosaicking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5

Pattern Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10

xi
Pattern Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-15

Geometric Transformations
9
Nearest Neighbor, Bilinear, and Bicubic Interpolation Methods . . . . . . . 9-2
Nearest Neighbor Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Bilinear Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Bicubic Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3

Filters, Transforms, and Enhancements


10
Adjust the Contrast of Intensity Images . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2

Adjust the Contrast of Color Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6

Remove Salt and Pepper Noise from Images . . . . . . . . . . . . . . . . . . . . . 10-10

Sharpen an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14

Statistics and Morphological Operations


11
Correct Nonuniform Illumination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2

Count Objects in an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8

Fixed-Point Design
12
Fixed-Point Signal Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Fixed-Point Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Benefits of Fixed-Point Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Benefits of Fixed-Point Design with System Toolboxes Software . . . . . . . 12-2

Fixed-Point Concepts and Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4


Fixed-Point Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4
Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5
Precision and Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6

xii Contents
Arithmetic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-8
Modulo Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-8
Two's Complement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-8
Addition and Subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9
Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10
Casts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12

Fixed-Point Support for MATLAB System Objects . . . . . . . . . . . . . . . . . 12-15


Getting Information About Fixed-Point System Objects . . . . . . . . . . . . . 12-15
Setting System Object Fixed-Point Properties . . . . . . . . . . . . . . . . . . . . 12-15

Specify Fixed-Point Attributes for Blocks . . . . . . . . . . . . . . . . . . . . . . . . 12-17


Fixed-Point Block Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-17
Specify System-Level Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19
Inherit via Internal Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19
Specify Data Types for Fixed-Point Blocks . . . . . . . . . . . . . . . . . . . . . . . 12-26

Code Generation and Shared Library


13
Simulink Shared Library Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2

Accelerating Simulink Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

Portable C Code Generation for Functions That Use OpenCV Library . . 13-4
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4

xiii
1

Featured Examples

• “Localize and Read Multiple Barcodes in Image” on page 1-2


• “Monocular Visual Odometry” on page 1-22
• “Track Vehicles Using Lidar: From Point Cloud to Track List” on page 1-35
• “Semantic Segmentation Using Dilated Convolutions” on page 1-55
• “Define Custom Pixel Classification Layer with Tversky Loss” on page 1-59
• “Track a Face in Scene” on page 1-66
• “Create 3-D Stereo Display” on page 1-71
• “Measure Distance from Stereo Camera to a Face” on page 1-72
• “Reconstruct 3-D Scene from Disparity Map” on page 1-74
• “Visualize Stereo Pair of Camera Extrinsic Parameters” on page 1-77
• “Remove Distortion from an Image Using the Camera Parameters Object” on page 1-80
1 Featured Examples

Localize and Read Multiple Barcodes in Image


This example shows how to use the readBarcode function from the Computer Vision Toolbox™ to
detect and decode 1-D and 2-D barcodes in an image. Barcodes are widely used to encode data in a
visual, machine-readable format. They are useful in many applications such as item identification,
warehouse inventory tracking, and compliance tracking. For 1-D barcodes, the readBarcode
function returns the location of the barcode endpoints. For 2-D barcodes, the function returns the
locations of the finder patterns. This example uses two approaches for localizing multiple barcodes in
an image. One approach is clustering-based, which is more robust to different imaging conditions and
requires the Statistics and Machine Learning Toolbox™. The second approach uses a segmentation-
based workflow and might require parameter tuning based on the imaging conditions.

Barcode Detection using the readBarcode Function

Read a QR code from an image.

I = imread("barcodeQR.jpg");

% Search the image for a QR Code.


[msg, ~, loc] = readBarcode(I);

% Annotate the image with the decoded message.


xyText = loc(2,:);
Imsg = insertText(I, xyText, msg, "BoxOpacity", 1, "FontSize", 25);

% Insert filled circles at the finder pattern locations.


Imsg = insertShape(Imsg, "FilledCircle", [loc, ...
repmat(10, length(loc), 1)], "Color", "red", "Opacity", 1);

% Display image.
imshow(Imsg)

1-2
Localize and Read Multiple Barcodes in Image

Read a 1-D barcode from an image.

I = imread("barcode1D.jpg");

% Read the 1-D barcode and determine the format..


[msg, format, locs] = readBarcode(I);

% Display the detected message and format.


disp("Detected format and message: " + format + ", " + msg)

Detected format and message: EAN-13, 1234567890128

% Insert a line to show the scan row of the barcode.


xyBegin = locs(1,:); imSize = size(I);
I = insertShape(I,"Line",[1 xyBegin(2) imSize(2) xyBegin(2)], ...
"LineWidth", 7);

% Insert markers at the end locations of the barcode.


I = insertShape(I, "FilledCircle", [locs, ...
repmat(10, length(locs), 1)], "Color", "red", "Opacity", 1);

1-3
1 Featured Examples

% Display image.
imshow(I)

Improving Barcode Detection

For a successful detection, the barcode must be clearly visible. The barcode must also be as closely
aligned to a horizontal or vertical position as possible. The readBarcode function is inherently more
robust to rotations for 2-D or matrix codes than it is to 1-D or linear barcodes. For example, the
barcode cannot be detected in this image.

I = imread("rotated1DBarcode.jpg");

% Display the image.


imshow(I)

1-4
Localize and Read Multiple Barcodes in Image

% Pass the image to the readBarcode function.


readBarcode(I)

ans =
""

Rotate the image using the imrotate so that the barcode is roughly horizontal. Use readBarcode
on the rotated image.

% Rotate the image by 30 degrees clockwise.


Irot = imrotate(I, -30);

% Display the rotated image.


imshow(Irot)

1-5
1 Featured Examples

% Pass the rotated image to the readBarcode function.


readBarcode(Irot)

ans =
"012345678905"

Detect Multiple Barcodes

The readBarcode function detects only a single barcode in each image. In order to detect multiple
barcodes, you must specify a region-of-interest (ROI). To specify an ROI, you can use the
drawrectangle function to interactively determine the ROIs. You can also use image analysis
techniques to detect the ROI of multiple barcodes in the image.

1-6
Localize and Read Multiple Barcodes in Image

Interactively determine ROIs

I = imread("multiple1DBarcodes.jpg");

1-7
1 Featured Examples

Use the drawrectangle function to draw and obtain rectangle parameters.

roi1 = drawrectangle;

pos = roi1.Position;

% ROIs obtained using drawrectangle


roi = [350 190 690 370
350 640 690 360
350 1090 690 340];

imSize = size(I);
for i = 1:size(roi,1)
[msg, format, locs] = readBarcode(I, roi(i,:));
disp("Decoded format and message: " + format + ", " + msg)

% Insert a line to indicate the scan row of the barcode.


xyBegin = locs(1,:);
I = insertShape(I,"Line",[1 xyBegin(2) imSize(2) xyBegin(2)], ...
"LineWidth", 7);

% Annotate image with decoded message.


I = insertText(I, xyBegin, msg, "BoxOpacity", 1, "FontSize", 30);
end

Decoded format and message: UPC-A, 012345678905


Decoded format and message: EAN-13, 4567891324562
Decoded format and message: CODE-39, ABC-123

imshow(I)

1-8
Localize and Read Multiple Barcodes in Image

Image analysis to determine ROIs

Use image analysis techniques to automate the detection of multiple barcodes. This requires
localizing multiple barcodes in an image, determining their orientation, and correcting for the
orientation. Without preprocessing, barcodes cannot be detected in the image containing multiple
rotated barcodes.

1-9
1 Featured Examples

I = imread("multiple1DBarcodesRotated.jpg");
Igray = rgb2gray(I);

% Display the image.


imshow(I)

% Pass the unprocessed image to the readBarcode function.


readBarcode(Igray, '1D')

ans =
""

Detection on the unprocessed image resulted in no detection.

Step 1: Detect candidate regions for the barcodes using MSER

Detect regions of interest in the image using the detectMSERFeatures function. Then, you can
eliminate regions of interest based on a specific criteria such as the aspect ratio. You can use the
binary image from the filtered results for further processing.

1-10
Localize and Read Multiple Barcodes in Image

% Detect MSER features.


[~, cc] = detectMSERFeatures(Igray);

% Compute region properties MajorAxisLength and MinorAxisLength.


regionStatistics = regionprops(cc, 'MajorAxisLength', 'MinorAxisLength');

% Filter out components that have a low aspect ratio as unsuitable


% candidates for the bars in the barcode.
minAspectRatio = 10;
candidateRegions = find(([regionStatistics.MajorAxisLength]./[regionStatistics.MinorAxisLength])

% Binary image to store the filtered components.


BW = false(size(Igray));

% Update the binary image.


for i = 1:length(candidateRegions)
BW(cc.PixelIdxList{candidateRegions(i)}) = true;
end

% Display the binary image with the filtered components.


imshow(BW)
title("Candidate regions for the barcodes")

1-11
1 Featured Examples

Step 2: Extract barcode line segments using hough transform

Detect prominent edges in the image using the edge function. Then use the hough transform to find
lines of interest. The lines represent possible candidates for the vertical bars in the barcode.

% Perform hough transform.


BW = edge(BW,'canny');
[H,T,R] = hough(BW);

% Display the result of the edge detection operation.


imshow(BW)

1-12
Localize and Read Multiple Barcodes in Image

% Determine the size of the suppression neighborhood.


reductionRatio = 500;
nhSize = floor(size(H)/reductionRatio);
idx = mod(nhSize,2) < 1;
nhSize(idx) = nhSize(idx) + 1;

% Identify the peaks in the Hough transform.


P = houghpeaks(H,length(candidateRegions),'NHoodSize',nhSize);

% Detect the lines based on the detected peaks.


lines = houghlines(BW,T,R,P);

% Display the lines detected using the houghlines function.


Ihoughlines = ones(size(BW));

% Start and end points of the detected lines.


startPts = reshape([lines(:).point1], 2, length(lines))';
endPts = reshape([lines(:).point2], 2, length(lines))';

1-13
1 Featured Examples

Ihoughlines = insertShape(Ihoughlines, 'Line', [startPts, endPts], ...


'LineWidth', 2, 'Color', 'green');

% Display the original image overlayed with the detected lines.


Ibarlines = imoverlay(I, ~Ihoughlines(:,:,1));
imshow(Ibarlines)

Step 3: Localize barcodes in image

After extracting the line segments, two methods are presented for localizing the individual barcodes
in the image:

• Method 1: A clustering-based technique that uses functionalities from the Statistics and Machine
Learning Toolbox™ to identify individual barcodes. This technique is more robust to outliers that
were detected using the image analysis techniques above. It can also be extended to a wide range
of imaging conditions without having to tune parameters.
• Method 2: A segmentation-based workflow to separate the individual barcodes. This method uses
other image analysis techniques to localize and rotation correct the extracted barcodes. While this
works fairly well, it might require some parameter tuning to prevent detection of outliers.

1-14
Localize and Read Multiple Barcodes in Image

Method 1: Clustering based workflow

There are two steps in this workflow:

1. Determine bisectors of barcode line segments

While it is common practice to directly use the lines (that were obtained using the Hough transform)
to localize the barcode, this method uses the lines to further detect the perpendicular bisectors for
each of the lines. The bisector lines are represented as points in cartesian space, which makes them
suitable for identifying individual barcodes. Using the bisectors make the detection of the individual
barcodes more robust, since it results in less misclassifications of lines that are similar but belonging
to different barcodes.

2. Perform clustering on the bisectors to identity the individual barcodes

Since all of the bars in a barcode are approximately parallel to each other, the bisectors of each of
these bars should ideally be the same line, and their corresponding points should therefore cluster
around a single point. In practice, these bisectors will vary from segment to segment, but still remain
similar enough to allow the use of a density-based clustering algorithm. The result of performing this
clustering operation is a set of clusters, each of which points to a separate barcode. This example
uses the dbscan function, which does not require prior knowledge of the number of clusters. The
different clusters (barcodes) are visualized in this example.

The example checks for a Statistics and Machine Learning Toolbox™ license. If a license is found, the
example uses the clustering method. Otherwise, the example uses the segmentation method.

useClustering = license('test','statistics_toolbox');

if useClustering
[boundingBox, orientation, Iclusters] = clusteringLocalization(lines, size(I));

% Display the detected clusters.


imshow(Iclusters)
else
disp("The clustering based workflow requires a license for the Statistics and Machine Learnin
end

1-15
Another Random Document on
Scribd Without Any Related Topics
They can never see happiness in one part of the world but to reflect
on the misery which is experienced in another. Is our country at
peace, happy and prosperous, than rejoice not at it, for there are
millions of human beings suffering in China, Japan, Hindostan, and
Bengal. Thompson's writings are deeply imbued with this whining
philosophy, and so perhaps are Cowper's, as was to be expected
from the state of his mind.

It is, however, the association by distant resemblances in objects, by


analogies in effects and in emotions which furnishes the mind with
perhaps the most interesting materials for social converse. Such a
mind is what the world calls brilliant. We soon tire of it, however, if it
does not occasionally relax, and give us a few of those details and
minutiæ, which belong to the mind of the first order in our division.
As was said of the poetry of Thomas Moore, we do not like always to
feed upon the whip syllabubs we soon become hungry for bread and
meat.

Such a mind as the one I have just been describing, has rarely a
very accurate or exact memory. The imagination is too active for the
fidelity of the memory. Pope has well asserted, that

"Where beams of warm imagination play,


The memory's soft figures melt away."

Men possessing such minds as these rarely make good historians or


profound philosophers. They neither narrate with fidelity, nor can
they philosophize with ability. Their imagination gilds and varnishes
the knowledge they have accumulated. Events, as Boswell expresses
it, grow mellow in their memories.11 But for this very reason do they
become exceedingly brilliant in conversation, when they have the
power of communicating their ideas well. Mr. Stewart tells as that
Boswell himself was a striking exemplification of his own remark,
"for his stories," says Mr. S. "which I have often listened to with
delight, seldom failed to improve wonderfully in such a keeping as
his memory afforded. They were much more amusing than even his
printed anecdotes; the latter were deprived of every chance of this
sort of improvement, by the scrupulous fidelity with which (probably
from a secret distrust of the accuracy of his recollection) he was
accustomed to record every conversation which he thought
interesting, a few hours after it took place."
11 "I have often experienced," says Boswell in his tour through the Hebrides with Dr.
Johnson, "that scenes through which a man has past improves by lying in the
memory: they grow mellow."

With regard to the order of mind which we have just been


considering, it may be said that although a few men may cultivate it
to a much higher pitch of perfection than it is generally found to
exist among women, yet taking the sexes together, it is rather a
characteristic of the weaker sex, at least in as much as the
associations are dependent on similarity or contrast in emotions.
Women, taking the whole sex together, have undoubtedly more
imagination than men, especially inrelation to what I would term the
sentimental and romantic portions of our nature. They have nicer
discernment and tact, more feeling, sympathy, emotion and curiosity
of all descriptions, and so far as these furnish materials for
association, they are superior to our sex. Now these are precisely
the materials which are most interesting when properly clothed in
the fascinating unaffected phraseology of a well educated lady.
Moreover, although men may perhaps display more originality
generally in the species of association falling under our second
division, yet I apprehend for that very reason they have less variety,
and, as we shall soon see, less quickness and ease in calling up their
associations.

The third class of minds, according to our arrangements is the


philosophical mind—that which associates principally by the relation
of necessary contiguity in time and place, by cause and effect,
premises and conclusions. This is undoubtedly the mind of the first
quality, and much the rarest in the human family. Knowledge,
however, which is acquired by associations of this character, is too
abstruse and unintelligible to the great mass of mankind to be
interesting in the social circle, and persons who have this order of
mind rarely have the other two in any perfection, and consequently
their conversation is not of that attractive character which pleases by
its ease, grace, and variety. Individuals of this character very rarely
display a good memory for mere words and details. Their knowledge
is arranged under certain general principles, and when they wish to
arrive at the detail, they are obliged to reason down from the
principle to the fact which is arranged under it. Such a mind has
rather a knowledge of general principles, than of particular facts and
incidents. General abstract subjects rarely produce much impression
on the mind of the mass. This is one reason why divines, who have
the most grand and sublime theme to descant on, nevertheless often
fail to produce much effect on their audiences. Their subject,
although grand, is yet a general one. The vices against which they
preach are the vices of the human race. The awful judgment of
which they speak, is a judgment to come at some indefinite time
hereafter. Mankind to be moved and interested must be addressed
specially and personally. You must not come before them clothed in
abstractions and generalizations. Look to that celebrated sermon of
Massillon, pronounced by Voltaire in his article on Eloquence, in the
Encydopedie Francaise, to be one of the most eloquent effusions of
modern times, and examine particularly that portion which had so
startling an effect on the audience as to make them spring
simultaneously from their seats, and you will see that it was just at
that moment that the eloquent divine dropped all his abstractions
and generalities and applied his subject to those very persons who
were listening to him. "Je m'arrête à vous, mes freres, qui êtes ici
assemblées. Je ne parle plus du reste des hommes," &c. And again,
"Je suppose que c'est ici votre derniere heure, et la fin de l'univers;
que les cieux vont s'ouvrir sur vos têtes—Jesus Christe paraitre dans
sa gloire au milieu de ce temple," &c.

It is useless to say that men much oftener have minds of the third
class in our arrangement than women; not because there is any
natural difference between the sexes in this particular, but because
ours is placed in a situation requiring the cultivation of this species
of mind more than the other. Our professions and occupations exert,
if I may say so, a more effectual demand for the development of this
order of intellect, than those of woman. Men in their passage
through life, are obliged to examine into the necessary connection
between events; they must adapt means to ends; they must attain
their purposes by well arranged plans, according to the relation of
cause and effect. Woman, on the contrary, from the nature of the
sphere in which she moves, and the character of the occupations in
which she is engaged, is more conversant with objects than with
their necessary connections and relations. She is not obliged to
arrange so many concatenated plans; her mind is more alive to the
perception of the objects around her, and less to the causæ rerum.
Her feelings and sympathies are most exquisite, but she attends less
to their relations and dependences. She is in fine a creature of
emotion rather than of philosophy.

It is for this reason that women rarely make good metaphysicians,


although their feelings and sympathies are of the most exquisite
character. Yet they are not in the habit of reflecting upon them—
arranging them into classes, according to their necessary
connections, and thence deducing the general principles and laws of
the mind. Mr. Stewart says that the taste for the philosophy of the
human mind is rarer among the sex, than even for pure
mathematics. He seems to think that there are but two names in the
whole catalogue of female authors, at all celebrated for deep
metaphysical research—Miss Edgeworth and Madame de Stael; and
he deems it not unfortunate for the world that the former was early
diverted from such unattractive speculations, to that more brilliant
career of literature which she has pursued with so unrivalled a
reputation.12
12 In regard to Madame de Stael, it is proper to remark, that although certainly an
able metaphysician—perhaps the very ablest that has ever appeared of her sex—yet
you see throughout her writings the character of the woman. Her isolated aphorisms
and maxims are most splendid; but when you come to examine any one of her
productions as a whole, you see the want of system and complete connection
between the parts. Her descriptions of our emotions and feelings are almost
unrivalled for pathos and beauty; but when she would put together the different parts
of the mind, and sketch out a heroine or a hero—a Corinne or her lover—she presents
incongruous beings such as nature never produces. Her mind, after all, was but the
mind of a woman—a mind that could furnish the very best materials in the world for a
philosopher to weave into his systems—a mind too susceptible of emotion to
philosophize on abstract principles—a mind that relied on feeling, rather than reason,
to guide it to truth. In her work on the French Revolution, though certainly very able,
you see how her mind is warped by her affection for her father, (M. Necker.) You see
how her conceptions of the Revolution as a whole, are biassed and prejudiced by too
intense a consideration of the scenes and events transpiring immediately around her,
and concerning her family. Goethe seems to think that Madame de Stael had no idea
what duty meant, so completely was she a creature of feeling.

Having described three distinct and separate orders of mind,


remarkable for different kinds of associations, and all widely differing
in the possession of that information suited to social converse, I
come now to compare the sexes together, in relation to the second
point essential to conversation, the power of communicating our
knowledge pleasantly and attractively to others. He undoubtedly is
the most pleasing companion in the social circle whose mind is of
that capacious, well stored kind that is capable of ranging at will
through the various classes of associations just pointed out, giving
you at one time connections and relations of abstract principles, or
philosophical deductions—at another, of analogies between objects,
effects, and emotions—and at another, interesting and circumstantial
details of the common events of every day life. "Conversation," says
a modern writer, "may be compared to a lyre with seven chords—
philosophy, art, poetry, politics, love, scandal, and the weather.
There are some professors who, like Paganini, 'can discourse most
eloquent music' upon one string only, and some who can grasp the
whole instrument, and with a master's hand, sound it from the top
to the bottom of its compass." Such individuals as these are very
rare. Perhaps Dr. Johnson,13 McIntosh and Coleridge might be cited
as specimens in England, and Schlegel in Germany. Individuals of
this character are very rare, because in the first place, there are very
few whose minds are capable of ranging through the whole extent of
knowledge; and secondly, it does by no means follow, that those
possessing the information, might be able to communicate it to
others with that brilliancy of diction, and judgment in the selection of
matter and its quantity, which will insure complete success in the
social circle.
13 Johnson's style in conversation must have been too grandiloquent and studied, to
have admitted of that variety and ease so necessary to the social circle.

I will make a few promiscuous remarks on these two points. Men of


deeply philosophic minds, are almost sure, from the character of
their speculations, to glide imperceptibly into habits of abstraction,
and to withdraw their attention from the scenes and occurrences
transpiring around them, to the contemplation of that world of
thought in which they dwell. Their thoughts are not the thoughts of
other men; the world in which they live is not the world of others. A
Newton, while wrapt in these philosophic visions, can sit for hours in
the cold, half dressed, eyes fixed, unconscious of all around him; he
can forget to dine; he can, in fine, forget himself, his friends, and
the world in which he lives. An Adam Smith, while studying the great
laws which regulate the accumulation, distribution, and consumption
of wealth, can so far forget himself and the world, as to mimic with
his cane, a soldier, who presents arms to him through respect, and
march after him when he moves off; he can be present when toasts
are drunk, and know nothing of what is passing.14 Minds of this
order are almost sure to neglect associations of a lighter character.
They fail to acquire that species of information which is most
pleasing in conversation. And, moreover, they are apt to have what
are called slow memories; they cannot call up their knowledge quick,
and utter it with volubility. The process by which they hive their
wisdom is slow and tedious, depending on patient thought, and
persevering reflection. Such a mind has been compared, in the social
circle, to a ship of the line run a ground in a creek. It is too massive
and ponderous for the element and space in which it floats. It is said
that Newton was rather slow and dull in conversation even upon
philosophical subjects. Many an individual in Europe, of far inferior
genius, was more brilliant in conversation than himself, even upon
his own discoveries. Descartes, whose mind was of the first order,
was silent in mixed company. It was said that he received his
intellectual wealth from nature in solid bars, not in current coin.15
Men like these are better pleased with the contemplation of the solid
wealth in their possession, than with the means of making it glitter
and attract the gaze of the world. They value ideas more than words
—knowledge more than the media of communication. They think it
better, as Spurzheim on Education says, to have two ideas with one
mode of expressing them, than one idea with two modes of
expression. Such men as these then are apt, unless stimulated by
very peculiar circumstances, to be deficient, first, in that variety
requisite for agreeable conversation, and secondly, in the style and
power of communicating their ideas to others.
14 It is said that Dr. Smith was one day present, when the toast to "absent friends"
was drank by the company. A friend who sat by the Doctor, told him that he had just
been toasted, whereupon he thanked the company for the honor, and apologised for
his absence of mind, very much of course to the amusement of his friends so well
aware of his habits of abstraction.

15 The character of Oliver Cromwell in this respect is well known. He did not, during
his whole parliamentary career, make one single lucid, perspicuous speech. In fact,
his speaking was almost unintelligible; and yet his course of conduct, although that of
an usurper and tyrant, marks most generally, clearness of judgment, and great
decision of character. Of course I am not here considering his moral character, which
was detestable.

Again, men of poetic or miscellaneous minds, possessing that varied


store of knowledge and thought so well calculated to form the staple
of conversation, may nevertheless, from various causes, be unable
to make any display in the social circle. They may write beautifully
whilst they converse badly. Addison's dulness in company is well
known. Peter Corneille, who has been called the Shakspeare of
France, it is said, did not speak correctly that language of which he
was so perfect a master in his composition. His answer to his
friends, when laughing at his spoken language was, "I am not the
less Peter Corneille!" Virgil is said to have been dull in the social
circle. La Fontaine, whose writing was the very model of poetry, was
coarse, heavy, and stupid in conversation. Chaucer's silence was said
to be much more agreeable than his talking. And Dryden says of
himself, "My conversation is slow and dull, my humor saturnine and
reserved." Thus do we find that it is not only necessary that the
mind should be stored with pleasing and varied knowledge, in order
that we may converse well; but we must have besides the power of
communicating that knowledge agreeably to others—a power which
is by no means universally coupled with the knowledge.

Let us then for a moment examine into the character of woman in


this respect. We have already seen that she has more of the proper
materiel for conversation than man. If then her power and manner
of communicating be better, she may certainly be pronounced his
superior in the social circle. In the first place I would remark, that
she has in general much less professional bias than man. When men
arrive at the age of maturity, they generally engage in some one
profession or occupation, which employs most of their time and
exertion. Their intellectual characters are, to a very great degree,
modelled by their employments. Hence an inaptitude to acquire what
does not belong to one's business—an indocility upon all subjects
not strictly professional. I recollect once to have been a member of a
country debating society, in which we had divines, lawyers, doctors,
farmers, schoolmasters, &c., and upon all topics discussed, it was
easy to determine at once the profession of the speaker. You saw
immediately the professional bias and the professional language and
knowledge. Woman is in general, except so far as affected by her
husband, free from this influence, which is so unfavorable to that
varied and brilliant conversation suited to promiscuous society.

Again, the social circle is the field in which woman wins her trophies,
displays her accomplishments, and achieves her conquests. The art
of pleasing by conversation is all and all to her. The power of
colloquial display is her greatest accomplishment—her most
irresistible weapon. Hence, while man in general aims to make
himself plain and perspicuous, woman endeavors not only to be
understood, but to delight and fascinate the hearer at the same time
by her style and manner. "Man in conversation," says Rousseau, "has
need of knowledge—woman of taste." We are instructed profoundly
in a few things by the conversation of an intelligent man. The
conversation of woman embraces many things, and though we may
not be profoundly instructed in any, yet we have a living and moving
panoramic view presented to the mind, which sooths and charms it
by the beauty, variety, and brilliancy of the parts. Rousseau was so
struck with the differences between the sexes in conversation, that
he seems (I think erroneously) to imagine a natural difference in this
respect between them. "Women," says he, "have a more flexible
tongue: they speak sooner, more easily, and more agreeably than
men. They are accused of speaking more. That is just as it should
be; this should be considered an ornament of the sex, and not a
reproach. Their mouth and eyes have the same activity, and for the
same reason."

The occupations of women are generally of such a character as to


allow full scope for their conversational talents, while their work is
advancing. Knitting, sewing, &c. invite to a free use of the tongue,
while the occupations of men will generally allow of no such
indulgence. Moreover, the business of woman is oftener social; it can
be carried on in society; whereas that of man cannot, being
generally much more solitary. This difference in the occupations of
the two, produces a much greater effect on the social differences
between the sexes than most persons are aware of. Lastly, the
greater docility of woman, her greater susceptibility to impression,
have a tendency to generate more conversational talent than is
developed in man. Woman, as we have frequently remarked, is
made physically weaker than man; she is, therefore, dependent on
him, and looks up to him as a protector. Man is the governing
member of the human family all over the world. Woman submits to
his guidance and direction. She adapts herself to him, and
endeavors to conform to his nature. Hence a quiet submissiveness
on the part of the weaker sex to control and dictation, even when
very intelligent, and able to act for themselves. I have known
intelligent women look up to their husbands for direction in most
matters, and with pleasure submit to their will, when it was evident
to the whole world that they were vastly superior in intellectual
endowments to those whose dictation and direction they thus
seemed to court. All a woman's ambition is for the promotion of her
husband. Her own elevation is generally a secondary matter,
because always derived from his. Shakspeare makes even the
fiendish acts of Lady Macbeth, to proceed from a desire to elevate
her own husband rather than herself. This condition of woman
makes her more docile and susceptible of impression. Her nature
becomes more pliant and flexible. At one period of her life she may
be the wife of a divine, at another of a lawyer, and at a third of a
physician: and she can quickly conform to these different natures
with which she has to deal. Her docility is far superior to that of
man. Mr. Stewart thinks that women learn languages even with
greater quickness, and pronounce them much better than men. He
says Fox spoke French better than any Englishman of his
acquaintance, but he knew many females who spoke it better than
he.

Now this greater docility and susceptibility of impression, while it


admirably adapts the weaker to the stronger sex, at the same time
improves greatly the conversational powers of woman. She is alive
to all that is passing around; she sees what our duller eyes fail to
behold. She thus gathers more, and details it more vividly and
impressively. While we are gathering general and stale news, she
collects that which is more special and impressive. Every one who
has ever been in the habit of paying what are called morning visits,
with intelligent ladies, must have remarked the great difference
between the sexes in this respect.
Before leaving the subject of conversation, I shall take leave to make
a few remarks on the practice so prevalent among the married and
elderly gentlemen, of separating themselves from the rest of the
company at dinner parties and evening gatherings, to talk among
themselves on those topics more congenial to their feelings and
business. Such an abstraction as this leaves the young to
themselves, and frees them from a restraint which may sometimes
be irksome, but is almost always salutary. The elderly portion are in
the habit of excusing themselves, by saying the conversation of the
young is too frivolous for their attention; that their tastes have
changed, and they take now no pleasure in the gaieties, pastimes,
and frivolities of youth. But they should recollect that this division is
calculated to produce that very frivolity of which they complain.
Separate the old and intelligent from the young and thoughtless, and
you immediately give a loose to all the wild, buoyant feelings of
youth. Lycurgus could never have succeeded in Sparta in enforcing
so completely his celebrated system of laws, but for the public
tables, which brought the old and young, intelligent and simple
together. The young learned modesty in the presence of the old, and
the ignorant imbibed wisdom from the instruction of the intelligent.
If our most intelligent men would always mingle in the social circle,
they would elevate the character of the topics discussed, while they
would stimulate the young to more thought and intellectual exertion.
The young would be improved by the instruction they would receive,
and the laudable ambition that would be exerted by the example of
the old and intelligent; and the latter would be compensated by the
great improvement which social intercourse produces on all our finer
feelings, tastes, and emotions, by the cultivation of talents which
would otherwise become dormant and useless, and the consequent
opening of new sources of enjoyment. But duty to the rising
generation—particularly to that portion for whom we feel the
warmest solicitude, because the weaker and more dependent—
absolutely demands this intercourse. It would elevate the intellectual
character of the sex, and thereby improve the general condition of
society. Our wives and daughters would become fit companions for
intelligent husbands, and the social circle would lose its unmeaning
conversation and reckless frivolity in the presence of age and
intelligence.

The social circles of France are greatly improved by the free and
unrestrained intercourse of all ages together. There is no man in
Paris, it matters not what is his standing or intelligence, but has
social ambition; he aims at distinction in conversation, at reputation
in the social circle, no less than he does at winning trophies in the
field, or fame in the senate chamber. The consequence is, that,
frivolous as we consider that people as a nation, they far excel us in
the social circle, both in the dignity of the topics discussed, and the
ability displayed by both sexes, especially by the females, in
conversation. Women who enjoy the society and conversation of the
wittiest and greatest men of their country will themselves become
witty and clever. "I was talking," says Bulwer in his France, "one
evening with the master of the house where I had been dining, on
some subject of trade and politics, which I engaged in unwillingly in
the idea that it was not very likely to interest the lady. I was soon
rather astonished, I confess, to find her enter into conversation with
a knowledge of detail and a right perception of general principles
which I did not expect. 'How do you think,' said she, when I
afterward expressed my surprise, 'that I could meet my husband
every evening at dinner, if I were not able to talk on the topics on
which he has been employed in the morning.'" Let us then at least
imitate the French in this particular, certain that it will in the process
of time be productive of the most marked and happy result.

For the same reason that woman surpasses man in conversation,


she is superior to him in epistolary composition. Her letters are
generally more varied, more lively and impressive, more replete with
interesting facts and details, than those of our sex. A gentleman, in
writing a mere letter of friendship, is engaged in a business which
rather breaks in on his habits, and interrupts for a time the
accustomed routine of his thoughts and tastes. He is very apt to run
off upon the general news of the day, and commence prosing upon
some subject which we would find perhaps infinitely better handled
in the public prints than in his letter. He has no variety; he forgets to
tell us of our friends, and of what they are doing and saying. He
forgets that we have hearts, and thinks only of our heads. He omits
to mention trifles, because he considers them "light as air," when
some of these trifles might touch a chord that would vibrate to the
heart, and fill the soul with joy and gratitude. When Mr. Dacre writes
to the Duke of Fitzjames, in the Young Duke, and says in conclusion,
"Mary desires me to present her regards to you"—this was worth all
the letter besides to the young duke; 'twas this he read over and
over again, and forgot his estates and his debts, while his heart was
reeling with gratitude for just this little kindness from her whom he
loved so devotedly. With woman, letter writing is in complete unison
with her condition in society. The details of most interest to her
correspondents are precisely those with which she is most
conversant. She presents no mutilated picture; she gives that which
delights. She is apt to know, too, the little Goshen of our hearts, and
to pay all due attention to it. And she is sure to tell, as if by
accident, precisely the sweetest things in the world to us. She writes
with ease, variety, and interest—because she pursues the course of
the celebrated Madame de Sévigné, (who has never perhaps had an
equal in our sex for epistolary composition.) "Il faut un peu entre
bons amis," says Madame de S. "laisser trotter les plumes comme
elles veulent, la mienne a toujours la bride sur le cou."

I had intended, before concluding my remarks on the intellectual


differences of the sexes, to offer some considerations in favor of
improving the system of female education; but my number has
already expanded to a size greatly beyond my anticipations when I
commenced it. This subject I must therefore postpone for the
present, and resume it in my next, if my time and occupations will
permit me.
For the Southern Literary Messenger.

TO F——.

And could'st thou F—— then believe


That I had thought thy guileless heart
Would prompt thee meanly to deceive,
And stoop to play a treacherous part?

No, lady no!—I saw thee move,


Artless in unsuspecting youth;
That heart I saw had learn'd to love
The hallowed sanctity of truth.

Could F——'s throbbing bosom beat


Victims on victims to ensnare:
Point to the lovers at her feet,
And proudly count the captives there?

No, lady no! to honor true,


Thou would'st not—could'st not thus appear—
Triumphs like these would seem to you,
Too dearly purchased to be dear.

These, these are arts alone allied


To spirits yet akin to earth;
The generous soul with nobler pride
Spurns the poor trick, and trusts to worth.

Yes, lady yes! such worth as thine,


Which kindred worth and genius rules,
To baser spirits may resign
The mad idolatry of fools.
H.

For the Southern Literary Messenger.

TO MARY.

Tune.—Gramachree.

The vernal month comes on with flowers


To deck the plains around,
No more the frown of winter lowers,
Or chills the fertile ground.

The snow-white lily, nature's pride,


Now blooms in every vale,
The rose breathes fragrance far and wide,
And perfumes every gale.

The vocal thrush pours forth her note


To hail the gladsome morn,
And every warbler strains his throat,
From garden, brake, and thorn.

Come then, dear Mary, let us fly


To join the impassioned lay,
And pluck each flower whose modest eye
Just opens into day.

And whilst we view the sweetest charms


That grace the new born year,
I'll fold thee gently in my arms,
And crush each budding care.

I'll say the blush upon thy cheek


Outvies the rose's hue,
The lily blooming o'er the vale,
No purer is than you.

But soon kind nature's sweetest flowers


Will wither and decay,
And that bright glow which decks thy cheek,
Like them will fade away:

But let not this alarm thy peace,


Nor tremble at thy doom,
For though the flush of youth will cease,
Thy soul shall ever bloom.

For the Southern Literary Messenger.

SONG.

I will twine me a wreath of life's withering flowers,


And bind with their brightness this aching heart,
And wear a smile through the long, long hours,
As if in their gladness I bore a part.

I will seek mid the gay and festive throng,


To check each thought of the love I cherished,
And playfully murmur his favorite song,
As if not a tone of its sweetness had perished.

Tho' the flowers of feeling are fallen and faded,


Yet the fragrance of memory may still remain:—
And the heart by their withered leaves o'ershaded,
May hide the wound though it nurse the pain.

And if ever we meet upon earth again,


He shall not know it by word or by token:
For the eye shall still sparkle, though only with pain,
And the lip wear a smile, while the heart may be broken.
MORNA.

For the Southern Literary Messenger.

REMEMBER ME, LOVE.

By the late Mrs. ANN ROY, of Mathews county, Virginia.

When afar thou art roaming love,


In sunny climes where maidens' eyes
Beam bright as their own glowing skies,
Where lofty domes and scented bowers
Gleam with the golden orange flowers;
And many a column and fallen fane
Tell of Italia's buried fame:
Oh! then remember me, love!

When woo'd by the proud and gay, love,


And mirthful smiles and voices sweet,
As angel's lutes united meet
Thy eager ear, thy raptured glance,
As they pass thee by in the joyous dance,
Ah pause and think of the lonely one,
Whose bosom throbs for thee alone:
Oh! then remember me, love!

Fame's glittering wreath allures thee, love;


Ah, when thou bindest it round thy brow,
And heartless crowds around thee bow;
When stern ambition's meed is won,
Ah, think of her who urged thee on
To climb the proudest height of fame,
And carve thyself a deathless name:
Oh! then remember me, love!

And should grief or death assail me, love,


While thou art o'er the dark blue wave,
And carest not to soothe or save,
My latest sigh shall be breathed for thee,
On my fading lips thy name shall be,
And my dying words shall be a prayer
To heaven that thou mayest love me there:
Oh! then remember me, love!

For the Southern Literary Messenger.

TO SARAH.
When melancholy and alone,
I sit on some moss-covered stone
Beside a murm'ring stream;
I think I hear thy voice's sound
In every tuneful thing around,
Oh! what a pleasant dream.

The silvery streamlet gurgling on,


The mock-bird chirping on the thorn,
Remind me, love, of thee.
They seem to whisper thoughts of love,
As thou didst when the stars above
Witnessed thy vows to me;—

The gentle zephyr floating by,


In chorus to my pensive sigh,
Recalls the hour of bliss,
When from thy balmy lips I drew
Fragrance as sweet as Hermia's dew,
And left the first fond kiss.

In such an hour, when are forgot,


The world, its cares, and my own lot,
Thou seemest then to be,
A gentle guardian spirit given
To guide my wandering thoughts to heaven,
If they should stray from thee.
SYLVIO.

For the Southern Literary Messenger.


BON-BON—A TALE.

BY EDGAR A. POE.

"Notre Gulliver"—dit le Lord Bolingbroke—"a de telles fables."—Voltaire.

That Pierre Bon-Bon was a Restaurateur of uncommon qualifications,


no man who, during the reign of ——, frequented the little Câfé in
the Cul-de-sac Le Febvre at Rouen, will, I imagine, feel himself at
liberty to dispute. That Pierre Bon-Bon was, in an equal degree,
skilled in the philosophy of that period is, I presume, still more
especially undeniable. His Patés à la fois were beyond doubt
immaculate—but what pen can do justice to his essays sur la Nature
—his thoughts sur l'Ame—his observations sur l'Esprit? If his
omelettes—if his fricandeaux were inestimable, what literateur of
that day would not have given twice as much for an 'Idée de Bon-
Bon' as for all the trash of all the 'Idées' of all the rest of the
savants? Bon-Bon had ransacked libraries which no other man had
ransacked—had read more than any other would have entertained a
notion of reading—had understood more than any other would have
conceived the possibility of understanding; and although, while he
flourished, there were not wanting some authors at Rouen, to assert
"that his dicta evinced neither the purity of the Academy, nor the
depth of the Lyceum"—although, mark me, his doctrines were by no
means very generally comprehended, still it did not follow that they
were difficult of comprehension. It was, I think, on account of their
entire self-evidency that many persons were led to consider them
abstruse. It is to Bon-Bon—but let this go no farther—it is to Bon-
Bon that Kant himself is mainly indebted for his metaphysics. The
former was not indeed a Platonist, nor strictly speaking an
Aristotelian—nor did he, like the modern Leibnitz, waste those
precious hours which might be employed in the invention of a
fricassée, or, facili gradu, the analysis of a sensation, in frivolous
attempts at reconciling the obstinate oils and waters of ethical
discussion. Not at all. Bon-Bon was Ionic. Bon-Bon was equally Italic.
He reasoned a priori. He reasoned also a posteriori. His ideas were
innate—or otherwise. He believed in George of Trebizond. He
believed in Bossarion. Bon-Bon was emphatically a—Bon-Bonist.

I have spoken of the philosopher in his capacity of Restaurateur. I


would not however have any friend of mine imagine that in fulfilling
his hereditary duties in that line, our hero wanted a proper
estimation of their dignity and importance. Far from it. It was
impossible to say in which branch of his duplicate profession he took
the greater pride. In his opinion the powers of the mind held
intimate connection with the capabilities of the stomach. By this I do
not mean to insinuate a charge of gluttony, or indeed any other
serious charge to the prejudice of the metaphysician. If Pierre Bon-
Bon had his failings—and what great man has not a thousand?—if
Pierre Bon-Bon, I say, had his failings, they were failings of very little
importance—faults indeed which in other tempers have often been
looked upon rather in the light of virtues. As regards one of these
foibles I should not have mentioned it in this history but for the
remarkable prominency—the extreme alto relievo in which it jutted
out from the plane of his general disposition. Bon-Bon could never
let slip an opportunity of making a bargain.

Not that Bon-Bon was avaricious—no. It was by no means necessary


to the satisfaction of the philosopher, that the bargain should be to
his own proper advantage. Provided a trade could be effected—a
trade of any kind, upon any terms, or under any circumstances, a
triumphant smile was seen for many days thereafter to enlighten his
countenance, and a knowing wink of the eye to give evidence of his
sagacity.

At any epoch it would not be very wonderful if a humor so peculiar


as the one I have just mentioned, should elicit attention and remark.
At the epoch of our narrative, had this peculiarity not attracted
observation, there would have been room for wonder indeed. It was
soon reported that upon all occasions of the kind, the smile of Bon-
Bon was wont to differ widely from the downright grin with which
that Restaurateur would laugh at his own jokes, or welcome an
acquaintance. Hints were thrown out of an exciting nature—stories
were told of perilous bargains made in a hurry and repented of at
leisure—and instances were adduced of unaccountable capacities,
vague longings, and unnatural inclinations implanted by the author
of all evil for wise purposes of his own.

The philosopher had other weaknesses—but they are scarcely


worthy of our serious examination. For example, there are few men
of extraordinary profundity who are found wanting in an inclination
for the bottle. Whether this inclination be an exciting cause, or
rather a valid proof of such profundity, it is impossible to say. Bon-
Bon, as far as I can learn, did not think the subject adapted to
minute investigation—nor do I. Yet in the indulgence of a propensity
so truly classical, it is not to be supposed that the Restaurateur
would lose sight of that intuitive discrimination which was wont to
characterize, at one and the same time, his Essais and his
Omelettes. With him Sauterne was to Medoc what Catullus was to
Homer. He would sport with a syllogism in sipping St. Peray, but
unravel an argument over Clos de Vougeot, and upset a theory in a
torrent of Chambertin. In his seclusions the Vin de Bourgogne had
its allotted hour, and there were appropriate moments for the Côtes
du Rhone. Well had it been if the same quick sense of propriety had
attended him in the peddling propensity to which I have formerly
alluded—but this was by no means the case. Indeed, to say the
truth, that trait of mind in the philosophic Bon-Bon did begin at
length to assume a character of strange intensity and mysticism,
and, however singular it may seem, appeared deeply tinctured with
the grotesque diablerie of his favorite German studies.

To enter the little Café in the Cul de Sac Le Febvre was, at the period
of our tale, to enter the sanctum of a man of genius. Bon-Bon was a
man of genius. There was not a sous-cuisinier in Rouen, who could
not have told you that Bon-Bon was a man of genius. His very cat
knew it, and forbore to whisk her tail in the presence of the man of
genius. His large water-dog was acquainted with the fact, and upon
the approach of his master, betrayed his sense of inferiority by a
sanctity of deportment, a debasement of the ears, and a dropping of
the lower jaw not altogether unworthy of a dog. It is, however, true
that much of this habitual respect might have been attributed to the
personal appearance of the metaphysician. A distinguished exterior
will, I am constrained to say, have its weight even with a beast; and
I am willing to allow much in the outward man of the Restaurateur
calculated to impress the imagination of the quadruped. There is a
peculiar majesty about the atmosphere of the little great—if I may
be permitted so equivocal an expression—which mere physical bulk
alone will be found at all times inefficient in creating. If, however,
Bon-Bon was barely three feet in height, and if his head was
diminutively small, still it was impossible to behold the rotundity of
his stomach without a sense of magnificence nearly bordering upon
the sublime. In its size both dogs and men must have seen a type of
his acquirements—in its immensity a fitting habitation for his
immortal soul.

I might here—if it so pleased me—dilate upon the matter of


habiliment, and other mere circumstances of the external
metaphysician. I might hint that the hair of our hero was worn short,
combed smoothly over his forehead, and surmounted by a conical-
shaped white flannel cap and tassels—that his pea-green jerkin was
not after the fashion of those worn by the common class of
Restaurateurs at that day—that the sleeves were something fuller
than the reigning costume permitted—that the cuffs were turned up,
not as usual in that barbarous period, with cloth of the same quality
and color as the garment, but faced in a more fanciful manner with
the particolored velvet of Genoa—that his slippers were of a bright
purple, curiously filagreed, and might have been manufactured in
Japan, but for the exquisite pointing of the toes, and the brilliant
tints of the binding and embroidery—that his breeches were of the
yellow satin-like material called aimable—that his sky-blue cloak
resembling in form a dressing-wrapper, and richly bestudded all over
with crimson devices, floated cavalierly upon his shoulders like a
mist of the morning—and that his tout ensemble gave rise to the
remarkable words of Benevenuta, the Improvisatrice of Florence,
"that it was difficult to say whether Pierre Bon-Bon was indeed a bird
of Paradise, or the rather a very Paradise of perfection."

I have said that "to enter the Café in the Cul-de-Sac Le Febvre was
to enter the sanctum of a man of genius"—but then it was only the
man of genius who could duly estimate the merits of the sanctum. A
sign consisting of a vast folio swung before the entrance. On one
side of the volume was painted a bottle—on the reverse a Paté. On
the back were visible in large letters the words Æuvres de Bon-Bon.
Thus was delicately shadowed forth the two-fold occupation of the
proprietor.

Upon stepping over the threshold the whole interior of the building
presented itself to view. A long, low-pitched room of antique
construction was indeed all the accommodation afforded by the Café
in the Cul-de-Sac Le Febvre. In a corner of the apartment stood the
bed of the metaphysician. An array of curtains, together with a
canopy à la Gréque gave it an air at once classic and comfortable. In
the corner diagonally opposite appeared, in direct and friendly
communion, the properties of the kitchen and the bibliothéque. A
dish of polemics stood peacefully upon the dresser. Here lay an
oven-full of the latest ethics—there a kettle of duodecimo melanges.
Volumes of German morality were hand and glove with the gridiron
—a toasting fork might be discovered by the side of Eusebius—Plato
reclined at his ease in the frying pan—and cotemporary manuscripts
were filed away upon the spit.

In other respects the Café de Bon-Bon might be said to differ little


from the Cafés of the period. A gigantic fire-place yawned opposite
the door. On the right of the fire-place an open cupboard displayed a
formidable array of labelled bottles. There Mousseux, Chambertin,
St. George, Richbourg, Bordeaux, Margaux, Haubrion, Leonville,
Medoc, Sauterne, Bârac, Preignac, Grave, Lafitte, and St. Peray
contended with many other names of lesser celebrity for the honor
of being quaffed. From the ceiling, suspended by a chain of very
long slender links, swung a fantastic iron lamp, throwing a hazy light
over the room, and relieving in some measure the placidity of the
scene.

It was here, about twelve o'clock one night, during the severe winter
of ——, that Pierre Bon-Bon, after having listened for some time to
the comments of his neighbors upon his singular propensity—that
Pierre Bon-Bon, I say, having turned them all out of his house,
locked the door upon them with a sacre Dieu, and betook himself in
no very pacific mood to the comforts of a leather-bottomed arm-
chair, and a fire of blazing faggots.

It was one of those terrific nights which are only met with once or
twice during a century. The snow drifted down bodily in enormous
masses, and the Café de Bon-Bon tottered to its very centre, with
the floods of wind that, rushing through the crannies in the wall, and
pouring impetuously down the chimney, shook awfully the curtains
of the philosopher's bed, and disorganized the economy of his Paté-
pans and papers. The huge folio sign that swung without, exposed
to the fury of the tempest, creaked ominously, and gave out a
moaning sound from its stanchions of solid oak.

I have said that it was in no very placid temper the metaphysician


drew up his chair to its customary station by the hearth. Many
circumstances of a perplexing nature had occurred during the day, to
disturb the serenity of his meditations. In attempting Des Æufs à la
Princesse he had unfortunately perpetrated an Omelette à la Reine—
the discovery of a principle in Ethics had been frustrated by the
overturning of a stew—and last, not least, he had been thwarted in
one of those admirable bargains which he at all times took such
especial delight in bringing to a successful termination. But in the
chafing of his mind at these unaccountable vicissitudes, there did
not fail to be mingled a degree of that nervous anxiety which the
fury of a boisterous night is so well calculated to produce. Whistling
to his more immediate vicinity the large black water-dog we have
spoken of before, and settling himself uneasily in his chair, he could
not help casting a wary and unquiet eye towards those distant
recesses of the apartment whose inexorable shadows not even the
red fire-light itself could more than partially succeed in overcoming.

Having completed a scrutiny whose exact purpose was perhaps


unintelligible to himself, Bon-Bon drew closer to his seat a small
table covered with books and papers, and soon became absorbed in
the task of retouching a voluminous manuscript, intended for
publication on the morrow.

"I am in no hurry, Monsieur Bon-Bon"—whispered a whining voice in


the apartment.

"The devil!"—ejaculated our hero, starting to his feet, overturning


the table at his side, and staring around him in astonishment.

"Very true"—calmly replied the voice.

"Very true!—what is very true?—how came you here?"—vociferated


the metaphysician, as his eye fell upon something which lay
stretched at full length upon the bed.

"I was saying"—said the intruder, without attending to Bon-Bon's


interrogatories—"I was saying that I am not at all pushed for time—
that the business upon which I took the liberty of calling is of no
pressing importance—in short that I can very well wait until you
have finished your Exposition."

"My Exposition!—there now!—how do you know—how came you to


understand that I was writing an Exposition?—good God!"

"Hush!"—replied the figure in a shrill under tone; and arising quickly


from the bed he made a single step towards our hero, while the iron
lamp overhead swung convulsively back from his approach.
The philosopher's amazement did not prevent a narrow scrutiny of
the stranger's dress and appearance. The outlines of a figure,
exceedingly lean, but much above the common height, were
rendered minutely distinct by means of a faded suit of black cloth
which fitted tight to the skin, but was otherwise cut very much in the
style of a century ago. These garments had evidently been intended
a priori for a much shorter person than their present owner. His
ankles and wrists were left naked for several inches. In his shoes,
however, a pair of very brilliant buckles gave the lie to the extreme
poverty implied by the other portions of his dress. His head was
bare, and entirely bald, with the exception of the hinder part, from
which depended a queue of considerable length. A pair of green
spectacles, with side glasses, protected his eyes from the influence
of the light, and at the same time prevented our hero from
ascertaining either their color or their conformation. About the entire
person there was no evidence of a shirt; but a white cravat, of filthy
appearance, was tied with extreme precision around the throat, and
the ends hanging down formally side by side, gave, although I dare
say unintentionally, the idea of an ecclesiastic. Indeed, many other
points both in his appearance and demeanor might have very well
sustained a conception of that nature. Over his left ear he carried,
after the fashion of a modern clerk, an instrument resembling the
stylus of the ancients. In a breast-pocket of his coat appeared
conspicuously a small black volume fastened with clasps of steel.
This book, whether accidentally or not, was so turned outwardly
from the person as to discover the words "Rituel Catholique" in
white letters upon the back. His entire physiognomy was
interestingly saturnine—even cadaverously pale. The forehead was
lofty and deeply furrowed with the ridges of contemplation. The
corners of the mouth were drawn down into an expression of the
most submissive humility. There was also a clasping of the hands, as
he stepped towards our hero—a deep sigh—and altogether a look of
such utter sanctity as could not have failed to be unequivocally
prepossessing. Every shadow of anger faded from the countenance
of the metaphysician, as, having completed a satisfactory survey of
his visiter's person, he shook him cordially by the hand, and
conducted him to a seat.

There would however be a radical error in attributing this


instantaneous transition of feeling in the philosopher to any one of
those causes which might naturally be supposed to have had an
influence. Indeed Pierre Bon-Bon, from what I have been able to
understand of his disposition, was of all men the least likely to be
imposed upon by any speciousness of exterior deportment. It was
impossible that so accurate an observer of men and things should
have failed to discover, upon the moment, the real character of the
personage who had thus intruded upon his hospitality. To say no
more, the conformation of his visiter's feet was sufficiently
remarkable—there was a tremulous swelling in the hinder part of his
breeches—and the vibration of his coat tail was a palpable fact.
Judge then with what feelings of satisfaction our hero found himself
thrown thus at once into the society of a—of a person for whom he
had at all times entertained such unqualified respect. He was,
however, too much of the diplomatist to let escape him any
intimation of his suspicions, or rather—I should say—his certainty in
regard to the true state of affairs. It was not his cue to appear at all
conscious of the high honor he thus unexpectedly enjoyed, but by
leading his guest into conversation, to elicit some important ethical
ideas which might, in obtaining a place in his contemplated
publication, enlighten the human race, and at the same time
immortalize himself—ideas which, I should have added, his visiter's
great age, and well known proficiency in the science of Morals might
very well have enabled him to afford.

Actuated by these enlightened views our hero bade the gentleman


sit down, while he himself took occasion to throw some faggots
upon the fire, and place upon the now re-established table some
bottles of the powerful Vin de Mousseux. Having quickly completed
these operations, he drew his chair vis a vis to his companion's, and
waited until he should open the conversation. But plans even the
most skilfully matured are often thwarted in the outset of their
application, and the Restaurateur found himself entirely nonplused
by the very first words of his visiter's speech.

"I see you know me, Bon-Bon,"—said he:—"ha! ha! ha!—he! he! he!
—hi! hi! hi!—ho! ho! ho!—hu! hu! hu!"—and the devil, dropping at
once the sanctity of his demeanor, opened to its fullest extent a
mouth from ear to ear so as to display a set of jagged, and fang-like
teeth, and throwing back his head, laughed long, loud, wickedly, and
uproariously, while the black dog crouching down upon his haunches
joined lustily in the chorus, and the tabby cat, flying off at a tangent
stood up on end and shrieked in the farthest corner of the
apartment.

Not so the philosopher: he was too much a man of the world either
to laugh like the dog, or by shrieks to betray the indecorous
trepidation of the cat. It must be confessed, however, that he felt a
little astonishment to see the white letters which formed the words
"Rituel Catholique" on the book in his guest's pocket momentarily
changing both their color and their import, and in a few seconds in
place of the original title, the words Regitre des Condamnés blaze
forth in characters of red. This startling circumstance, when Bon-Bon
replied to his visiter's remark, imparted to his manner an air of
embarrassment which might not probably have otherwise been
observable.

"Why, sir,"—said the philosopher—"why, sir, to speak sincerely—I


believe you are—upon my word—the d——dest—that is to say I
think—I imagine—I have some faint—some very faint idea—of the
remarkable honor——"

"Oh!—ah!—yes!—very well!"—interrupted his majesty—"say no more


—I see how it is." And hereupon, taking off his green spectacles, he
wiped the glasses carefully with the sleeve of his coat, and deposited
them in his pocket.
If Bon-Bon had been astonished at the incident of the book, his
amazement was now increased to an intolerable degree by the
spectacle which here presented itself to view. In raising his eyes,
with a strong feeling of curiosity to ascertain the color of his guest's,
he found them by no means black, as he had anticipated—nor gray,
as might have been imagined—nor yet hazel nor blue—nor indeed
yellow, nor red—nor purple—nor white—nor green—nor any other
color in the heavens above, or in the earth beneath, or in the waters
under the earth. In short Pierre Bon-Bon not only saw plainly that
his majesty had no eyes whatsoever, but could discover no
indications of their having existed at any previous period, for the
space where eyes should naturally have been, was, I am constrained
to say, simply a dead level of cadaverous flesh.

It was not in the nature of the metaphysician to forbear making


some inquiry into the sources of so strange a phenomenon, and to
his surprise the reply of his majesty was at once prompt, dignified,
and satisfactory.

"Eyes!—my dear Bon-Bon, eyes! did you say?—oh! ah! I perceive.


The ridiculous prints, eh? which are in circulation, have given you a
false idea of my personal appearance. Eyes!!—true. Eyes, Pierre
Bon-Bon, are very well in their proper place—that, you would say, is
the head—right—the head of a worm. To you likewise these optics
are indispensable—yet I will convince you that my vision is more
penetrating than your own. There is a cat, I see, in the corner—a
pretty cat!—look at her!—observe her well. Now, Bon-Bon, do you
behold the thoughts—the thoughts, I say—the ideas—the reflections
—engendering in her pericranium?

"There it is now!—you do not. She is thinking we admire the


profundity of her mind. She has just concluded that I am the most
distinguished of ecclesiastics, and that you are the most superfluous
of metaphysicians. Thus you see I am not altogether blind: but to
one of my profession the eyes you speak of would be merely an
incumbrance, liable at any time to be put out by a toasting iron or a
pitchfork. To you, I allow, these optics are indispensable. Endeavor,
Bon-Bon, to use them well—my vision is the soul."

Hereupon the guest helped himself to the wine upon the table, and
pouring out a bumper for Bon-Bon, requested him to drink it without
scruple, and make himself perfectly at home.

"A clever book that of yours, Pierre"—resumed his majesty, tapping


our friend knowingly upon the shoulder, as the latter set down his
glass after a thorough compliance with this injunction.

"A clever book that of yours, upon my honor. It's a work after my
own heart. Your arrangement of matter, I think, however, might be
improved, and many of your notions remind me of Aristotle. That
philosopher was one of my most intimate acquaintances. I liked him
as much for his terrible ill temper, as for his happy knack at making
a blunder. There is only one solid truth in all that he has written, and
for that I gave him the hint out of pure compassion for his absurdity.
I suppose, Pierre Bon-Bon, you very well know to what divine moral
truth I am alluding."

"Cannot say that I——"

"Indeed!—why I told Aristotle that by sneezing men expelled


superfluous ideas through the proboscis."

"Which is—hiccup!—undoubtedly the case"—said the metaphysician,


while he poured out for himself another bumper of Mousseux, and
offered his snuff-box to the fingers of his visiter.

"There was Plato too"—continued his majesty, modestly declining


the snuff-box and the compliment—"there was Plato, too, for whom
I, at one time, felt all the affection of a friend. You knew Plato, Bon-
Bon?—ah! no, I beg a thousand pardons. He met me at Athens, one
day, in the Parthenon, and told me he was distressed for an idea. I
bade him write down that 'o nous estin augos.' He said that he
would do so, and went home, while I stepped over to the Pyramids.
But my conscience smote me for the lie, and, hastening back to
Athens, I arrived behind the philosopher's chair as he was inditing
the 'augos.' Giving the gamma a fillip with my finger I turned it
upside down. So the sentence now reads 'o nous estin aulos,' and is,
you perceive, the fundamental doctrine of his metaphysics."

"Were you ever at Rome?"—asked the Restaurateur as he finished


his second bottle of Mousseux, and drew from the closet a larger
supply of Vin de Chambertin.

"But once, Monsieur Bon-Bon—but once. There was a time"—said


the devil, as if reciting some passage from a book—"'there was an
anarchy of five years during which the republic, bereft of all its
officers, had no magistracy besides the tribunes of the people, and
these were not legally vested with any degree of executive power'—
at that time, Monsieur Bon-Bon—at that time only I was in Rome,
and I have no earthly acquaintance, consequently, with any of its
philosophy."1
1 Ils ecrivalent sur la Philosophie (Cicero, Lucretius, Seneca) mais c'etait la
Philosophie Grécque.—Condorcet.

"What do you think of Epicurus?—what do you think of—hiccup!—


Epicurus?"

"What do I think of whom?"—said the devil in astonishment—"you


cannot surely mean to find any fault with Epicurus! What do I think
of Epicurus! Do you mean me, sir?—I am Epicurus. I am the same
philosopher who wrote each of the three hundred treatises
commemorated by Diogenes Laertes."

"That's a lie!"—said the metaphysician, for the wine had gotten a


little into his head.

"Very well!—very well, sir!—very well indeed, sir"—said his majesty.


"That's a lie!"—repeated the Restaurateur dogmatically—"that's a—
hiccup!—lie!"

"Well, well! have it your own way"—said the devil pacifically: and
Bon-Bon, having beaten his majesty at an argument, thought it his
duty to conclude a second bottle of Chambertin.

"As I was saying"—resumed the visiter—"as I was observing a little


while ago, there are some very outré notions in that book of yours,
Monsieur Bon-Bon. What, for instance, do you mean by all that
humbug about the soul? Pray, sir, what is the soul?"

"The—hiccup!—soul"—replied the metaphysician, referring to his MS.


"is undoubtedly"—

"No, sir!"

"Indubitably"—

"No, sir!"

"Indisputably"—

"No, sir!"

"Evidently"—

"No, sir!"

"Incontrovertibly"—

"No, sir!"

"Hiccup!"—

"No, sir!"

"And beyond all question a"—


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!

textbookfull.com

You might also like