1. Field of the Invention
This invention relates to an image inspection device, image inspection method, and image inspection program to perform inspections of image elements.
2. Description of the Related Art
In recent years, CCDs (Charge Coupled Devices), CMOS (Complementary Metal Oxide Semiconductor) devices and other image-capture elements have come to be used in imaging equipment such as digital cameras, digital camcorders, and scanners, use of which is expanding due to their implementation to portable telephones and to declining costs and improved image quality. In quality inspections of imaging equipment equipped with such image-capture elements, the quality (pass or fail) of the image-capture element is judged based on a captured image of a test pattern.
One cause of “fail” results is a defect called a “blemish” (also called a brightness unevenness), in which an area appears such that the difference with the density of the surrounding area is equal to or greater than a prescribed value In manual operation to detect blemishes, a human inspector can inspect captured images visually; but there is variation in the precision of the detection according to the skill of the inspector and his physical condition, the speed of processing differs, and in some cases the problem arises that erroneous judgments are made, with failed items being judged to pass, and passing items failing. Moreover, a substantial amount of time and expense are required to train a skilled inspector. Hence methods have been proposed in the technology of the prior art to automatically inspect for such blemishes.
In general, a captured image may have shading characteristics in which for example the gradation values are bright in the center portion and are darker moving toward the periphery, due to the lens characteristic, illumination characteristic or other factors. When inspecting an image with a pronounced shading characteristic, which in the above example would be an image with a large gradation difference in the center portion and in the peripheral portion, any “faint blemishes” at a level lower than the gradation difference due to shading are hidden by the shading characteristic, so that detection is difficult.
In the prior art, if the shading characteristic in a previously captured image is known, a method has been adopted in which the shading is corrected, smoothing is performed to uniformly correct the image level, and automatic detection of “blemishes” is then performed. For example, Japanese Patent Laid-open No. H9-329527 proposes a method in which, after smoothing, pixel values in differential image data are used to determine the centers of dark defect areas and bright defect areas as well as the positions of the vertices of quadrangles circumscribing these areas, and the positional relationships are used to detect ring-shaped bright defects and ring-shaped dark blemishes.
As peripheral technology, Japanese-Patent Laid-open No. 2003-130756 describes an optical member inspection method in an image inspection apparatus for inspection of the quality of lenses and other optical members, in which filtering using a Fourier transform is performed and gradation patterns appearing periodically in a captured image are removed. And, Japanese Patent Laid-open No. 2003-169255 describes the computation of correction approximation lines for each axis, based on sampling point data on the horizontal and vertical axes passing through the center point of a captured image. It also tells calculation of shading correction coefficients at arbitrary coordinates in the captured image as a product of correction coefficients for correction approximation lines on the horizontal axis and that for correction approximation lines on the vertical axis. Japanese Patent Laid-open No. H7-154675 describes a capture apparatus which changes the size of the block in which data is detected in each area on a screen, and can improve the correction accuracy of shading correction and other processing.
However, in the above-described technology of the prior art, shading characteristics prepared in advance can be used to correct an image and enable automatic detection of “blemishes” when the shading characteristic in a captured image is known; but in actuality, due to lens mounting errors and other scattering occurring at the time of equipment manufacture, shading characteristics cannot be determined for uniform application to all imaging equipment for inspection. Consequently when the shading characteristics prepared in advance differ from the shading characteristics of imaging equipment for inspection, acculate correction cannot be performed, and so there are the problems that the accuracy of defect detection is reduced and erroneous judgments occur.
Hence an object of this invention is to provide an image inspection device, image inspection method, and image inspection program capable of automatically detecting “blemishes” in accordance with shading characteristics which differ among imaging equipment for inspection.
As a first aspect of this invention, the above object is achieved by providing a defect detection method, executed by an image inspection device which is connected to imaging equipment having an optical member and an imaging element to convert light received by said optical member into electrical signals, into which is input data of images captured by said imaging equipment, and which detects defects of said imaging equipment based on the image data. The method includes: dividing a digital image, formed from M rows and N columns (where M and N are natural numbers) of pixels, into a plurality of band-shaped areas by partitioning at each of a prescribed number of rows; averaging, for each column, the gradation values of pixels in said band-shaped areas for each of said plurality of band-shaped areas; computing an approximation line which approximates, in each of said plurality of band-shaped areas, a distribution of said average of gradation values; and judging whether there exists a succession of d columns (where d is a natural number satisfying 1<d<N) at which the difference between said gradation value derived from said approximation line and said average of gradation values for each column exceeds a prescribed threshold.
As a second aspect of this invention, the above object is achieved by providing a defect detection method, executed by an image inspection device which is connected to imaging equipment having an optical member and an imaging element to convert light received by said optical member into electrical signals, into which is input data of images captured by said imaging equipment, and which detects defects of said imaging equipment based on the image data. The method includes: dividing a digital image, formed from M rows and N columns (where M and N are natural numbers) of pixels, into a plurality of band-shaped areas by partitioning at each of a prescribed number of rows; averaging, for each column, the gradation values of pixels in said band-shaped areas for each of said plurality of band-shaped areas; computing an approximation line which approximates, in each of said plurality of band-shaped areas, a distribution of said average of gradation values; and judging, in a first band-shaped area among said plurality of band-shaped areas, whether there exists a succession of d columns (where d is a natural number satisfying 1<d<N) at which the difference between said gradation value derived from said approximation line and said average of gradation values for each column exceeds a prescribed threshold, and when such a succession exists, identifying as a position of a defect a portion of said succession of columns at which said difference exceeds said prescribed threshold, and judging whether the position of an defect in an adjacent second band-shaped area overlaps the position of said defect in said first band-shaped area.
As a third aspect of this invention, the above object is achieved by providing a defect detection method, executed by an image inspection device which is connected to imaging equipment having an optical member and an imaging element to convert light received by said optical member into electrical signals, into which is input data of images captured by said imaging equipment, and which detects defects of said imaging equipment based on the image data. The method includes: dividing a digital image, formed from M rows and N columns (where M and N are natural numbers) of pixels, into a plurality of band-shaped areas by partitioning at each of a prescribed number of rows; averaging, for each column, the gradation values of pixels in said band-shaped areas for each of said plurality of band-shaped areas; computing an approximation line which approximates, in each of said plurality of band-shaped areas, a distribution of said average of gradation values; identifying a section of said columns at which the difference of said average of gradation values for each column subtracted from said gradation values derived from said approximation line is positive; and computing, for each of said identified sections, the area enclosed by the distribution of said average of gradation values and by said approximation line, and judging whether said areas in each of said sections exceeds a prescribed threshold.
As a fourth aspect of this invention, the above object is achieved by providing a program executed by a computer which is connected to imaging equipment having an optical member and an imaging element to convert light received by said optical member into electrical signals, into which is input data of images captured by said imaging equipment, and which detects defects of said imaging equipment based on the image data. The program causes the computer to execute: dividing a digital image, formed from M rows and N columns (where M and N are natural numbers) of pixels, into a plurality of band-shaped areas by partitioning at each of a prescribed number of rows; averaging, for each column, the gradation values of pixels in said band-shaped areas for each of said plurality of band-shaped areas; computing an approximation line which approximates, in each of said plurality of band-shaped areas, a distribution of said average of gradation values; and judging whether there exists a succession of d columns (where d is a natural number satisfying 1<d<N) at which the difference between said gradation value derived from said approximation line and said average of gradation values for each column exceeds a prescribed threshold.
As a fifth aspect of this invention, the above object is achieved by providing an image inspection device which is connected to imaging equipment having an optical member and an imaging element to convert light received by said optical member into electrical signals, into which is input data of images captured by said imaging equipment, and which detects defects of said imaging equipment based on the image data, including: a division portion which divides a digital image, formed from M rows and N columns (where M and N are natural numbers) of pixels, into a plurality of band-shaped areas by partitioning at each of a prescribed number of rows; an averaging portion which averages, for each column, the gradation values of pixels in said band-shaped areas for each of said plurality of band-shaped areas; an approximation portion which computes an approximation line which approximates, in each of said plurality of band-shaped areas, a distribution of said average of gradation values; and a judgment portion which judges whether there exists a succession of d columns (where d is a natural number satisfying 1<d<N) at which the difference between said gradation value derived from said approximation line computed by said approximation portion, and said average of gradation values computed by said averaging portion, exceeds a prescribed threshold.
By means of this invention, blemishes can be detected appropriately according to different shading characteristics for each imaging equipment unit in which an imaging element is installed. Hence in inspections there is no need to set shading characteristics identified in advance, and there is no longer a need for strict installation in imaging equipment of a signal capture device which relays signals from the imaging equipment to an image detection device.
Below, embodiments of the invention are explained referring to the drawings. However, the technical scope of the invention is not limited to these embodiments, but extends to the inventions described in the scope of claims, and to inventions equivalent thereto.
The camera unit 2 includes a lens 3 and a CCD, CMOS device or other imaging element 4 onto which an image is focused by the lens 3. The camera unit 2 captures a capture image 1 for inspection irradiated by light from an illumination device 9. The camera unit 2 is connected via the signal line 8 to a signal input device 5, and electrical signals converted from the light received by the imaging element 4 are input to the signal contact portion 6 of the signal input device 5.
The camera unit 2 is connected to the signal input device 5 by a connection terminal of the signal contact portion 6 which enables the camera unit 2 to be attached or detached, and by a connection terminal of the camera unit 2, in a design enabling inspection of a plurality of imaging elements 4 by detaching and exchanging the camera unit 2. Electrical signals input to the signal contact portion 6 are converted in the signal conversion portion 7 into one among various image formats, such as the RAW image format, TIFF (Tag Image File Format), JPEG (Joint Photographic Experts Group), GIF (Graphic Interchange Format), and BMP (Bit MaP), and is then input as image data to the image inspection device 10.
The image inspection device 10 shown in
The image inspection device 10 of this embodiment divides the image data of the captured image into a plurality of band-shaped areas, computes the distribution of gradation values for each band-shaped area, and calculates an approximation line which approximates the distribution of gradation values. Then, based on the difference between the actual gradation values and the approximating values derived from the approximation lines, the presence of blemishes is detected. By this means blemishes can be detected appropriately according to different shading characteristics for each camera unit 2 caused by errors in installation of the lens 3, the quality of the imaging element 4, tolerance during camera unit manufacture, and similar in the camera unit 2.
The control portion 11 includes a CPU (Central Processing Unit), not shown, which executes a program stored in RAM 12 and controls each of the portions in the image inspection device 10. The RAM 12 is storage means in which computation results of processing by the image inspection device 10 and a program are stored temporarily. The storage portion 13 is a hard disk, optical disc, magnetic disk, flash memory, or other non-volatile storage means, and stores various data and an OS (Operating System) or other programs which are to be read into RAM.
The peripheral equipment I/F 15 is an interface for connection of peripheral equipment to the server 1, and may be a USB (Universal Serial Bus) port, a PCI card slot or similar. A broad range of peripheral equipment may be connected, including a printer, TV tuner, SCSI (Small Computer System Interface) equipment, audio equipment, memory card reader/writer, network interface card, wireless LAN card, modem card, keyboard and mouse, and display device. The mode of connection of peripheral equipment to the image inspection device 1 may be wire or wireless.
The input portion 16 is input means to which are input requests from an operator via the keyboard 41, mouse 42, or similar; the display portion 17 is display means such as a CRT (Cathode Ray Tube) or liquid crystal display 43, to provide information to the operator. In this embodiment, the signal input device 5, illumination device 9, input portion 16, and display portion 17 in
The control portion 11 of
For a monochrome image, the number of channels is 1. An ordinary color image has three channels, corresponding to three primary colors, so that the number of channels is 3. However, in the case of images captured in a plurality of wavelength regions, such as those used in the field of remote sensing, the number of channels may be greater than 3.
The gradation value of a pixel in the ith row, jth column, and kth channel is, in
As the number of rows in band-shaped areas, which determines the manner of division, the number of rows set in advance in the storage portion 13 is used. Even if data formats differ, the area division portion 31 acquires data for the number of rows corresponding to the prescribed area.
Returning to
The gradation average computation portion 32 computes the averages of the gradation values for three rows composing each column. For example, if the average gradation value of the jth column in the pth band-shaped area and in the kth channel is represented by Q_k(p,j), then Q_k(1,1) in
The gradation average computation portion 32 performs similar computations for the remaining columns included in the first band-shaped area shown in
In
Returning to
The blemish judgment portion 34 judges whether a blemish is present in the captured image, based on the difference between the average gradation values computed by the gradation value computation portion 32, and the approximating values derived from approximation lines computed by the approximation line computation portion 33, and detects the positions of any blemishes. In this way, the presence of blemishes is judged from image data input to the image inspection device 10, and when blemishes exist, their positions are detected.
Next, operation of the image inspection device, including the method of blemish detection, is explained.
Next, the area division portion 31 divides the captured image input to the image inspection device 10 into a plurality of band-shaped areas (S2). In step S2, as explained in
Then, the gradation average computation portion 32 computes the distribution of gradations for each band-shaped area (S3). As explained in
Further, the approximation line computation portion 33 computes approximation lines which approximate the gradation distribution in band-shaped areas (S4). In step S4, as explained in
Based on the average gradation values computed in step S3 and the approximation lines computed in step S4, the blemish judgment portion 34 judges whether there are blemishes in the captured image, and if blemishes are present, identifies their positions (S5). The blemish detection method in step S5 is described below. When the image inspection device 10 completes judgment of the presence of blemishes for all band-shaped areas (Yes in S6), processing ends; if there exist band-shaped areas for which judgment has not been performed (No in S6), processing returns to step S5, and processing is continued for the remaining band-shaped areas.
In step S1, the division width is set in advance in the storage portion 13; but the division width may be changed based on past data relating to blemishes detected by the image inspection device 10. That is, in step S1 the area division portion 31 can set the division width, which is the size of the band-shaped areas, to the optimum value according to data relating to blemishes detected as a result of past operation. In other words, by estimating the sizes of blemishes taking into account the division width when blemishes have been detected and whether blemishes were serially detected in adjacent band-shaped areas, the area division portion 31 can set the optimum division width.
Next, an example of processing for blemish detection in step S5 of
The blemish judgment portion 34 takes the difference between the approximation value of gradation values determined by input of column numbers to the approximation function which defines approximation lines, and the average of gradation values in the column corresponding to the input column number. The blemish judgment portion 34 then stores column numbers for which the difference exceeds a prescribed threshold. In this way, the blemish judgment portion 34 determines, for each band-shaped area, the group of column numbers for which the above difference exceeds the prescribed threshold.
Then, the blemish judgment portion 34 judges, in one band-shaped area, whether the column numbers in the above column number group are continuous for the prescribed number (for example, d columns), and if the prescribed number of columns are continuous (Yes in S51), judges a blemish to be present, and stores in the storage portion 13 the column corresponding to the column number of the d columns as the blemish position (S52). For example, if the group of column numbers for which the above difference exceeds the prescribed threshold is {1,2,3,5,6,8,9,10,11}, and if d=3, then it is judged that blemishes exist in the section [1,3] and in the section [8,11].
If the above group of column numbers does not include d continuous columns (No in S51), the blemish judgment portion 34 judges that, for the band-shape area, there are no blemishes (S53). When step S53 ends, processing proceeds to step S6, and by performing similar processing for all band-shaped areas, blemish detection can be performed.
In
When the difference between the approximation value determined by input of a certain column number to the approximation function, and the gradation value at that column number, is positive, the approximation line at that column number is positioned above the graph, and when the difference is negative, the positional relationship is reversed. The area enclosed by the approximation line and the gradation distribution then corresponds to the sections of column numbers for which the difference is continuously positive and to the sections of column numbers for which the difference is continuously negative, and so in these sections, by taking the sum of the absolute values in the respective sections of the difference obtained by subtracting the gradation value average from the approximation line, the area enclosed by the approximation line and gradation distribution can be determined.
In this way the blemish judgment portion 34 judges whether any of the areas enclosed between the approximation line and the gradation distribution are equal to or exceed the prescribed threshold SS (S55), and judges any sections with column numbers for which the area exceeds the threshold SS to be blemishes (S56). If there are no areas which exceed the prescribed threshold SS, the blemish judgment portion 34 judges the band-shaped area to be free of blemishes (S53). When step S53 is completed, processing proceeds to step S6, and by performing similar processing for all band-shaped areas, blemish detection can be performed.
The cumulative sum of gradation differences computed in step S54, divided by the number of columns included in the corresponding section, may be compared with a newly set threshold SS2 and used in the judgment of step S55. By averaging the gradation differences for each column, when for example the difference with the approximation line is slight, but the graph formed is always below the approximation line, erroneous detection of a blemish can be avoided.
In
For example, when the processing of step S51 is performed for the band-shaped area with area number p (1≦p≦P), the blemish judgment portion 34 obtains the average gradation value and (parameters determining) the approximation function determined in step S4 of
If the section continues for the prescribed length (Yes in S58), the blemish judgment portion 34 stores the columns corresponding to the column numbers of the d columns in the storage portion 13, similarly to when the result of step S51 is Yes. Then, when there exists an overlap section of column numbers extending for d columns in the area of adjacency of the band-shaped area addressed in step S51 and the area adjacent thereto, the blemish judgment portion 34 judges a blemish to be present, and stores (the column numbers composing) this overlap section, as the position of a blemish, in the storage portion 13 (S59).
In the case of No in step S51, and in the case of No in step S58, the blemish judgment portion 34 judges the band-shaped area to be blemish-free (S53). When step S53 ends, processing proceeds to step S6, and by performing similar processing for all band-shaped areas, blemishes can be detected.
Below, the manner in which blemishes are detected is explained using a specific example.
In this embodiment, as shown in
The section 81 exceeding the threshold in
The area computation section 82 is the section over which the difference, obtained by subtracting the average value of gradation values at a column number from the average value computed by input of the column numbers to the approximation function, is continuously positive. In this area computation section 82, if a cumulative sum of the above difference is taken, the area used in step S55 of the detection method explained in
As described above, by means of these embodiments, in contrast with technology of the prior art in which blemish detection is performed after making corrections based on shading characteristics stipulated in advance, appropriate detection of blemishes can be performed according to shading characteristics which differ among camera units. Moreover, by means of these embodiments, shading characteristics identified in advance need not be set in order to perform inspections, nor is there a need to install the camera unit 2 in a signal input device 5 (signal contact portion 6) in order that the shading characteristics set in advance may appear.
| Number | Date | Country | Kind |
|---|---|---|---|
| 2004-284776 | Sep 2004 | JP | national |