METHODSANDAPPARATUS FOR FABRIC INSPECTION
This invention relates to fabric inspection.
Fabric is inspected routinely in the textile industry so that fabric faults do not persist through processing and aking-up into the final textile article. Fabric inspection is however a tedious business and inspectors are prone to variable performance through fatigue and other factors so that a consistent quality cannot be ass reα.
Numerous proposals have been made for using machine vision to automate the inspection of fabric and eliminate the tedium and variable quality. The fact that fabrics produced in the piece are still generally speaking inspected by the human eye is evidently due to the high cost of automated systems, which, in turn, is dictated by the inspection methodology.
The present invention provides methods and apparatus for inspecting plain web fabric for faults which involve methodology which can be implemented on equipment which is economical to instal and maintain.
The invention comprises a method for inspecting plain web fabric for faults comprising moving the fabric
relatively to a line scan camera forming a line pixel image across the width of the fabric so as to form successive line images spaced apart comparably to the pixels of the line image and storing a succession of such line images in a frame store so as to constitute an area image of a rectangular area of the fabric, processing said area image by thresholding to isolate trigger areas from background areas, filtering the thresholded area image to eliminate (as noise) trigger areas of small pixel number leaving only defect triggers, and generating a defect signal if at least one αefect trigger is present in the filtered image.
Said thresholding, filtering and defect signal generating steps may be" performed while the next area image is being built up from a succession of line images. These steps may be always performed within a predetermined time which is less than the time taken to form an area image having a given number of line images. However, the area image may be of variable length, imaging being terminated when the thresholding, filtering and defect signal generating steps for a previous area image are completed. Thus 'no-defect' area images may be processed in a short time while when a defect is encountered the image processing time may be extended by delaying the capturing of the next area image by taking more lines. This next image will take
longer to process, of course, but if, as would normally be expected, it contains no defect, its processing time can still be relatively short.
Instead of capturing a longer area image to accommodate increased defective area processing time, it can be arranged that a mechanism for moving the fabric past the line scan camera can be slowed down. Measures such as these can make the most of expensive data storage and computing power.
To improve processing time generally to speed up the inspection rate, successive area images can be processed in separate processors so that image processing time can be longer than area image formation time.
The area image may be processed by a thresholding method which is adaptive to the fabric (generally speaking to its colour and surface texture) and also to the levelness of illumination of the fabric. In a knitting mill, for example, fabrics will be produced in numerous knitting constructions and it will be desirable not to have to reset the inspection equipment each time a different fabric is encountered. Levelness of illumination is a factor which cannot be guaranteed to remain constant in time even if it can be
achieved in the first place; it is at least difficult over a width of a metre, and it is desirable that ageing of lamps and changing ambient lighting do not affect the equipment.
One method according to the invention of adaptive thresholding is to create an average line image from the area image. Each column of the area image is summed and divided by the number of lines in it to give an average brightness for that column; the line image which is reconstituted from these column averages is the average line. Thresholding is then a matter of setting a bright¬ ness level as the threshold value for any particular pixel of the line image which is at a predetermined brightness level away from the corresponding pixel of the average line. Threshold values may be set above and below the average line to detect hole faults, with back lighting, which show up bright, and yarn contamination, slubs and the like, which show up dark.
The thresholded area image, which will now consist of a uniformly gray background, with light and dark pixels occuring either singly (due mainly to noise) or in clusters (indicative of a fault) is now filtered to remove noise. One method is to associate each pixel with its eight neighbours and reset its brightness level to a new value unless four or more of those neighbours
have the same brightness value. This will effectively remove single and small groups of pixels. The operation (which involves convolving each pixel with the unchanged value of its neighbours) is best carried out by writing new values to a separate frame store. This operation will affect defect areas by removing some edge pixels, of course, but if the system resolution is adequate the method successfully eliminates noise, and hence false alarms, while detecting fabric faults reliably.
A satisfactory resolution for knitted fabric is 0.5 mm per pixel side; a 2000 pixel line scan camera is thus suitable for a 1 metre fabric width.
Images which have been thus processed can be displayed in real time on a VDU. Faults are now much easier to spot since they are contrasted by the thresholding and the background noise has been eliminated. It is a simple matter to trigger an audible alarm whenever a displayed image contains a cluster of bright or dark pixels above a certain size, so that an inspector may use the equipment simply to improve the reliability with which he can spot faults at higher fabric throughput speeds than he can otherwise cope with.
However, a processed area image can also be analysed to locate faults - it is again a relatively
simple matter to locate the centroid of a pixel cluster and post its coordinates together with the frame number to a hard copy record or, by computer graphics, to superimpose a flashing symbol, such as cross wires, on to the screen to highlight the fault.
The processed area image may also be further analysed to identify faults. The area image region containing a fault may be associated with a set of masks representative of typical faults for the fabric until a "match'• is obtained according to predetermined criteria. This further analysis may be quite time consuming but need be performed only when a fault is found, and it can be carried out off line if required. Thus fault data can be reduced for convenient storage and this analysis carried out on the fault data at the end of each 100 metres fabric piece run, for example.
The invention also comprises apparatus for inspecting plain web fabric for faults comprising a line scan camera arranged to form a line pixel image across the width of a relatively moving fabric so as to form successive line images spaced apart comparably to the pixels of the line image, frame store means adapted to store a succession of such line images so as to constitute an area image of a rectangular area of fabric, image processing means adapted to threshold the
area image to isolate trigger areas from background areas and to filter the threshold area image to eliminate (as noise) trigger areas of small pixel number leaving only defect triggers, and defect signal generating means generating a defect signal if at least one defect trigger is present in the filtered image.
Said frame store may be comprised in memory of a computer which is also loaded with software so as to constitute said image processing and defect signal generating means. Said memory may accommodate two frame stores, one being a frame store written to by the line scan camera and the other being written to by said image processing means. The computer may comprise two image processing arrangements operating on alternate area images.
The image processing means may be operative to threshold the image adaptively.
The apparatus may comprise fabric drive means controlled in accordance with the image processing means, so that the fabric speed can be adjusted to the processing rate.
The apparatus may also comprise lighting means, which may comprise back lighting means so that a hole
defect appears bright against the fabric background while a slub fault appears dark.
For tubular fabrics, the lighting means may comprise a floating lamp pod, which may be powered by on-board battery means or by comprising fluorescent tubes powered by an alternating magnetic field.
The apparatus may comprise a monitor displaying the processed area images.
The apparatus may also comprise off-line defect identification means comprising data processing means connected to receive defect data and programmed to associate said defect data with mask data representative of typical defects.
Embodiments of apparatus and methods for inspecting plain web fabric for faults will now be described with reference to the accompanying drawings, in which :-
Figure 1 is a diagrammatic illustration of fabric inspection apparatus;
Figure la is a semi-processed area image,
Figure 2 is a view of an arrangement for a tubular fabric;
Figure 3 is a depiction of a line image produced by a line scan camera;
Figure 4 is a depiction of an area image built up from a plurality of line images;
and Figure 5 is a diagrammatic illustration of an adaptive thresholding method;
The apparatus illustrated in Figure 1 comprises a 2000 + element line scan camera 11 connected to a frame store 12 which is controlled by a computer 13 through suitable software. A display monitor 14 displays the contents of a second framestore 15 into which data representative of a processed image is fed by the computer. The framestores 12,15 are in fact memory areas of said computer 13. The computer 13 has a VDU 16 and keyboard input 17 and a printer 18 for hard copy output.
Fabric 19 is run from a roll 21 on a stand 22 to a take-up roll 23 driven by a motor 24 which can be controlled by the computer 13 as indicated by the broken line or which can simply run so as to feed the fabric at constant speed - a roller supporting and driving
arrangement is depicted which for constant motor speed gives a constant web speed.
The fabric 19 is illuminated by any convenient method - here in Figure 1 a battery of lamps 25 is illustrated on the same side of the fabric as the camera, though back-lighting can, of course, be used. For tubular fabric, as shown in Figure 2, a floating lamp pod 26 is contained within the moving fabric tube 19 supported on rollers 29 and comprises a circular fluorescent lamp 27 powered by a battery and inverter arrangement 28 - this gives backlighting, naturally. The lamp 27 could alternatively be powered by a powerful externally applied alternating magnetic field provided adequate shielding for the line scan camera can be arranged.
Figure 3 is a typical line scan image, though showing only twenty pixels whereas a typical line scan camera output can be 2048 pixels long. For the arrangement of Figure 2, the camera 11 can be arranged to "see" all around the fabric by carefully arranging mirrors 30.
Figure 4 is a typical area scan built up from the successive line scans as illustrated in Figure 3. The arrows indicate that the area scan can be longer.
The camera 11 is so arranged in relation to the fabric 19 that the desired image resolution is obtained along the scan line. In the situation of Figure 1 there is obviously some slight distortion because of the fact that the edges of the fabric 19 are further away than the middle of the fabric from the centrally placed camera, and there will be even more distortion in the arrangement of Figure 2. It is of course possible to use a correcting optical system, but such distortions could easily be corrected in software, it being necessary to ensure only that the worst-case resolution, i.e. ' the resolution at the edges of the image, is adequate to resolve the smallest fault required to be detected.
The image of Figure 3 has pixels representing image areas spaced 0.5 mm apart, which is an adequate resolution for most knitted fabrics. The speed of the fabric 19 is selected in relation to the scanning rate of the camera 11 so that the spacing between consecutive line images is also 0.5 mm so that the area image shown is Figure 4 is "square" in the sense that the vertical scale is not squashed nor expanded in relation to the horizontal scale. The actual image need not, of course, be square, in the sense that if it is 2048 pixels wide it need be 2048 pixels long. There is in general no need to have the area image any longer than the length
of the largest hole defect expected to be found in the fabric - lengthwise runs, ladders and other vertical faults excepted, of course, which can persist over quite long intervals.
Unless the camera 11 can be adjusted so that it images the entire width of the fabric, no more and no less, and it can be guaranteed that the edges do not wobble, it will be necessary to deal with the image areas beyond the fabric edges. Perhaps the simplest way to deal with this is to begin reading into the framestore 12 when the first fabric image pixel is detected for each line scan - this will be indicated by a marked change in brightness. Then assuming that the fabric width remains constant, the image width will correspond to the fabric width despite any variations in tracking of the fabric.
Fabric width can also be measured by detecting the change in intensity at the end of the scan, of course. Width measurements can be analysed to monitor departures from nominal width. Fabric inspection is sometimes associated with stentering, and automated inspection according to the present invention is particularly suitable for combination with stentering, the fabric width measurement being useful in the control of the stenter to ensure that the finished width is
within a desired specification, any width error being input to a feedback loop controlling the stenter width.
In Figure 1 the box depicting the ' memory 12 written to by the camera 11, is a simplified illustration of a typical area image assembled from line images. It is to be understood here that the image will usually be a virtual rather than a visual image although this image could be displayed on a monitor, in. practice it will not need to be. The image will comprise pixels each having one of an allowed range of brightness values. Two faults, a hole defect 101 and a slub defect 102 are shown against a generally gray, generally uniform background 103, the hole defect 101 (assuming backlighting, as in Figure 2) showing up as a relatively bright area while the slub defect 102 appearing dark. In addition, single pixels 104 or very small clusters 105 are present due to background noise, whether this arises within the camera and associated electronics or as a result of the texture of the fabric.
It is assumed for present purposes that a defect occupies a reasonable number of adjacent pixels. Faults in knitted fabrics include vertical and horizontal defects as well as area defects. Examples of defects include holes resulting from press offs, slubs and knots as well as drop stitches and dropstitch runs, irregular-
ities of appearance due to thick and thin yarn, barre, tuck needle and rip needle faults. A needle line fault is manifested as a think vertical line, while most of the other faults extend both vertically and horizontally, or, in knitting terminology, walewise and coursewise.
The first processing step performed on the area image is thresholding in which the image is segmented, in this case, into three gray scale levels, of which a middle level represents the general fabric background, a bright level represents holes and a dark level represents slubs. The segmenting is carried out by a thresholding method adaptive to the fabric.
Fabrics can of course be presented to the camera in different colours (including white and black) and will have different surface textures as well as densities. It is desirable that the system is adaptive to different fabric colours and types and whilst completely automatic adaptation covering the whole range of possible colours and types may be difficult, if not impossible, to achieve with apparatus of reasonable capital cost, the present invention provides automatic adaptation over a wide range of colours and fabric types.
Lighting is also a problem dealt with by the invention. It is difficult - again, if not impossible -
to achieve absolutely uniform lighting across a metre width of fabric. Lamps, moreover, are subject to changing intensity with age and with variations in the electric supply, and ambient lighting may change according as the room lights are on or off and with the time of day.
The adaptive thresholding method comprises calculating from the area image an average line image by summing for each column of the area image the brightness levels of the pixels of the column and dividing the sum by the number of lines in the image (i.e. the number of pixels in the column).
It is, of course, to be expected that the average line will deviate from a uniformly bright line, but not by large brightness levels. Figure 5 shows a typical average line AL derived from a white fabric which indicates an increased brightness in the centre of the line.
The next step is to normalize the average line, which is to say bring it to a middle gray scale level without losing the transverse variation. The brightness values are summed across the line and divided by the pixel number of arrive at an average brightness. Assuming there are 256 gray scale levels to work with, and the average line average brightness is 64 (0 = white,
255 = black) so that the mid value can be chosen to be 128 the value 64 is added to each pixel brightness to produce the normalized average line (NAL) which has an average brightness of 128.
Threshold levels are now set above and below the average line by adding and subtracting, respectively, constant values, say 32, to and from the pixel brightness levels - the upper threshold is shown as UT, and the lower threshold as LT.
A typical line signal LS is now converted (by adding 64 to each gray scale level) into a normalised line signal NLS which is then segmented into gray scale levels of 0, 128 and 255 according as the signal is above UT, between UT and LT or below LT. This results in a segmented image as shown in Figure la - this will be the processed image stored in the framestore 12.
The normalized average line NAL can be computed at the beginning of a fabric run and used throughout the run. Or, if long fabric runs are contemplated so that lighting conditions may vary significantly during the run, or if different fabrics, especially of different colours and/or albedos are to be joined together to run through on a continous basis, the computation can be updated periodically or whenever a change of fabric requires.
The constant value added to and subtracted from the normalized average line to set the two thresholds may be chosen on the basis of experience with given systems or by calibration against known fabrics.
The area image is then segmented using the upper and lower thresholds and will then contain small isolated pixel groups or single pixels at gray scale level zero or level 255 which are assumed to be due to noise, either system noise or noise caused by non-defect signals from the fabric, e.g. reflections from individual fibres or pinholes or shadows from stitches, and larger pixel clusters indicative of a defect.
This thresholded area image is filtered by convolving each pixel of the image with its eight neighbours and resetting its brightness level to a new value (which is written into the corresponding address in framestore 15) unless four or more of its neighbours had the same gray scale level, otherwise the present value is written to the corresponding address in framestore 15. The resulting area image is shown inset in the box depicting framestore 15 in Figure 1. All or most of the noise signals have been eliminated, leaving only the defect signals, slightly reduced in size.
This image is displayed on the monitor 14. Each time an area image is processed it replaces the current
display so that the monitor 14 can be used by an inspector to watch out for fabric defects which will show up more clearly than they appear in the fabric because of the increased contrast and the elimination of non-defect fabric generated noise.
The appearance of a fabric effect in the processed image as displayed on the monitor 14 can be detected by assuming that the presence of an arbitarily small number of extreme (0 or 255) gray scale level pixels, say ten pixels, in the area image indicates a fabric defect and arranging that the computer sounds an audible alarm whenever ten or more extreme value pixels are present in the image. Thus the inspector's attention will be drawn to the monitor 16. However, to allow time to peruse the image, it might be retained on the screen for a period of time beyond the normal display time, or it might be written to yet a further framestore (not shown) for recall when the inspector is ready, the monitor 14 proceeding to the next image display in the usual way. Of course, the alarm can also effect other operations if desired, including the slowing down or even stopping of the fabric feed to allow visual inspection of the fabric itself at the defect position, or an automatic marker can be placed on the fabric's edge so that the inspected, marked roll can be re-wound stopping at the markers to further inspect or deal with
indicated defects (as by cutting them out and sewing together or by removing slubs or knots or repairing drop stitches where this is possible).
It has so far been assumed that it is possible within the apparatus to carry out all the necessary computation to produce the processed image in less than the time taken to build up the area image, so that the apparatus can cope with the information. However, at high fabric throughput speeds, processing time, if there is a defect or perhaps more than one defect, may be prolonged, and there are various ways in which this problem can be attacked.
One is to have a variable length area image so that if processing of any particular image is prolonged because of the presence of defect signals, the next area image is allowed to build up until the current processing is finished. If the longer image contains no defects it will not take so long to process so that the following image can revert to a selected minimum length or at least partway theretowards. It is to be expected that defects will not be present on successive images very often unless there is something radically wrong. If even with this measure the system becomes overloaded so that processing is not complete by the time a maximum permitted length area image has been built up, an alarm
can be sounded and the fabric slowed down or even stopped.
In Figure 1 a connection is shown from the computer 13 to the motor 24 to effect this control. Of course, the fabric can be run at variable speed in any event to cope with variable image processing times.
Yet another way of dealing with image processing times that are longer than the time taken to build up an area image is to add a second processor so that two images (or more) can be processed at once. The additional cost of the hardware will be small compared to the gain in efficiency - the expensive fabric supporting and driving arrangement, lighting arrangement, line scan camera and monitor do not need to be duplicated.
The processed area image can be further analysed to locate any faults - some, especially if small to begin with, may be even smaller in the image as a result of filtering - and a flashing cursor or cross-wires can be generated by graphics software and superimposed on the defect centroid, which can be determined by standard methods.
Also from this location analysis, location data can be posted to some useful output, for example a log
for a roll of fabric in which length along the fabric is derived from image frame number (or 21 [frame member x image length] in the case of variable length images) plus y-coordinate. Such information can be printed on a fault tag which may be applied automatically to the fabric edge or output to hard copy to accompany the roll for further processing.
Likewise, the processed area image may be further analyzed to identify fabric faults and this may ae done by convolving an image region containing a defect indication with a set of masks representative of typicaJ faults for the fabric. Having located the fault centroid and possibly an indication as to whether it is a vertical or horizontal fault and an indication of its area by well-understood routines, a selection of trial masks from a library can be made automatically without having to pick through the entire library and, of course, the masks do not have to be used except in connection with already located faults.
This further processing is likely to be time consuming nevertheless and may be relegated to off-line status, fault data being saved in simplified, condensed form. The type of defect can be indicated on the log referred to above alongside the fault coordinates.
The methods and apparatus described herein will detect most faults in knitted fabrics as well as woven fabrics and non-wovens. One fault that may be eliminated by the filtering method described is the needle line fault in a knitted fabric which may be at most one or two pixels wide in the unprocessed image and it may be desirable to incorporate a detection routine aimed specifically at this defect.
If the average line routine is repeated for each frame, of course, indication of a needle line fault will appear as a sharp peak which may be detected by a differentiation technique. Such a peak will in any event need to be removed by the software if it is present in the average line.