You are on page 1of 41

(eBook PDF) Image Operators: Image

Processing in Python
Visit to download the full and correct content document:
https://ebooksecure.com/download/ebook-pdf-image-operators-image-processing-in-
python/
Contents

Python Codes ................................................................................................................................... xv


Preface.............................................................................................................................................xxi
Software and Data.........................................................................................................................xxiii
Author ............................................................................................................................................ xxv

PART I Image Operators

Chapter 1 Introduction ............................................................................................................. 3


1.1 Scripting in Python ......................................................................................... 3
1.2 Installation ...................................................................................................... 4
1.2.1 Example Codes .................................................................................. 4
1.2.2 Establishing a Work Space................................................................. 4
1.2.3 The Spyder Interface.......................................................................... 5
1.2.4 Intent of the Text ................................................................................ 5

Chapter 2 Operator Nomenclature ........................................................................................... 7


2.1 Image Notation ............................................................................................... 7
2.2 Operators......................................................................................................... 8
2.2.1 Creation Operators ............................................................................. 8
2.2.2 Channel Operators ............................................................................. 9
2.2.3 Informational Operators................................................................... 12
2.2.4 Intensity Operators........................................................................... 14
2.2.5 Geometric Operators........................................................................ 16
2.2.6 Transformation Operators ................................................................ 16
2.2.7 Expansion Operators........................................................................ 17
2.3 Combinations and Reduced Notation ........................................................... 18
2.4 Summary....................................................................................................... 19

Chapter 3 Scripting in Python ................................................................................................ 21


3.1 Basic Python Skills ....................................................................................... 21
3.1.1 Variables........................................................................................... 21
3.1.2 Strings .............................................................................................. 22
3.1.3 Type Conversions with Strings ........................................................ 23
3.2 Tuples, List, Dictionaries, and Sets .............................................................. 23
3.2.1 Tuple ................................................................................................ 23
3.2.2 Slicing .............................................................................................. 23
3.2.3 Lists.................................................................................................. 25
3.2.4 Dictionaries ...................................................................................... 25
3.2.5 Sets................................................................................................... 26
3.3 Flow Control ................................................................................................. 26
3.3.1 The if Command .............................................................................. 27
3.3.2 The while Command........................................................................ 28

vii
viii Contents

3.3.3 Break and Continue.......................................................................... 29


3.3.4 The For Loop ................................................................................... 29
3.3.5 The map and lambda Functions ....................................................... 31
3.3.6 Image Operators and Control........................................................... 31
3.4 Input and Output ........................................................................................... 32
3.4.1 Reading and Writing Text Files ....................................................... 32
3.4.2 Pickling Files ................................................................................... 32
3.5 Defining Functions........................................................................................ 33
3.5.1 Function Components ...................................................................... 33
3.5.2 Returns ............................................................................................. 34
3.5.3 Default Arguments........................................................................... 35
3.5.4 Function Help................................................................................... 35
3.6 Modules ........................................................................................................ 36
3.7 Errors ............................................................................................................ 38
3.8 NumPy .......................................................................................................... 39
3.8.1 Creating Arrays................................................................................ 39
3.8.1.1 Zeros and Ones ................................................................ 39
3.8.1.2 Random............................................................................ 40
3.8.1.3 Geometric Shapes............................................................ 41
3.8.1.4 Conversion of Numerical Data ........................................ 41
3.8.2 Manipulating Arrays ........................................................................ 42
3.8.2.1 Display Option................................................................. 42
3.8.2.2 Converting Arrays ........................................................... 42
3.8.2.3 Simple Math .................................................................... 42
3.8.2.4 Multiplying Vectors ......................................................... 43
3.8.2.5 Multiplying Matrices ....................................................... 44
3.8.2.6 Array Functions ............................................................... 44
3.8.2.7 Decisions ......................................................................... 47
3.8.2.8 Advanced Slicing............................................................. 48
3.8.2.9 Universal Functions ......................................................... 48
3.8.2.10 Sorting ............................................................................. 49
3.8.3 Indices .............................................................................................. 51
3.9 SciPy ............................................................................................................. 52
3.9.1 Loading and Saving Images............................................................. 53
3.9.2 Examples from ndimage .................................................................. 54
3.9.2.1 Rotation and Shift............................................................ 54
3.9.2.2 Center of Mass................................................................. 55
3.10 Summary....................................................................................................... 56

Chapter 4 Digital Images ....................................................................................................... 59


4.1 Images in Python .......................................................................................... 59
4.2 Resolution ..................................................................................................... 59
4.2.1 Intensity Resolution ......................................................................... 59
4.2.2 Spatial Resolution ............................................................................ 61
4.3 Digital Formats ............................................................................................. 63
4.3.1 Bitmaps ............................................................................................ 63
4.3.2 JPEG ................................................................................................ 63
4.3.3 GIF ................................................................................................... 63
4.3.4 TIFF ................................................................................................. 64
Contents ix

4.3.5 PNG.................................................................................................. 65
4.3.6 Other Compressions......................................................................... 65
4.4 Summary....................................................................................................... 65

Chapter 5 Color ...................................................................................................................... 67


5.1 The RGB Color Model ................................................................................. 67
5.2 The HSV Color Model.................................................................................. 69
5.3 The YUV Family .......................................................................................... 72
5.4 CIE L*a*b*................................................................................................... 73
5.5 Improvements in Recognition....................................................................... 74
5.6 Summary....................................................................................................... 77

PART II Image Space Manipulations


Chapter 6 Geometric Transformations ................................................................................... 81
6.1 Selections...................................................................................................... 81
6.2 Linear Translation......................................................................................... 83
6.2.1 Simple Shifting ................................................................................ 83
6.2.2 NonInteger Shifts ............................................................................. 84
6.3 Scaling .......................................................................................................... 85
6.4 Rotation......................................................................................................... 87
6.5 Dilation and Erosion ..................................................................................... 88
6.6 Coordinate Mapping ..................................................................................... 90
6.7 Polar Transformations................................................................................... 90
6.7.1 Theory .............................................................................................. 91
6.7.2 Python Implementation.................................................................... 92
6.7.3 Example ........................................................................................... 94
6.8 Pincushion and Barrel Transformations ...................................................... 95
6.9 Other Transformations.................................................................................. 96
6.9.1 Generic Transformations.................................................................. 97
6.9.2 Affine Transformation...................................................................... 98
6.10 Summary....................................................................................................... 99

Chapter 7 Image Morphing .................................................................................................. 101


7.1 Warp............................................................................................................ 101
7.1.1 Marking Fiducial Points................................................................. 101
7.1.2 Image Dancer ................................................................................. 101
7.1.3 Delaunay Tessellation .................................................................... 103
7.1.4 Applying the Warp ......................................................................... 104
7.2 Average Face............................................................................................... 106
7.3 Image Morphing ......................................................................................... 107

Chapter 8 Principle Component Analysis ............................................................................ 111


8.1 The Purpose of PCA ................................................................................... 111
8.2 Covariance Matrix ...................................................................................... 111
8.3 Eigenvectors................................................................................................ 112
8.4 PCA............................................................................................................. 113
x Contents

8.4.1 Distance Tests ................................................................................ 116


8.4.2 Organization Example ................................................................... 116
8.4.3 RGB Example ................................................................................ 121
8.5 First Order Nature of PCA.......................................................................... 124
8.6 Summary..................................................................................................... 124

Chapter 9 Eigenimages ........................................................................................................ 127


9.1 Eigenimages................................................................................................ 127
9.1.1 Large Covariance Matrix ............................................................... 128
9.1.2 Python Implementation.................................................................. 128
9.1.3 Face Recognition Example ............................................................ 130
9.1.4 Natural Eigenimages...................................................................... 131

PART III Frequency Space Manipulations

Chapter 10 Image Frequencies............................................................................................... 137


10.1 Complex Numbers ...................................................................................... 137
10.2 Theory......................................................................................................... 138
10.3 Digital Fourier Transform........................................................................... 138
10.3.1 FFT in Python ................................................................................ 139
10.3.2 Signal Reconstruction .................................................................... 139
10.4 Properties of a Fourier Transform............................................................... 140
10.4.1 DC Term......................................................................................... 140
10.4.2 Conservation of Energy ................................................................. 141
10.4.3 Replication ..................................................................................... 142
10.4.4 Addition ......................................................................................... 142
10.4.5 Shift................................................................................................ 143
10.4.6 Scale............................................................................................... 143
10.4.7 Power Spectrum ............................................................................. 144
10.5 Displaying the Transform ........................................................................... 144
10.6 Simple Shapes............................................................................................. 145
10.6.1 Rectangle........................................................................................ 145
10.6.2 Circle.............................................................................................. 146
10.7 Frequency Bands ........................................................................................ 147
10.8 Windowing.................................................................................................. 149
10.9 Summary..................................................................................................... 152

Chapter 11 Filtering in Frequency Space............................................................................... 153


11.1 Frequency Filtering..................................................................................... 153
11.1.1 Low-pass Filter .............................................................................. 153
11.1.2 High-pass Filter.............................................................................. 154
11.1.3 Band-pass Filter ............................................................................. 155
11.2 Directional Filtering.................................................................................... 156
11.3 Fingerprint Example ................................................................................... 158
11.4 Artifact Removal......................................................................................... 160
11.5 Summary..................................................................................................... 163
11.6 Problems ..................................................................................................... 163
Contents xi

Chapter 12 Correlations ......................................................................................................... 165


12.1 Justification and Theory.............................................................................. 165
12.2 Theory......................................................................................................... 165
12.2.1 Computations in Fourier Space...................................................... 166
12.3 Implementation in Python........................................................................... 167
12.3.1 Brute Force..................................................................................... 167
12.3.2 Method Based on Fourier Transforms ........................................... 168
12.3.3 Example – Geometric Shapes ........................................................ 169
12.3.4 Example – Boat Isolation............................................................... 170
12.4 Composite Filtering .................................................................................... 174
12.5 SDF and MACE.......................................................................................... 175
12.5.1 Fractional Power Filter (FPF) ........................................................ 176
12.5.1.1 Theory............................................................................ 176
12.5.1.2 Manipulating α .............................................................. 177
12.5.1.3 Example......................................................................... 178
12.5.1.4 The Constraints.............................................................. 180
12.5.1.5 Dual FPFs ...................................................................... 182
12.6 Restrictions of Correlations ........................................................................ 184
12.7 Summary..................................................................................................... 184

PART IV Texture and Shape

Chapter 13 Edge Detection .................................................................................................... 189


13.1 Edges........................................................................................................... 189
13.2 The Sobel Filters......................................................................................... 190
13.3 Difference of Gaussians.............................................................................. 191
13.4 Corners........................................................................................................ 193

Chapter 14 Hough Transforms ............................................................................................... 199


14.1 Detection of a Line ..................................................................................... 199
14.2 Detection of a Circle................................................................................... 202
14.3 Application ................................................................................................. 204
14.4 Summary..................................................................................................... 205

Chapter 15 Noise.................................................................................................................... 209


15.1 Random Noise ............................................................................................ 209
15.2 Salt and Pepper Noise................................................................................. 209
15.3 Camera Noise.............................................................................................. 212
15.4 Colored Noise ............................................................................................. 212
15.5 Comparison of Noise Removal Systems .................................................... 212
15.5.1 Smoothing ...................................................................................... 213
15.5.2 Low-Pass Filtering ......................................................................... 214
15.5.3 Erosion and Dilation ...................................................................... 214
15.5.4 Median Filter.................................................................................. 215
15.5.5 Wiener Filter .................................................................................. 216
15.6 Other Types of Noise .................................................................................. 217
15.7 Summary..................................................................................................... 217
xii Contents

Chapter 16 Texture Recognition ............................................................................................ 221


16.1 Data............................................................................................................. 221
16.2 Edge Density............................................................................................... 221
16.2.1 Statistical Method .......................................................................... 221
16.2.2 The Method of Rosenfeld and Thurston ........................................ 223
16.2.3 Wavelet Decomposition and Texture ............................................. 227
16.2.4 Gray-Level Co-Occurrence Matrix ................................................ 230
16.2.4.1 Angular Second Moment............................................... 232
16.2.4.2 Contrast.......................................................................... 232
16.2.4.3 Correlation..................................................................... 233
16.2.4.4 Variance ......................................................................... 234
16.2.4.5 Entropy .......................................................................... 234
16.2.4.6 The Remaining Haralick Metrics .................................. 235
16.3 Filter-Based Methods.................................................................................. 238
16.3.1 Law’s Filters................................................................................... 238
16.4 Summary..................................................................................................... 240

Chapter 17 Gabor Filtering .................................................................................................... 243


17.1 Gabor Filtering............................................................................................ 243
17.2 Edge Response............................................................................................ 245
17.3 Texture Extraction with Gabor Filters ........................................................ 246
17.4 Gabor Filters in Fourier Space.................................................................... 249
17.5 Summary..................................................................................................... 249

Chapter 18 Describing Shape................................................................................................. 251


18.1 Contour Methods ........................................................................................ 251
18.1.1 Chain Code..................................................................................... 251
18.1.2 The Polygon Method...................................................................... 252
18.1.3 Metrics Used to Describe Shape .................................................... 252
18.1.4 Fourier Descriptors ........................................................................ 255
18.1.5 Wavelets ......................................................................................... 258
18.1.6 Elastic Matching ............................................................................ 258
18.2 Region Methods.......................................................................................... 262
18.2.1 Eigenvectors and Eigenvalues........................................................ 262
18.2.2 Shape Metrics................................................................................. 265
18.3 Describing Structure ................................................................................... 267
18.3.1 Curvature Flow .............................................................................. 267
18.3.2 Medial Axis.................................................................................... 269
18.4 Problems ..................................................................................................... 271

PART V Basis

Chapter 19 Basis Sets............................................................................................................. 275


19.1 Discrete Cosine Transform ......................................................................... 276
19.2 Zernike Polynomials................................................................................... 279
19.3 Empirical Mode Decomposition................................................................. 282
19.4 Image Analysis with Basis Sets.................................................................. 285
Contents xiii

Chapter 20 Pulse Images and Autowaves .............................................................................. 293


20.1 Pulse-Coupled Neural Network .................................................................. 293
20.1.1 Mammalian Visual Cortex ............................................................. 293
20.1.2 PCNN............................................................................................. 293
20.1.2.1 Theory............................................................................ 294
20.1.2.2 Pulse Streams................................................................. 294
20.1.2.3 Applications................................................................... 295
20.1.2.4 Operator Notation.......................................................... 296
20.2 Intersecting Cortical Model ........................................................................ 296
20.2.1 Centripetal Autowaves ................................................................... 297
20.2.2 ICM ................................................................................................ 297
20.3 Texture Classification with the ICM........................................................... 298
20.4 Summary..................................................................................................... 300

Appendix A Operators ............................................................................................................. 303


Appendix B Operators in Symbolic Order............................................................................... 325
Appendix C Lengthy Codes..................................................................................................... 327
Bibliography ................................................................................................................................. 333
Index.............................................................................................................................................. 335
Python Codes
1.1 Positioning Python to the user’s directory ............................................................................. 4
1.2 Positioning Python to the user’s directory ............................................................................. 5
2.1 Corresponding Python outline ............................................................................................... 7
2.2 Swapping the color channels ............................................................................................... 11
2.3 Converting an RGB image to a grayscale image ................................................................. 12
2.4 A few informational operations ........................................................................................... 13
2.5 Computing the average of selected pixels............................................................................ 13
2.6 Determining which channel has the most energy ................................................................ 14
2.7 Isolating the man’s cane....................................................................................................... 16
3.1 Creating an integer............................................................................................................... 21
3.2 Simple math functions ......................................................................................................... 22
3.3 Type casting ......................................................................................................................... 22
3.4 Creating strings .................................................................................................................... 22
3.5 Type conversions.................................................................................................................. 23
3.6 Building a name ................................................................................................................... 23
3.7 Tuple .................................................................................................................................... 24
3.8 Extraction............................................................................................................................. 24
3.9 Slicing selected elements ..................................................................................................... 24
3.10 Using a list ........................................................................................................................... 25
3.11 Using a dictionary ................................................................................................................ 26
3.12 Some dictionary functions ................................................................................................... 26
3.13 Some set functions ............................................................................................................... 27
3.14 A simple if statement ......................................................................................................... 27
3.15 A multiple line if statement................................................................................................ 27
3.16 The if-else statement ....................................................................................................... 28
3.17 The elif statement.............................................................................................................. 28
3.18 A compound if statement ................................................................................................... 28
3.19 A while statement............................................................................................................... 29
3.20 Usgin break command........................................................................................................ 29
3.21 Using the continue command ........................................................................................... 30
3.22 The for loop........................................................................................................................ 30
3.23 Using the range command.................................................................................................. 30
3.24 Using the range command in a for loop ........................................................................... 31
3.25 Using the map and lambda functions ................................................................................. 31
3.26 Choosing parameters in a function ...................................................................................... 31
3.27 Choosing parameters in a function ...................................................................................... 32
3.28 Writing to a file .................................................................................................................... 32
3.29 Reading to a file ................................................................................................................... 32
3.30 Pickling a file ....................................................................................................................... 33
3.31 Reading a pickle file............................................................................................................. 33
3.32 Reading a pickle file............................................................................................................. 33
3.33 Defining a function .............................................................................................................. 34
3.34 Return a value from a function ............................................................................................ 34
3.35 Return a tuple from a function ............................................................................................. 34
3.36 Default arguments ................................................................................................................ 35

xv
xvi Python Codes

3.37 Function help ....................................................................................................................... 35


3.38 Showing help ....................................................................................................................... 36
3.39 Initial commands.................................................................................................................. 36
3.40 Reading a module ................................................................................................................ 37
3.41 Shortcut name ...................................................................................................................... 37
3.42 From import ......................................................................................................................... 37
3.43 Executing commands in either version of Python ............................................................... 38
3.44 Divide by 0 error .................................................................................................................. 38
3.45 Traceback through a module................................................................................................ 38
3.46 Try-except ............................................................................................................................ 39
3.47 Creation of vectors............................................................................................................... 40
3.48 Creating tensors ................................................................................................................... 40
3.49 Accessing data in a matrix ................................................................................................... 40
3.50 Creating random arrays........................................................................................................ 41
3.51 Using a random seed............................................................................................................ 41
3.52 Creating a solid rectangle..................................................................................................... 41
3.53 Creating arrays from data..................................................................................................... 42
3.54 Setting the number of decimal places that are printed to the console.................................. 42
3.55 Converting between vectors and matrices............................................................................ 43
3.56 Math operations for vectors ................................................................................................. 43
3.57 Multiplication with vectors .................................................................................................. 44
3.58 The inner product of two matrices ....................................................................................... 44
3.59 Maximum values in an image .............................................................................................. 45
3.60 Application of several functions .......................................................................................... 46
3.61 Locating the maximum ........................................................................................................ 46
3.62 Using the nonzero function ................................................................................................ 47
3.63 Advanced slicing for arrays ................................................................................................. 48
3.64 Advanced slicing for arrays with multiple dimensions........................................................ 49
3.65 Mathematical functions for an array .................................................................................... 49
3.66 Sorting data in an array ........................................................................................................ 50
3.67 Sorting images according to a user-defined criteria............................................................. 50
3.68 Example of the indices function .......................................................................................... 51
3.69 Creating a solid circle .......................................................................................................... 52
3.70 The Circle function.............................................................................................................. 52
3.71 Loading an image................................................................................................................. 53
3.72 Rearranging the color channels............................................................................................ 53
3.73 Saving an image ................................................................................................................... 54
3.74 An example of melding the operators and functions from ndimage.................................... 54
3.75 Finding the center of mass ................................................................................................... 55
4.1 Loading the image using Python Image Library.................................................................. 59
4.2 Loading the image using commands from imageio ............................................................. 59
4.3 Reducing the intensity resolution......................................................................................... 61
5.1 Creating an image that suppresses the background ............................................................. 69
5.2 Converting between HSV and RGB values ......................................................................... 70
5.3 The vectorize function applies the operation to all pixels................................................... 70
5.4 Modifying the hue channel .................................................................................................. 71
5.5 The RGB to YIQ conversion................................................................................................ 72
5.6 Getting the Cb and Cr channels from the rocket image....................................................... 73
6.1 Using the Window and Plop operators................................................................................. 82
6.2 Demonstrating the Downsample and Concatenate operators .............................................. 83
Python Codes xvii

6.3 Shifting an image ................................................................................................................. 84


6.4 Noninteger shifts.................................................................................................................. 86
6.5 Scaling the image................................................................................................................. 86
6.6 Rotation using scipy.ndimage .............................................................................................. 87
6.7 Multiple rotations................................................................................................................. 88
6.8 Dilation operations............................................................................................................... 89
6.9 The perimeters are created by computing the difference between two dilations................. 90
6.10 Creation of the image in Figure 6.10 ................................................................................... 91
6.11 The RPolar function............................................................................................................. 93
6.12 The IRPolar function............................................................................................................ 93
6.13 The LogPolar function ......................................................................................................... 93
6.14 Finding the perimeter of the cell.......................................................................................... 96
6.15 The Barrel function ............................................................................................................. 97
6.16 An example using scipy.ndimage.geometric–transform .................................................. 98
6.17 An example using scipy.ndimage.affine_transform ................................................ 98
7.1 Starting Dancer .................................................................................................................. 102
7.2 The DelaunayWarp function ............................................................................................ 103
7.3 Reading a CSV file............................................................................................................. 103
7.4 Extracting information from the tessellation ..................................................................... 104
7.5 Finding a simplex............................................................................................................... 104
7.6 Commands to warp an image............................................................................................. 106
7.7 Morphing two images ........................................................................................................ 108
8.1 Testing the eigenvector engine in NumPy ......................................................................... 113
8.2 Proving that the eigenvectors are orthonormal .................................................................. 113
8.3 Projection of data into a new space.................................................................................... 115
8.4 Projection of data into a new space.................................................................................... 116
8.5 The first two dimensions in PCA space ............................................................................. 117
8.6 The ScrambleImage function ........................................................................................... 118
8.7 The Unscramble function ................................................................................................. 119
8.8 Various calls to the Unscramble function ......................................................................... 120
8.9 The LoadImage and IsoBlue functions ............................................................................ 122
9.1 The EigenImages function ................................................................................................ 129
9.2 The ProjectEigen function................................................................................................ 129
10.1 The Rect2Polar and Polar2Rect functions....................................................................... 137
10.2 Forward and inverse FFT ................................................................................................... 139
10.3 The DC term ...................................................................................................................... 142
10.4 Conservation of energy ...................................................................................................... 142
10.5 Computing the original image ........................................................................................... 142
10.6 The shifting property.......................................................................................................... 143
10.7 The script for Equation (10.28).......................................................................................... 148
10.8 Creating the mask .............................................................................................................. 151
10.9 Using the KaiserMask function........................................................................................ 152
11.1 An example of a low-pass filter ......................................................................................... 154
11.2 An example of a high-pass filter ........................................................................................ 155
11.3 An example of a band-pass filter ....................................................................................... 155
11.4 An example of a band-pass filter with soft edges .............................................................. 156
11.5 The Wedge function .......................................................................................................... 157
11.6 An example of line filtering ............................................................................................... 158
11.7 The MaskinF function....................................................................................................... 159
11.8 The MultiWedges function ............................................................................................... 160
xviii Python Codes

11.9 The ColorCode1 function ................................................................................................. 160


11.10 Removal of the screen from the baseball image ................................................................ 162
12.1 Smoothing through a correlation with a small solid block ................................................ 167
12.2 The Correlate1D function................................................................................................. 169
12.3 The Correlate2DF function .............................................................................................. 169
12.4 Correlating shapes.............................................................................................................. 169
12.5 Loading and creating the necessary images....................................................................... 171
12.6 The LocateDock function.................................................................................................. 172
12.7 The Overlay function ........................................................................................................ 173
12.8 The SubtractDock function .............................................................................................. 174
12.9 The IDboats function ........................................................................................................ 174
12.10 The FPF function............................................................................................................... 176
12.11 Testing the FPF function ................................................................................................... 177
12.12 Computing an FPF ............................................................................................................. 178
12.13 The LoadTach function..................................................................................................... 179
12.14 The MakeTachFPF function............................................................................................. 180
12.15 Running the functions in the tachometer problem............................................................. 180
13.1 Shifting a simple array ....................................................................................................... 189
13.2 Extracting the vertical edges .............................................................................................. 190
13.3 Using the Sobel function to create an edge enhancement ................................................. 191
13.4 Application of the DoG filter ............................................................................................. 193
13.5 The Harris function........................................................................................................... 194
13.6 Applying the Harris detector to simple geometric shapes ................................................. 195
14.1 The LineHough function................................................................................................... 200
14.2 Creating Figure 14.1 .......................................................................................................... 201
14.3 Creating Figure 14.2 .......................................................................................................... 201
14.4 Running the Hough transform on an image with a line ..................................................... 201
14.5 The Hough transform applied to a different image............................................................ 202
14.6 Creating a line that is at a different orientation.................................................................. 202
14.7 Circle Hough transform applied to multiple rings ............................................................. 204
14.8 The detection of the cane ................................................................................................... 206
15.1 Adding random noise......................................................................................................... 210
15.2 Smoothing in Python ......................................................................................................... 210
15.3 Salt noise............................................................................................................................ 211
15.4 Applying colored noise ...................................................................................................... 212
15.5 The AddNoise function ..................................................................................................... 213
15.6 The Lopass function .......................................................................................................... 214
15.7 The ErosionDilation function ........................................................................................... 215
15.8 Applying a median filter .................................................................................................... 216
15.9 Applying a Wiener filter .................................................................................................... 217
16.1 Simple texture measure through the ratio of the mean and standard deviation ................. 223
16.2 Compute the edge density.................................................................................................. 223
16.3 Measuring the four moments ............................................................................................. 225
16.4 The FourMoments function.............................................................................................. 225
16.5 Beginning the comparison of textures ............................................................................... 226
16.6 The WvlIteration function................................................................................................ 228
16.7 Creating an output after a single iteration in wavelet decompostion ................................. 228
16.8 The WaveletDecomp function .......................................................................................... 229
16.9 The GetParts function....................................................................................................... 230
16.10 The WaveletEnergies function.......................................................................................... 230
Python Codes xix

16.11 The Cooccurrence function .............................................................................................. 231


16.12 The HHomogeneity function ............................................................................................ 232
16.13 The HContrast function.................................................................................................... 233
16.14 The HCorrelation function ............................................................................................... 234
16.15 The HVariance function.................................................................................................... 234
16.16 The HEntropy function..................................................................................................... 235
16.17 The Haralick function....................................................................................................... 236
16.18 Using the Haralick function.............................................................................................. 237
16.19 The five Law’s vectors ....................................................................................................... 239
16.20 The BuildLawsFilters function ........................................................................................ 239
16.21 The LawsJets function ...................................................................................................... 240
17.1 The GaborCos function .................................................................................................... 244
17.2 The Filts function .............................................................................................................. 244
17.3 The ManyCorrelations function ...................................................................................... 245
17.4 Complete steps to create an image, Gabor filters, and the correlations ............................. 246
17.5 The RandomJets function................................................................................................. 247
17.6 The entire process of gathering correlations, extracting jets, and mapping in
PCA space ......................................................................................................................... 248
18.1 The PerimeterPoints function .......................................................................................... 254
18.2 The ShowPerimPoints function........................................................................................ 254
18.3 The ChainLength function ............................................................................................... 255
18.4 The Curvature function .................................................................................................... 255
18.5 The FourierDescriptors function ..................................................................................... 257
18.6 The ReadFiducial function ............................................................................................... 259
18.7 The RemoveCenterBias function ..................................................................................... 260
18.8 The RemoveRotateBias function...................................................................................... 261
18.9 The RemoveScaleBias function ........................................................................................ 261
18.10 The GridDifference function ............................................................................................ 262
18.11 The Shape1 function.......................................................................................................... 263
18.12 The ExtractStats function................................................................................................. 263
18.13 Computing four geometric values...................................................................................... 266
18.14 The metrics for the six shapes............................................................................................ 267
18.15 The CurveFlow function ................................................................................................... 268
18.16 Running iterations of curvature flow ................................................................................. 269
18.17 Computing the medial axis ................................................................................................ 270
19.1 Using the 1D discrete cosine transform ............................................................................. 276
19.2 An example of a 1D DCT .................................................................................................. 277
19.3 The dct2d function ............................................................................................................ 278
19.4 The idct2d function ........................................................................................................... 278
19.5 Modified 2D EMD ............................................................................................................. 284
19.6 Reconstruction ................................................................................................................... 285
20.1 The original PCNN Python class ....................................................................................... 295
20.2 Typical execution of the PCNN ......................................................................................... 295
C.1 Programs to convert RGB to XYZ and then to CIE L*a*b* ............................................. 327
C.2 The Zernike function ........................................................................................................ 328
C.3 The Plop function .............................................................................................................. 329
C.4 The Warp function ............................................................................................................ 330
C.5 The KaiserMask function ................................................................................................. 331
Preface
Image processing and analysis is a burgeoning field that is gaining renewed interest in recent years.
The need for image analysis tools is ever increasing. Along with this is also the need to be able to
efficiently and explicitly describe processes used in analyzing images. Unfortunately, the current
state of publications is that each author has their own way of describing processes. Two different
authors describing the same process will often provide vastly different ways of communicating their
proposed process.
The recent development of high-powered scripting languages such as Python compounds the
issue. Publications can consume more real estate in explaining the process than it takes to write
the Python script to execute the process. Furthermore, the descriptions can be imprecise, because
some authors prefer to describe their processes through textual descriptions. Readers attempting to
replicate their results may find it a difficult process as not all of the steps are clearly explained.
The purpose of this text is to provide a unified mathematical language that coincides with Python
scripting. Image operators represent processes in a image analysis sequence, and these are associated
with Python scripts. Thus, a concise mathematical description of a process is easily translated into
Python scripts through this correlation. The conversion of Python scripts to image operators is nearly
as easy. Thus, this text introduces the initial set of image operators, complete with associated Python
scripts and examples.

Jason Kinser, D.Sc.


George Mason University
Fairfax, VA, USA
jkinser@gmu.edu

xxi
Software and Data
Software and data used in this text are available at:
https://jmkinser49.wixsite.com/imageoperators
Software and images copyright (c) Jason M. Kinser 2018. Software and images provided on this
site may be used for educational purposes. All other rights are reserved by the author.

xxiii
Another random document with
no related content on Scribd:
CHAPTER V
CHLORINE

Chlorine is of interest in chemical warfare, not only because it


was the first poison gas used by the Germans, but also because of
its extensive use in the preparation of other war gases. The fact that,
when Germany decided upon her gas program, her chemists
selected chlorine as the first substance to be used, was the direct
result of an analysis of the requirements of a poison gas.
To be of value for this purpose, a chemical must satisfy at least
the following conditions:
(1) It must be highly toxic.
(2) It must be readily manufactured in large
quantities.
(3) It must be readily compressible to a liquid
and yet be more or less easily volatilized
when the pressure is released.
(4) It should have a considerably higher
density than that of air.
(5) It should be stable against moisture and
other chemicals.
Considering the properties of chlorine in the light of these
requirements, we find:
(1a) Chlorine is fairly toxic, though its lethal
concentration (2.5 milligrams per liter of air) is very
high when compared with some of the later gases
developed. This figure is the concentration
necessary to kill a dog after an exposure of thirty
minutes. Its effects during the first gas attack
showed that, with no protection, the gas was very
effective.
(2a) Chlorine is very readily manufactured by the
electrolysis of a salt (sodium chloride) solution. The
operation is described below. In 100-pound
cylinders, the commercial product sold before the
War for 5 cents a pound. Therefore on a large scale,
it can be manufactured at a very much smaller
figure.
(3a) Chlorine is easily liquefied at the ordinary
temperature by compression, a pressure of 16.5
atmospheres being required at 18° C. The liquid
which is formed boils at -33.6° C. at ordinary
atmospheric pressure, so that it readily vaporizes
upon opening the valve of the containing cylinder.
Such rapid evaporation inside would cause a
considerable cooling of the cylinder, but this is
overcome by running the outlet pipe to the bottom of
the tank, so that evaporation takes place at the end
of the outlet pipe.
(4a) Chlorine is 2.5 times as heavy as air, and
therefore the gas is capable of traveling over a
considerable distance before it dissipates into the
atmosphere.
(5a) The only point in which chlorine does not
seem to be an ideal gas, is in the fact that it is a
reactive substance. This is best seen in the success
of the primitive protection adopted by both the
British and the French during the days immediately
following the first gas attack.
At first, however, chlorine proved a very effective weapon. During
the first six months of its use, its value was maintained by devising
new methods of attack. When these were exhausted, phosgene was
added (see next chapter). With the decline in importance of cloud
gas attacks, and the development of more deadly gases, chlorine
was all but discarded as a true war gas, but remained as a highly
important ingredient in the manufacture of other toxic gases.

Manufacture in the United States


It was at first thought that the existing plants might be able to
supply the government’s need of chlorine. The pre-war production
averaged about 450 tons (900,000 pounds) per day. The greater
amount of this was used in the preparation of bleach, only about
60,000 pounds per day being liquefied. Only a few of the plants were
capable of even limited expansion. In an attempt to conserve the
supply, the paper mills agreed to use only half as much bleach
during the war, which arrangement added considerably to the supply
available for war purposes. It was soon recognized that even with
these accessions, large additions would have to be made to the
chlorine output of the country in order to meet the proposed toxic gas
requirements.
After a careful consideration of all the factors, the most important
of which was the question of electrical energy, it was decided to build
a chlorine plant at Edgewood Arsenal, with a capacity of 100 tons
(200,000 pounds) per day. The Nelson cell was selected for use in
the proposed plant. During the process of erection of the plant, the
Warner-Klipstein Chemical Company, which was operating the
Nelson cell in its plant in Charleston, West Virginia, agreed that men
might be sent to their plant to acquire the special knowledge required
for operating such a plant. Thus when the plant was ready for
operation, trained men were at once available.
Fig. 19.—Chlorine Plant, Edgewood Arsenal.
Fig. 20.—Ground Plan of Chlorine Caustic Soda
Plant,
Edgewood Arsenal.

The following description of the plant is taken from an article by


S. M. Green in Chemical and Metallurgical Engineering for July 1,
1919:
“The chlorine plant building, a ground plan of which is shown in
Figure 20, consisted of a salt storage and treating building, two cell
buildings, a rotary converter building, etc. In connection with the
chlorine plant, there was also constructed a liquefying plant for
chlorine and a sulfur chloride manufacturing and distilling plant.
“The salt storage and treating building was located on ground
much below the cell buildings, which allowed the railroad to enter the
brine building on the top of the salt storage tanks. These tanks were
constructed of concrete. There were seven of these tanks, 34 feet
long, 28 feet wide and 20 feet deep having a capacity for storing
4,000 tons of salt. There would have been 200 tons of salt used per
day when the plant was running at full capacity.
“On the bottom of each tank distributing pipes for dissolving-
water supply were installed, and at the top of each, at the end next to
the building, there was an overflow trough and skimmer board
arranged so that the dissolving-water after flowing up through the
salt, overflowed into this trough and then into a piping system and
into either of two collecting tanks. The system was so arranged that,
if the brine was not fully saturated, it could be passed through
another storage tank containing a deep body of salt. The saturated
brine was pumped from the collecting tanks to any one of 24 treating
tanks, each of which had a capacity of 72,000 gallons.
“The eighth storage bin was used for the storage of soda ash,
used in treating the saturated brine. This was delivered from the bin
on the floor level of the salt building to the soda ash dissolving tanks.
From these tanks it was pumped to any one of the 24 treating tanks.
After the brine was treated and settled, the clear saturated brine was
drawn from the treating tanks through decanting pipes and delivered
by pumps to any one of the four neutralizing tanks. These were
located next to a platform on the level of the car body. This was to
provide easy handling of the hydrochloric acid, which was purchased
at first, though later prepared at the plant from chlorine and
hydrogen. The neutralized brine was delivered from the tanks by a
pump to a tank located at a height above the floor so that the brine
would flow by gravity to the cells in the cell building.
“There were to be two cell buildings, each 541 feet long by 82
feet wide, and separated by partitions into four sections, containing
six cell circuits of 74 cell units. Each section is a complete unit in
itself, provided with separate gas pump, drying and cooling
equipment, and has a guaranteed capacity of 12.5 tons of chlorine
gas per 24 hours.
“Each Nelson electrolytic cell unit consists of a complete
fabricated steel tank 13 by 32 by 80 inches, a perforated steel
diaphragm spot welded to supporting angle irons, plate glass dome,
fourteen Acheson graphite electrodes 2.5 inches in diameter, 12
inches long and fourteen pieces of graphite 4 by 4 by 17 inches, and
various accessories. (The cell is completely described in Chemical
and Metallurgical Engineering, August 1st, 1919.) Each cell is
operated by a current of 340 amperes and 3.8 volts and is
guaranteed to produce 60 pounds of chlorine gas and 65 pounds of
caustic soda using not more than 120 pounds of salt per 24 hours,
the gas to be at least 95 per cent pure.

Fig. 21.—Interior View of the Cell Building.

“The salt solution from the cell feed tank, located in the salt
treating building, flows by gravity through a piping system located in
a trench running the length of each cell building, and is delivered to
each cell unit through an automatic feeding device which maintains a
constant liquor level in the cathode compartment.
“The remaining solution percolates from the cathode
compartment through the asbestos diaphragm into the anode
compartment and flows from the end of the cell, containing from 8 to
12 per cent caustic soda, admixed with 14 to 16 per cent salt, into an
open trough and into a pipe in the trench and through this pipe by
gravity to the weak caustic storage tanks located near the caustic
evaporator building.

Fig. 22.—Nelson Electrolytic Cell, showing the


Interior Arrangement of the Cell.

“The gas piping from the individual cell units to and including the
drying equipment is of chemical stoneware. The piping is so
designed that the gas can be drawn from the cells through the drying
equipment at as near atmospheric pressure as possible in order that
the gas can be kept nearly free of air. When operating, the suction at
the pump was kept at ¹/₂₀ inch or less. The quality of the gas was
maintained at a purity of 98.5 to 99 per cent. The coolers used were
very effective, the gas being cooled to within one degree of the
temperature of the cooling water, no refrigeration being necessary.
The drying apparatus consisted of a stoneware tower of special
design containing a large number of plates, and thus giving a very
large acid exposure. There was practically no loss of vacuum
through the drying tower and cooler. The gas pumping equipment
consisted of two hydroturbine pumps using sulfuric acid as the
compressing medium. The acid was cooled by circulation through a
double pipe cooler similar to those used in refrigerating work. The
gas was delivered under about five pounds pressure into large
receiving tanks located just outside the pump rooms, and from these
tanks into steel pipe mains which conducted the gas to the chemical
plant.”
The purity of the gas was such that it was not found necessary to
liquefy it for the preparation of phosgene.

Properties
Chlorine, at ordinary atmospheric pressure and temperature, is a
greenish yellow gas (giving rise to its name), which has a very
irritating effect upon the membranes of the nose and throat. As
mentioned above, at a pressure of 16.5 atmospheres at 18° C.,
chlorine is condensed to a liquid. If the gas is first cooled to 0°, the
pressure required for condensation is decreased to 3.7
atmospheres. This yellow liquid has a boiling point of -33.6° C. at the
ordinary pressure. If very strongly cooled, chlorine will form a pale
yellow solid (at -102° C.). Chlorine is 2.5 times as heavy as air, one
liter weighing 3.22 grams. 215 volumes of chlorine gas will dissolve
in 100 volumes of water at 20°. It is very slightly soluble in hot water
or in a concentrated solution of salt.
Chlorine is a very reactive substance and is found in combination
in a large number of compounds. Among the many reactions which
have proved important from the standpoint of chemical warfare, the
following may be mentioned:
Chlorine reacts with “hypo” (sodium thiosulfate) with the
formation of sodium chloride. Hypo is able to transform a large
amount of chlorine, so that it proved a very satisfactory impregnating
agent for the early cloth masks.
Water reacts with chlorine under certain conditions to form
hypochlorous acid, HOCl. In the presence of ethylene, this forms
ethylene chlorhydrin, which was the basis for the first method of
preparing mustard gas. In the later method, in which sulfur chloride
was used, chlorine was used in the manufacture of the chloride.
Chlorine reacts with carbon monoxide, in the sunlight, or in the
presence of a catalyst, to form phosgene, which is one of the most
valuable of the toxic gases.
Chlorine and acetone react to form chloroacetone, one of the
early lachrymators. The reaction of chlorine with toluene forms
benzyl chloride, an intermediate in the preparation of
bromobenzylcyanide.
In a similar way, it is found that the greater number of toxic gases
use chlorine in one phase or another of their preparation. One author
has estimated that 95 per cent of all the gases used may be made
directly or indirectly by the use of chlorine.
Chlorine has been used in connection with ammonia and water
vapor for the production of smoke clouds. The ammonium chloride
cloud thus produced is one of the best for screening purposes. In
combination with silicon or titanium as the tetrachloride it has also
been used extensively for the same purpose.
On the other hand one may feel that, whatever bad reputation
chlorine may have incurred as a poison gas, it has made up for it
through the beneficial applications to which it has lent itself. Among
these we may mention the sterilization of water and of wounds.
In war, where stationary conditions prevail only in a small number
of cases, the use of liquid chlorine for sterilization of water is
impractical. To meet this condition, an ampoule filled with chlorine
water of medium concentration has been developed, which furnishes
a good portable form of chlorine as a sterilizing agent for relatively
small quantities of water.
Chlorine has also been applied, in the form of hypochlorite, to the
sterilization of infected wounds. The preparation of the solution and
the technique of the operation were worked out by Dakin and Carrel.
This innovation in war surgery has decreased enormously the
percentage of deaths from infected wounds.
CHAPTER VI
PHOSGENE

The first cloud attack, in which pure chlorine was used, was very
effective, but only because the troops attacked with it were entirely
unprotected. Later, in spite of the varied methods of attack, the
results were less and less promising, due to the increased protection
of the men and also to the gas discipline which was gradually being
developed. During this time the Allies had started their gas attacks
(Sept., 1915), and it soon became evident that, if Germany was to
keep her supremacy in gas warfare, new gases or new tactics would
have to be introduced.
The second poison gas was used in December, 1915, when
about 20-25 per cent of phosgene was mixed with the chlorine. Here
again the Germans made use of an industry already established.
Phosgene is used commercially in the preparation of certain
dyestuffs, especially methyl violet, and was manufactured before and
during the war by the Bayer Company and the Badische Anilin und
Soda Fabrik.
Phosgene can not be used alone in gas cylinders because of its
high boiling point (8° C.). While this is considerably below ordinary
temperatures, especially during the summer months, the rate of
evaporation is so slow that a cloud attack could never be made with
it alone. However, when a mixture of 25 per cent phosgene and 75
per cent chlorine, or 50 per cent phosgene and 50 per cent chlorine
is used in warm weather there is no difficulty in carrying out gas
attacks from cylinders. At the same time the percentage of phosgene
in the mixture is sufficiently high to secure the advantages which it
possesses. These advantages are at least three:
(a) Phosgene is more toxic than chlorine. It requires 2.5
milligrams per liter of chlorine to kill a dog on an exposure of 30
minutes, but 0.3 milligram of phosgene will have the same effect.
This of course means that a cloud of phosgene containing one-
eighth (by weight) of the concentration of a chlorine cloud will have
the same lethal properties.
(b) Phosgene is much less reactive than chlorine, so that the
matter of protection becomes more difficult. Fortunately, word was
received by the British of the intended first use of phosgene against
them and consequently they were able to add
hexamethylenetetramine to the impregnating solution used in the
cloth masks.
(c) The third, and a very important, factor in the use of phosgene
is the so-called delayed effect. In low concentrations, men may
breathe phosgene for some time with apparently no ill effects. Ten or
twelve hours later, or perhaps earlier if they attempt any work, the
men become casualties.
Pure phosgene has been used in projector attacks (described in
Chapter II). The substance has also been used in large quantities in
shell; the Germans also used shell containing mixtures with
superpalite (trichloromethyl chloroformate) or sneezing gas
(diphenylchloroarsine).

Manufacture
Phosgene was first prepared by John Davy in 1812, by exposing
a mixture of equal volumes of carbon monoxide and chlorine to
sunlight; Davy coined the name “phosgene” from the part played by
light in the reaction. While phosgene may be prepared in the
laboratory by a number of other reactions, it was quite apparent that
the first mentioned reaction is the most economical of these for large
scale production. The reaction is a delicate one, however, and its
application required extended investigation.
The United States was fortunate in that, for some months
previous to the war, the Oldbury Electrochemical Company had been
working on the utilization of their waste carbon monoxide in making
phosgene. The results of these investigations were given to the
government and aided considerably in the early work on phosgene
at the Edgewood plant.

Fig. 23.—Furnace for Generating Carbon Monoxide.

Of the raw materials necessary for the manufacture of phosgene,


the chlorine was provided, at first by purchase from private plants,
but later through the Edgewood chlorine plant. After a sufficient
supply of chlorine was assured the next question was how to obtain
an adequate supply of carbon monoxide. A method for this gas had
not been developed on a large scale because it had never been
necessary to make any considerable quantity of it. The French and
English passed oxygen up through a gas producer filled with coke;
the oxygen combines with the carbon, giving carbon monoxide. The
oxygen was obtained from liquid air, for which a Claude liquid air
machine may be used. The difficulty with this method of preparing
carbon monoxide was that the amount of heat generated was so
great that the life of the generators was short. Our engineers
conceived the idea of using a mixture of carbon dioxide and oxygen.
The union of carbon dioxide with carbon to form carbon monoxide is
a reaction in which heat is absorbed. Therefore by using the mixture
of the two gases, the heat of the one reaction was absorbed by the
second reaction. In this way a very definite temperature could be
maintained, and the production of carbon monoxide was greatly
increased.

Fig. 24.—Catalyzer Boxes Used in the Manufacture


of Phosgene.
Carbon dioxide was prepared by the combustion of coke. The
gas was washed and then passed into a solution of potassium
carbonate. Upon heating, this evolved carbon dioxide.
Phosgene was then prepared by passing the mixture of carbon
monoxide and chlorine into catalyzer boxes (8 feet long, 2 feet 9
inches deep and 11 inches wide), which are made of iron, lined with
graphite and filled with a porous form of carbon. Two sets of these
boxes were used. In the first the reaction proceeds at room
temperature, and is about 80 per cent complete. The second set of
boxes were kept immersed in tanks filled with hot water, and there
the reaction is completed.
The resulting phosgene was dried with sulfuric acid and then
condensed by passing it through lead pipes surrounded by
refrigerated brine.
The Germans prepared their phosgene by means of a prepared
charcoal (wood or animal). Carbon monoxide was manufactured by
passing carbon dioxide over wood charcoal contained in gas-fired
muffles and was washed by passing through sodium hydroxide. This
was mixed with chlorine and the mixture passed downward through
a layer of about 20 cm. of prepared charcoal contained in a cast iron
vessel 80 cm. in diameter and 80 cm. deep. By regulating the
mixture so that there was a slight excess of carbon monoxide, the
phosgene was obtained with only one-quarter of one per cent free
chlorine. The charcoal (wood) was prepared by washing with
hydrochloric and other acids until free from soluble ash; it was then
washed with water and dried in vacuum. The size of the granules
was about one-quarter inch mesh. Their life averaged about six
months.

Properties
Phosgene is a colorless gas at room temperatures, but becomes
a liquid at 8°. The odor of phosgene is suggestive of green corn or
musty hay. One liter of phosgene vapor weighs 4.4 grams (chlorine
weights 3.22 grams). At 0° C., the liquid is heavier than water, having
a specific gravity of 1.432. At 25°, the vapor exerts a pressure of
about 25 pounds per square inch. Phosgene is absorbed by solid
materials, such as pumice stone and celite. Pumice stone absorbs
more than its own weight of phosgene. Thus 5.7 grams of pumice
absorbed 7.4 grams phosgene, which completely evaporated in 60
minutes. German shell have been found which contained such a
mixture (phosgene and pumice stone). While the apparent reason for
their use is to prevent the rapid evaporation of the phosgene, it is a
question whether such is the case, for a greater surface is really
present in the case of pumice stone than where the phosgene is
simply on the ground. Phosgene is slowly decomposed by cold
water, rapidly by hot water. This reaction is important because there
is always moisture in the air, which would tend to lower the
concentration of the gas.
Phosgene is absorbed and decomposed by
hexamethylenetetramine (urotropine). This reaction furnished the
basis of the first protection used by the British. Later the catalytic
decomposition of phosgene into carbon dioxide and hydrochloric
acid by the charcoal in the mask furnished protection.
For most purposes a trace of chlorine in phosgene is not a
disadvantage; for example, when it is used in cylinders or projectors.
Under certain conditions, as when used as a solvent for sneezing
gas, the presence of chlorine must be avoided, since it reacts with
the substance in solution, usually producing a harmless material.
Chlorine may be removed from phosgene by passing the mixture
through cotton seed oil.

Protection
It was mentioned above that hexamethylenetetramine
(urotropine) was used in the early pads (black veil and similar
masks) and flannel helmets. This was found to be satisfactory
against chlorine and phosgene, in the concentrations usually found
during a cylinder attack. The mixture used consisted of urotropine,
sodium thiosulfate (“hypo”), sodium carbonate and glycerine. The
glycerine tended to keep the pads moist, while the other chemicals
acted as protective agents against the mixture of phosgene and
chlorine.
The introduction of the Standard Box Respirator with its charcoal-
soda lime filling increased very materially the protection against
phosgene. In this filling, the charcoal both absorbs the phosgene and
catalyzes the reaction with the moisture of the air with which the
phosgene is mixed, to form hydrochloric acid and carbon dioxide.
Soda-lime absorbs phosgene but does not catalyze its
decomposition. This shows the advantage of the mixture, since the
hydrochloric acid, which is formed through the action of the charcoal,
is absorbed by the soda-lime. Experiments seem to indicate that it
does not matter which material is placed in the bottom of the
canister, but that an intimate mixture is the best arrangement. Using
a concentration of 5,000 parts per million (20.2 mg. per liter) a type H
canister (see page 217) will give complete protection for about 40
minutes; when the air-gas mixture passes at the rate of 16 liters per
minute the efficiency or life of a canister increases with a decrease in
temperature, as is seen in the following table (the concentration was
5,000 parts per million, the rate of flow 16 liters per minute)
Temperature Efficiency
° C. (Time in minutes)
-10 223
0 172
10 146
20 130
30 125
40 99
From these figures it is seen that at -10° C. the life is about 50
per cent greater than at summer temperature. As would be expected
the life of a canister is shortened by increasing the concentration of
phosgene in the phosgene air mixture. This is illustrated by the
following figures:
Concentration Life
p.p.m. (Time in minutes)
5,000 177
10,000 112
15,000 72
20,000 58
25,000 25
(25,000 p.p.m. is equal to 101.1 mg. per liter.)
There is rather a definite relation between the concentration of
the gas and the life of a canister at any given rate of flow. Many of
these relations have been expressed by formulas of which the
following is typical. At 32 liters per minute flow, C⁰ ˙ ⁹ × T =
101,840, in which C is the concentration and T the time.

Shell Filling
The empty shell, after inspection, are loaded on trucks, together
with the appropriate number of “boosters,” which screw into the top
of the shell and thereby close them. The trucks are run by an electric
storage battery locomotive to the filling unit. The shell are transferred
by hand to a conveyor, which carries the shell slowly through a cold
room. During this passage of about 30 minutes, the shell are cooled
to about 0° F. The cooled shell are transferred to shell trucks, each
truck carrying 6 shell. These trucks are drawn through the filling
tunnel by means of a chain haul operated by an air motor to the
filling machine. Here the liquid phosgene is run into the shell by
automatic machines, so arranged that the 6 shell are at the same
time automatically filled to a constant void. The truck then carries the
filled shell forward a few feet to a small window, at which point the
boosters are inserted into the nose of the shell by hand. The final
closing of the shell is then effected by motors operated by
compressed air. The filling and closing machines are all operated by
workmen on the outside of the filling tunnel.

Fig. 25.—Filling Livens’ Drums with Phosgene.

The filled shell are conveyed to the shell dump, where they are
stored for 24 hours, nose down on skids, in order to test for leaks.

Tactical Use
Phosgene was first used in cloud attacks in December, 1915.
These attacks continued for about nine months and were then
gradually replaced, to a large extent, by gas shell attacks. Phosgene
was first found in German projectiles in November, 1916. These shell
were known as the d-shell. Besides pure phosgene, mixtures of

You might also like