100% found this document useful (6 votes)
47 views55 pages

Modern Algorithms For Image Processing: Computer Imagery by Example Using C# 1st Edition Vladimir Kovalevsky

Imagery

Uploaded by

alhtarjanjay
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 (6 votes)
47 views55 pages

Modern Algorithms For Image Processing: Computer Imagery by Example Using C# 1st Edition Vladimir Kovalevsky

Imagery

Uploaded by

alhtarjanjay
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/ 55

Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.

com

Modern Algorithms for Image Processing: Computer


Imagery by Example Using C# 1st Edition Vladimir
Kovalevsky

https://textbookfull.com/product/modern-algorithms-for-
image-processing-computer-imagery-by-example-using-c-1st-
edition-vladimir-kovalevsky/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Learn C++ by Example: Covers Versions 11 to 23 (Final


Release) 1 / converted Edition Frances Buontempo

https://textbookfull.com/product/learn-c-by-example-covers-
versions-11-to-23-final-release-1-converted-edition-frances-buontempo/

textboxfull.com

Essential algorithms a practical approach to computer


algorithms using Python and C Second Edition Rod Stephens

https://textbookfull.com/product/essential-algorithms-a-practical-
approach-to-computer-algorithms-using-python-and-c-second-edition-rod-
stephens/
textboxfull.com

Feature extraction and image processing for computer


vision Fourth Edition Aguado

https://textbookfull.com/product/feature-extraction-and-image-
processing-for-computer-vision-fourth-edition-aguado/

textboxfull.com

Feature Extraction and Image Processing for Computer


Vision 4th Edition Mark Nixon

https://textbookfull.com/product/feature-extraction-and-image-
processing-for-computer-vision-4th-edition-mark-nixon/

textboxfull.com
Fuzzy Logic for Image Processing A Gentle Introduction
Using Java SpringerBriefs in Electrical and Computer
Engineering Caponetti Laura Castellano Giovanna
https://textbookfull.com/product/fuzzy-logic-for-image-processing-a-
gentle-introduction-using-java-springerbriefs-in-electrical-and-
computer-engineering-caponetti-laura-castellano-giovanna/
textboxfull.com

Data Mining Algorithms in C++: Data Patterns and


Algorithms for Modern Applications 1st Edition Timothy
Masters
https://textbookfull.com/product/data-mining-algorithms-in-c-data-
patterns-and-algorithms-for-modern-applications-1st-edition-timothy-
masters/
textboxfull.com

Image Processing and Communications Techniques Algorithms


and Applications Micha■ Chora■

https://textbookfull.com/product/image-processing-and-communications-
techniques-algorithms-and-applications-michal-choras/

textboxfull.com

Writing Great Specifications: Using Specification by


Example and Gherkin 1st Edition Kamil Nicieja

https://textbookfull.com/product/writing-great-specifications-using-
specification-by-example-and-gherkin-1st-edition-kamil-nicieja/

textboxfull.com

Image Processing and Computer Vision in iOS Oge Marques

https://textbookfull.com/product/image-processing-and-computer-vision-
in-ios-oge-marques/

textboxfull.com
Modern
Algorithms for
Image Processing
Computer Imagery by Example Using C#

Vladimir Kovalevsky
Modern Algorithms for
Image Processing
Computer Imagery by Example
Using C#

Vladimir Kovalevsky
Modern Algorithms for Image Processing: Computer Imagery by Example Using C#
Vladimir Kovalevsky
Berlin, Germany

ISBN-13 (pbk): 978-1-4842-4236-0 ISBN-13 (electronic): 978-1-4842-4237-7


https://doi.org/10.1007/978-1-4842-4237-7
Library of Congress Control Number: 2018965475

Copyright © 2019 by Vladimir Kovalevsky


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Joan Murray
Development Editor: Laura Berendson
Coordinating Editor: Jill Balzano
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street,
6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-
sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a
Delaware corporation.
For information on translations, please e-mail [email protected], or visit http://www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book's product page, located at www.apress.com/9781484242360. For more
detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
Dedicated to my wife, Dr. Baerbel Kovalevsky
Table of Contents
About the Author����������������������������������������������������������������������������������������������������� ix

Acknowledgments��������������������������������������������������������������������������������������������������� xi
Introduction����������������������������������������������������������������������������������������������������������� xiii

Part I: Image Processing�������������������������������������������������������������������������������� 1


Chapter 1: Introduction�������������������������������������������������������������������������������������������� 3

Chapter 2: Noise Reduction�������������������������������������������������������������������������������������� 5


The Simplest Filter������������������������������������������������������������������������������������������������������������������������ 6
The Simplest Averaging Filter������������������������������������������������������������������������������������������������������� 6
The Fast Averaging Filter�������������������������������������������������������������������������������������������������������������� 8
The Fast Gaussian Filter������������������������������������������������������������������������������������������������������������� 14
The Median Filter������������������������������������������������������������������������������������������������������������������������ 17
Sigma Filter: The Most Efficient One������������������������������������������������������������������������������������������� 18
Suppression of Impulse Noise���������������������������������������������������������������������������������������������������� 23

Chapter 3: Contrast Enhancement�������������������������������������������������������������������������� 43


Automatic Linear Contrast Enhancement����������������������������������������������������������������������������������� 43
Histogram Equalization��������������������������������������������������������������������������������������������������������������� 45
Measuring the Lightness of Color Images����������������������������������������������������������������������������������� 49
Contrast of Color Images������������������������������������������������������������������������������������������������������������� 52
Manually Controlled Contrast Enhancement������������������������������������������������������������������������������� 53

Chapter 4: Shading Correction with Thresholding�������������������������������������������������� 65


Thresholding the Images������������������������������������������������������������������������������������������������������������ 75

Chapter 5: Project WFshadBinImpulse������������������������������������������������������������������� 81

v
Table of Contents

Part II: Image Analysis��������������������������������������������������������������������������������� 85


Chapter 6: Edge Detection�������������������������������������������������������������������������������������� 87
Laplacian Operator���������������������������������������������������������������������������������������������������������������������� 87
The Method of Zero Crossing������������������������������������������������������������������������������������������������������ 89
Are Zero Crossings of Laplacian Closed Curves?������������������������������������������������������������������������ 89
How to Eliminate Irrelevant Crossings���������������������������������������������������������������������������������������� 91
Noise Reduction Before Using the Laplacian������������������������������������������������������������������������������ 92
Blur During the Digitization and Extreme Value Filter����������������������������������������������������������������� 93
Fundamental Errors of the Method of Zero Crossing in the Laplacian���������������������������������������� 98

Chapter 7: A New Method of Edge Detection�������������������������������������������������������� 101


Means for Encoding the Edges������������������������������������������������������������������������������������������������� 102
The Idea of an Abstract Cell Complex��������������������������������������������������������������������������������������� 103
A Simple Method of Encoding Edges���������������������������������������������������������������������������������������� 105
Improvements of the Method of Binarized Gradient����������������������������������������������������������������� 107
Further Improvements of the Method of Binarized Gradient����������������������������������������������������� 120
The Edge Detector of Canny������������������������������������������������������������������������������������������������������ 122
Edges in Color Images�������������������������������������������������������������������������������������������������������������� 123
Conclusions������������������������������������������������������������������������������������������������������������������������������� 125

Chapter 8: A New Method of Image Compression������������������������������������������������ 127


Using a Cell Complex for the Encoding of Boundaries�������������������������������������������������������������� 128
Description of the Project WFcompressPal������������������������������������������������������������������������������� 131
The Project WFrestoreLin���������������������������������������������������������������������������������������������������������� 150

Chapter 9: Image Segmentation and Connected Components������������������������������ 167


Segmentation by Quantizing the Colors������������������������������������������������������������������������������������ 168
Connected Components������������������������������������������������������������������������������������������������������������ 168
The Graph Traversal Algorithm and Its Code����������������������������������������������������������������������������� 171
The Pseudo-Code of the Breadth-First Algorithm���������������������������������������������������������������� 172

vi
Table of Contents

The Approach of Equivalence Classes�������������������������������������������������������������������������������������� 173


The Pseudo-Code of the Root Algorithm����������������������������������������������������������������������������������� 177
The Project WFsegmentAndComp��������������������������������������������������������������������������������������������� 179
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 186

Chapter 10: Straightening Photos of Paintings���������������������������������������������������� 187


The Principle of Straightening�������������������������������������������������������������������������������������������������� 189
Codes of Most Important Methods�������������������������������������������������������������������������������������������� 196
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 203

Chapter 11: Polygonal Approximation of Region Boundaries and Edges������������� 205


The Problem of Polygonal Approximation��������������������������������������������������������������������������������� 205
Schlesinger’s Measure of Similarity of Curves������������������������������������������������������������������������� 206
Statement of the Approximation Problem��������������������������������������������������������������������������� 207
Algorithms for Polygonal Approximation����������������������������������������������������������������������������������� 207
The Split-and-Merge Method���������������������������������������������������������������������������������������������� 208
The Sector Method�������������������������������������������������������������������������������������������������������������� 209
The Improvement of the Sector Method������������������������������������������������������������������������������ 210
Replacing Polygons by Sequences of Arcs and Straight Lines������������������������������������������������� 211
Definitions and the Problem Statement������������������������������������������������������������������������������� 211
The Approximate Solution��������������������������������������������������������������������������������������������������� 212
The Project WFpolyArc�������������������������������������������������������������������������������������������������������������� 217
Methods Used in the Project WFpolyArc������������������������������������������������������������������������������ 218
Precision of the Calculation of the Radii����������������������������������������������������������������������������������� 225
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 226

Chapter 12: Recognition and Measurement of Circular Objects��������������������������� 227


Mathematical Foundation of the Method���������������������������������������������������������������������������������� 228
The Project WFcircleReco��������������������������������������������������������������������������������������������������������� 232
The Form of the Project WFcircleReco�������������������������������������������������������������������������������� 233

vii
Table of Contents

Chapter 13: Recognition of Bicycles in Traffic������������������������������������������������������ 243


Mathematical Foundation of Ellipse Recognition���������������������������������������������������������������������� 243
The Project WFellipseBike��������������������������������������������������������������������������������������������������������� 247
Another Method of Recognizing the Direction�������������������������������������������������������������������������� 258

Chapter 14: A Computer Model of Cell Differentiation������������������������������������������ 261


Conclusion�������������������������������������������������������������������������������������������������������������������������������� 266

References������������������������������������������������������������������������������������������������������������ 267

Index��������������������������������������������������������������������������������������������������������������������� 269

viii
About the Author
Vladimir Kovalevsky received his diploma in physics from the Kharkov University
(Ukraine), his first doctoral degree in technical sciences from the Central Institute of
Metrology (Leningrad), and his second doctoral degree in computer science from the
Institute of Cybernetics of the Academy of Sciences of the Ukraine (Kiev) where he
headed the Department of Pattern Recognition for more than a decade.
Vladimir has been living in Germany since 1983. He was a researcher at the Central
Institute of Cybernetics of the Academy of Sciences of the GDR, Berlin, a professor
of computer science at the University of Applied Sciences Berlin, and a scientific
collaborator at the University of Rostock.
He has been a visiting researcher at the University of Pennsylvania, a professor at
the Manukau Institute of Technology in New Zealand, and a professor at the Chonbuk
National University in South Korea. He has reviewed for the journals Applied General
Topology, Computer Vision and Image Understanding, IEEE Transactions on Pattern
Analysis and Machine Intelligence, and others.
Vladimir has been a plenary speaker at conferences in Europe, the United States, and
New Zealand. His research interests include digital geometry, digital topology, computer
vision, image processing, and pattern recognition. He has published four monographs
and more than 180 journal and conference papers on image analysis, digital geometry,
and digital topology.

ix
Acknowledgments
I wish to acknowledge valuable and fruitful discussions with Boris Flach, Reinhard
Klette, Ulrich Koethe, Alexander Kovalevsky, Volkmar Miszalok, and Peer Stelldinger.
These discussions have significantly contributed to this work.
I would like to express my special appreciation to Alexander V. Kovalevsky, who
helped significantly as an experienced programmer in the development of my projects.

xi
Introduction
This book presents a collection of algorithms and projects for processing two-­dimensional
images. I developed and investigated the algorithms. Special emphasis is placed on
computer solutions of problems related to the improvement of the quality of images,
with image analysis and recognition of some geometrically definable objects. New data
structures useful for image analysis are presented. The description of all algorithms
contains examples of source code in the C# programming language. Descriptions of
projects contain source code that can be used by readers.
With this book I intend to help you develop efficient software for processing
two-­dimensional images. There are a lot of books on image processing, but important
algorithms are missing from these books. I have developed many efficient algorithms as
a new and important contribution to this area.
I have paid great attention to solutions of problems in image analysis. On the other
hand, problems of improving the quality of images are important for the arts. My wife is
a recognized specialist in the history of the arts, and her publications often use copies
of famous pictures and drawings. The photographs of these artworks are often of low
quality. Often photographs of historical drawings illustrating the work of a painter are
of such low quality that it is almost impossible to clearly see the contents of the image.
Improving these images is therefore very important. In such cases, the programs I have
developed for improving the quality of pictures are very useful.
I have developed efficient algorithms for recognizing circles and ellipses in
noisy images. These algorithms can be used for recognizing objects with a shape
approximating a circle; for example, apples, mushrooms, and so on. They can also be
used for recognizing bicycles in images of traffic because the wheels of bicycles are ideal
circles, but if the bicycle is positioned in such a way that the plane of its frame is not
orthogonal to the viewing ray, then its wheels look like ellipses rather than circles. I was
therefore forced to develop efficient algorithms for recognizing ellipses in noisy images
as well. My efforts were successful and the book contains a chapter devoted to the
recognition of bicycles in noisy images.
The book contains descriptions of numerous algorithms for image analysis,
including these:

xiii
Introduction

• Manually controlled thresholding of shading corrected images.

• A fast algorithm for simultaneously labeling all connected


components in a segmented image.

• A new efficient method of edge detection.

• A fast algorithm for approximating digital curves by polygons and for


estimating the curvature of circular arcs approximating the curve.

• Algorithms for recognition and measurement of circular or elliptical


objects in color images.

Among the algorithms for image improvement, the most important are the following:

• The algorithm for rectifying photographs of paintings taken at an


oblique angle.

• An algorithm correcting images of nonuniformly illuminated scenes.

• The algorithm for improving the contrast of images of nonuniformly


illuminated scenes.

• The best algorithm for reducing Gaussian noise (the so-called


Sigma-­Filter).

• The algorithm for reducing impulse noise.

All descriptions are followed by a pseudo-code similar to the C# programming


language. Most of the descriptions contain source code that can be copied from the text
and used directly in a Windows Forms program written in the C# .NET language.
All source code and figures are included in a download file (which you can access via
the Download Source Code button located at www.apress.com/9781484242360) so you
can see the colors.

xiv
PART I

Image Processing
CHAPTER 1

Introduction
This book contains descriptions of algorithms for image processing such as noise
reduction, including reduction of impulse noise, contrast enhancement, shading
correction, edge detection, and many others. The source codes of the projects in the
C# programming language implementing the algorithms are included on the book’s
companion web site. The source codes are Windows Forms projects rather than
Microsoft Foundation Classes Library (MFC) projects. The controls and the graphics in
these projects are implemented by means of simple and easily understandable methods.
I have chosen this way of implementing controls and graphics services rather than those
based on MFC because the integrated development environment (IDE) using MFC is
expensive. Besides that, the software using MFC is rather complicated. It includes many
different files in a project and the user is largely unable to understand the sense and
usefulness of these files. On the contrary, Windows Forms and its utility tools are free
and are easier to understand. They supply controls and graphics similar to that of MFC.
To provide fast processing of images we transform objects of the class Bitmap, which
is standard in Windows Forms, to objects of our class CImage, the methods of which are
fast because they use direct access to the set of pixels, whereas the standard way of using
Bitmap consists of implementing the relatively slow methods of GetPixel and SetPixel
or methods using LockBits, which are fast, but not usable for indexed images.
The class CImage is rather simple: It contains the properties width, height, and nBits
of the image and methods used in the actual project. My methods are described in the
chapters devoted to projects. Here is the definition of our class CImage.

  class CImage
  { public Byte[] Grid;
     public int width, height, nBits;

     public CImage() { } // default constructor

3
© Vladimir Kovalevsky 2019
V. Kovalevsky, Modern Algorithms for Image Processing, https://doi.org/10.1007/978-1-4842-4237-7_1
Chapter 1 Introduction

     public CImage(int nx, int ny, int nbits) // constructor


     {
        width = nx;
        height = ny;
        nBits = nbits;
        Grid = new byte[width * height * (nBits / 8)];
    }

    public CImage(int nx, int ny, int nbits, byte[] img) // constructor
    {
        width = nx;
        height = ny;
        nBits = nbits;
        Grid = new byte[width * height * (nBits / 8)];
        for (int i = 0; i < width * height * nBits / 8; i++) Grid[i] = img[i];
    }
  } //*********************** end of class CImage *****************

Methods of the class CImage are described in the descriptions of projects.

4
CHAPTER 2

Noise Reduction
Digital images are often distorted by random errors usually referred to as noise. There
are two primary kinds of noise: Gaussian noise and impulse noise (see Figure 2-1).
Gaussian noise is statistical noise having a probability distribution similar to a Gaussian
distribution. It arises mainly during acquisition (e.g., in a sensor). It could be caused
by poor illumination or by high temperature of the sensor. It comes from many natural
sources, such as the thermal vibrations of atoms in conductors, referred to as thermal
noise. It influences all pixels of the image.
Impulse noise, also called salt-and-pepper noise, presents itself as sparsely occurring
light and dark pixels. It comes from pulse distortions like those coming from electrical
welding near the electronic device taking up the image or due to improper storage of old
photographs. It influences a small part of the set of pixels.

Figure 2-1. Examples of noise: (a) Gaussian noise; (b) impulse noise

5
© Vladimir Kovalevsky 2019
V. Kovalevsky, Modern Algorithms for Image Processing, https://doi.org/10.1007/978-1-4842-4237-7_2
Chapter 2 Noise Reduction

The Simplest Filter


We consider first the ways of reducing the intensity of Gaussian noise. The algorithm for
reducing the intensity of impulse noise is considered later in this chapter.
The most efficient method of reducing the intensity of Gaussian noise is replacing
the lightness of a pixel P by the average value of the lightness of a small subset of pixels
in the neighborhood of P. This method is based on the fact from the theory of random
values: The standard deviation of the average of N equally distributed random values
is by the factor √N less than the standard deviation of a single value. This method
performs a two-dimensional convolution of the image with a mask, which is an array of
weights arranged in a square of W × W pixels, and the actual pixel P lies in the middle
of the square. Source code for this filter is presented later in this chapter. This method
has two drawbacks: It is rather slow because it uses W × W additions for each pixel of the
image, and it blurs the image. It transforms fine edges at boundaries of approximately
homogeneous regions to ramps where the lightness changes linearly in a stripe whose
width is equal to W pixels. The first drawback is overcome with the fast averaging filter.
However, the second drawback is so important that it prevents use of the averaging filter
for the purpose of noise removal. Averaging filters are, however, important for improving
images with shading (i.e., those representing nonuniformly illuminated objects), as we
see later. I propose another filter for the purpose of noise removal as well.
First, let us describe the simplest averaging filter. I present the source code of this
simple method, which the reader can use in his or her program. In this code, as well
as in many other code examples, we use certain classes, which are defined in the next
section.

The Simplest Averaging Filter


The nonweighted averaging filter calculates the mean gray value in a gliding square
window of W × W pixels where W is the width and height of a square gliding window.
The greater the window size W, the stronger the suppression of Gaussian noise: The filter
decreases the noise by the factor W. The value W is usually an odd integer W = 2 × h + 1
for the sake of symmetry. The coordinates (x + xx, y + yy) of pixels inside the window vary
symmetrically around the current center pixel (x, y) in the intervals: −h ≤ xx ≤ +h and
−h ≤ yy ≤ +h with h = 1, 2, 3, 4, and so on.

6
Chapter 2 Noise Reduction

Near the border of the image the window lies partially outside of the image. In this
case, the computation loses its natural symmetry because only pixels inside the image
can be averaged. A reasonable way to solve the border problem is to take control of the
coordinates (x + xx, y + yy) if they point out of the image. If these coordinates are out
of the image the summation of the gray values must be suspended and the divisor nS
should not be incremented.
An example of the algorithm for averaging the colors is presented here. We often use
in our code comments denoted by lines of certain symbols: lines marked with = label the
start and the end of a loop, lines with minus signs label if instructions, and so on. This
makes the structure of the code more visible.
The simplest slow version of the algorithm has four nested for loops.

public void CImage::Averaging(CImage input, int HalfWidth)


{ int nS, sum;
  for (int y=0; y<height; y++) //================================
  { for (int x=0; x<width; x++) //==============================
    { nS=sum=0;
      for (int yy=-HalfWidth; yy<=HalfWidth; yy++) //=======
      {  if (y+yy>=0 && y+yy<input.height )
          for (int xx=-HalfWidth; xx<=HalfWidth; xx++) //===
          { if (x+xx>=0 && x+xx<input.width)
            { sum+=input.Grid[x+xx+width*(y+yy)];
               nS++;
            }
          } //====== end for (xx... ===================
      } //======== end for (yy... =======================
      Grid[x+width*y]=(sum+nS/2)/nS; //+nS/2 is for rounding
    } //============ end for (x... ========================
  } //============== end for (y... ========================
} //****************** end Averaging ****************************

This is source code: The reader can copy it and put into its C# source, and it will
work.
The parameter HalfWidth is half the width of the gliding window. The width and
height of the window are both equal to 2*HalfWidth+1. The variables x and y in the
preceding code are the indexes of pixels in Grid, and xx and yy are the indexes of the
pixels inside the gliding averaging window.
7
Chapter 2 Noise Reduction

The computation of sum in the innermost for loop needs W × W additions and
W × W accesses to the image for each pixel of the input image, which is quite time
consuming.
Let us remark once again that averaging filters, although they are very efficient
at reducing the intensity of Gaussian noise, strongly blur the image. Therefore they
should not be used for noise reduction. I suggest using the sigma filter described later
in this chapter for this purpose. Averaging is used for the purpose of shading correction
(see Chapter 4). Therefore it will be mostly used with a rather large gliding window, as
large as half the width of the image. Then the simplest averaging routine becomes so
time consuming that it is practically impossible to use it. For example, in the case of a
grayscale image of 1000 × 1000 pixels and a gliding window of 400 × 400 pixels, which is
typical for shading correction, the runtime of the function Averaging on a standard PC
can take about 20 minutes.

The Fast Averaging Filter


The simplest averaging filter makes W2 additions and one division for each pixel of
the image. For example, it makes 5 · 5 + 1 = 26 operations for each pixel in the case of a
gliding window of 5 × 5 = 25 pixels. There are applications (e.g., the shading correction)
that are using much greater gliding windows; for example, one of 400 × 400 = 160,000
pixels. If an application uses the simplest averaging filter with such a great gliding
window, it can run for several minutes.
It is possible to accelerate the averaging filter using the following basic idea: It is
possible to calculate first the sums of gray values in small one-dimensional windows of
1 × W pixels. We call the arrays of these sums the columns. In the following description
of the basic idea we use a Cartesian coordinate system, the index of a column of the
image being the abscissa x and the index of a row being the ordinate y. We consider
the ordinate axis as directed downward, from top to bottom, which is usual in image
processing and different from the direction of the ordinate axis in mathematics.
The fast averaging filter solves the same problem as the simplest filter, but it is much
faster. The fast filter blurs the image in the same way as the simplest filter does. Therefore
its main application is shading correction rather than noise suppression.
When using the basic idea just mentioned, it is possible to reduce the number of
operations per pixel from W × W to ≈4: The fast filter calculates and saves the sum of the
gray values in each column of W pixels, and the middle pixel of each column lies in the

8
Chapter 2 Noise Reduction

actual row of the image (Figure 2-2). The filter then directly calculates the sum over the
window having its central pixel at the beginning of a row; that is, by adding up the sums
saved in the columns. Then the window moves one pixel along the row, and the filter
calculates the sum for the next location by adding the value of the column sum at the
right border of the window and by subtracting the value of the column sum at the left
border. It is necessary to check whether the column to be added or subtracted is inside
the image. If it is not, the corresponding addition or subtraction must be skipped.

Old
window
Old column
W×W
1×W - - - -
New
column
1×W New
window
- + W×W
Actual row

+ + + +
+Y

Figure 2-2. Explanation of the functioning of the fast average filter

Due to applying a similar procedure for the calculation of the column sums, the
average number of additions or subtractions per pixel is reduced to ≈2 + 2 = 4. The
sum inside the window must be calculated directly (i.e., by the addition of HalfWidth + 1
sums of columns) only for a pixel at the beginning of each row. The sums of columns
must be calculated directly only for the pixels of the first row of the image.
The filter updates the values of the columns when proceeding to the next row of
the image by adding the gray value below the lower end and subtracting the gray value
at the upper end of each column (Figure 2-2). In this case it is also necessary to check
whether the gray value to be added or subtracted is in the image. The filter divides (with
rounding) the sum by the number of pixels in the intersection of the window with the
image as soon as the sum of the gray values in a window is calculated and saves the
result in the corresponding pixel of the output image.

9
Chapter 2 Noise Reduction

Here is the source code of the simplest version of the fast averaging filter designed for
filtering grayscale images.

public int FastAverageM(CImage Inp, int hWind, Form1 fm1)


// Filters the grayscale image "Inp" and returns the result in 'Grid' of the
// calling image.
{
    width  = Inp.width ; height = Inp.height; // elements of class CImage
    Grid = new byte[width  * height];
    int[] SumColmn; int[] nPixColmn;
    SumColmn = new int[width];
    nPixColmn = new int[width];
    for (int i = 0; i < width ; i++) SumColmn[i] = nPixColmn[i] = 0;

    int nPixWind = 0, SumWind = 0;


    for (int y = 0; y < height + hWind; y++) //=============================
    {
      int yout = y - hWind, ysub = y - 2 * hWind - 1;
      SumWind = 0; nPixWind = 0;
      int y1 = 1 + (height + hWind) / 100;
      for (int x = 0; x < width + hWind; x++) //===========================
      {
        int xout = x - hWind, xsub = x - 2 * hWind - 1; // 1. and 2.
addition
        if (y < height && x < width )
        {
          SumColmn[x] += Inp.Grid[x + width  * y];
          nPixColmn[x]++; // 3. and 4. addition
        }
        if (ysub >= 0 && x < width )
        {
          SumColmn[x] -= Inp.Grid[x + width * ysub];
          nPixColmn[x]--;
        }
        if (yout >= 0 && x < width )
        {

10
Chapter 2 Noise Reduction

          SumWind += SumColmn[x];
          nPixWind += nPixColmn[x];
        }
        if (yout >= 0 && xsub >= 0)
        {
          SumWind -= SumColmn[xsub];
          nPixWind -= nPixColmn[xsub];
        }
        if (xout >= 0 && yout >= 0)
          Grid[xout + width  * yout] = (byte)((SumWind + nPixWind / 2) /
nPixWind);
      } //===================== end for (int x = 0; =====================
    } //====================== end for (int y = 0; ======================
    return 1;
    } //************************* end FastAverageM ***********************

I present next the universal source code of the fast average filter designed both for
color and grayscale images. It uses the variable int nbyte, which is set to 3 for color and
to 1 for grayscale images. We define for the sum of color intensities in the gliding window
of (2*hWind + 1)2 pixels an array SumWind[3] of three elements for sums of red, green,
and blue intensities. In the case of a grayscale image, only the element SumWind[0] is
being used. We use the following variables as described next.
The location with the coordinates (c+nbyte*x, nbyte*y) is the location of a
color channel, one of red, green, or blue channels whose intensity is added to the
corresponding element of the array SumColmn. The location (c+nbyte*x, nbyte*ysub)
is that of a color channel whose intensity is to be subtracted from SumColmn. The
variable c+nbyte*x is the abscissa of the short column whose contents are to be added
to SumWind[c]. The variable c+nbyte*xsub is the abscissa of the short column whose
contents are to be subtracted from SumWind[c].

public int FastAverageUni(CImage Inp, int hWind, Form1 fm1)


// Filters the color or grayscale image "Inp" and returns the result in
// 'Grid' of calling image.
{ int c = 0, nByte = 0;
   if (Inp.N_Bits == 8) nByte = 1;
   else nByte = 3;

11
Chapter 2 Noise Reduction

   width  = Inp.width ; height = Inp.height; // elements of the class "Cimage"


   Grid = new byte[nByte * width  * height];
   int[] nPixColmn;
   nPixColmn = new int[width];
   for (int i = 0; i < width ; i++) nPixColmn[i] = 0;
   int[,] SumColmn;
   SumColmn = new int[width, 3];
   int nPixWind = 0, xout = 0, xsub = 0;
   int[] SumWind = new int[3];
   for (int y = 0; y < height + hWind; y++) //=============================
  { int yout = y - hWind, ysub = y - 2 * hWind - 1;
     nPixWind = 0;
     for (c = 0; c < nByte; c++) SumWind[c] = 0;
     int y1 = 1 + (height + hWind) / 100;
     for (int x = 0; x < width  + hWind; x++) //============================
     { xout = x - hWind;
        xsub = x - 2 * hWind - 1;    // 1. and 2. addition
        if (y < height && x < width) // 3. and 4. addition
       { for (c=0; c< nByte; c++)
            SumColmn[x, c] += Inp.Grid[c + nByte*(x + width*y)];
         nPixColmn[x]++;
      }
      if (ysub >= 0 && x < width )
      { for (c=0; c<nByte; c++)
            SumColmn[x, c] -=Inp.Grid[c+nByte*(x+ width*ysub)];
        nPixColmn[x]--;
      }
      if (yout >= 0 && x < width )
      { for (c = 0; c < nByte; c++) SumWind[c] += SumColmn[x, c];
         nPixWind += nPixColmn[x];
      }
      if (yout >= 0 && xsub >= 0)
      { for (c = 0; c < nByte; c++) SumWind[c] -= SumColmn[xsub, c];
         nPixWind -= nPixColmn[xsub];
      }

12
Chapter 2 Noise Reduction

      if (xout >= 0 && yout >= 0)


        for (c = 0; c < nByte; c++)
          Grid[c+nByte*(xout+width*yout)]=(byte)( SumWind[c] / nPixWind);
    } //============= end for (int x = 0;  =============================
  } //============== end for (int y = 0;  ==============================
  return 1;
} //***************** end FastAverageUni ********************************

This source code can be used in a corresponding Windows Forms project. It is not
the fastest version; it can be made 50 percent faster by removing the multiplications from
the interior loop. Some multiplications can be performed before starting the loop; some
others can be replaced by additions. A still faster version can be made containing the
following nine loops instead of the two loops with the indexes y and x in FastAverageM
or in FastAverageUni:

for (int yOut=0; yOut<=hWind; yOut++)


{ for(int xOut=0; xOut<=hWind; xOut++){...} //Loop 1
   for(xOut=hWind+1; xOut<=width-hWind-1; xOut++) {...} //Loop 2
   for(xOut=width-hWind; xOut<width; xOut++) {...} //Loop 3
}
for(yOut=hWind+1; yOut<=height-hWind-1; yOut++)
{ for(xOut=0; xOut<=hWind; xOut++) {...} //Loop 4
   for(xOut=hWind+1; xOut<=width-hWind-1; xOut++) {...} //Loop 5
   for(xOut=width-hWind; xOut<width; xOut++) {...} //Loop 6
}
for(yOut=height-hWind; yOut<height; yOut++)
{ for(xOut=0; xOut<=hWind; xOut++) {...} /Loop 7
   for(xOut=hWind+1; xOut<=width-hWind-1; xOut++) {...} //Loop 8
   for(xOut=width-hWind; xOut<width; xOut++) {...} //Loop 9
}

Each of the nine loops processes a part of the image (see Figure 2-3) that is either
hWind + 1 pixels wide or hWind + 1 pixels high.

13
Chapter 2 Noise Reduction

Part 1 Part 2 Part 3

hWind+1

Part 4 Part 5 Part 6

hWind+1

Part 7 Part 8 Part 9

Figure 2-3. The nine parts of the image corresponding to the nine loops

This version of the fast averaging filter can be used only if the condition hWind ≤
min (width, height)/2 - 1 is fulfilled. In such a version of the routine the interior loops
with the variable xOut contain no multiplications and no if instructions. The routine
is about 60 percent faster than the previously described FastAverageM. However, it
is much longer and much more difficult to debug. The gain in speed is not essential:
This code uses 0.7 seconds to process a big color image of 2448 × 3264 pixels with the
gliding window of 1200 × 1200 pixels, whereas FastAverageM takes 1.16 seconds. These
calculation times are almost independent from the size of the gliding window: They are
0.68 and 1.12 seconds correspondingly for the case of a gliding window of 5 × 5 pixels.

The Fast Gaussian Filter


The averaging filter produces a smoothed image in which some rectangular shapes not
present in the original image can be seen. These shapes appear because the averaging
filter transforms each light pixel to a homogeneously light rectangle of the size of the
gliding window. As soon as a pixel has an outstanding lightness strongly differing
from the values of adjacent pixels, the rectangle becomes visible. This is an unwanted
distortion. It can be avoided when using the Gaussian filter that multiplies the gray
values to be added by values that decay with the distance from the center of the window
according to the two-dimensional Gauss law. In addition, the Gaussian filter provides a
better suppression of noise. An example of the weights is shown in Figure 2-4.

14
Chapter 2 Noise Reduction

-Y

0.011 0.018 0.023 0.023 0.018 0.011

0.018 0.030 0.039 0.039 0.030 0.018

0.023 0.039 0.050 0.050 0.039 0.023


-X +X

0.023 0.039 0.050 0.050 0.039 0.023

0.018 0.030 0.039 0.039 0.030 0.018

0.011 0.018 0.023 0.023 0.018 0.011

+Y

Figure 2-4. Example of weights in the gliding window of the classical Gauss filter

These values are called the weights of the filter. The weights corresponding to the
two-dimensional Gauss law are floats less than one:

w(x, y) = (2πσxσy)-1exp(-x2/2σ2x - y2/2σ2y).

They can be calculated in advance and saved in a two-dimensional array whose


size corresponds to the size of the gliding window (Figure 2-4). Then the gray values
or color channels of the filtered image are multiplied with the weights and the sum of
the products is calculated. This procedure needs W2 floating point multiplications and
W2 ­additions per pixel of the grayscale image to be filtered where W is the width of the
gliding window. In the case of a color image, this number is 3W2.
There is a possibility of obtaining approximately the same results using the knowledge
of the statistics that says that the convolution of many equivalent probability distributions
tends to the Gaussian distribution. The convergence of this process is so fast that it is
sufficient to calculate the convolution of only three rectangular distributions to obtain a
good approximation. A rectangular distribution has a constant density in an interval and a
zero density outside the interval. If an image is processed with a filter three times, the result
is equivalent to the filtering with weights being convolutions of three rectangular weights.
Thus to perform approximately a Gaussian filtering of an image it is sufficient to filter the
image three times with a fast averaging filter. This procedure requires 4 × 3 = 12 integer

15
Chapter 2 Noise Reduction

additions per color channel of a pixel independent from the size of the window. We have
calculated that the standard of the equivalent Gaussian ­distribution is proportional to the
half-width of the gliding window of the averaging filter. In Table 2-1 hWind is the half-width
of the averaging window, and Sigma is the standard of a random variable whose distribution
corresponds to the weights calculated by the triple filtering with the fast filter.

Table 2-1. Relation Sigma/hWind tending to 1 with


increasing hWind

hWind 1 2 3 4 5

Sigma 1.414 2.456 3.459 4.456 5.49


Sigma/hWind 1.414 1.218 1.153 1.114 1.098

You can see that the relation Sigma/hWind tends to 1 when the width of the window
increases.
Figure 2-5 shows how the weights of the approximate Gauss filter differ from true
Gauss weights.

weights after one filtering


weights after two filtering
weights after three filtering
true Gaussian weights

Figure 2-5. Weights of the approximate and true Gauss filters


16
Chapter 2 Noise Reduction

The Median Filter


The averaging and the Gaussian filters provide the most efficient suppression of Gaussian
noise. The averaging filter with a gliding window that has the width of W = 2h + 1 pixels
transforms steep edges of homogeneous regions to ramps of the width W. In the case of
a Gaussian filter, the ramp is steeper. However, both these filters blur the image, so they
should not be used for noise suppression.
Most textbooks on image processing recommend using median filters for noise
suppression. A median filter sorts the intensities of colors in the gliding window and
replaces the intensity in the middle of the gliding window by the intensity staying in the
middle of the sorted sequence. Median filters can also be used for suppressing impulse
noise or salt-and-pepper noise.
Almost no textbook, though, draws the attention of the reader to very important
drawbacks of the median filter. First, it heavily distorts the image. A median filter with a
gliding window of (2 * h + 1)2 pixels deletes each stripe of the width of less than h pixels.
It also deletes a triangular part of approximately 2h pixels at each corner of a rectangular
shape. Even more, it inverts a part of the image containing some parallel stripes of
the width h if the width of the spaces between the stripes is also equal to h (compare
Figure 2-6 with Figure 2-7). This is easily understandable if the reader notices that
median makes decisions according to the majority: The central pixel becomes dark if the
majority of pixels in the gliding window are dark.

Figure 2-6. Original image and the gliding window of 5 × 5 pixels

17
Chapter 2 Noise Reduction

Figure 2-7. The same image after filtering with median of 5 × 5 pixels
Using the median for the suppression of impulse noise is also not recommended
because it will delete objects having the shape of thin lines that have nothing to do with
noise. I suggest an efficient method in a later chapter.

Sigma Filter: The Most Efficient One


The sigma filter reduces noise in the same way as the averaging filter: by averaging many
gray values or colors. The idea of the sigma filter is averaging only those intensities
(i.e., gray values or intensities of color channels) in a gliding window that differ from
the intensity of the central pixel by no more than a fixed parameter called tolerance.
According to this idea, the sigma filter reduces the Gaussian noise and retains the edges
in the image not blurred.
The sigma filter was suggested by John-Sen Lee (1983). However, it remained almost
unknown until recently: It has been mentioned in no textbook for image processing that
I am aware of. It was mentioned in a professional paper only once Chochia (1984).
A filter similar to the sigma filter was suggested by Tomasi and Manduchi (1998),
which they called the bilateral filter. They suggested assigning two kinds of weights
to the colors being averaged: a domain weight becoming smaller with the increasing
distance of the averaged pixel from the central pixel of the gliding window and a range
weight becoming smaller with increasing difference between the intensities of colors
of the pixel being averaged and that of the central pixel. Both weights can be defined as
densities of the Gauss distribution. The filter works well: It reduces the Gaussian noise
and preserves the sharpness of the edges. However, it is essentially slower than the sigma
filter; for example, to process a color image of 2500 × 3500 pixels the bilateral filter needs
30 seconds, whereas the simplest sigma filter needs only 7 seconds. Thus the bilateral
filter is approximately four times slower than the sigma filter. The authors of the bilateral
filter did not mention the sigma filter among the references.
18
Exploring the Variety of Random
Documents with Different Content
following extracts are taken: There are over ten thousand
Europeans and Americans resident in China. The English head
the list with 4,000; the Americans number 1,325; Germans, 882;
French, 875; Portuguese, 805; Spaniards, 461; Norwegians, 375;
Russians, 116; Italians, 108, etc. There are 669 Japanese.
Twenty-two ports are open to foreign residence, that is to
say, that Europeans are allowed to acquire conditional title
to certain lands, on which they live, govern themselves, and
have special privileges in judicial matters. The ports are
Mengtz, Lung Chow, Pakhoi, King Chow, Lappa, Canton, Kowlon,
Swatow, Amoy, Fuchau, Winchow, Ningpo, Shanghai, Chinkiang,
Wuhu, Kiukiang, Hankow, Ichang, Chungking, Chefoo, Tientsin,
and Niuchwang. It is to be noted that Peking does not appear
on this list, although the embassies and legations are
established there. The Chinese who find themselves under
foreign jurisdiction appear more than contented with the
situation, because, although taxes are high, they are fixed.
Two hundred thousand natives live in the European settlements
of Shanghai. Besides the foreign residents of China, a large
number live in ports that have been ceded to other nations.
For instance, Hongkong comprises in its civil population 4,195
Europeans and Americans. With the troops and sailors, this
number is raised to 8,545. Hongkong is the actual capital of
foreign industry in the far East. More than 3,000 vessels,
with a tonnage of nearly 4,000,000 touch there annually. The
same spirit which caused the development of Singapore,
Colombo, and Hongkong is to be found in the foreign
settlements of the open ports of China."

United States Consular Reports,


October, 1897, page 315.

CHINA: A. D. 1897 (May-June).


Cessions and concessions to England and France.

In May, the Chinese government sanctioned an extension of the


British settlement at Tien-tsin from 65 acres to about 300. In
the next month, it satisfied the complaints of Great Britain
concerning the cession of Kiang-Hung to France (see above: A.
D. 1894-1895, MARCH-JULY), by ceding to that Power the Shan
district of Kokang, about 400 square miles in extent, and
leasing to Great Britain in perpetuity a considerable tract at
the south of the Namwan River. The same treaty opened new
routes to trade across the frontier between Burmah and China,
and admitted British consuls and merchants to two new ports.
At about the same time France secured mining privileges on the
Tonquin frontier and rights for the extension of a railway
into Chinese territory.

CHINA: A. D. 1897 (November).


Germany opens the attack of European Powers on the
integrity of the Chinese Empire.
Seizure of the port of Kiao-Chau.
Concessions obtained as reparation for the murder
of German missionaries.

"Among the recent events that have attracted especial


attention to China is the lease to foreign nations of
important strategic or commercial ports on the coast of the
Empire. While the Portuguese have controlled the island of
Macao, near Canton, since 1537, and the English became owners
of the island of Hongkong, in the same vicinity, by the treaty
of 1842, no other nation had possessions on or near the coast
of China until within a comparatively recent date. One result
of the war between China and Japan was that Japan obtained the
island of Formosa, lying 90 miles off the coast of central
China. By this treaty Japan was also to have certain territory
on the peninsula of Liaotung, which commands from the north
the entrance to the Gulf of Pechili, the gateway to the
capital of China; but on the urgent protest of Russia, France,
and Germany this was abandoned, and the mainland of China up
to that time thus remained intact. On November 4, 1897,
however, the German Government seized the port of Kiao-chau,
on the northeastern coast of China, asserting as the cause of
its action the desire to obtain satisfaction for the murder of
[two] German missionaries by Chinese on November 1 of that
year. This port was held by a German war ship until the
announcement of a treaty with China by which the port of
Kiaochau and adjacent territory were leased to Germany for a
term of ninety-nine years, the German Government being given
the right to land troops, construct fortifications, and
establish a coaling and naval station, while German subjects
were to have the right to construct railways, open mines, and
transact business in the rich mineral and agricultural
province of Shantung, in which Kiaochau is located, Chinese
vessels, however, to have the same privileges in the port of
Kiaochau that the German Government might decide to give to
other nations."

United States Bureau of Statistics,


Monthly Summary of Commerce and Statistics,
March, 1899.

{81}

The terms of the German acquisition of Kiao-chau, as


officially communicated to the Reichstag by Herr von Bülow,
Foreign Secretary of the German Empire, on the 8th of
February, 1898, were as follows: "The Imperial Chinese
Government, in fulfilment of the legitimate wish of the German
Government to possess, in common with other Powers, a point in
the matters [waters?] of Eastern Asia, where German vessels
may be fitted out and repaired, where the necessary materials
can be deposited, and other arrangements made in connection
with that object, cedes to the German Government in the form
of a lease, to run, as at present fixed, for a period of
ninety-nine years, the territory situated on both sides of the
entrance to the Bay of Kiao-chau, in South Shantung, more
accurately described below, in such a manner that the German
Government will be at liberty to erect all necessary
buildings, &c., within the territory, and take all the
measures required for their defence. According to the English
chart of Kiao-chau Bay of 1863, the district leased to the
German Government consists of the following:

1. The promontory north of the entrance to the bay, bounded on


the north-east by a straight line drawn from the extreme
north-eastern point of Potato Island to the sea-coast in the
direction of Zoshan.

2. The promontory south of the entrance to the bay, bounded on


the south-west by a straight line drawn from the southernmost
point of the inlet situated to the south-west of Tschiposan,
in the direction of the Tolosan Islands (Weber chart), to the
sea-coast.

3. The Island of Tschiposan and Potato Island, as well as all


the islands lying at the entrance to the bay, inclusive of
Tolosan and Seslien. Further, the Chinese Government undertake
not to frame any Regulations within a zone of 50 kilometers
round the bay without the consent of the German Government,
and, in particular, to offer no resistance to any measures
necessary for regulating the course of the rivers. The Chinese
Government also grant to German troops the right of passage
across the zone above described. With the object of avoiding
every possibility of collision, the Chinese Government will
exercise no rights of sovereignty within the leased territory
during the period of the lease, but they cede these rights as
well as those over the entire water-surface of the Bay of
Kiao-chau to the German Government. The German Government will
erect sea-marks on the islands and shallows at the entrance to
the bay.

4. In the event of the territory leased not proving to be


adapted to the requirements of the German Government, the
Government of China will cede to Germany a more suitable
district, and will take back the Bay of Kiao-chau, paying
compensation for any improvements or constructions the Germans
may have made there.

5. A more accurate delimitation of the boundaries of the


district leased will take place in accordance with the local
conditions, and will be carried out by Commissioners from both
Governments."

The Foreign Secretary added the following particulars


respecting the area, &c., of the territory and the character
of the lease:

"The territory leased, the boundaries of which are not yet


accurately determined, will cover an area of 30 to 50 square
kilometers. Consequently, it is materially larger than the
British possession at and opposite Hong Kong. For military
reasons, the northern boundary had been pushed a little
further forward than is shown on the map presented to the
Budget Commission. The number of inhabitants is calculated at
a few thousand. As regards the size of the bay, accurate
details are as yet wanting. It runs about 20 geographical
miles into the mainland. At its narrowest point, the entrance
to the bay is about 3,000 metres broad. Two-thirds of the bay
afford harbour accommodation. The rent payable to China, the
exact amount of which has not yet been determined, is an
unimportant point, as it possesses a nominal character merely
representing the continuation in theory of the proprietorship
of China over the territory ceded. The following stipulations
have been secured respecting railway and mining
concessions:—The Chinese Government have consented to hand
over to a German-Chinese Railway Company, to be formed
hereafter, the construction of a railway from Kiao-chau, which
will run first in a northerly and then in a westerly
direction, to be subsequently connected with the projected
great railway system of China. The railway will serve the
coalfields of Weih-sien and Poshan, situated to the north of
Kiao-chau, which will be exploited by German capital. The
Chinese Government have further pledged themselves to accord
to the Railway Company to be thus formed, conditions at least
as favourable as those granted to any other European Chinese
Railway Company in China."

The Foreign Secretary concluded his speech with an exposition


of the motives which had induced the German Government to
occupy Kiao-chau in preference to other places. Its proximity
to the scene of the massacre had been the first consideration.
Secondly, it was favourably situated from a political point of
view, being removed from the French and British spheres in
Southern China and from the Russian base of operations in the
north. Lastly, the spacious, ice-free harbour, the climate,
which is probably the best to be met with in China, and the
existence of coalfields in the vicinity of the coast, offered
sufficient grounds for the choice of Kiao-chau. Herr von
Billow might have quoted in this connection a candid remark
which had been made not long before by the "Kolonial Zeitung:"
"The principal point is that the Power which possesses Kiao-chau
will control the coal supply in northern Chinese waters."

Great Britain, Papers by Command:


China, Number 1, 1898.

CHINA: A. D. 1898 (February).


British diplomacy in China.
The tone in which foreign demands were made
on the Tsung-li Yamên.
Agreement not to alienate the Yang-tsze region.

Early in 1898 the Chinese government was in need of money for


the final payment of indemnity to Japan, and opened
negotiations with the British government for the guarantee of
a loan: Her Majesty's Ministers were quite ready to give the
needed financial aid, for a consideration, requiring, in
return, that Ta-lien-wan should be opened to trade as a treaty
port. But Russia was then scheming to secure possession of
Ta-lien-wan, and interfered with the British negotiation so
vigorously that the Chinese were frightened into breaking it
off, even after they had practically accepted the offered
loan. Not daring, however, to take from Russia the financial
guarantee which they rejected at British hands, they thought
to balance themselves between these jealous rivals by
borrowing without help from either. Both the Powers were thus
offended, England especially showing stern resentment on
account of the slight with which she had been treated. The
following report by Sir Claude MacDonald, the British Minister
at Peking, of his interviews with the Tsung-li-Yamên on the
subject, is very interesting, as showing the tone in which the
European Powers were making demands on the government of China
at that time. The despatch of Sir Claude MacDonald is dated at
Peking, February 20, 1898.

{82}

"Since the 4th of February," he wrote. "I have had four


interviews with the Yamên for the purpose of extracting some
concessions in return for the rejection of the offer of a
guaranteed loan from Great Britain after it had in principle
been accepted. At the first of these, on the 5th February, the
Yamên refused to recognize that we had any claim to
compensation, declaring that the refusal of a Russian as well
as a British guarantee left no ground for complaint. I told
them that this argument might have had some plausibility if
the two offers had been equally advantageous, or if the
Chinese Government had not committed themselves to serious
negotiations with us. The British Government had at China's
own request reluctantly agreed to do her a very exceptional
favour, and the Yamên could not suppose that we should accept
with equanimity a brusque intimation that the Chinese
Government had changed its mind.

"The Yamên abounded in protestations of their readiness at


some future date to give proofs of their gratitude to Great
Britain in the shape of encouragement to commerce, but they
insisted that the loan negotiations must first be dismissed,
and all demands for compensation in connection with them
dropped. I refused to telegraph such a suggestion to your
Lordship, and as after long debate they still refused to bind
themselves by any promises, I reminded them that at an earlier
interview they had asked me whether the action threatened by
Great Britain in the event of their accepting a Russian
guarantee would equally be taken if they borrowed from neither
Power. I could not at the time answer the question, but I
could now tell them that Her Majesty's Government had a right
to feel deeply affronted by what had occurred, and I would not
be answerable for the consequences if they declined to make to
Great Britain even such concessions as they had frequently
admitted to be in China's own interests.

"The Yamên begged me to smooth matters for them, to which I


answered that their present attitude made it impossible for me
to do so. Let them permit me to report that China was ready to
open inland navigation to steamers; to establish Treaty ports
at Nanning and Hsiang T'an; and to give reasonable security to
trade by a pledge against alienation of the Yang-tsze region
to another Power, and the rejection of our loan might be
forgiven. All these were matters within the Yamên's power.

"The Ministers did not deny the feasibility of what I had


asked (except as regarded the opening of Nanning), but
objected to these measures being tacked on to the loan, for if
that were done, Russia would at once demand
counter-concessions for the rejection of her loan, and China
would be placed in a very difficult position. On this they
laid much stress. I said I did not insist on the concessions
being formally announced as made to England in connection with
the loan, and should be prepared to move Her Majesty's
Government to treat them as steps taken spontaneously by
China, but that I absolutely refused to treat the loan account
as settled until I had some definite assurance that these
measures would be carried out within a fixed time. The Yamên
again attempted to persuade me to leave the carrying out of
the measures indicated entirely to the Chinese Government, and
it was only after the usual prolonged argument that they
consented to open internal waters to steam navigation within
four months; to let me know at an early date when they would
open a port in Hunan, and to give me a written guarantee
against the alienation of the Yang-tsze region to a foreign
Power."

After reporting conversation on other matters, the Minister


recounted his action on the subject of the Yang-tsze region,
and on that of the opening of inland waterways to steam
navigation, at an interview with the Tsung-li Yamên on the
9th. "I then produced," he said, "a draft of the note I
intended addressing to them with regard to non-alienation of
the Yang-tsze region. This was accepted with little demur,
with the insertion of the words 'now entirely in China's
possession,' which, as recording an undeniable fact, I agreed
to put in. Copies of the notes subsequently exchanged are
inclosed. I have not thought it necessary to narrate the
arguments by which I supported the demand for this pledge at
both these interviews. My chief ground was that we could not
afford to find one morning that by reason of the murder of a
foreign subject, or the refusal of some demand by a foreign
Power, some place on the Yang-tsze had been seized and was to
be retained on a ninety-nine years' lease. I then handed to
the Ministers the despatch … recording their assurance with
regard to steam navigation of inland waterways. They read it
with attention, and accepted it as satisfactory."

Of the notes thus passed between the British Minister and the
Tsung-li Yamên, that of the former, dated February 9, was as
follows: "Your Highnesses and your Excellencies have more than
once intimated to me that the Chinese Government were aware of
the great importance that has always been attached by Great
Britain to the retention in Chinese possession of the
Yang-tsze region, now entirely hers, as providing security for
the free course and development of trade. I shall be glad to
be in a position to communicate to Her Majesty's Government a
definite assurance that China will never alienate any
territory in the provinces adjoining the Yang-tsze to any
other Power, whether under lease, mortgage, or any other
designation. Such an assurance is in full harmony with the
observations made to me by your Highnesses and your
Excellencies."

On the 11th, the Yamên returned the following reply: "The


Yamên have the honour to acknowledge the receipt of the
British Minister's despatch of the 9th February, stating that
the Yamên had more than once intimated to him that the Chinese
Government were aware of the great importance that has always
been attached by Great Britain to the retention in Chinese
possession of the Yang-tsze region, now entirely hers, as
providing security for the free course and development of
trade. The British Minister would be glad to be in a position
to communicate to Her Majesty's Government a definite
assurance that China would never alienate (any territory) in
the provinces adjoining the Yang-tsze to any other Power,
whether under lease, mortgage, or any other designation.
{83}
The Yamên have to observe that the Yang-tsze region is of the
greatest importance as concerning the whole position (or
interests) of China, and it is out of the question that
territory (in it) should be mortgaged, leased, or ceded to
another Power. Since Her Britannic Majesty's Government has
expressed its interest (or anxiety), it is the duty of the
Yamên to address this note to the British Minister for
communication to his Government."

The despatch recording the Chinese concession of steam


navigation on inland waters was in the following terms: "It
was … with great pleasure that I learnt from your Highnesses
and your Excellencies at a recent interview that the Chinese
Government had determined that wherever the use of native
boats is now by Treaty permitted to foreigners, they shall
equally be permitted to employ steamers or steam-launches,
whether Chinese or foreign-owned, or their own boats, and,
further, that this arrangement would come into effect before
the end of the 4th Chinese moon. I shall have great pleasure
in communicating the Chinese Government's decision to my
Government, for it is an indication that China is prepared to
take every step open to her to increase the volume of trade,
and so add to her resources and the wealth of the people."

Great Britain, Papers by Command:


China, Number 1, 1899, page 13-18.

CHINA: A. D. 1898 (February-December).


The "Battle of Concessions," for railway building and mining.

By summer-time in 1898 the scramble among the Powers for


footholds of territory on the Chinese coast seemed to be
giving way to what Lord Salisbury described as "the battle of
concessions," for the building of railways and the opening of
mines. This newer battle gave his lordship much anxiety. On
the 13th of July he cabled to Sir Claude MacDonald: "It does
not seem that the battle of Concessions is going well for us,
and that the mass of Chinese railways, if they are ever built,
will be in foreign hands is a possibility that we must face.
One evil of this is, that no orders for materials will come to
this country. That we cannot, help. The other evil is, that by
differential rates and privileges the Managers of the railways
may strangle our trade. This we ought to be able to prevent,
by pressing that proper provisions for equal treatment be
inserted in every Concession."

The British Minister at Peking, in reply, dissented warmly


from Lord Salisbury's opinion. "The battle of Concessions is
not, in my opinion," he cabled on the 23d of July, "going
against us. … Up to the present, any concessions granted to
other nationalities are far out-balanced in financial value by
the Shansi and Honan mining and railway concession, with its
possible extensions. I have consistently informed the Chinese
government that, as to differential rates and privileges, we
want none ourselves, and cannot admit that other nationalities
have a claim to them." In due time, as will appear, Sir Claude
was able to furnish very good evidence in support of his
contention that the "battle of concessions" was not going
against Great Britain, by forwarding a list of all the
concessions granted to clamoring capitalists and promoters of
the several nationalities. Meantime, he gave close attention
to the varying fortunes of the battle.

A concession for the Peking-Hankow Railway was the one which


interested the English most. Its line would traverse the rich
and populous provinces of Chi-li, Honan, and Hoa-Pé, and be
connected by another line, for which the Russo-Chinese Bank
held concessions, with the valuable coal-mining basin of
Ping-ting. Early in August, the British found reason to
believe that the pending agreement with a Belgian syndicate
for the building of this road was one that would give control
of it to the Russo-Chinese Bank,—which meant Russian, or
Russian and French control. He promptly remonstrated to the
Yamên, and was assured that the agreement had not yet been
submitted to the throne, and would not be ratified if the
effect were such as he had described. He cabled this assurance
to Lord Salisbury on the 6th of August. On the 13th he had a
very different report to make. "I learnt on the 9th," he says,
"that the Yamên had, under the influence of Li Hung-chang,
abandoned this position [that they would not ratify the
Belgian agreement if its effect was to give control of the
Peking-Hankow line of railway to the Russo-Chinese Bank], and
intended to ratify the agreement immediately. In view of the
urgency of the matter, I addressed a note on the same day to
the Yamên, in which I asked for an interview on the 10th or
11th instant, and informed them that the Chinese text of the
Contract had reached me, warning them at the same time that if
they did not give me another interview before they ratified
the Agreement Her Majesty's Government would look upon their
action as unfriendly, and would probably insist on the same
rights being given to Great Britain in all the provinces
adjoining the Yang-tsze.

"On the evening of the 10th the Yamên answered that they would
appoint a day for an interview when they had received the
Contract, which, they said, had not yet reached Peking for
ratification. On the 11th I replied that I understood from
this communication that they undertook not to ratify until
they had seen me. To this they returned an evasive answer to
the effect that they were all engaged by ceremonies at the
Palace connected with the Emperor's birthday, which would last
some days. I should add that I had already, on the 10th, sent
them a note in which I criticized the Contract in detail,
stating finally that I should have further objections to bring
forward at my interview with them. I now hear on good
authority that the Contract was ratified yesterday, the 12th.
That the ratification has thus been rushed through is
undoubtedly due to the influence of Li Hung-chang, combined
with strong pressure on the part of the Representatives of
Russia, France, and Belgium, and if heavy payment is not
exacted from the Chinese Government for their bad faith, Li
will persuade his colleagues that it is safer to slight
England than any other Power, and any pressure which we may
want to bring to bear in other matters will be without weight.
I therefore think that Her Majesty's Government should insist
either:—

"1. On a written assurance from the Yamên that if British


Syndicates apply for any railway concessions in the Yang-tsze
provinces, they shall be given on the same terms as those
which France, under cover of the Belgian Syndicate, has
received in the Peking-Hankow Contract, and that no mining or
railway concessions will be granted in those provinces unless
they have been previously declined by British Syndicates; or
{84}

"2. On a written assurance that all railways for which British


Syndicates are now in Treaty, that is to say—
(a.) The Shan-hai-Kuan-Niuchwang line;
(b.) The line from Tien-tsin to Chinkiang (the latter, as I
understand, in conjunction with Germans and Americans);
(c.) The line from Shanghae to Nanking with its
continuations and branches;
(d.) The lines in Honan and Shansi should be granted
without any further delay on terms identical with those
contained in the Contract for the Peking-Hankow line. The
latter consist, so far as I can learn, in complete control
over the construction, choice of material, working, and
personnel of the line, together with an Imperial guarantee
for the repayment of the loan.

The second demand seems to me to be preferable on the whole;


it will be impossible to obtain either demand without bringing
great pressure to bear, and I consider that the demand should
be made not as a compensatory concession, but as a punishment
for bad faith."

On the 17th the reply of the British Foreign Office was sent
by Mr. Balfour, as follows:

"With reference to your telegram of the 13th instant, inform


Yamên that they must assent to your proposal Number 2 without
delay, omitting from it the Shankaikuan-Newchwang Railway,
which we must deal with as a separate question. You are
authorized to inform them, if you have any reason to apprehend
that they will delay compliance, that, unless they agree at
once, we shall regard their breach of faith concerning the
Peking-Hankow Railway as an act of deliberate hostility
against this country, and shall act accordingly. After
consultation with the Admiral, you may give them the number of
days or hours you think proper within which to send their
reply. The delay should not be of too long duration. It should
be noted, on face of your demand, that Chingkiang Concession
is for Americans and Germans, if they desire a share, as well
as ourselves. Also make it clear that your ultimatum has
nothing to do with the line to Newchwang."

The tone of these demands made them effectual. On the 4th of


September, Sir Claude MacDonald was able to announce to his
superiors, in London: "At an interview which I had with them
yesterday, the Yamên entered into the following
undertaking:—Within the next few days they will address a
despatch to me, apologising for their action, and consenting
to the construction of the following lines by British
Syndicates:

1. A. line from Shanghae to Nanking with a continuation viâ


Chinkiang to Sui Yang. They said, however, that the latter
route was that followed by the line from Tien-tsin to
Chinkiang, for which they said that a Preliminary Agreement
had been signed between Yung Wing and the Anglo-American
Syndicate; and the continuation in question must be dependent
on the cancellation of that Agreement.

2. A line connecting Hangchow and Soochow with Shanghae, to be


continued if required to Ningpo.

3. A line from Canton to Kowloon.

4. The Peking Syndicate to be entitled to construct a railway


to convey minerals from their mines to the Yang-tsze. The
Yamên have also agreed to send me a Confidential note
embodying a declaration that the terms accorded for the
construction of these lines will not be inferior to those
granted for the construction of any railways in China proper.
The Manchurian lines are excluded from the scope of this
Agreement. I venture to think that this is a satisfactory
settlement. I did not give them an ultimatum, confining myself
to a warning of the grave consequences which would now attend
any failure on their part to keep their word. The fact that
the fleet is concentrating is, of course, known to them."

Before receiving this announcement, Mr. Balfour had cabled, on


the 24th of August:

"Negotiations with Yamên may be facilitated if you informed


them at once that, unless the very moderate terms already
demanded are immediately complied with, we shall, in addition,
require the Concession of another line, on same conditions as
those granted in case of Peking Hankow line of railway, and
that additional demands will be preferred as the result of
further delay. If you think it would conduce to the rapid and
satisfactory termination of the negotiations, you are
authorized to make a communication to them in this sense."
Whether this suggestion was acted upon or not does not appear.

This transaction, connected with the project of a railway from


Peking to Hankow, appears to illustrate, not unfairly, on the
whole, the mode in which speculative concessions were being
wrung from the Chinese government in the busiest year of
oriental speculation, 1898. The outcome of the grand "battle"
was communicated by Sir Claude MacDonald to Lord Charles
Beresford, on the 23d of November, in a full list of the
concessions then granted to British subjects, compared with
the grants to other nationalities. "We do not seem," wrote Sir
Claude, with pardonable complacency, "to have come out second
best. … Not a single bona fide or approximately practical
scheme which has been brought to this Legation has failed to
be put through." The summarized result in railway concessions
was

9 British (2,800 miles);


3 Russian (1,530 miles);
2 German (720 miles);
3 French (420 miles);
1 Belgian (650 miles);
1 American (300 miles).

In detail, the railway and mining concessions were described


in the list as follows:

CHINA:
"Railway and other Concessions obtained by British Companies:

I. Province of Shansi.
The Peking Syndicate have acquired the 'sole right to open and
work coal and iron mines throughout the districts of Yu Hsien
and Ping Ting-chou, and the Prefectures of Lusan Fu, Tsü-chou
Fu, and Ping Yang Fu, and also petroleum, wherever found.'
Under their contract, the Syndicate have also the right to
'construct branch railways to connect with main lines or with
water navigation, to facilitate transport of Shansi coal.'
This has been interpreted officially to include the right of
connecting the mines with Siang-yang in Hupeh, the nearest
head of navigation giving access to the Yang-tsze. This means
a railway of 250 miles. As to the value of this Concession, it
is not amiss to quote the testimony of Baron von Richthofen,
the great authority on the geology of China. He says that, 'in
proportion to its area, Shansi has probably the largest and
most easily workable coalfield of any region on the globe, and
the manufacture of iron is capable of almost unlimited
extension.'

II. Province of Honan.


The Peking Syndicate have also acquired rights similar to
those obtained in Shansi in that part of Honan north of the
Yellow River.

{85}

III. Province of Chihli.


The Hong Kong and Shanghae Bank are financing and controlling
the North China railways from Peking to Tien-tsin, and thence
to Shanhaikuan and Newchwang. The total length of these lines
is about 500 miles, of which 300 miles are completely open to
traffic.

IV. This bank has also acquired a half-interest in the


coal-mines at Nan P'iao, in the Ch'ao-yang district. According
to experts, these mines possess the best and richest coal
seams in North China, and they have the immense advantage of
being close to a line of railway and the sea.

V. Provinces of Chihli and Kiangsu.


The Tsung-li Yamên have undertaken officially that the
construction of the Tien-tsin-Chinkiang line shall be
intrusted to an Anglo-German Syndicate. The British portion of
this Syndicate is represented in China by Messrs. Jardine,
Matheson, and Co., and the Hong Kong and Shanghae Bank. This
will be a trunk line of 600 miles, passing through more
populous country than the Lu-Han Railway (the Belgian line),
with which it is certain to be able to compete successfully.

VI. Province of Kiangsu.


A British Syndicate, represented by Messrs. Jardine, Matheson,
and Co., and the Hong Kong and Shanghae Bank, has obtained the
Concession to finance and construct the Shanghae-Nanking
Railway. There is no more paying district than this for a
railway in China. The length of line will be 170 or 180 miles.

VII. Provinces of Kiangsu, Anhui, and Honan.


The same Syndicate has the right to extend the
Shanghae-Nanking Railway from P'u-k'ou, opposite Nanking, to
Hsin Yang, in Honan, a distance of 270 miles.

VIII. Provinces of Kiangsu and Chekiang.


The same Syndicate has the right to construct a line from
Soochow to Hangchow, with a possible extension to Ningpo. This
line will run through very populous districts for over 200
miles. The last three Concessions all lie within the Yang-tsze
region.

IX. Province of Chêkiang.


The Peking Syndicate have also obtained mining Concessions
similar to the Shansi and Honan in this province.

X. Province of Kwangtung.
The Jardine Syndicate has the right to construct a railway
from Kowloon to Canton. The length of line will be nearly 100
miles.

XI. Provinces of Hupei, Kiangsi, and Kwangtung.


An American Syndicate signed a preliminary Agreement for the
construction of a railway from Hankow to Canton in May last.
Negotiations are now in progress for the amalgamation of this
Concession with Number 10, Kowloon to Canton, and the working
of the whole line from Hankow to Kowloon by an Anglo-American
Company. This will be a trunk line of, approximately, 600
miles long.

XII. Provinces of Yünnan, Kweichow, and Ssuchuan.


The right to extend the Burmah system into China as far as the
Yang-tsze is admitted, and surveys are now in progress. This
involves a possible railway of 700 miles.

See Remarks on French Concessions.

CHINA:
"Concessions other than British. Russian.

The Manchurian Railway Concession dates from 1896. As is well


known, it was obtained as recompense for help given in
securing the retrocession of Liaotung. From Stretensk on the
Shilka, where it leaves the main Siberian line, this railway
will cross the Argun and Hingan Mountains, and reach Kirin viâ
Petuna. The whole length from Stretensk to Vladivostock is
estimated at 1,400 miles, of which about 1,000 will pass
through Chinese territory. The Concession is purely
strategical. The country traversed, though potentially rich,
in great part is, and will be for long, sparsely populated,
and the line cannot, in the near future at any rate, hope to
pay its working expenses.

2. The Port Arthur Agreement of March 1898 arranges for the


conclusion by Russia of a branch from the above line to Port
Arthur or Talienwan. The length of the railway will be about
400 miles. Commercially, this branch is more promising than
the first Concession.

3. The Russo-Chinese Bank has signed a contract for the


construction of a branch line from T'ai-yüan Fu to connect
with the Lu-Han trunk lines near Chêng-tung. Length,
approximately 130 miles. They have, up to date, been unable to
raise money for this line. I think it very possible that it
will eventually be built by an Anglo-Russian Syndicate. I am
trying to arrange this.

"French.—The French possess the right to construct three


lines, but beyond acquiring this right they have done nothing.

1. From Tonquin up the Red River Valley to Yünnan Fu, say 200
miles. The impression in French railway circles is that a
railway through Yünnan will not pay expenses, and if any
serious attempt is made to carry out the extension of the
Tonquin system, it will be merely as a stepping-stone to
Ssü-ch'uan. Yet again, any pretensions that a railway from
Yünnan to the Yang-tsze may have to rank as a commercial
project have been pronounced against by every traveller in
Central China.

2. Langson-Lungchow-Nanning Railway; length, about 100 miles.


(There appears to be an alternative open to the French of
going to Pésé instead of Nanning.) The right to build this
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