Program, and data processing apparatus

The program effectively detects defects in objects with diverse shapes by calculating color component values and using band frames, improving defect detection accuracy in data processing systems.

JP2025141463APending Publication Date: 2025-09-29BROTHER KOGYO KK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
JP2024041406
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-03-15
Publication Date
2025-09-29

AI Technical Summary

Technical Problem

Existing techniques for determining defects in images of various objects, such as printed patches and fabrics, are inadequate due to the varied shapes and complexities of these objects, making it difficult to accurately detect defects regardless of shape.

Method used

A program that calculates representative values of color components in band regions of an inspection area, determines the presence of defects by analyzing differences or ratios between these values, and uses band frames to identify defects extending in a specific direction, applicable in data processing methods and devices.

Benefits of technology

Enables accurate detection of defects in objects with varying shapes by focusing on color component analysis and band frame analysis, enhancing defect detection precision and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025141463000001_ABST
    Figure 2025141463000001_ABST
Patent Text Reader

Abstract

To determine whether or not there is any problem.SOLUTION: There is calculated a first value which is a representative value of values related to a specific color component in each of a plurality of band areas included in an inspection region in a target image. The target image represents an object optically read. The inspection area represents at least a part of the object. Each of the plurality of band areas is a long area in a first direction. The plurality of first values of the plurality of band areas are used to calculate a second value which is a representative value of values related to the specific color components in the entire of the plurality of band areas. The plurality of first values in the plurality of band areas are used to calculate a third value related to a maximum value or a minimum value of values related to the specific color component in the entire of the plurality of band areas. Difference or ratio between the second value and the third value is used to determine whether or not there is any defect extending in the first direction in the inspection area.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present specification relates to a technique for determining the presence or absence of a defect using an image. [Background technology]

[0002] Techniques have been proposed for determining the presence or absence of defects using images. For example, Patent Document 1 discloses a technique for obtaining a value indicating the degree of banding noise using an image generated by scanning multiple printed patches. In this technique, multiple divided regions are obtained by cutting the patch in a direction approximately perpendicular to the direction in which banding noise occurs when the patch is printed. Then, a value indicating the degree of banding noise is obtained from the Fourier transform value of each divided region. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] Patent No. 4543796 Summary of the Invention [Problem to be solved by the invention]

[0004] The presence or absence of defects can be determined using images of various objects, such as not only printed patches but also various printed images and various products (e.g., fabrics). Unlike patches, objects can have various shapes. There is room for improvement in determining the presence or absence of defects using images of such objects.

[0005] This specification discloses a technique for determining whether or not a defect exists. [Means for solving the problem]

[0006] The techniques disclosed in this specification can be implemented in the following application examples.

[0007] [Application Example 1] A program that causes a computer to realize the following functions: a function of calculating a first value that is a representative value of values ​​related to a specific color component in each of multiple band regions included in an inspection area in a target image, wherein the target image represents an optically read object, the inspection area represents at least a portion of the object, and each of the multiple band regions is a region that is long in a first direction; a function of calculating a second value that is a representative value of the values ​​related to the specific color component in all of the multiple band regions using multiple first values ​​of the multiple band regions; a function of calculating a third value that is related to the maximum or minimum value of the values ​​related to the specific color component in all of the multiple band regions using the multiple first values ​​of the multiple band regions; and a function of determining the presence or absence of a defect extending in the first direction within the inspection area using the difference or ratio between the second value and the third value.

[0008] According to this configuration, the presence or absence of defects extending in the first direction within the inspection area is determined using multiple band areas (each of which is long in the first direction) included in the inspection area representing at least a portion of the object, so that the presence or absence of defects can be determined regardless of the shape of the object.

[0009] The technology disclosed in this specification can be realized in various forms, such as a data processing method and a data processing device, a computer program for realizing the functions of the method or device, a recording medium (e.g., a non-temporary recording medium) on which the computer program is recorded, and the like. [Brief explanation of the drawings]

[0010] [Figure 1] FIG. 1 is an explanatory diagram illustrating a data processing device according to an embodiment; [Figure 2] 1 is a perspective view showing an example of a reading device 100. FIG. [Figure 3] 1A is a diagram showing an example of an image represented by image data for printing, and FIG. 1B is a diagram showing an example of a scanned image. [Figure 4] 10 is a flowchart illustrating an example of an inspection process. [Figure 5] 10 is a flowchart illustrating an example of a process for visual inspection. [Figure 6] 10 is a flowchart illustrating an example of a process for determining an inspection area. [Figure 7] 10A-10F are diagrams showing examples of images processed in visual inspection. [Figure 8] 10 is a flowchart illustrating an example of a differential image generation process. [Figure 9] 10A to 10D are diagrams showing examples of images processed in the differential image generation process. [Figure 10] 10 is a flowchart illustrating an example of a defect detection process. [Figure 11] 10A to 10D are diagrams showing examples of difference images that are referenced in defect detection processing. [Figure 12] 10A and 10B are diagrams showing examples of a differential image IMd, an inspection area LAp, a band frame BF, and a band area BA. [Figure 13] 10 is a flowchart illustrating another embodiment of the process for generating a difference image. [Figure 14] 10 is a flowchart illustrating another embodiment of the process for generating a difference image. [Figure 15] 10 is a flowchart illustrating another embodiment of the defect detection process. [Figure 16] 10 is a flowchart illustrating another embodiment of a process for visual inspection. [Figure 17] 10 is a flowchart illustrating an example of a defect detection process. DETAILED DESCRIPTION OF THE INVENTION

[0011] A. First Example: A1.Device configuration: FIG. 1 is an explanatory diagram showing a data processing device according to one embodiment. The data processing device 200 is, for example, a personal computer. The data processing device 200 performs inspection processing of a printed image. The data processing device 200 includes a processor 210, a storage device 215, a display unit 240, an operation unit 250, and a communication interface 270. These elements are connected to each other via a bus. The storage device 215 includes a volatile storage device 220 and a non-volatile storage device 230.

[0012] The processor 210 is a device configured to perform data processing, such as a central processing unit (CPU) or a system on a chip (SoC). The volatile storage device 220 is, for example, a dynamic random access memory (DRAM), and the non-volatile storage device 230 is, for example, a flash memory. The non-volatile storage device 230 stores data of a program 231.

[0013] The display unit 240 is a device configured to display images, such as a liquid crystal display or an organic EL display. The operation unit 250 is a device configured to receive operations by a user, such as a button, a lever, or a touch panel overlaid on the display unit 240. The display unit 240 and the operation unit 250 may form a so-called touch screen. The user can input various requests and instructions to the data processing device 200 by operating the operation unit 250.

[0014] The communication interface 270 is an interface for communicating with other devices (for example, it includes one or more of a USB interface, a wired LAN interface, an IEEE802.11 wireless interface, and an industrial camera interface (for example, CameraLink, CoaXPress, etc.)). In this embodiment, the communication interface 270 connects the reading device 100 and the printing device 900. The printing device 900 is a so-called inkjet printing device that prints an image on a printing medium such as cloth or paper by ejecting ink onto the printing medium. The reading device 100 optically reads the object to be read and generates read image data representing the object. Hereinafter, it is assumed that the printing medium is a T-shirt, and that the reading device 100 reads the T-shirt containing the printed image.

[0015] 1 shows an example of a printing device 900. In this embodiment, the printing device 900 includes a support unit 940, a transport unit 920, a print head 980, a moving unit 970, and a control unit 910. The support unit 940 is a plate-like member that forms a flat upper surface for supporting the print medium (such a member is also called a platen). In the figure, a T-shirt 700, which is an example of the print medium, is placed on the support unit 940.

[0016] The transport device 920 is configured to transport the support portion 940 (and thus the print medium) in a direction parallel to the transport direction Dt. For example, the transport device 920 includes a rail that supports the support portion 940 so that the support portion 940 is slidable in a direction parallel to the transport direction Dt, and a plurality of pulleys, belts, and an electric motor (not shown) for moving the support portion 940 along the rail.

[0017] The print head 980 has multiple nozzles Nz for ejecting ink toward the print medium. In this embodiment, the print head 980 is provided with multiple nozzles Nz for each of the cyan, magenta, yellow, black, and white inks. The movement device 970 is configured to move the print head 980 in a direction parallel to the scanning direction Ds. For example, the movement device 970 includes a rail that supports the print head 980 so that it can slide in a direction parallel to the scanning direction Ds, and multiple pulleys, belts, and an electric motor (not shown) for moving the print head 980 along the rail. In this embodiment, the scanning direction Ds is perpendicular to the transport direction Dt. The print head 980 ejects ink from the nozzles Nz while moving in a direction parallel to the scanning direction Ds, thereby forming ink dots on a portion of a partial printing area AP of the print medium. The partial printing area AP is a band-shaped area extending in the scanning direction Ds.

[0018] The control device 910 controls the transport device 920, the movement device 970, and the print head 980 in accordance with print job data from an external device (e.g., data processing device 200). The control device 910 is configured, for example, using a computer or dedicated hardware (such as an Application Specific Integrated Circuit (ASIC)). The control device 910 executes, multiple times, each of a transport process that moves the support unit 940 (and thus the print medium) in a direction parallel to the transport direction Dt, and a partial printing process that forms ink dots on a portion of the print medium within a partial print area AP. In this way, the control device 910 prints an image in a predetermined target area AT on the print medium.

[0019] The target area AT includes multiple partial areas APp aligned in the transport direction Dt. Each partial area APp is an area in which ink dots can be formed by a single partial printing process. The control device 910 forms ink dots in each partial area APp by multiple partial printing processes. The multiple partial areas APp may be arranged so that they do not overlap each other. Alternatively, each partial area APp may be arranged so that it partially overlaps with an adjacent partial area APp.

[0020] 2 is a perspective view showing an example of the reading device 100. In the figure, the first direction Da and the second direction Db indicate horizontal directions, and the third direction Dc indicates a vertically upward direction. The first direction Da and the second direction Db are perpendicular to each other.

[0021] The reading device 100 includes a housing 190, a table 130, a support 140 fixed to the upper surface of the table 130, a conveying device 120, a reading sensor 180, and a control device 110. The control device 110, the conveying device 120, and the reading sensor 180 are fixed to the housing 190.

[0022] The support unit 140 is a plate-like member that forms a flat upper surface for supporting an object to be read (such a member is also called a platen). In the figure, a T-shirt 700 having a printed image IMpp thereon is placed on the support unit 140.

[0023] The transport device 120 is configured to transport the table 130 in a direction parallel to the second direction Db. Although not shown, the transport device 120 includes rails that support the table 130 so that the table 130 is slidable in a direction parallel to the second direction Db, and a plurality of pulleys, belts, and an electric motor for moving the table 130 along the rails. The transport device 120 further includes a position sensor 122 (e.g., a rotary encoder) that detects the position of the table 130 on the transport path.

[0024] The reading sensor 180 is disposed at a position higher than the support unit 140 and midway along the transport path PTh of the support unit 140. The reading sensor 180 includes a line sensor (for example, a contact image sensor (CIS) or a charge coupled device (CCD)) that is composed of a plurality of photoelectric conversion elements arranged in a direction intersecting the transport direction Db (in this embodiment, a direction Da perpendicular to the transport direction Db). The reading sensor 180 faces downward. The reading sensor 180 can read a portion of the object supported by the support unit 140 that is located below the reading sensor 180.

[0025] When reading the T-shirt 700, the reading device 100 transports the table 130 in a direction parallel to the second direction Db. The reading sensor 180 repeatedly reads the T-shirt 700 during transportation. This allows the reading sensor 180 to read almost the entire portion of the T-shirt 700 that is supported by the support portion 140.

[0026] The control device 110 is an electric circuit configured to control the transport device 120 and the reading sensor 180. The control device 110 is configured using, for example, a computer or dedicated hardware (such as an Application Specific Integrated Circuit (ASIC)). The control device 110 generates data of the read image by controlling the transport device 120 and the reading sensor 180.

[0027] A2.Printing process: In this embodiment, an image is printed on a T-shirt 700 (FIG. 2). The printing of the image is performed, for example, as part of a T-shirt sales service. The T-shirt sales service may include on-demand printing. A customer places an order for on-demand printing with a service provider. In response to the customer's order, the service provider prints the image on the T-shirt 700 using image data provided by the customer.

[0028] FIG. 3A is a diagram showing an example of an image represented by image data for printing (referred to as a print image IMp). In this embodiment, the data of the print image IMp is bitmap data representing the color values ​​(here, the gradation values ​​(e.g., values ​​greater than or equal to zero and less than or equal to 255) of red R, green G, and blue B) of a plurality of pixels arranged in a matrix along a first direction Dx and a second direction Dy. In the example of FIG. 3A, the print image IMp represents a background BG and an object OB. The object OB represents a simplified image of a motorcycle helmet viewed from the side. The object OB includes a first area PA1 representing the outer shell, a second area PA2 representing the face protection, and a third area PA3 representing the face shield. These areas PA1, PA2, and PA3 are assumed to be monochromatic areas having mutually different colors. A character string is drawn on the second area PA2 in a color different from the color of the second area PA2. In this embodiment, the background BG represents an area indicating that no coloring material (here, ink) is used.

[0029] Although not shown in the figures, the printing image IMp is printed using the data processing device 200 and the printing device 900 (FIG. 1). Note that instead of the data processing device 200, another data processing device (not shown) may print the printing image IMp using the printing device 900.

[0030] Various defects can occur during printing of the print image IMp. For example, an error in the transport amount of the T-shirt 700 (FIG. 1) can cause two adjacent partial areas APp to unintentionally overlap. The unintentional overlap can result in a dark streak extending in the scanning direction Ds on the printed image. Furthermore, an error in the transport amount can cause a gap between two adjacent partial areas APp. This gap can result in a light streak extending in the scanning direction Ds on the printed image. Furthermore, if a nozzle Nz is defective, improper ink dot formation caused by the defective nozzle Nz can result in a streak extending in the scanning direction Ds (the streak can be dark or light in color). This streak is also called banding. This streak can be formed at regular intervals in the second direction Dy. The data processing device 200 detects defects, including banding, in the printed image through an inspection process described below. In this embodiment, the data of the print image IMp is used in the inspection process. After printing the print image IMp, the data of the print image IMp is stored in the storage device 215 (for example, the non-volatile storage device 230) of the data processing device 200 for inspection processing.

[0031] A3. Inspection process: FIG. 4 is a flowchart illustrating an example of an inspection process. For inspection, the T-shirt 700 is placed on the support unit 140 of the reading device 100 (FIG. 2) so that the printed image IMpp is visible. In this embodiment, an operator places the T-shirt 700 on the support unit 140. Alternatively, a machine (e.g., a robot arm) may place the T-shirt 700 on the support unit 140. After the T-shirt 700 is placed, an instruction to start the inspection process is input to the data processing device 200 (FIG. 1). In this embodiment, the operator inputs the instruction to start the inspection by operating the operation unit 250. The processor 210 starts the inspection process in response to the start instruction. Note that the start instruction may be input to the data processing device 200 via the communication interface 270 by a device other than the data processing device 200.

[0032] The processor 210 of the data processing device 200 executes the inspection process in accordance with the program 231. In S110, the T-shirt 700 is photographed. The processor 210 supplies a reading instruction to the reading device 100. The control device 110 of the reading device 100 reads the T-shirt 700 by controlling the reading sensor 180 and the conveying device 120 in accordance with the reading instruction. The control device 110 generates read image data representing the read T-shirt 700. The processor 210 of the data processing device 200 acquires the read image data from the control device 110 of the reading device 100, and stores the acquired read image data in the storage device 215 (e.g., the non-volatile storage device 230).

[0033] FIG. 3B is a diagram showing an example of a scanned image. In this embodiment, the data of the scanned image IMs is bitmap data representing the color values ​​(here, the gradation values ​​(e.g., values ​​greater than or equal to zero and less than or equal to 255) of red R, green G, and blue B) of a plurality of pixels arranged in a matrix along the first direction Dx and the second direction Dy. The scanned image IMs in the figure represents a portion of the T-shirt 700 that includes the printed image IMpp. Here, the printed image IMpp is assumed to be an image obtained by printing the print image IMp (FIG. 3A). The printed image IMpp represents a background BGp and an object OBp that respectively correspond to the background BG and object OB of the print image IMp. The object OBp includes areas PA1p-pA3p that respectively correspond to the areas PA1-PA3 of the object OB of the print image IMp. The first direction Dx of the scanned image IMs corresponds to the scanning direction Ds of the printing device 900 (FIG. 1). The orientation of the object OB in the print image IMp may differ from the orientation of the object OBp in the scanned image IMs.

[0034] In S120 (FIG. 4), the processor 210 aligns the reference image and the scanned image. In this embodiment, a printing image IMp (FIG. 3A) is used as the reference image (hereinafter, the printing image IMp will also be referred to as the reference image IMt). The processor 210 determines a correspondence between coordinates on the reference image IMt and coordinates on the scanned image IMs through the alignment. The correspondence may be expressed, for example, by a matrix indicating an affine transformation or a homography transformation. Any method may be used to determine the correspondence. For example, the processor 210 may determine the correspondence of coordinates by template matching using the reference image IMt and the scanned image IMs. Alternatively, the processor 210 may detect feature points from each of the reference image IMt and the scanned image IMs. Then, the processor 210 may determine the correspondence of coordinates by matching the detected feature points.

[0035] Various methods may be used to detect feature points. For example, the processor 210 may detect feature points according to an algorithm preselected from SIFT, SURF, ORB, KAZE, and A-KAZE. Various methods may be used to determine correspondence relationships through feature point matching. For example, the processor 210 may determine a matrix indicating correspondence relationships according to a method called RANdom SAmple Consensus (RANSAC). To determine the matrix, for example, a function from OpenCV (Open Source Computer Vision Library) may be used.

[0036] In S130, the processor 210 inspects the appearance of the printed image. FIG. 5 is a flowchart showing an example of the appearance inspection process. In S210, the processor 210 determines an inspection area, which is an area for inspection within the scanned image IMs. In this embodiment, the processor 210 detects defects such as the banding described above. Detecting defects in areas with little color variation is easier than detecting defects in areas with great color variation. For example, detecting defects is easy in a single-color area. Detecting defects is not easy in an area showing dense, colorful tree leaves. The processor 210 determines the area with little color variation as the inspection area.

[0037] 6 is a flowchart illustrating an example of a process for determining an inspection region. The processor 210 executes a loop process (including steps S310 to S350) between a start L3s and an end L3e for each of a plurality of blocks on the reference image IMt.

[0038] 7(A) to 7(F) are diagrams showing examples of images processed in visual inspection. FIG. 7(A) shows an example of multiple blocks BL on a reference image IMt. A block BL is an area of ​​a predetermined size (for example, 64 pixels x 64 pixels). The multiple blocks BL are evenly arranged throughout the reference image IMt. In this embodiment, the multiple blocks BL are arranged in a grid pattern along the first direction Dx and the second direction Dy. Two blocks BL adjacent to each other in the first direction Dx overlap each other by half. Two blocks BL adjacent to each other in the second direction Dy overlap each other by half.

[0039] In S310 (FIG. 6), the processor 210 selects an unprocessed block BL from a plurality of blocks BL on the reference image IMt as a block of interest.

[0040] In S320, the processor 210 calculates the standard deviation sd(c) for each color component of the object pixels in the target block BL (c indicates a color component. In this embodiment, c is selected from R, G, and B). An object pixel is a pixel that indicates the use of a colorant (ink in this embodiment). In this embodiment, the processor 210 generates a mask image from the reference image IMt and uses the mask image to determine whether each pixel is an object pixel. Figure 7(B) shows an example of a mask image. The mask image IMtm shows a non-mask portion IK1 that indicates the use of a colorant and a mask portion IK2 that indicates the use of no colorant. The processor 210 refers to the reference image IMt (Fig. 1(A)) and classifies pixels included in the background BG into a masked portion IK2, and classifies pixels not included in the background BG into a non-masked portion IK1. The processor 210 refers to the mask image IMtm and determines whether or not pixels included in the target block BL are object pixels. The processor 210 calculates the standard deviation sd(c) of the gradation values ​​of each of red R, green G, and blue B of the object pixels included in the target block BL. In this way, pixels that do not use colorants are excluded from the calculation of the standard deviation sd(c).

[0041] 7(C) and 7(D) show examples of the standard deviation sd. FIG. 7(C) shows the boundary portion between the first region PA1 and the background BG in the reference image IMt. The figure shows the first block BLa and the second block BLb. The entire first block BLa is included in the first region PA1. In this embodiment, the first region PA1 is a monochromatic region. Therefore, the standard deviation sd(c) of each color component R, G, and B in the first region PA1 is small (for example, the standard deviation sd(c) is smaller than the threshold value sdTh1(c) described below). The second block BLb is located on the boundary line B01 between the first region PA1 and the background BG. The second block BLb includes multiple pixels representing the first region PA1 and multiple pixels representing the background BG. As described above, the pixels representing the background BG are excluded from the calculation of the standard deviation sd(c). The processor 210 calculates the standard deviation sd(c) of the second block BLb using the pixels representing the first area PA1. Therefore, the standard deviation sd(c) of each color component R, G, B is small (for example, the standard deviation sd(c) is smaller than a threshold sdTh1(c) described below).

[0042] FIG. 7(D) shows the boundary portion between the first region PA1 and the second region PA2 in the reference image IMt. The figure also shows a third block BLc. The third block BLc is located on the boundary line B12 between the first region PA1 and the second region PA2. The third block BLc includes a plurality of pixels representing the first region PA1 and a plurality of pixels representing the second region PA2. The processor 210 calculates the standard deviation sd(c) using the pixels of both the first region PA1 and the second region PA2. As described above, the first region PA1 and the second region PA2 represent different colors. Therefore, the standard deviation sd(c) of at least one color component of R, G, or B is large (for example, the standard deviation sd(c) is larger than the threshold value sdTh1(c) described below).

[0043] In S330 (FIG. 6), the processor 210 determines whether the standard deviation sd(c) is less than the threshold sdTh1(c). The threshold sdTh1(c) is predetermined for each color component. If the standard deviations sd(c) of all color components are less than the corresponding threshold sdTh1(c), the determination result in S330 is Yes. In this case, in S340, the processor 210 sets the determination flags of the object pixels in the target block to "uniform." As will be described later, an area where multiple consecutive pixels have the determination flag set to "uniform" is used as the inspection area. After S340, the processor 210 proceeds to S310 and processes the next target block. If the standard deviations sd(c) of one or more color components are greater than or equal to the corresponding threshold sdTh1(c), the determination result in S330 is No. In this case, in S350, the processor 210 sets the determination flags of the object pixels in the target block to "non-uniform." After S350, the processor 210 proceeds to S310 and executes processing of the next target block.

[0044] The threshold value sdTh1(c) for each color component may be determined by various methods. For example, the standard deviation sd(c) may be experimentally determined in advance so that the standard deviation sd(c) of blocks BL included in areas where defect detection is easy is less than the threshold value sdTh1(c) and the standard deviation sd(c) of blocks BL included in areas where defect detection is difficult is equal to or greater than the threshold value sdTh1(c).

[0045] In S340 and S350, the processor 210 sets the determination flag of pixels in the target block that are different from the object pixels (that is, pixels in the mask portion IK2) to "non-uniform."

[0046] When processing of all blocks is completed, in S360, processor 210 performs contraction processing of the uniform region. A uniform region is a region where multiple pixels having a determination flag of "uniform" are consecutive. FIG. 7(E) shows an example of the uniform region finally obtained. In the figure, the outlines of regions PA1-PA3 are indicated by dotted lines. Uniform regions LA1-LA3 are the uniform regions finally obtained from regions PA1-PA3, respectively.

[0047] As shown in Figure 7(D), the standard deviation sd(c) is large at the boundary between two regions showing different colors. Therefore, the boundary between the two regions is excluded from the uniform region. For example, as shown in Figure 7(E), the portion representing the boundary line B12 between the first region PA1 and the second region PA2 is not included in the uniform regions LA1 and LA2.

[0048] In the second area PA2, a character string TX is drawn in a color different from the color of the second area PA2. The standard deviation sd(c) of the block BL including the character string TX may be greater than the threshold value sdTh1(c). In the example of FIG. 7(E), the portion of the second area PA2 representing the character string TX is excluded from the uniform area LA2.

[0049] As explained in FIG. 7C, the standard deviation sd(c) is small at the boundary between the object OB and the background BG. Although not shown, the portions of each of the regions PA1, PA2, and PA3 near the boundary between the region PA1, PA2, and PA3 and the background BG may be included in the uniform regions LA1, LA2, and LA3 before S360 is executed. As will be described later, in this embodiment, edges in the image are detected as defects such as banding. If the boundary between the object OB and the background BG is included in the inspection area, the boundary may be erroneously detected as a defect.

[0050] In S360, the processor 210 performs erosion processing of the uniform region to remove the region representing the boundary line between the object OB and the background BG from the uniform region. The erosion processing may be various processes that shrink the contour of the region inward. For example, the erosion processing may be a filter process that sets the judgment flag of the target pixel to "non-uniform" when multiple surrounding pixels defined by a filter placed at the position of the target pixel include a pixel with a judgment flag set to "non-uniform." When the judgment flag of the target pixel is newly set to "non-uniform," the target pixel is removed from the uniform region. The size of the filter may be, for example, 3 rows and 3 columns centered on the target pixel. The processor 210 performs the above-mentioned process using the filter on all pixels included in the uniform region (called full-pixel processing). This shrinks each uniform region. The processor 210 may perform full-pixel processing L times (L is an integer greater than or equal to 1). The number of full-pixel processing times L may be determined experimentally in advance, for example, so that the region representing the boundary line is removed from the uniform region.

[0051] The uniform regions LA1-LA3 in Figure 7(E) are regions that have been processed in S360. As shown in the figure, the contours of each of the regions PA1-PA3 have been removed from the uniform regions LA1-LA3.

[0052] FIG. 7(F) shows uniform regions LA1p-LA3p on the scanned image IMs. The figure shows a portion of the scanned image IMs that includes object OBp. Processor 210 determines uniform regions LA1p-LA3p on the scanned image IMs from uniform regions LA1-LA3 on reference image IMt (FIG. 7(E)) according to the coordinate correspondence determined in S120 (FIG. 4). As shown, the shapes of uniform regions LA1p-LA3p are the same as the shapes of uniform regions LA1-LA3. The positions of uniform regions LA1p-LA3p relative to regions PA1p-PA3p on the scanned image IMs are the same as the positions of uniform regions LA1-LA3 relative to regions PA1-PA3 on the reference image IMt. Similar to uniform regions LA1-LA3 on the reference image IMt, uniform regions LA1p-LA3p on the scanned image IMs each represent a portion inside the contour of region PA1p-PA3p. For example, the first uniform region LA1p does not include the boundary line B01p between the first region PA1p and the background BGp, and does not include the boundary line B12p between the first region PA1p and the second region PA2p.

[0053] In S370 (FIG. 6), processor 210 performs labeling processing of the uniform regions. Processor 210 assigns an identification number to each of the uniform regions that are spaced apart from one another. In the example of FIG. 7(F), processor 210 assigns an identification number to each of uniform regions LA1p-LA3p (for example, uniform regions LA1p-LA3p are assigned numbers 1, 2, and 3, respectively). Processor 210 determines each uniform region identified by the identification number as an inspection region. Hereinafter, uniform regions LA1p-LA3p will also be referred to as inspection regions LA1p-LA3p. This completes the processing of FIG. 6, i.e., the processing of S210 in FIG. 5.

[0054] In S220, the processor 210 generates a difference image that shows enhanced edges that indicate defects such as banding, in order to easily detect the edges that indicate defects that are shown in the scanned images IMs.

[0055] FIG. 8 is a flowchart illustrating an example of a differential image generation process. In S410, the processor 210 generates data for a smoothed image IMs1 by performing a smoothing process on the luminance component of the scanned image IMs. FIGS. 9A-9D are diagrams illustrating examples of images processed in the differential image generation process. FIG. 9A illustrates a portion of an image IMsg representing the luminance component of the scanned image IMs (the image IMsg is referred to as a grayscale image IMsg). The illustrated portion represents a portion of a uniform region LA1p. The grayscale image IMsg illustrates a plurality of unintended streaks Lbn, known as banding. In the example of FIG. 9A, the streaks Lbn are arranged at approximately equal intervals in the second direction Dy. The grayscale image IMsg also illustrates a plurality of small lines Ptx. As described with reference to FIG. 3B, the scanned image IMs is a scanned image of a T-shirt 700. The T-shirt 700 is manufactured using fabric (e.g., woven or knitted). Fabric is manufactured using threads. The surface of the fabric (and therefore the surface of the T-shirt 700) has bumps and grooves formed by intertwined threads. The multiple lines Ptx represent the pattern of these bumps and grooves (i.e., the thread pattern). The thread pattern is also called texture. The line Ptx representing the thread is thinner and shorter than the streak Lbn. The color difference between the line Ptx and its surrounding area is usually smaller than the color difference between the streak Lbn and its surrounding area. Note that the unintentional streak Lbn is an example of a defect that should be detected. The line Ptx representing the thread is not a defect.

[0056] FIG. 9(B) shows an example of a smoothed image IMs1 generated by smoothing the grayscale image IMsg. The processor 210 generates a grayscale image IMsg using the scanned image IMs and performs a smoothing process on the grayscale image IMsg to generate the smoothed image IMs1. The smoothing process may be any of various processes that blur and smooth edges in an image. For example, the processor 210 may use a smoothing filter. The smoothing filter may be selected in advance from, for example, a mean filter, a Gaussian filter, or a median filter. As shown in FIG. 9(B), both the muscle Lbn and the line Ptx are smoothed in the smoothed image IMs1. Note that the muscle Lbn and the line Ptx may remain as weak edges.

[0057] In S420 (FIG. 8), the processor 210 generates data for an edge-preserving smoothed image IMs2 by performing an edge-preserving smoothing process on the luminance component of the scanned image IMs. FIG. 9C shows an example of the edge-preserving smoothed image IMs2. The edge-preserving smoothing process may be any of various processes that preserve strong edges while smoothing weak edges (e.g., texture). For example, the processor 210 may use an edge-preserving smoothing filter. The edge-preserving smoothing filter may be preselected from, for example, a bilateral filter or a mean-shift filter. As shown in FIG. 9C, in the edge-preserving smoothed image IMs2, the streaks Lbn are preserved and the lines Ptx are smoothed. Note that the lines Ptx may remain as weak edges.

[0058] In S430 (FIG. 8), the processor 210 generates data for a difference image IMd representing the difference between the smoothed image IMs1 and the edge-preserving smoothed image IMs2. In this embodiment, the processor 210 calculates the absolute value of the difference in luminance values ​​of each pixel as the color value of the difference image IMd (hereinafter, the color value of the difference image IMd is referred to as the absolute luminance difference). FIG. 9D shows an example of the difference image IMd. As described with reference to FIGS. 9B and 9C, the multiple muscles Lbn are smoothed in the smoothed image IMs1 and preserved in the edge-preserving smoothed image IMs2. Therefore, in the difference image IMd, the multiple muscles Lbn are represented by large color values ​​(here, absolute luminance differences). On the other hand, the multiple lines Ptx are smoothed both in the smoothed image IMs1 and in the edge-preserving smoothed image IMs2. Therefore, in the difference image IMd, the lines Ptx are removed or represented as weaker edges than in the grayscale image IMsg. In this way, in the difference image IMd, the line Lbn indicating the defect is emphasized compared to the line Ptx that is not a defect.

[0059] After S430 (FIG. 8), processor 210 ends the process of FIG. 8, that is, S220 of FIG.

[0060] After S220, processor 210 executes loop processing between start L2s and end L2e (i.e., S230) for each of the inspection areas determined in S210. In S230, processor 210 executes defect detection processing. FIG. 10 is a flowchart showing an example of defect detection processing. The processing in FIG. 10 represents processing for one inspection area. Hereinafter, the inspection area to be processed will be referred to as inspection area LAp.

[0061] In S510, the processor 210 calculates the standard deviation sdg of the luminance values ​​of the portion of the scanned image IMs that corresponds to the inspection area LAp. In S515, the processor 210 determines whether the standard deviation sdg is less than the threshold value sdTh2.

[0062] 11(A) to 11(D) are diagrams showing examples of difference images referenced in the defect detection process. As will be described later, in the defect detection process, the inspection area portion of the difference image generated in S220 of FIG. 5 is referenced (hereinafter, the inspection area portion of the difference image is referred to as the target difference portion). 11(A) to 11(D) show examples of target difference portions, which are the inspection areas LAq, LAr, LAs, and LAt portions of the difference images IMdq, IMdr, IMds, and IMdt. FIG. 11(A) shows a case where the target difference portion represents a defect NSq that is larger than the streak Lbn. The defect NSq represents, for example, a stain on a T-shirt or a scratch on a T-shirt. FIGS. 11(B) to 11(D) show cases where the target difference portion does not represent such a large defect. When the target difference portion represents a defect NSq (FIG. 11(A)), the standard deviation sdg may be larger than when the target difference portion does not represent a defect (FIGS. 11(B)-11(D)). The threshold value sdTh2 (FIG. 10: S515) is experimentally determined in advance so that the standard deviation sdg is equal to or larger than the threshold value sdTh2 when the portion of the scanned image IMs within the inspection area represents a large defect, and is smaller than the threshold value sdTh2 when the portion of the scanned image IMs within the inspection area does not represent a large defect.

[0063] If the standard deviation sdg is equal to or greater than the threshold value sdTh2 (S515: No), in S520, the processor 210 sets the determination result of the detection process to "there is a defect." In the example of FIG. 11(A), the determination result of S515 is No, and the process proceeds to S520. After S520, the processor 210 ends the process of FIG. 10, that is, S230 of FIG. 5. The processor 210 executes the process of S230 for the next inspection area.

[0064] If the standard deviation sdg is less than the threshold value sdTh2 (FIG. 10: S515: Yes), in S525, the processor 210 arranges multiple band frames BF on the inspection area LAp of the difference image IMd. FIGS. 12(A) and 12(B) are diagrams showing examples of the difference image IMd, the inspection area LAp, the band frames BF, the band area BA, and the banding streak Lbn. FIG. 12(A) shows the band frame BF and a portion of the difference image IMd. In this embodiment, the band frame BF is a rectangular frame. The height Hb is the length of the band frame BF in the second direction Dy. The width Wb is the length of the band frame BF in the first direction Dx. The band area BA is the portion of the area within the band frame BF that is included in the inspection area LAp. The band frame BF is used to detect defects. In this embodiment, the defect to be detected is a linear defect extending in the first direction Dx, such as the streak Lbn (FIG. 12(B)). To detect such defects, a band frame BF that is long in the first direction Dx is used (i.e., Wb>Hb). If the band frame BF includes a defect (e.g., a streak Lbn), the band frame BF includes multiple pixels with large absolute brightness differences. If the band frame BF does not include a defect, the band frame BF does not include pixels with large absolute brightness differences. Thus, the average value of the absolute brightness differences within the band frame BF may differ between a band frame BF that includes a defect and a band frame BF that does not include a defect. As described below, the processor 210 uses the average value of the absolute brightness differences of each of the multiple band frames BF to determine whether or not a defect exists in the examination area.

[0065] The processor 210 arranges multiple band frames BF on the inspection area LAp so that the multiple band frames BF cover the entire inspection area LAp. The multiple band frames BF may be arranged in various ways. FIG. 12(A) shows an example of the arrangement of multiple band frames BF. The figure shows band frames BF1-BF3 arranged at a first position Py1 in the second direction Dy and band frames BF4-BF6 arranged at a second position Py2 in the second direction Dy. Band areas BA1, BA2, BA4, and BA5 indicate band areas BA included in band frames BF1, BF2, BF4, and BF5.

[0066] In this embodiment, the processor 210 places the first band frame BF1 at a position where the -Dx side end of the first band frame BF1 contacts the -Dx side portion of the contour LAPB of the inspection area LAP, and is the position closest to the -Dx side. It is permitted for a portion of the band frame BF1 to extend outside the inspection area LAP. In the figure, the first band area BA1, which is the portion of the area within the first band frame BF1 that is included in the inspection area LAP, is hatched. A portion of the lower left corner of the first band frame BF1 is located outside the inspection area LAP. The processor 210 places a new band frame BF from this first band frame BF1 in the first direction Dx, without gaps or overlaps. The processor 210 repeats the placement of the new band frame BF until the entire new band frame BF is located outside the inspection area LAP. 12A, the processor 210 places the second band frame BF2 next to the first band frame BF1, and places the third band frame BF3 next to the second band frame BF2. Next to the third band frame BF3, the entire band frame BF is located outside the inspection area LAP, so no new band frame BF is placed.

[0067] After placement at the first position Py1, the processor 210 places the band frame BF at the adjacent second position Py2. The distance dy between the first position Py1 and the second position Py2 is predetermined so that the band frame BF at the first position Py1 and the band frame BF at the second position Py2 partially overlap. This is to ensure that the band frame BF properly overlaps defects that may be formed at various positions in the second direction Dy. In this embodiment, the distance dy is half the height Hb of the band frame BF. The placement method at the second position Py2 is the same as the placement method at the first position Py1. The processor 210 places the fourth band frame BF4 at the position closest to the -Dx side where the -Dx side end of the fourth band frame BF4 contacts the outline LAPB of the inspection area LAp. 12(A), the positions in the first direction Dx are different between the first band frame BF1 and the fourth band frame BF4 (the position of the fourth band frame BF4 is shifted in the first direction Dx from the position of the first band frame BF1). The processor 210 places a fifth band frame BF5 next to the fourth band frame BF4, and places a sixth band frame BF6 next to the fifth band frame BF5. Next to the sixth band frame BF6, the entire band frame BF is located outside the inspection area LAP, so a new band frame BF is not placed.

[0068] The processor 210 performs the process of arranging the band frame BF along the first direction Dx in this manner from the -Dy end of the inspection area LAp to the +Dy end. The processor 210 may select the position of each of the multiple band frames BF in the second direction Dy from multiple predetermined positions. Alternatively, the processor 210 may determine the position of each band frame BF in the second direction Dy based on the position of the inspection area LAp. For example, the processor 210 may determine the position of each band frame BF in the second direction Dy so that the -Dy end of the band frame BF overlaps the -Dy end of the contour LApB of the inspection area LAp.

[0069] After arranging the multiple band frames BF (S525 (FIG. 10)), the processor 210 executes the loop process (including S530-S555) between the start L5s and the end L5e for each of the multiple band frames BF on the inspection area LAp.

[0070] In S530, the processor 210 selects an unprocessed band frame BF as the target band frame BFi. In S535, the processor 210 calculates a total difference value Vs, which is the total value of the absolute luminance differences of the portion of the inspection area LAP included in the target band frame BFi, by referring to the difference image IMd. Also, the processor 210 calculates an effective pixel number Np, which is the total number of pixels of the portion of the inspection area LAP included in the target band frame BFi. The processor 210 uses the pixels of the portion included in the target band frame BFi and also included in the inspection area LAP (i.e., object pixels) for the calculation of the total difference value Vs and the effective pixel number Np. Pixels of the portion outside the inspection area LAP among those included in the target band frame BFi are not used.

[0071] In S540, the processor 210 determines whether the effective pixel number Np is equal to or greater than a pixel number threshold NpTh. If the effective pixel number Np is less than the pixel number threshold NpTh (S540: No), the processor 210 ends the processing of the target band frame BFi and proceeds to S530. Then, the processor 210 processes a new target band frame BFi. For example, a part of the third band frame BF3 in FIG. 12(A) is located outside the inspection area LAP. Therefore, the effective pixel number Np of the third band frame BF3 is small. As a result, the determination result of S540 for the third band frame BF3 may be No. The same applies to the sixth band frame BF6.

[0072] As described above, the reason for ending the processing of the target band frame BFi when Np < NpTh is to reduce the possibility of error in defect detection due to a portion having a small effective pixel number Np (this error includes missed defect detection and false defect detection in the processing of FIG. 10). The pixel number threshold NpTh may be determined experimentally in advance so that the possibility of error is acceptable.

[0073] If the number of valid pixels Np is equal to or greater than the pixel number threshold NpTh (S540: Yes), in S545, the processor 210 determines the band area of ​​interest BAi to be the portion of the area within the band frame of interest BFi that is included in the inspection area LAp. The band area of ​​interest BAi is an area formed by a plurality of pixels that correspond to the number of valid pixels Np described above.

[0074] In S550, the processor 210 calculates the average difference AveDiff of the band area of ​​interest BAi. The average difference AveDiff is the absolute value of the difference total value Vs (S535) divided by the number of valid pixels Np. When the band frame of interest BFi overlaps with a defect, the average difference AveDiff is larger than when the band frame of interest BFi does not overlap with a defect. The processor 210 associates the data of the average difference AveDiff with data of identification information (e.g., identification number, position, etc.) of the band frame of interest BFi and stores them in the storage device 215 (e.g., non-volatile storage device 230).

[0075] In S555, the processor 210 updates the maximum average difference MaxAveDiff, which is the maximum average difference AveDiff within the examination area LAp. In the first S555 for the examination area LAp, the processor 210 sets the maximum average difference MaxAveDiff to the average difference AveDiff of the band area of ​​interest BAi. In S555 from the second time onwards, if the average difference AveDiff of the band area of ​​interest BAi is greater than the maximum average difference MaxAveDiff, the processor 210 sets the maximum average difference MaxAveDiff to the average difference AveDiff of the band area of ​​interest BAi.

[0076] After S555, the processor 210 proceeds to S530 and processes the new band frame of interest BFi. When the processing of all band frames BF in the examination area LAp is completed, the processor 210 proceeds to S560.

[0077] In S560, the processor 210 calculates the overall average difference AveAllDiff, which is the average value of the average differences AveDiff of all band regions on the examination region LAp (that is, all band regions determined in S545).

[0078] In S565, the processor 210 calculates an evaluation value Ve that indicates the possibility that the inspection area LAp contains a defect. In this embodiment, the processor 210 calculates the difference by subtracting the total average difference AveAllDiff from the maximum average difference MaxAveDiff. The processor 210 calculates the evaluation value Ve by dividing this difference by the standard deviation sdg.

[0079] In S570, processor 210 sets the judgment result according to evaluation value Ve. If evaluation value Ve is greater than evaluation threshold VeTh, processor 210 sets the judgment result to "there is a defect." If evaluation value Ve is equal to or less than evaluation threshold VeTh, processor 210 sets the judgment result to "there is no defect." Such judgment results will be described with reference to FIGS. 11(B) to 11(D).

[0080] The inspection area LAr in FIG. 11(B) includes a line Ptq representing a thread, but does not include defects such as banding. The line Ptq is thin and short, similar to the line Ptx in FIG. 9(A). In this case, the standard deviation sdg of the inspection area LAr is less than the threshold value sdTh2 (FIG. 10: S515: Yes). The average differences AveDiff are approximately the same among the multiple band areas in the inspection area LAr. Therefore, the difference between the maximum average difference MaxAveDiff and the total average difference AveAllDiff is small. Furthermore, the evaluation value Ve is equal to or less than the evaluation threshold value VeTh. As a result, the judgment result is set to "no defect."

[0081] The inspection area LAs in FIG. 11(C) includes multiple unintended streaks Lbs (i.e., banding) and a line Ptq representing a thread. Here, the standard deviation sdg of the inspection area LAs is assumed to be less than the threshold sdTh2 (FIG. 10: S515: Yes). Within the inspection area LAs, the average difference AveDiff of the band areas representing the streaks Lbs is greater than the average difference AveDiff of the band areas not representing the streaks Lbs. Therefore, the difference between the maximum average difference MaxAveDiff and the total average difference AveAllDiff is large. Furthermore, the evaluation value Ve is greater than the evaluation threshold VeTh. As a result, the judgment result is set to indicate the presence of a defect.

[0082] The inspection area LAt in Fig. 11(D) includes multiple unintended streaks Lbt (i.e., banding) and a line Ptt representing a thread. As in the example of Fig. 11(C), the standard deviation sdg of the inspection area LAt is assumed to be less than the threshold value sdTh2 (Fig. 10: S515: Yes).

[0083] In the inspection area LAt in FIG. 11(D), unlike the line Ptq in FIGS. 11(A)-11(C), the color difference between the line Ptt and its surrounding area is large. That is, in the difference image IMdt, the pixel representing the line Ptt exhibits a larger absolute brightness difference than the pixel representing the line Ptq in FIGS. 11(A)-11(C) (however, it is smaller than the absolute brightness difference of the pixel representing the streak Lbt). The absolute brightness difference of the line representing the thread can have various values ​​depending on the composition of the fabric forming the T-shirt 700. For example, if the thread forming the fabric is thick, the unevenness of the fabric surface will be large (i.e., the difference in height between the concave and convex portions will be large). If the unevenness of the fabric surface is large, the absolute brightness difference of the line representing the thread will likely be large. In the example of FIG. 11(D), the unevenness of the fabric surface will be large.

[0084] In the examination area LAt, the pixels representing the line Ptt show a large absolute brightness difference, so the average difference AveDiff in the band area not representing the muscle Lbt is larger than in the example of FIG. 11(C). Therefore, in the examination area LAt, the overall average difference AveAllDiff is larger than in the example of FIG. 11(C). As a result, the difference between the maximum average difference MaxAveDiff and the overall average difference AveAllDiff is smaller than in the example of FIG. 11(C). However, this difference is larger than in the example of FIG. 11(B).

[0085] If the surface of the fabric is significantly uneven, banding streaks in the image printed on the surface of the fabric will be hidden by the unevenness of the fabric surface and will be less noticeable. Thus, if the surface of the fabric (and ultimately the printing medium) is not smooth, it is preferable that inconspicuous streaks are not detected as defects. Therefore, in this embodiment, the denominator of the calculation formula for the evaluation value Ve (FIG. 10: S565) includes the standard deviation sdg (specifically, Ve = (MaxAveDiff - AveAllDiff) / sdg). As explained in S510 (FIG. 10), the standard deviation sdg indicates the variation in luminance values ​​in the inspection area LAp. This standard deviation sdg indicates the surface roughness of the printing medium. The larger the standard deviation sdg, the rougher the surface of the printing medium, and the less noticeable the banding streaks will be. In the example of FIG. 11(D), the standard deviation sdg is larger than in the example of FIG. 11(C). As a result, the evaluation value Ve may be reduced to or below the evaluation threshold VeTh. The determination result can then be set to no defect.

[0086] The evaluation threshold VeTh may be experimentally determined in advance so that the judgment result is set to "there is a defect" when the inspection area of ​​the scanned image includes noticeable banding streaks, and the judgment result is set to "there is no defect" when the inspection area of ​​the scanned image does not include noticeable banding streaks. The evaluation threshold VeTh may be determined using various samples of scanned images.

[0087] After S570 (FIG. 10), processor 210 ends the process of FIG. 10, i.e., S230 of FIG. 5. Processor 210 executes the process of S230 of the next inspection area. When the processing of all inspection areas is completed, processor 210 ends the process of FIG. 5, i.e., S130 of FIG. 4.

[0088] In S140 (FIG. 4), the processor 210 outputs the inspection results. Various methods may be used to output the inspection results. In this embodiment, the processor 210 displays an image representing the inspection areas (e.g., an image such as that shown in FIG. 7(E)) and the judgment results for each inspection area on the display unit 240 (FIG. 1). By observing the display unit 240, the operator can easily recognize defects in the printed image. Alternatively, the processor 210 may output data representing the inspection results to a storage device (e.g., the non-volatile storage device 230 or an external storage device connected to the data processing device 200). As a result, the data representing the inspection results is stored in the storage device. The data representing the inspection results can be used for various processes (e.g., inspection processing of the entire T-shirt 700). After S140, the processor 210 ends the inspection processing.

[0089] Note that linear defects may be tilted and distorted on the read image IMs (and thus on the difference image IMd) due to various causes. FIG. 12(B) shows an example of multiple streaks Lbn represented by the difference image IMd. In the difference image IMd, the extension direction of the streaks Lbn is tilted downward and to the right with respect to the first direction Dx. The streaks Lbn are also curved. There are various reasons for this. For example, the streaks Lbn may be distorted on the difference image IMd due to the characteristics of the lens included in the reading sensor 180 ( FIG. 2 ). Furthermore, the T-shirt 700 may be placed on the support unit 140 in a tilted state relative to the reading sensor 180 ( FIG. 2 ). This may cause the streaks Lbn to be tilted on the difference image IMd. Furthermore, the T-shirt 700 is flexible and easily deformed. The T-shirt 700 may be placed on the support unit 140 in a partially deformed state. This may cause the muscle Lbn to appear curved in the image.

[0090] It is preferable that the height Hb and width Wb (i.e., the height and width of the band area BA) of the band frame BF (Figure 12(A)) are determined so that the proportion of pixels representing defects within the band frame BF (i.e., the band area BA) is significantly different between when the band frame BF overlaps with a defect (e.g., a line Lbn) and when the band frame BF does not overlap with the defect.

[0091] FIG. 12(B) shows band frames BFz1 and BFz2 of a reference example. These band frames BFz1 and BFz2 are obtained by dividing the scanned image IMs into multiple rectangular frames aligned in the second direction Dy. The band frames BFz1 and BFz2 extend from the -Dx end of the scanned image IMs to the +Dx end. The band regions BAz1 and BAz2 within the band frames BFz1 and BFz2 extend from the -Dx end of the inspection region LAp to the +Dx end. The height of the band frames BFz1 and BFz2 in the second direction Dy is approximately the same as the thickness of a single streak Lbn. The first band frame BFz1 overlaps with the streak Lbn. However, the portion of the band region BAz1 within the first band frame BFz1 that represents the streak Lbn is only a portion of the range from the -Dx end to the +Dx end. The second band frame BFz2 does not overlap with muscle Lbn. Both band frames BFz1 and BFz2 contain many pixels that do not represent muscle Lbn. Therefore, the difference in the proportion of pixels that represent muscle Lbn between band frames BFz1 and BFz2 is small. That is, the difference in average difference AveDiff (FIG. 10: S550) between band frames BFz1 and BFz2 may be small. Such small differences may reduce the accuracy of defect detection.

[0092] FIG. 12B shows multiple band frames BF (including band frames BFa and BFb) of this embodiment. Unlike the band frames BFz1 and BFz2 of the reference example, the multiple band frames BF include multiple band frames BF that respectively represent multiple portions of the examination area LAp that are located at the same position in the second direction Dy but at different positions in the first direction Dx. The length in the first direction Dx of the band frame BF (i.e., width Wb) is shorter than the length in the first direction Dx of the band frames BFz1 and BFz2 of the reference example. The height Hb of the band frame BF is approximately the same as the thickness of a single muscle Lbn. The first band frame BFa overlaps with the muscle Lbn. Of the area within the first band frame BFa, the portion representing the muscle Lbn is the entire range from the end on the -Dx side to the end on the +Dx side. In other words, the portion of the muscle Lbn within the first band frame BFa can be regarded as a straight line extending in the first direction Dx. In this case, the proportion of pixels representing muscle Lbn within the first band frame BFa is high. The second band frame BFb does not overlap with muscle Lbn. The proportion of pixels representing muscle Lbn within the second band frame BFb is zero. Therefore, the proportion of pixels representing muscle Lbn may differ significantly between band frames BFa and BFb. In other words, the difference in average difference AveDiff (FIG. 10: S550) between band frames BFa and BFb may be large. Such a large difference may improve the accuracy of defect detection.

[0093] Note that if the band frame BF is small, small noise that is not a defect (e.g., cloth texture) may be mistakenly detected in addition to the defect to be detected. The height Hb and width Wb of the band frame BF may be experimentally determined in advance so as to reduce the possibility of mistakenly detecting noise and enable appropriate defect detection. For example, the ratio of the width Wb to the height Hb may be, for example, 20 or more and 50 or less. The height Hb may be approximately the same as the thickness of a single line to be detected (e.g., 3 pixels or more and 10 pixels or less). The width Wb may be various values ​​(e.g., 100 pixels or more and 200 pixels or less).

[0094] As described above, in this embodiment, the processor 210 executes the following processing in accordance with the program 231. In steps S535-S550 (FIG. 10), the processor 210 calculates an average difference AveDiff, which is the average value of absolute brightness differences in each of the multiple band regions BA included in the inspection region LAp in the difference image IMd (FIG. 12A). The average difference AveDiff is an example of a first value, which is a representative value of the absolute brightness difference in the band region BA. As described in step S220 (FIG. 5), the absolute brightness difference, which is the color value of each pixel in the difference image IMd, is calculated using the brightness value of the read image IMs (FIG. 3B). Therefore, the absolute brightness difference is an example of a value related to a specific color component (here, the brightness component). The read image IMs (FIG. 3B) is an example of a target image representing an optically read object (here, the image IMpp, particularly the object OBp, printed on the T-shirt 700). Hereinafter, the read image IMs will also be referred to as the target image IMs. Inspection areas LA1p-LA3p in Fig. 7(F) are all used as inspection area LAp. As shown in the figure, inspection areas LA1p-LA3p respectively represent at least a portion of areas PA1p-PA3p of object OBp included in target image IMs. As described in Fig. 12(A) and Fig. 12(B), each of the multiple band areas BA is an area that is long in the first direction Da.

[0095] In S560 (FIG. 10), the processor 210 uses the average differences AveDiff of the band areas BA included in the inspection area LAp to calculate an overall average difference AveAllDiff, which is the average average difference AveDiff across all of the band areas BA. The overall average difference AveAllDiff is an example of a second value that is a representative value of the absolute brightness difference across all of the band areas BA included in the inspection area LAp.

[0096] In S555 (FIG. 10), the processor 210 uses the average differences AveDiff of the band areas BA included in the inspection area LAp to calculate a maximum average difference MaxAveDiff, which is the largest average difference AveDiff across all of the band areas BA. The maximum average difference MaxAveDiff is an example of a third value related to the maximum value of the absolute brightness differences across all of the band areas BA included in the inspection area LAp.

[0097] In S565, the processor 210 calculates an evaluation value Ve using the difference between the all average difference AveAllDiff and the maximum average difference MaxAveDiff. In S570, the processor 210 uses the evaluation value Ve to determine the presence or absence of defects extending in the first direction Dx within the inspection area LAp.

[0098] In this way, the processor 210 uses a plurality of band areas BA (each elongated in the first direction Dx) included in the inspection area LA1p-LA3p representing at least a portion of the object OBp (FIG. 7(F)) which is an example of the object, to determine whether or not there is a defect extending in the first direction Dx within the inspection area LA1p-LA3p. Therefore, the processor 210 can determine whether or not there is a defect regardless of the shape of the object. Note that the shape of the object is not limited to the shape of the object OBp and may be any shape. For example, the object may be a patch image. The shape of the patch image may be, for example, a circle or a rectangle.

[0099] Furthermore, in this embodiment, as described in S430 (FIG. 8), the difference image IMd represents the absolute value of the difference in luminance values ​​of each pixel. The positive or negative sign of the difference in luminance values ​​may differ between when the defect is represented in a light color and when the defect is represented in a dark color. In this embodiment, the processor 210 can appropriately determine the presence or absence of both a light-color defect and a dark-color defect by using the absolute value of the difference. Note that when the difference image IMd represents the absolute value of the difference in luminance values, the total difference value Vs (S535 (FIG. 10)) is equal to or greater than zero. Therefore, calculation of the absolute value may be omitted in S550. That is, AveDiff=Vs / Np may be used. Furthermore, when the absolute value is calculated in S550, the difference image IMd may represent the difference in luminance values.

[0100] Furthermore, in this embodiment, in S565, the processor 210 calculates the evaluation value Ve to be compared with the evaluation threshold VeTh using the standard deviation sdg. That is, the processor 210 adjusts the evaluation value Ve using the standard deviation sdg. As described in S510, the standard deviation sdg is an example of a value related to the variance of luminance in the inspection area LAp. The larger the variance, the larger the standard deviation sdg. In S565, the processor 210 reduces the evaluation value Ve as the standard deviation sdg increases. As described in S570, the smaller the evaluation value Ve, the more likely the determination result is that there is a defect. In this way, the processor 210 adjusts the conditions for determining whether or not there is a defect (here, the evaluation value Ve) so that the smaller the variance, the more likely it is that there is a defect. Therefore, the processor 210 can reduce the possibility that an inconspicuous streak will be detected as a defect, as described in FIG. 11(D).

[0101] Also, in this embodiment, in S210 (FIG. 5), the processor 210 determines an inspection area (e.g., inspection area LA1p-LA3p (FIG. 7(F))) by analyzing the reference image IMt. The reference image IMt represents the same image as the target image IMs. Therefore, the processor 210 can use various target images to determine whether or not there is a defect.

[0102] Furthermore, in this embodiment, as described in FIG. 6, the processor 210 determines the inspection area using a plurality of object pixels included in the block BL having a standard deviation sd(c) smaller than the threshold value sdTh1(c). As described in S320, the standard deviation sd(c) indicates the standard deviation of the gradation values ​​for each color component, i.e., the color variation. In this manner, the processor 210 determines, as the inspection area, an area in which the color variation is smaller than the standard. Therefore, the processor 210 can determine, as the inspection area, an area in which defects can be easily detected.

[0103] In this embodiment, in S220 (FIG. 5), the processor 210 generates a difference image IMd. In S230, i.e., in the processing of FIG. 10, the processor 210 calculates the average difference AveDiff using the difference image IMd. In this way, the processing for calculating the average difference AveDiff includes processing for generating the difference image IMd (S220). In this embodiment, in S220, the processor 210 executes the processing of FIG. 8. In the processing of FIG. 8, the processor 210 generates the difference image IMd using the target image IMs. As described with reference to FIGS. 9(A) to 9(D), the processing of FIG. 8 emphasizes edges represented by the target image IMs (in particular, the line Lbn indicating a defect is emphasized). In this way, the processing of FIG. 8 is an example of edge enhancement processing using the target image IMs. By executing the processing of FIG. 8, the processor 210 generates the difference image IMd, which is an example of an image with emphasized edges. A defect extending in the first direction Dx on the target image IMs can be represented by an edge on the target image IMs. By using the difference image IMd, the processor 210 can properly determine whether or not there is a defect represented by an edge.

[0104] Furthermore, in this embodiment, as described above, the process of calculating the average difference AveDiff includes the process of generating a difference image IMd (S220 ( FIG. 5 )). In this embodiment, in S220, the processor 210 executes the process of FIG. 8. In S410, the processor 210 executes a smoothing process using the target image IMs to generate a smoothed image IMs1. In S430, the processor 210 generates a difference image IMd between the edge-preserving smoothed image IMs2 and the smoothed image IMs1. As described in S420 ( FIG. 8 ) and FIG. 9(C), the edge-preserving smoothed image IMs2 represents the edges of the target image IMs. Therefore, the processor 210 can generate a difference image IMd that represents the edges of the target image IMs. A defect extending in the first direction Dx on the target image IMs can be represented by an edge on the target image IMs. By using the difference image IMd, the processor 210 can appropriately determine the presence or absence of a defect represented by an edge.

[0105] In this embodiment, the target image IMs (FIG. 7(F)) includes a first region PA1p and a second region PA2p, which represent different portions of the object OBp. The first region PA1p borders the second region PA2p. As described in FIG. 6, the processor 210 determines the inspection region using a uniform region on the reference image IMt. In steps S320-S360 (FIG. 6), the processor 210 excludes from the uniform region a plurality of object pixels included in a block BL having a standard deviation sd(c) greater than the threshold sdTh1(c). As a result, as described in FIG. 7(D), the third block BLc located on the boundary line B12 between the first region PA1 and the second region PA2 is not used as the uniform region. As shown in FIG. 7(E), the processor 210 determines a uniform region LA1 from the remaining region of the first region PA1, excluding the edge bordering the second region PA2. 7(F), the processor 210 determines the inspection area LA1p from the remaining area of ​​the first area PA1p excluding the edge that contacts the second area PA2p. Therefore, the processor 210 can reduce the possibility that the boundary line B12p between the first area PA1p and the second area PA2p will be erroneously detected as a defect.

[0106] Furthermore, in this embodiment, as described in S540 (FIG. 10), if the number of valid pixels Np of the band frame of interest BFi is equal to or greater than the pixel count threshold NpTh (S540: Yes), the processor 210 determines the band area of ​​interest BAi to be the portion of the band frame BFi that is included in the inspection area LAp (i.e., the portion corresponding to the number of valid pixels Np). That is, the processor 210 determines the area of ​​the target image IMs that has a pixel count equal to or greater than the pixel count threshold NpTh as the band area BA. Therefore, the processor 210 can reduce the possibility of defect detection errors caused by portions with a small number of pixels. For example, the processor 210 can reduce the possibility of missing a defect and erroneously detecting a defect.

[0107] In this embodiment, as described with reference to FIG. 1, the object (here, an image printed on a T-shirt 700) is an image printed by the printing device 900. The printing device 900 prints an image by performing multiple operations: ejecting ink from the nozzle Nz toward the printing medium (here, the T-shirt 700) while moving the nozzle Nz relative to the printing medium; and moving the printing medium relative to the nozzle Nz. The first direction Dx of the target image IMs (FIG. 3(B)) indicates the movement direction of the nozzle Nz relative to the object in the target image IMs. With this configuration, the image printed by the printing device 900 may include streaks called banding. On the target image IMs, the streaks may extend in the first direction Dx. The processor 210 can determine whether such streaks exist.

[0108] B. Second Example: FIG. 13 is a flowchart illustrating another example of the process for generating a difference image. In S220 (FIG. 5), the processor 210 executes the process of FIG. 13 instead of the process of FIG. 8. S410 is the same as S410 in FIG. 8. The processor 210 generates data for a smoothed image IMs1 by performing a smoothing process using the target image IMs. In S420b, the processor 210 generates data for an edge-enhanced image IMs2b by performing an edge enhancement process on the luminance component of the scanned image IMs. The edge enhancement process may be any of various processes that enhance edges within an image. For example, the edge enhancement process may be an unsharp mask or a filter process using a Laplacian filter. In S430b, the processor 210 generates data for a difference image IMdb that represents the difference between the smoothed image IMs1 and the edge-enhanced image IMs2b. In this example, the processor 210 calculates the absolute value of the difference in luminance values ​​of each pixel as the color value of the difference image IMdb. The difference image IMdb may emphasize streaks indicating defects, similar to the difference image IMd in FIG. 9(D). The processor 210 uses the difference image IMdb instead of the difference image IMd in the process of S230 (FIG. 5). This allows the processor 210 to determine the presence or absence of defects, similar to when the difference image IMd is used. Note that the color value of each pixel in the difference image IMdb is calculated using the luminance value of the scanned image IMs. Therefore, the color value of each pixel in the difference image IMdb is an example of a value related to a specific color component (here, the luminance component).

[0109] In this embodiment, the processor 210 generates a difference image IMdb in S220 (FIG. 5). In S230, i.e., in the processing of FIG. 10, the processor 210 calculates the average difference AveDiff using the difference image IMdb. Thus, the processing for calculating the average difference AveDiff includes processing for generating a difference image IMd (S220). In this embodiment, the processor 210 executes the processing of FIG. 13 in S220. The processing of FIG. 13 includes processing for generating an edge-enhanced image IMs2b in which edges are enhanced by executing edge enhancement processing using the target image IMs (S420b). The difference image IMdb generated in S430b may emphasize streaks indicating defects, similar to the difference image IMd of FIG. 9(D). The difference image IMdb is also an example of an image in which edges are enhanced, similar to the edge-enhanced image IMs2b. The processor 210 generates the difference image IMdb using the edge-enhanced image IMs2b and calculates the average difference AveDiff using the difference image IMdb. In this way, the processor 210 can appropriately determine whether or not there is a defect represented by an edge by using the image with the edge enhanced (edge ​​enhanced image IMs2b, and hence the difference image IMdb).

[0110] In this embodiment, the processing in FIG. 13 also includes processing for generating a smoothed image IMs1 by performing a smoothing process using the target image IMs (S410). In S430b, the processor 210 generates a difference image IMdb between the edge-enhanced image IMs2b and the smoothed image IMs1. As described in S420b, the edge-enhanced image IMs2b represents the edges of the target image IMs. Therefore, the processor 210 can generate a difference image IMdb representing the edges of the target image IMs. By using the difference image IMdb, the processor 210 can appropriately determine the presence or absence of defects represented by edges.

[0111] C. Third Example: FIG. 14 is a flowchart illustrating another example of the process for generating a difference image. In S220 (FIG. 5), the processor 210 executes the process of FIG. 14 instead of the process of FIG. 8. S410 is the same as S410 in FIG. 8. The processor 210 generates data for a smoothed image IMs1 by executing a smoothing process using the target image IMs. In S430c, the processor 210 generates data for an intermediate difference image IMdci that represents the difference between the grayscale image IMsg, which represents the luminance component of the target image IMs, and the smoothed image IMs1. In this example, the processor 210 calculates the absolute value of the difference in luminance values ​​of each pixel as the color value of the intermediate difference image IMdci. The intermediate difference image IMdci can emphasize streaks that indicate defects, similar to the difference image IMd in FIG. 9(D).

[0112] In S440c, the processor 210 generates data for the difference image IMdc by performing edge enhancement processing on the intermediate difference image IMdci. The edge enhancement processing may be any of various processes that enhance edges in an image. For example, the edge enhancement processing may be a filter processing using an unsharp mask or a Laplacian filter. The difference image IMdc may further emphasize streaks indicating defects compared to the intermediate difference image IMdci. The processor 210 uses the difference image IMdc instead of the difference image IMd in the processing of S230 (FIG. 5). This allows the processor 210 to determine the presence or absence of defects in the same way as when the difference image IMd is used. Note that the color value of each pixel in the difference image IMdc is calculated using the luminance value of the scanned image IMs. Therefore, the color value of each pixel in the difference image IMdc is an example of a value related to a specific color component (here, the luminance component).

[0113] In this embodiment, in S220 (FIG. 5), the processor 210 generates a difference image IMdc. In S230, i.e., in the processing of FIG. 10, the processor 210 calculates the average difference AveDiff using the difference image IMdc. Thus, the processing for calculating the average difference AveDiff includes processing for generating the difference image IMdc (S220). In this embodiment, in S220, the processor 210 executes the processing of FIG. 14. The processing of FIG. 14 includes processing for generating an edge-enhanced difference image IMdc by performing edge enhancement processing on the intermediate difference image IMdci (S440c). As described in S410 and S430c, the intermediate difference image IMdci is generated using the target image IMs. The processing of FIG. 14, including S410, S430c, and S440c, is an example of edge enhancement processing using the target image IMs. The difference image IMdc generated by the processing of FIG. 14 may emphasize streaks indicating defects, similar to the difference image IMd of FIG. 9(D). The difference image IMdc is an example of an image in which edges are enhanced. The processor 210 calculates the average difference AveDiff using the difference image IMdc (FIG. 10). In this way, by using the difference image IMdc, the processor 210 can appropriately determine whether or not there is a defect represented by an edge.

[0114] D. Fourth Example: Figure 15 is a flowchart showing another embodiment of the fault detection process. The only difference from the process in Figure 10 is that S565 and S570 following S560 are replaced by S565d and S570d in Figure 15. The other parts of the fault detection process are the same as the corresponding parts in Figure 10 (description will be omitted).

[0115] In S565d, the processor 210 calculates the evaluation value Ve2. In this embodiment, the processor 210 calculates the evaluation value Ve2 using the ratio of the maximum average difference MaxAveDiff to the all average difference AveAllDiff (specifically, Ve2=(MaxAveDiff / AveAllDiff) / sdg).

[0116] In S570d, processor 210 sets the judgment result according to evaluation value Ve. If evaluation value Ve2 is greater than evaluation threshold VeTh2, processor 210 sets the judgment result to "there is a defect." If evaluation value Ve2 is equal to or less than evaluation threshold VeTh2, processor 210 sets the judgment result to "there is no defect."

[0117] Similar to the evaluation value Ve in FIG. 10, when the inspection area LAp contains defects, the evaluation value Ve2 is larger than when the inspection area LAp does not contain defects. For example, when the inspection area LAr in FIG. 11(B) is the processing target, the evaluation value Ve2 is smaller. When the inspection area LAs in FIG. 11(C) is the processing target, the evaluation value Ve2 is larger. Furthermore, in this embodiment, the denominator of the calculation formula for the evaluation value Ve2 (FIG. 15: S565d) includes the standard deviation sdg. When the surface of the printing medium is rough and banding streaks are less noticeable, the standard deviation sdg may be larger, and the evaluation value Ve2 may be smaller. For example, when the inspection area LAt in FIG. 11(D) is the processing target, the evaluation value Ve2 may be smaller.

[0118] The evaluation threshold VeTh2 may be experimentally determined in advance so that the judgment result is set to "there is a defect" when the inspection area of ​​the scanned image includes noticeable banding streaks, and the judgment result is set to "there is no defect" when the inspection area of ​​the scanned image does not include noticeable banding streaks. The evaluation threshold VeTh2 may be determined using various samples of scanned images.

[0119] As described above, in this embodiment, in S565d, processor 210 calculates evaluation value Ve2 using the ratio between the all average difference AveAllDiff and the maximum average difference MaxAveDiff. In S570d, processor 210 uses evaluation value Ve2 to determine the presence or absence of defects extending in the first direction Dx within inspection area LAp. As with the embodiment of FIG. 10, processor 210 can determine the presence or absence of defects regardless of the shape of the object.

[0120] Furthermore, the defect detection process of this embodiment is similar to the defect detection process of Fig. 10 except that the method of calculating the evaluation value Ve2 is different. The defect detection process of this embodiment can provide the same various advantages as those provided by the defect detection process of Fig. 10. Furthermore, in S220 of Fig. 5, the processor 210 may execute the process of Fig. 13 or Fig. 14, not limited to the process of Fig. 8.

[0121] E. Fifth Example: Figure 16 is a flowchart showing another embodiment of the visual inspection process. The only difference from the process in Figure 5 is that S220 is replaced with S220e and S230 is replaced with S230e. The other parts of the visual inspection process are the same as the corresponding parts in Figure 5 (description will be omitted).

[0122] In S220e, the processor 210 generates data for an edge-preserving smoothed image IMde by performing edge-preserving smoothing processing on the luminance component of the scanned image IMs. The processing of S220e may be various processing that smoothes weak edges (e.g., texture) while preserving strong edges, similar to the processing of S420 in Fig. 8. In the edge-preserving smoothed image IMde, streaks that indicate defects such as banding are preserved, and weak edges such as texture are smoothed, similar to the edge-preserving smoothed image IMs2 in Fig. 9(C).

[0123] After S220e, processor 210 executes loop processing between start L2s and end L2e (i.e., S230e) for each of the inspection areas determined in S210. FIG. 17 is a flowchart showing an example of defect detection processing in S230e. Unlike the processing in FIG. 10, processor 210 uses edge-preserving smoothed image IMde instead of difference image IMd. Also, in this embodiment, processor 210 sets the judgment result using two evaluation values ​​Ve3x and Ve3n. In FIG. 17, steps that are the same as those in FIG. 10 are assigned the same reference numerals, and descriptions thereof will be omitted.

[0124] S510-S525 are the same as S510-S525 in Fig. 10. Processor 210 calculates the standard deviation sdg and arranges multiple band frames BF on inspection area LAp (e.g., Fig. 12(A)). After S525, processor 210 executes loop processing (including S530-S557e) between start L5s and end L5e for each of multiple band frames BF on inspection area LAp.

[0125] S530 is the same as S530 in Fig. 10 (the band frame of interest BFi is selected). In S535e, processor 210 refers to edge-preserving smoothed image IMde and calculates a gradation sum Vse, which is the sum of the gradation values ​​(here, luminance values) of the portion of inspection area LAp that is included in the band frame of interest BFi. Processor 210 also calculates the number of effective pixels Np, similar to S535 in Fig. 10.

[0126] S540 and S545 are the same as S540 and S545 in Fig. 10. Although not shown, if the determination result in S545 is No, the processor 210 ends the processing of the band frame of interest BFi and proceeds to S530. If the determination result in S540 is Yes, the processing proceeds to S545.

[0127] S545 is the same as S545 in FIG. 10 (the band area of ​​interest BAi is determined). In S550e, the processor 210 calculates the average gradation value AveV of the band area of ​​interest BAi. The average gradation value AveV is the value obtained by dividing the total gradation value Vse by the number of valid pixels Np. The average gradation value AveV can differ significantly between when the band frame of interest BFi overlaps with a defect and when the band frame of interest BFi does not overlap with a defect. For example, when the band frame of interest BFi overlaps with a defect represented by a light color, the average gradation value AveV can be larger than the average gradation value AveV when the band frame of interest BFi does not overlap with a defect. When the band frame of interest BFi overlaps with a defect represented by a dark color, the average gradation value AveV can be smaller than the average gradation value AveV when the band frame of interest BFi does not overlap with a defect. The processor 210 associates the data of the average gradation value AveV with data of identification information (for example, identification number, position, etc.) of the band frame of interest BFi and stores them in the storage device 215 (for example, the nonvolatile storage device 230).

[0128] In S555e, processor 210 updates the maximum average gradation value MaxAveV, which is the maximum average gradation value AveV within inspection area LAp. In the first S555e for inspection area LAp, processor 210 sets the maximum average gradation value MaxAveV to the average gradation value AveV of the target band area BAi. In S555e from the second time onwards, if the average gradation value AveV of the target band area BAi is greater than the maximum average gradation value MaxAveV, processor 210 sets the maximum average gradation value MaxAveV to the average gradation value AveV of the target band area BAi.

[0129] In S557e, processor 210 updates the minimum average gradation value MinAveV, which is the smallest average gradation value AveV within inspection area LAp. In the first S557e for inspection area LAp, processor 210 sets the minimum average gradation value MinAveV to the average gradation value AveV of the target band area BAi. In S557e from the second time onwards, if the average gradation value AveV of the target band area BAi is smaller than the minimum average gradation value MinAveV, processor 210 sets the minimum average gradation value MinAveV to the average gradation value AveV of the target band area BAi.

[0130] After S557e, the processor 210 proceeds to S530 to process the new band frame of interest BFi. When the processing of all band frames BF in the inspection area LAp is completed, the processor 210 proceeds to S560e.

[0131] In S560e, the processor 210 calculates an overall average gradation value AveAllV, which is the average value of the average gradation values ​​AveV of all band areas on the inspection area LAp (that is, all band areas determined in S545).

[0132] In S565e, processor 210 calculates a first evaluation value Ve3x that indicates the possibility that inspection area LAp contains a light-color defect. In this example, processor 210 calculates the difference by subtracting the overall average gradation value AveAllV from the maximum average gradation value MaxAveV. Processor 210 calculates the first evaluation value Ve3x by dividing this difference by the standard deviation sdg.

[0133] In S567e, processor 210 calculates a second evaluation value Ve3n that indicates the possibility that inspection area LAp contains a dark-color defect. In this embodiment, processor 210 calculates the difference by subtracting minimum average gradation value MinAveV from all average gradation values ​​AveAllV. Processor 210 calculates the second evaluation value Ve3n by dividing this difference by the standard deviation sdg.

[0134] In S570e, processor 210 sets the judgment result using first evaluation value Ve3x and second evaluation value Ve3n. Processor 210 sets the judgment result to "there is a defect" if one or both of the following conditions 1 and 2 are met. Processor 210 sets the judgment result to "there is no defect" if neither of the following conditions 1 and 2 are met. (Condition 1): The first evaluation value Ve3x is greater than the first evaluation threshold VeTh3x. (Condition 2): The second evaluation value Ve3n is greater than the second evaluation threshold VeTh3n.

[0135] The first evaluation value Ve3x will be large, similar to the evaluation value Ve in FIG. 10, when the inspection area includes defects (e.g., streaks) that are displayed in a light color. For example, when the streaks Lbs in FIG. 11C are displayed in a light color, the first evaluation value Ve3x will be large, similar to the evaluation value Ve. Furthermore, the denominator of the formula for calculating the first evaluation value Ve3x (S565e) includes the standard deviation sdg, similar to the denominator of the formula for calculating the evaluation value Ve (FIG. 10: S565). Therefore, when the surface of the printing medium is rough and banding streaks are not noticeable, the first evaluation value Ve3x can be small, similar to the evaluation value Ve. For example, when the streaks Lbt in FIG. 11D are displayed in a light color, the first evaluation value Ve3x can be small, similar to the evaluation value Ve.

[0136] The characteristics of the second evaluation value Ve3n are similar to those of the first evaluation value Ve3x, except that the second evaluation value Ve3n is large when the inspection area includes defects (e.g., streaks) that are displayed in dark colors. For example, if the streaks Lbs in FIG. 11(C) are displayed in dark colors, the second evaluation value Ve3n will be large, just like the evaluation value Ve. Furthermore, the denominator of the calculation formula (S567e) for the second evaluation value Ve3n includes the standard deviation sdg. Therefore, if the surface of the print medium is rough and banding streaks are less noticeable, the second evaluation value Ve3n may be small. For example, if the streaks Lbt in FIG. 11(D) are displayed in dark colors, the second evaluation value Ve3n may be small, just like the evaluation value Ve.

[0137] As described above, in this embodiment, processor 210 uses color values ​​(here, luminance values) of edge-preserving smoothed image IMde instead of absolute luminance differences as values ​​related to specific color components (here, luminance components). The average gradation value AveV calculated in S550e is an example of a first value that is a representative value of luminance values ​​in band area BA. The overall average gradation value AveAllV calculated in S560e is an example of a second value that is a representative value of luminance values ​​across all of the multiple band areas BA included in inspection area LAp (the overall average gradation value AveAllV is calculated using the average gradation value AveV). The maximum average gradation value MaxAveV calculated in S555e is an example of a third value related to the maximum value of luminance values ​​across all of the multiple band areas BA included in inspection area LAp (the maximum average gradation value MaxAveV is calculated using the average gradation value AveV). The minimum average gradation value MinAveV calculated in S557e is an example of a third value related to the minimum luminance value across all of the multiple band regions BA included in the inspection area LAp (the minimum average gradation value MinAveV is calculated using the average gradation value AveV). In S565e and S567e, processor 210 calculates evaluation values ​​Ve3x and Ve3n using the difference between the second value (all average gradation value AveAllV) and the third value (maximum average gradation value MaxAveV and minimum average gradation value MinAveV). In S570e, processor 210 uses evaluation values ​​Ve3x and Ve3n to determine the presence or absence of a defect extending in the first direction Dx within inspection area LAp. In this embodiment as well, as in the above embodiments, processor 210 can determine the presence or absence of a defect regardless of the shape of the object.

[0138] F. Variations: (1) The process for determining the inspection area may be various other processes instead of the process of FIG. 6. For example, the standard deviation used to determine the inspection area is not limited to R, G, and B, but may include the standard deviations of various color components (e.g., luminance). Furthermore, processor 210 may determine the inspection area using one standard deviation of one color component. However, in order to remove the boundary portion between two regions having different colors, as shown in FIG. 7(D), processor 210 preferably uses the standard deviations of two or more color components. Furthermore, processor 210 may use various parameters representing color variation, such as variance, instead of standard deviation.

[0139] Alternatively, the processor 210 may determine the inspection area by analyzing the target image IMs instead of the reference image IMt. For example, the processor 210 may divide the target image IMs into a background area and an object area by a binarization process (e.g., Otsu's binarization). Then, the processor 210 may determine the object area as the inspection area.

[0140] The processor 210 may also determine the area specified by the user as the inspection area.

[0141] In either case, if the target image includes a first target area and a second target area representing different parts of the object, and the first target area borders the second target area, the inspection area representing the first target area may include an edge of the first target area that borders the second target area.

[0142] (2) In S220e of Fig. 16, the processor 210 may perform various processes capable of emphasizing edges that indicate defects. For example, the processor 210 may generate data of an edge-enhanced image by performing edge enhancement processing. Then, in the processing of S230e, i.e., the processing of Fig. 17, the processor 210 may use the edge-enhanced image instead of the edge-preserving smoothed image IMde.

[0143] (3) The color component used in the defect detection process (e.g., FIGS. 10 and 17) is not limited to luminance, and may be various color components (e.g., green, cyan, etc.). Furthermore, the defect detection process may be various other processes instead of the processes shown in FIGS. 10 and 17. For example, steps S515 and S520 may be omitted. Step S540 may be omitted.

[0144] (4) The configuration of the multiple band regions included in the inspection area in the target image is not limited to the configuration described in FIGS. 12(A) and 12(B), and may be various. Preferably, the multiple band regions include multiple partial regions representing multiple portions of the inspection area that are located at the same position in the second direction Dy but at different positions in the first direction Dx. Hereinafter, a group of multiple partial regions representing such multiple portions will be referred to as a first-type group. In the example of FIG. 12(A), band regions BA1, BA2, BA4, and BA5 represent multiple portions located between a first position Py1 and a second position Py2 in the second direction Dy but at different positions in the first direction Dx. Therefore, band regions BA1, BA2, BA4, and BA5 form a first-type group. If the inspection area represents a long defect (e.g., a streak Lbn (FIG. 12(B))) extending in the first direction Dx, the multiple band regions included in the first-type group that overlap the defect may represent different portions of the defect. Therefore, the processor 210 can appropriately determine that there is a defect in the inspection area LAp.

[0145] The first type group may include one or more pairs of band regions that are positioned differently in the first direction Dx and partially overlap each other. For example, the second band region BA2 in FIG. 12A may be positioned to partially overlap the first band region BA1. Assume that a defect includes a first specific portion, which is a portion located at the end of the first specific band region in the first direction Dx. In this case, a portion of the first specific portion of the defect may extend outside the first specific band region. If the first type group includes a pair of a first specific band region and a second specific band region that partially overlaps the end of the first specific band region in the first direction Dx, the second specific band region may represent the first specific portion of the defect as a portion inside the outline of the second specific band region. Therefore, the processor 210 can reduce the possibility of erroneously determining that there is no defect in the inspection region LAp. However, multiple band regions aligned in the first direction Dx at the same position in the second direction Dy may be positioned so as not to overlap each other. Furthermore, multiple band regions forming the same type 1 group may be arranged so as not to overlap each other.

[0146] Furthermore, the multiple band regions preferably include multiple partial regions each representing multiple portions of the examination region that are located at the same position in the first direction Dx but different positions in the second direction Dy. Hereinafter, a group of multiple partial regions representing multiple portions will be referred to as a type-2 group. In the example of FIG. 12(A), multiple band regions BA including band regions BA1 and BA4 and aligned in the second direction Dy form a type-2 group. Furthermore, multiple band regions BA including the second band region BA2 and the fifth band region BA5 and aligned in the second direction Dy form another type-2 group. If the examination region represents multiple defects (e.g., multiple muscles Lbn (FIG. 12(B))) that are located at different positions in the second direction Dy, the multiple band regions included in the type-2 group may represent each of these defects. Therefore, the processor 210 can appropriately determine that the examination region LAp has a defect.

[0147] The second type group may include one or more pairs of band regions that are positioned differently in the second direction Dy and that partially overlap each other. For example, the pair of the first band region BA1 and the fourth band region BA4 in FIG. 12(A) is positioned differently in the second direction Dy and partially overlaps each other. Assume that a defect includes a second specific portion, which is a portion located at the end of the first specific band region in the second direction Dy. In this case, a portion of the second specific portion of the defect may extend outside the first specific band region. If the second type group includes a pair of a first specific band region and a second specific band region that partially overlaps the end of the first specific band region in the second direction Dy, the second specific band region may represent the second specific portion of the defect as a portion inside the outline of the second specific band region. Therefore, the processor 210 can reduce the possibility of erroneously determining that there is no defect in the inspection region LAp. However, multiple band regions aligned in the second direction Dy at the same position in the first direction Dx may be arranged so as not to overlap with each other, and multiple band regions forming the same second type group may be arranged so as not to overlap with each other.

[0148] Preferably, the plurality of band areas include a plurality of band areas each representing a plurality of portions of the inspection area that differ from one another in one or both of the positions in the first direction Dx and the second direction Dy. Defects may be formed at various positions within the inspection area. According to the above configuration, one or more of the plurality of band areas may represent a defect. Therefore, the processor 210 can appropriately determine that the inspection area LAp has a defect.

[0149] The shape of the band area may be various shapes that are elongated in the first direction Dx. The multiple band areas may be arranged at predetermined positions on the target image. For example, in S525 of FIGS. 10 and 17, the processor 210 may determine the position of each of the multiple band frames BF on the inspection area LAp according to this predetermined position. In either case, it is preferable that the multiple band areas be arranged so as to cover the entire inspection area. However, the multiple band areas may be arranged so as to cover only a portion of the inspection area.

[0150] (5) In the above embodiment and modified examples, the first value, which is a representative value of the values ​​related to a specific color component in each of the multiple band areas BA, is an average value, such as the average difference AveDiff (FIG. 10) or the average gradation value AveV (FIG. 17). Instead of the average value, the first value may be any of various values ​​indicating the magnitude of the values ​​related to a specific color component in the band area BA, such as the median or mode (for example, summary statistics).

[0151] In the above embodiment and modified examples, the second value, which is a representative value of the values ​​related to a specific color component across all of the multiple band areas BA, is an average value, such as the overall average difference AveAllDiff (FIG. 10) or the overall average gradation value AveAllV (FIG. 17). Instead of the average value, the second value may be any of various values ​​that indicate the magnitude of the values ​​related to a specific color component across all of the multiple band areas BA, such as the median or mode (for example, summary statistics).

[0152] (6) In S565 of FIG. 10 and S565e and S567e of FIG. 17, the processor 210 adjusts the evaluation values ​​Ve, Ve3x, and Ve3n by dividing them by the standard deviation sdg, thereby adjusting the conditions for determining whether or not a defect exists. Various other methods may be used to adjust the conditions for determining whether or not a defect exists. The processor 210 may adjust the evaluation thresholds VeTh, VeTh3x, and VeTh3n using the standard deviation sdg. For example, the processor 210 may calculate the evaluation thresholds VeTh, VeTh3x, and VeTh3n by multiplying a predetermined value by the standard deviation sdg. In this case, the processor 210 can also adjust the conditions for determining whether or not a defect exists so that the smaller the standard deviation sdg of the luminance in the inspection area, the more likely it is to be determined that a defect exists. Note that the parameter used to adjust the conditions may be various values ​​related to variance, such as the difference between the maximum and minimum values, instead of the standard deviation. Furthermore, the parameter used for adjusting the conditions is not limited to luminance, and may be expressed by various color components such as green, etc. Note that the adjustment of the conditions may be omitted.

[0153] (7) The images used in the visual inspection are not limited to the difference images IMd (FIG. 8), IMdb (FIG. 13), IMdc (FIG. 14), and the edge-preserving smoothed image IMde (FIG. 16), but may be various images that represent defects in the target image IMs. For example, in the example of FIG. 16, the grayscale image IMsg may be used instead of the edge-preserving smoothed image IMde. Furthermore, the specific color component used in the visual inspection is not limited to luminance, but may be various color components (e.g., a green component).

[0154] (8) The printing device is not limited to the printing device 900 of FIG. 1 , but may be various other printing devices, such as a line printer or a laser printer. In either case, unintended streaks may be formed due to various causes, such as nozzle malfunctions or photosensitive drum malfunctions. On an image printed by a line printer, streaks extending in the print medium transport direction may be formed due to nozzle malfunctions. On an image printed by a laser printer, streaks extending in a direction perpendicular to the print medium transport direction may be formed due to photosensitive drum malfunctions. The above-described embodiment and variations can determine the presence or absence of defects using scanned images of images printed by various printing devices. In either case, the processor 210 can appropriately detect defects by adopting the direction in which the defect to be detected (e.g., streaks) extends as the first direction, which is the longer direction of the band area BA.

[0155] (9) The object of visual inspection is not limited to a printed image, and may be various objects. For example, the object may be a fabric such as a woven or knitted fabric. The fabric may have defects extending in a specific direction due to defects in the threads. The processor 210 may use the scanned image of the fabric to determine whether or not such defects exist.

[0156] (10) Data processing device 200 in Fig. 1 may be a device of a type different from a personal computer (e.g., a digital camera, a scanner, or a smartphone). Furthermore, multiple devices (e.g., computers) that can communicate with each other via a network may share some of the data processing functions of the data processing device and collectively provide the data processing functions (a system including these devices corresponds to a data processing device).

[0157] In each of the above embodiments, a part of the configuration realized by hardware may be replaced by software, and conversely, a part or all of the configuration realized by software may be replaced by hardware. For example, the process of S220 in Fig. 5 may be executed by a dedicated hardware circuit such as an Application Specific Integrated Circuit (ASIC).

[0158] Furthermore, when some or all of the functions of the present disclosure are realized by a computer program, the program can be provided in a form stored on a computer-readable recording medium (e.g., a non-transitory recording medium). The program can be used in a state stored on the same or a different recording medium (computer-readable recording medium) from when it was provided. The "computer-readable recording medium" is not limited to portable recording media such as memory cards and CD-ROMs, but can also include internal storage devices within a computer, such as various ROMs, and external storage devices connected to a computer, such as a hard disk drive.

[0159] The above-described examples and modifications can be combined as appropriate. The above-described examples and modifications are provided to facilitate understanding of the present disclosure and are not intended to limit the present invention. The present invention may be modified or improved without departing from the spirit thereof, and the present invention includes equivalents thereof. [Explanation of symbols]

[0160] 100...reading device, 110...controller, 120...transporting device, 122...position sensor, 130...table, 140...supporting part, 180...reading sensor, 190...casing, 200...data processing device, 210...processor, 215...storage device, 220...volatile storage device, 230...non-volatile storage device, 231...program, 240...display unit, 250...operation unit, 270...communication interface, 700...T-shirt, 900...printing device, 910...controller, 920...transporting device, 940...supporting part, 970...moving device, 980...print head

Claims

1. A program, A function for calculating a first value that is a representative value of values ​​related to a specific color component in each of a plurality of band regions included in an inspection area in a target image, the target image representing an optically read object, the inspection area representing at least a portion of the object, and each of the plurality of band regions being an area that is long in a first direction; a function of calculating a second value that is a representative value of the values ​​associated with the specific color component across all of the band regions using a plurality of first values ​​in the plurality of band regions; a function of calculating a third value associated with a maximum or minimum value of the values ​​associated with the specific color component across the plurality of band regions using the plurality of first values ​​of the plurality of band regions; determining the presence or absence of defects extending in the first direction in the inspection area using a difference or ratio between the second value and the third value; A program that enables a computer to achieve this.

2. The program according to claim 1, further comprising: A program that causes a computer to realize a function of adjusting the conditions for determining whether or not a defect exists, using a value related to the variance of the specific color component in the inspection area, so that the smaller the variance, the more likely it is to be determined that the defect exists.

3. 3. The program according to claim 1 or 2, further comprising: A program that causes a computer to realize a function of determining the inspection area by analyzing the target image or a reference image that represents the same image as the target image.

4. 4. The program according to claim 3, The function of determining the inspection area determines an area in which color variation is smaller than a standard as the inspection area.

5. 3. The program according to claim 1 or 2, The function of calculating the first value in each of the plurality of band regions is generating an edge-enhanced image by performing an edge enhancement process using the target image; calculating the first value using the edge-enhanced image; Including, the program.

6. 3. The program according to claim 1 or 2, The function of calculating the first value in each of the plurality of band regions is generating a smoothed image by performing a smoothing process using the target image; a function of calculating the first value using a difference image between the smoothed image and either one of the target image or an image representing an edge of the target image; Including, the program.

7. 7. The program according to claim 6, the target image includes a first target region and a second target region representing different portions of the target, the first target region being adjacent to the second target region; The program further comprises: A program that causes a computer to realize a function of determining the inspection area from the remaining area of ​​the first target area excluding the edge that contacts the second target area.

8. 3. The program according to claim 1 or 2, further comprising: A program that causes a computer to realize a function of determining an area of ​​the target image having a pixel count equal to or greater than a threshold as the band area.

9. 3. The program according to claim 1 or 2, the target object is an image printed by performing a process of ejecting ink from a nozzle toward a printing medium while moving the nozzle relative to the printing medium, and a process of moving the printing medium relative to the nozzle, multiple times, respectively; the first direction indicates a movement direction of the nozzle relative to the object in the object image; program.

10. 1. A data processing device, comprising: a first calculation unit that calculates a first value that is a representative value of a value related to a specific color component in each of a plurality of band regions included in an inspection area in a target image, the target image representing an optically read object, the inspection area representing at least a portion of the object, and each of the plurality of band regions being an area that is long in a first direction; a second calculation unit that calculates a second value that is a representative value of the values ​​related to the specific color component in all of the band regions using a plurality of first values ​​in the plurality of band regions; a third calculation unit that calculates a third value associated with a maximum value or a minimum value of the values ​​associated with the specific color component across all of the plurality of band regions using the plurality of first values ​​of the plurality of band regions; a determination unit that determines the presence or absence of a defect extending in the first direction in the inspection area using a difference or ratio between the second value and the third value; A data processing device comprising:

Citation Information

Patent Citations

  • Calibration device, calibration program, and calibration method

    JP4543796B2