CHAPMAN & HALL/CRC MATHEMATlCAL AND COMPUTATlONAL lMAGlNG SCIENCES Series Editors Chandrajit Bajaj Center for Computational Visualization The University of Texas at Austin Guillermo Sapiro Department of Electrical and Computer Engineering Duke University Aims and Scope This series aims to capture new developments and summarize what is known over the whole spectrum of mathematical and computational imaging sciences. It seeks to encourage the integration of mathematical, statistical and computational methods in image acquisition and processing by publishing a broad range of textbooks, reference works and handbooks. The titles included in the series are meant to appeal to students, researchers and professionals in the mathematical, statistical and computational sciences, application areas, as well as interdisciplinary researchers involved in the field. The inclusion of concrete examples and applications, and programming code and examples, is highly encouraged. Published Titles Image Processing for Cinema by Marcelo Bertalmlo Image Processing and Acquisition using Python by Ravishankar Chityala and Sridevi Pudipeddi Statistical and Computational Methods in Brain Image Analysis by Moo K. Chung Rough Fuzzy Image Analysis: Foundations and Methodologies by Sankar K. Pal and James F. Peters Theoretical Foundations of Digital Imaging Using MATLAB ® by Leonid P. Yaroslavsky .• Proposals for the series should be submitted to the series editors above or directly to: CRC Press, Taylor & Francis Group 3 Park Square, Milton Park, Abingdon, OX14 4RN, UK CJ-IAI'MAN & 1-!ALL/CRC i'v\ATH EMATICAL AND CO tv\ PUTATIONAL I MAG INC SCI l NCES C( I I u 1 1 .L u \ r I D Image Processing and Acquisition using Python Ravishankar Chityala University of Minnesota at Minneapolis USA Sridevi Pudipeddi SriRav Scientific Solutions Minneapolis, Minnesota, USA 0 Boca Raton London New York CRC Press is an imprint of the Taylor & Francis Group an informa business A CHAPMAN & HALL BOOK
7
Embed
Center for Computational Visualization Department of ...
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CHAPMAN & HALL/CRC MATHEMATlCAL AND COMPUTATlONAL
lMAGlNG SCIENCES
Series Editors
Chandrajit Bajaj Center for Computational Visualization
The University of Texas at Austin
Guillermo Sapiro Department of Electrical
and Computer Engineering Duke University
Aims and Scope
This series aims to capture new developments and summarize what is known over the whole spectrum of mathematical and computational imaging sciences. It seeks to encourage the integration of mathematical, statistical and computational methods in image acquisition and processing by publishing a broad range of textbooks, reference works and handbooks. The titles included in the series are meant to appeal to students, researchers and professionals in the mathematical, statistical and computational sciences, application areas, as well as interdisciplinary researchers involved in the field. The inclusion of concrete examples and applications, and programming code and examples, is
highly encouraged.
Published Titles Image Processing for Cinema
by Marcelo Bertalmlo
Image Processing and Acquisition using Python by Ravishankar Chityala and Sridevi Pudipeddi
Statistical and Computational Methods in Brain Image Analysis by Moo K. Chung
Rough Fuzzy Image Analysis: Foundations and Methodologies by Sankar K. Pal and James F. Peters
Theoretical Foundations of Digital Imaging Using MATLAB® by Leonid P. Yaroslavsky
.•
Proposals for the series should be submitted to the series editors above or directly to: CRC Press, Taylor & Francis Group
3 Park Square, Milton Park, Abingdon, OX14 4RN, UK
CJ-IAI'MAN & 1-!ALL/CRC i'v\ATH EMATICAL AND CO tv\ PUTATIONAL I MAG INC SCI l NCES
C( I I .c~f' u 11
.L ~ u \ r I ~-I D
Image Processing and Acquisition using Python
Ravishankar Chityala University of Minnesota at Minneapolis
USA
Sridevi Pudipeddi SriRav Scientific Solutions
Minneapolis, Minnesota, USA
0 ~y~~F~~~~~"P Boca Raton London New York
CRC Press is an imprint of the Taylor & Francis Group an informa business
A CHAPMAN & HALL BOOK
MATLAB' is a trademark of The MathWorks, Inc. and is used with permission. The Math Works does not warrant the accuracy of the text or exercises in this book. This book's use or discussion of MATLAB' software or related products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the MAT LAB" software.
CRC Press Toy! or & l'ranci< Group 6000 Broken Sound Parkway NW. Boca Raton, FL 33187-2742
f:l 2014 by Taylor & fra ncis Group, LL CRC Press is an imprint of Taylor & Francis Group, an Inform a business
No claim to original U.S. Government works
Printed on acid-free paper Version Date: 20131206
International Standard Book Number-13: 978-1-4665-8375-7 (Hardback)
This book contains informati on obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all material s or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apo logi ze to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint.
Except n permitted under U.S. Copyright Law, no part of this book may be reprinted. reproduced, t rnnsmlned, or tltfl l•.ed in an)• form by a ny electronic, mechanical, or o thet' menns, now know n or hereafter invented. includIng photocopying, micro(i[ming, and recording, or In nny infot·mation storage or re.trl ·Vlll sy•tcm, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright. com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe.
Library of Congress Cataloging-in-Publication Data
Chityala, Ravishankar, author. Image processing and acquisition using Python I Ravishankar Chityala, Sridevi Pudipeddi.
Summary: "If title belongs to a series, the exact series title that will appear in the book is: Series number, exactly as it will appear in the book: Will the first-named author listed in Author Information appear as the first-named author for all other volumes of the series?"-Provided by publisher.
Includes bibliographical references and index . ISBN 978-1-4665-8375-7 (hardback) 1. Image processing. 2. Python (Computer program language) I. Pudipeddi, Sridevi, author.
ll. Title. •"
TA1637.C486 2014 006.6'63--dc23
Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com
and the CRC Press Web site at http://www.crcpress.com
2013047010
To our parents and siblings
..
Contents
List of Figures xvii
List of Tables xxiii
Foreword XXV
Preface xxvii
Introduction xxxi
About the Authors xxxiii
List of Symbols and Abbreviations XXXV
I Introduction to Images and Computing using
Python 1
1 Introduction to Python 3
1.1 Introduction ... 3
1.2 What is Python? 4
1.3 Python Environments 5
1.3.1 Python Interpreter 6
1.3.2 Enthought Python Distribution (EPD) 6
1.3.3 PythonXY .. . . . . . .. . . . . . 7
1.4 Running a Python Program •• 0 0 •••• 8
1.5 Basic Python Statements and Data Types 8
1.5.1 Data Structures 11 1.6 Summary 19 ..... . .
vii
viii Contents
1.7 Exercises
2 Computing using Python Modules
2.1 Introduction ...... .
2.2 Python Modules
2.2.1 Creating Modules
2.2.2 Loading Modules
2.3 Numpy ........ .
2.3.1 Numpy Array or Matrices? .
2.4 Scipy
2.5 Matplotlib
2.6 Python Imaging Library
2. 7 Scikits . . . . . . . . . .
2.8 Python OpenCV Module
2.9 Summary
2.10 Exercises
3 Image and its Properties
3.1 Introduction . . . . . .
3.2 Image and its Properties
3.2.1 Bit Depth ....
3.2.2 Pixel and Voxel
3.2.3 Image Histogram
3.2.4 Window and Level
3.2.5 Connectivity: 4 or 8 Pixels
3.3 Image Types
3.3.1 JPEG
3.3.2 TIFF .
3.3.3 DICOM
3.4 Data Structures for Image Analysis
3.4.1 Reading Images ..
3.4.2 Displaying Images .
3.4.3 Writing Images . .
20
23
23
23
24
24
26
30
31
32
33
33
34
34
35
37
37
38
38
39
41
42
43
44
44
44
45
49
49
50
50
Contents
3.5
3.6
Programming Paradigm
Summary
3. 7 Exercises
II Image Processing using Python
4 Spatial Filters
4.1 Introduction
4.2 Filtering ..
4.2.1 Mean Filter
4.2.2 Median Filter
4.2.3 Max Filter . .
4.2.4 Min Filter . .
4.3 Edge Detection using Derivatives
4.3.1 First Derivative Filters . .
4.3.2 Second Derivative Filters .
4.4 Summary
4.5 Exercises
5 Image Enhancement
5.1 Introduction ...
5.2 Pixel Transformation
5.3 Image Inverse ....
5.4 Power Law Transformation
5.5 Log Transformation
5.6 Histogram Equalization
5. 7 Contrast Stretching
5.8 Summary
5. 9 Exercises
6 Fourier Transform
6.1 Introduction .
6.2 Definition of Fourier Transform . . .
6.3 Two-Dimensional Fourier Transform
ix
51
53
53
55
57
57
58
60
64
66
68
69
71
79
85
86
89
89
89
91
92
97
99
103
106
107
109
109
110
113
X
6.4
6.5
Contents
6.3.1 Fast Fourier Transform using Python
Convolution ............. .
6.4.1 Convolution in Fourier Space
Filtering in Frequency Domain
6.5.1 Ideal Lowpass Filter ..
6.5.2 Butterworth Lowpass Filter
6.5.3 Gaussian Lowpass Filter ..
6.5.4 Ideal Highpass Filter ....
6.5.5
6.5.6
6.5.7
Butterworth Highpass Filter
Gaussian Highpass Filter .
Bandpass Filter
6.6 Summary
6. 7 Exercises
115
118
119
120
120
123
125
127
130
132
134
137
138
7 Segmentation 139
139
139
141
144
149
151
153
7.1 Introduction
7.2 Histogram Based Segmentation
7.3
7.2.1 Otsu's Method ... .
7.2.2 Renyi Entropy .... .
7.2.3 Adaptive Thresholding
Region Based Segmentation
7.3.1 Watershed Segmentation
7.4 Segmentation Algorithm for Various Modalities 161
7.4.1 Segmentation of Computed Tomography Image 161