DESIGN OF A COMPUTER SYSTEM for the ANALYSIS OF DEFECTS AND GRADING OF WOVEN FABRICS by SN N i l e s ^ This thesis was submitted to the Department of Textile & Clothing Technology of the University of Moratuwa in partial fulfilment of the requirements of the 1 "* Degree of C V ' ^ \ Master of Philosophy Department of Textile & Clothing Technology University of Moratuwa June 2004 u * Tresis call SI 6 I University of M o r a t u w a 81618 8 1 6 1 I D E C L A R A T I O N No portion of the work in this thesis has been submitted to any University or Institution for any other academic qualification. SN Niles (Candidate) Dr. Sandun Fernando (Supervisor) (Supervisor) 1 ABSTRACT Inspection of fabrics is a major consideration in fabric manufacture, as well as in the manufacture of garments and other fabric-based goods. In the Sri Lankan industry fabric inspection is almost entirely carried out by manual methods, and is therefore subjective and prone to human error. This research has sought to address this problem by developing a computerised system to analyse and grade fabrics on the basis of captured defective images obtained from the fabric. In this research a computer-based system for the objective assessment of fabric defects was designed. The system was designed with special emphasis on the fabric defects occurring in the Sri Lankan industry. Image processing techniques were used to analyse scanned images of the test fabric, compare it with an ideal sample which is made available, and identify defects according to pre-learnt rules. The information gathered was then used to grade the fabric, either by giving the frequency of occurrence of defects or by assigning points. A new classification method for common defects was designed, that would facilitate easy grading according to commonly used grading systems. A coding system for defects was also designed, which helps in reporting defects to the user. The detected fabric defects were classified and stored according to the developed classification method and using the proposed coding system. ii ACKNOWLEDGEMENTS I wish to place on record my sincere thanks to Dr. Sandun Fernando and Dr. Gamini Lanerolle, my supervisors, for the invaluable guidance, advice and encouragement accorded to me during the period of my research. I would like to thank Dr. Sandun Fernando specially for encouraging me to publish, and Dr. Lanerolle for the motivation he gave me during a crucial stage of the research. I wish to thank the University of Moratuwa for giving me the opportunity for postgraduate research. Thanks are due to the Director, Postgraduate Studies, Secretary, Higher Degrees Committee, and Dean, Engineering for their encouragement and support. Thanks are also conveyed to Prof. Lakdas Fernando and Dr. Nirmali de Silva, former Heads of Department, and to Mr. DPD Dissanayake, current Head of Department, for their support and encouragement. I specially thank Mr. Dissanayake and Dr. de Silva for willingly serving on my progress review committee.'I would also like to thank my colleagues in the Department of Textile & Clothing Technology for their support in various ways. My project had a considerable computing component, and 1 thank all those who gave me valuable input in this matter: Dr. Gihan Dias, former Head of the Department of Computer Science and Engineering, Dr. Lalith Gamage, formerly Senior Lecturer of the University of Moratuwa, and Dr. N. Kodikara, Head of the Department of Communication and Media Technologies of the University of Colombo. A very special word of thanks to my friend and colleague, GC de Silva of the Department of Computer Science and Engineering, who took time off from his graduate studies and heavy work schedules to promptly and painstakingly answer my innumerable questions. My gratitude also to a dear friend, Ruwan Fernando, Tech Lead at Virtusa (Pvt.) Ltd. for his persistence in keeping me on track on my research and for innumerable pointers regarding general computing aspects. Thanks are also due to technical officers Ms. Dilum Dissanayake, Mr. HM Seneviratne and Mr. GHD Wijesena, Mr. KT Anurasiri, former technical officer, and Mr. HS Soysa, laboratory assistant, for their assistance in the preparation of samples for testing, and to Mr. JA Chinthaka, laboratory assistant, and Mr. Sanjeewa Silva, office aide, for their assistance in printing the thesis. Thanks are also due to personnel in various textile and garment factories, especially my former students, for their assistance in data collection and verification. Last but not least, I would like to express my gratitude to my parents, for their guidance and encouragement throughout my educational career, and to my brother and sister-in-law for their support during my undergraduate days. A special word of thanks to my mother, whose patience and support has helped me to come this far in the academic field. iii TABLE OF CONTENTS Declaration Acknowledgements Abstract Table of Contents List of Figures List of Tables List of Abbreviations & Acronyms Chapter 1 - General Introduction 1.1. The Importance of Fabric Inspection 1.2. Objectives of the Research 1.3. Outline of the Thesis Chapter 2 - Literature Review 2.1. Introduction 2.2. Early Fabric Inspection 2.3. Existing Fabric Grading Systems 2.3.1. 4- Point system 2.3.2. 10-Point System 2.3.3. Graniteville ("78") System 2.3.4. 6-Point System 2.3.5. BS Standard 2.3.6. ASTM Standard 2.3.7. 1 in 9 System 2.3.8. Comparison of different Grading Systems 2.4. Fabric Inspection Systems: History & Developments 2.4.1. Manual Systems 2.4.2. Semi-automated Systems 2.4.3. Fully-automated Fabric Inspection 2.5. Conclusion Chapter 3 - Review Of Image Processing & Computer Vision 26 Techniques 3.1. Introduction 26 3.2. Overview of Computer Vision 27 3.3. Overview of Relevant Image Processing Operations 30 3.3.1. Image Enhancement 30 3.3.2. Edge Detection 32 3.3.3. Morphological Operations 34 3.3.4. Image Segmentation 36 3.3.5. Shape Features 38 3.3.6. Scene Matching 38 3.3.7. Recognition & Classification 39 3.4. Conclusion 41 Chapter 4 - Methodology of the Proposed System 42 4.1. Introduction 42 4.2. Fabric Defects 42 4.3. Relevant Classification of Fabric Defects 43 4.4. Coding of Fabric Defects 48 4.5. Introduction to the new system 51 4.6. Sample Preparation 52 4.7. Steps of the Algorithm 52 4.8. An Alternate Approach 68 4.9. Software used 69 4.10. Program Details 71 4.11. Conclusion 74 Chapter 5 - Discussion & Conclusions 75 5.1. Introduction 75 5.2. Classification & Coding System 75 Chapter 6 - Suggestions for Future Work 79 6.1. Introduction 79 v 6.2. Detection of Colour Defects 6.3. Extension of system to cover full length and width of fabrics 6.4. Further Classification 6.5. Software enhancement 6.6. System enhancement 6.7. Interfacing 6.8. Broadbasing of the scope of the system List of References Appendices Appendix A1 - Defects listed in ISO 8498: 1990 (E/F) Appendix A2 - Defects listed in ASTM D3990: 1990 Appendix A3 - Defects & Imperfections listed in ASQC 4-Poi System Appendix A4 - Matlab Source Code Appendix A5 - Visual Basic Source Code Appendix A6 - Program Results LIST OF FIGURES Fig. 2-1 Manual Inspection in Progress 15 Fig. 2-2 Detection of Fabric Faults in Manual Inspection 18 Fig. 2-3 Lindley Narrow Fabric Inspection System 20 Fig. 2-4 Sectional View of the Uster Fabriscan 21 Fig. 2-5 I-Tex 2000 system for the inspection of finished fabrics 22 Fig. 3-1 Diagram of a typical Computer Vision System 29 Fig. 3-2 Simple Rule-based Classifier 41 Fig. 4-1 Comparison of the appearance of (a) knot & (b) slub 46 Fig. 4-2 Comparison of the appearance of different defects 46 Fig. 4-3 Proposed Coding System 50 Fig. 4-4 Grey scale image of a fabric scanned on a flatbed scanner 53 Fig. 4-5 (a-b) Histogram Equalisation examples 54 Fig. 4-6 (a-f) Edge Detection examples 55-57 Fig. 4-7 (a-d) Smoothing examples 58-60 Fig. 4-8 Wiener filter followed by 2-D Convolution using an 61 averaging filter Fig. 4-9 Thresholded image, showing the defective region clearly 63 Fig. 4-10 Final image after 3-step morphological operation 64 Fig. 4-11 Block Diagram of the Process 67 Fig. 4-12 (a-e) Examples of Image Subtraction 68-69 Fig. 4-13 User Interface of the System 71 Fig. 4-14 Flow chart of the software program 73 4 vii LIST OF TABLES Table 2-1 4-Point System 7 Table 2-2 4-Point System (KTA) for Tricot Fabrics 8 Table 2-3 Determination of First Quality of Knitted Fabrics 8 Table 2-4 10-Point System 9 Table 2-5 6-Point System 10 Table 2-6 Comparison of points allocated under different inspection systems 13 Table 3-1 Common Gradient Operators 33 Table 4-1 Grouping of observed Fabric defects 45 Table 4-2 Defect Classification 47 Table 4-3 List of defects in each category grouped according to the new classification 47 Table 4-4 Coding of Fabric defects 49 • V 4 viii LIST OF ABBREVIATIONS & ACRONYMS AFIS Automatic Fabric Inspection System ASQC American Society for Quality Control ASTM American Society for Testing Materials BS British Standards DOG Difference of Gaussian filter EVS Elbit Vision Systems FDAS Fabric Defect Analysis System FFT Fast Fourier Transform FWA Fuzzy Wavelet Analysis ITMA International Textile Machinery Association KTA Knitted Textile Association LOG Laplacian of Gaussian filter UNI DO United Nations Industrial Development Organization WIRA Wool Industry Research Association