Digital Image Processing with Application to Digital Cinema Digital Image Processing with Application to Digital Cinema By K S Thyagarajan AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO Focal Press is an imprint of Elsevier Acquisitions Editor Angelina Ward Project Manager Paul Gottehrer Assistant Editor Rachel Epstein Marketing Manager Christine Veroulis Cover Design Cate Barr Interior Design Julio Esperas Focal Press is an imprint of Elsevier 30 Corporate Drive, Suite 400, Burlington, MA 01803, USA Linacre House, Jordan Hill, Oxford OX2 8DP, UK Copyright © 2006, Elsevier Inc All rights reserved No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher Permissions may be sought directly from Elsevier’s Science & Technology Rights Department in Oxford, UK: phone: (+44) 1865 843830, fax: (+44) 1865 853333, E-mail: permissions@elsevier.com You may also complete your request on-line via the Elsevier homepage (http://elsevier.com), by selecting “Support & Contact” then “Copyright and Permission” and then “Obtaining Permissions.” Recognizing the importance of preserving what has been written, Elsevier prints its books on acidfree paper whenever possible Library of Congress Cataloging-in-Publication Data Application submitted British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library ISBN 13: 978-0-240-80729-4 ISBN 10: 0-240-80729-4 For information on all Focal Press publications visit our website at www.books.elsevier.com 05 06 07 08 09 10 10 Printed in Canada Working together to grow libraries in developing countries www.elsevier.com | www.bookaid.org | www.sabre.org In memory of my beloved parents Contents Preface Introduction xv xix Introduction 1.1 Background 1.2 Enhancement 1.3 Compression 1.4 Restoration 1.5 Computed Tomography 1.6 Image Analysis 1.7 Summary 11 References 11 Two-Dimensional Signals, Systems, and Discrete Fourier Transform 2.1 Two-Dimensional Discrete Signals 13 2.2 Two-Dimensional Discrete Systems 15 2.2.1 2.2.2 2.2.3 2.2.4 Linear Systems 15 Space Invarient Systems 16 System Response via 2-D Convolution 16 Causal and Stable Systems 17 13 Contents viii 2.3 Two-Dimensional Discrete Fourier Transform 17 2.4 Frequency Response 19 2.5 Two-Dimensional Filtering 23 2.6 FIR Filter Design 27 2.6.1 2.6.2 2.7 Separable FIR Filters 27 2.6.1.1 Window-Based Methods 27 2.6.1.2 Frequency Sampling Technique 39 2.6.1.3 Optimal Design Techniques 40 Nonseparable FIR Filters 41 Summary 44 References 44 Human Visual Perception 3.1 Introduction 47 3.2 Brightness Perception 47 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3 3.3.3 3.3.4 3.4 Intensity, Luminance, and Brightness 47 Simultaneous Contrast 50 Mach Bands 52 Transfer Function of the HVS 54 Monochrome Vision Model 55 Visual Masking and an Improved HVS Model 57 Color Perception 59 3.3.1 3.3.2 Color-Matching Functions 61 Color Coordinate Systems 63 3.3.2.1 CIE XYZ Primaries 64 3.3.2.2 NTSC Receiver and Transmission Primaries 66 HVS Model for Color Vision 69 Opponent Color Model 70 Summary 70 References 47 71 Image Acquisition 4.1 Introduction 73 4.2 Image Sensors 73 4.2.1 CCD Sensors 74 73 Contents ix 4.2.2 4.2.3 4.2.1.1 Full-Frame Architecture 76 4.2.1.2 Interline Architecture 76 4.2.1.3 Frame-Transfer CCD 77 CMOS Sensors 79 Color Sensors 79 4.3 Image Sampling 82 4.4 Image Quantization 87 4.4.1 4.4.2 4.5 Uniform Quantization 87 Optimal Quantization 88 Image Scanning 90 4.5.1 4.5.2 4.5.3 Interlaced and Progressive Scanning 90 Color Image Scanning 91 Color Encoding in Digital Video 91 4.6 Film-to-Digital Conversion 93 4.7 Summary 94 References 95 Image Inhancement 5.1 Background 97 5.2 Point Processing 97 5.2.1 5.2.2 5.2.3 5.3 Logarithmic Transformation 98 Contrast Stretching 98 Histogram Modification 101 5.2.3.1 Histogram Equalization 101 5.2.3.2 Adaptive Histogram Modification 104 Neighborhood Processing 104 5.3.1 5.3.2 5.3.3 Simple Mask Operations 106 Two-Dimensional Filters Satisfying Specified Frequency Responses 109 Median Filtering 111 5.4 Color Image Enhancement 117 5.5 Summary 120 References 121 97 Appendix C MATLAB M Files for Selected Chapters 364 d(8,3) = 1.2528; r(8,3) = 1.6725; d(8,4) = 2.3797; r(8,4) = 3.0868; d(8,5) = inf; r(8,5) = r(8,4); % Quantize the rest of the % coefficients for k = 1:N:Rows for l = 1:N:Cols for m = k:k+N-1 m1 = mod(m,N); if m1 == m1 = N; end; for n = l:l+N-1 n1 = mod(n,N); if n1 == n1 = N; end L = R1(m1,n1); if m1 == & n1 == T1(m,n) = round(T(m,n)/8)*8; elseif L == T1(m,n) = 0; else flag = 1; if T(m,n) < flag = -1; end t = abs(T(m,n))/StdOfCoef(m1,n1); for s = 1:L/2 if t>=d(L,s) & t