Image generation method, program, and image generation apparatus
The image generation method uses a loss function to correct textile patterns, addressing fabric defects by automatically inverting pixel values, ensuring high-quality fabric production through systematic defect removal.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- UNIVERSITY OF YAMANASHI
- Filing Date
- 2022-06-21
- Publication Date
- 2026-05-29
Smart Images

Figure 0007867272000007 
Figure 0007867272000008 
Figure 0007867272000009
Abstract
Description
[Technical Field]
[0001] The present invention relates to an image generation method, a program, and an image generation apparatus. [Background technology]
[0002] Textiles express patterns by moving warp and weft threads up and down during weaving. The patterns formed by combining warp and weft threads in basic structures such as plain weave and twill weave are called textile patterns. Because the design of these textile patterns was traditionally done by hand by artisans, technologies have been proposed that enable textile design using digital data (input images) such as photographs and illustrations (see Non-Patent Literature 1). The technology described in Non-Patent Literature 1 uses a dither mask to binarize the pixel values of each pixel in the input image, enabling the semi-automatic generation of textile patterns (textile pattern images). Each binarized pixel corresponds to a grid point of the warp and weft threads, and the relationship between the front and back of the warp and weft threads is identified. [Prior art documents] [Non-patent literature]
[0003] [Non-Patent Document 1] M. Toyoura et al., "Generating Jacquard Fabric Pattern with Visual Impressions," IEEE Trans. Industrial Informatics, Vol.15, No.8, pp.4536-4544 (2019) [Overview of the project] [Problems that the invention aims to solve]
[0004] When fabric is actually manufactured using the fabric pattern (fabric pattern image) described in Non-Patent Literature 1, defects caused by the fabric pattern itself may occur in the fabric. To eliminate such defects, it is necessary to visually inspect the fabric pattern, identify the pixels that may cause defects, and perform appropriate operations such as inverting them.
[0005] This invention has been made in view of these circumstances, and aims to provide an image generation method, program, and image generation apparatus that facilitate the removal of potential defects inherent in textile pattern images. [Means for solving the problem]
[0006] According to the present invention, an image generation method is provided, comprising an output pattern image generation step, wherein an output pattern image is generated from the woven pattern image by performing a correction process on the woven pattern image using a loss function, each pixel value of the woven pattern image is binarized to one of two pixel values, a first and a second pixel value, so as to identify the up-down relationship of the warp and weft threads, the value of the loss function is calculated for each pixel, and in the correction process, pixels in which the value of the loss function decreases before and after the correction become the pixels to be corrected, and the pixel value of the pixels to be corrected is inverted from one of the two pixel values to the other.
[0007] According to the present invention, in the output pattern image generation step, an output pattern image can be generated by applying a correction process to the fabric pattern image using a loss function. In other words, an output pattern image with defects removed can be generated without relying on the operator's visual inspection or skill and experience, making it easy to remove defects.
[0008] The following are examples of various embodiments of the present invention. The embodiments shown below can be combined with each other. (1) An image generation method comprising an output pattern image generation step, wherein an output pattern image is generated from the textile pattern image by performing a correction process on the textile pattern image using a loss function, each pixel value of the textile pattern image is binarized to one of the first and second pixel values so as to identify the up-down relationship of the warp and weft threads, the value of the loss function is calculated for each pixel, and in the correction process, pixels in which the value of the loss function decreases before and after the correction become the pixels to be corrected, and the pixel value of the pixels to be corrected is inverted from one of the first and second pixel values to the other pixel value. (2) The method according to (1), wherein the correction process repeatedly generates a corrected pattern image from a pre-correction pattern image, the corrected pattern image is an image in which the pixel values of the pixels to be corrected in the pre-correction pattern image are inverted, in the first correction process of the repetition the pre-correction pattern image is the fabric pattern image, and in the final correction process of the repetition the corrected pattern image is the output pattern image. (3) A method according to (2), wherein the pixels to be corrected in the correction process have a difference in the value of the loss function before and after the correction that is greater than the loss function threshold, and the correction process is repeated until there are no more pixels where the difference in the value of the loss function is greater than the loss function threshold. (4) A method according to any one of (1) to (3), wherein the pixel to be corrected in the correction process is the pixel with the largest difference in the value of the loss function before and after the correction. (5) A method according to (1), further comprising a setting step, wherein in the correction process of the output pattern image generation step, a plurality of loss functions are used, the value of each loss function is calculated for each pixel, the setting step is performed before the output pattern image generation step, and in the setting step, the weight coefficient of each loss function can be set, and in the correction process of the output pattern image generation step, the pixels that decrease in the sum of the values of the plurality of loss functions before and after correction are the pixels to be corrected. A method according to (6)(5), wherein the setting step highlights pixels in which the difference of the sum of the values of the plurality of loss functions is greater than the loss function threshold when the pixel value of the pixel of interest in the textile pattern image is inverted. (7) A method according to any one of (1) to (6), further comprising an input image acquisition step and a textile pattern image generation step, wherein the input image acquisition step acquires an input image, and the textile pattern image generation step generates the textile pattern image from the input image by performing a masking process, and the masking process performs thresholding on the pixel value of each pixel of the image to be masked using a mask, wherein the mask has a set threshold corresponding to each pixel of the input image. A method according to (8)(7), wherein the loss function incorporates a first loss function, the first loss function is based on the difference in pixel values, and the difference in pixel values is based on the difference in pixel values before and after correction. A method according to (9), (7), or (8), wherein the loss function incorporates a fourth loss function, the fourth loss function is based on a threshold difference, the threshold difference is based on the difference between a correction threshold of the corrected mask and the threshold of the mask used in the textile pattern image generation step, and the correction threshold of the corrected mask is set such that when the masking is performed, a pattern image corrected by the correction process of the output pattern image generation step is generated. (10) A method according to any one of (1) to (9), wherein the loss function incorporates a second loss function, the second loss function is based on the inter-pixel distance, the inter-pixel distance is based on the number of pixels between the pixel of interest and the inverted pixel, and the pixel values of the pixels between the pixel of interest and the inverted pixel are different from the pixel values of the inverted pixel. (11) A method according to any one of (1) to (10), wherein the loss function incorporates a third loss function, the third loss function is based on the number of crossovers, and the number of crossovers is based on the number of pairs of pixels whose pixel values are inverted within a predetermined range including the pixel of interest. (12) A method according to any one of (1) to (11), wherein the loss function incorporates a fifth loss function, the fifth loss function is based on autocorrelation, the autocorrelation is based on the number of pixels with different pixel values between pixels in a first image region and pixels in a second image region, the first image region is an image within a predetermined region containing the pixel of interest, and the second image region is a region having the same shape as the first image region and located within a predetermined distance from the first image region. (13) A program that causes a computer to execute one of the image generation methods described in (1) to (12). (14) An image generation device comprising an output pattern image generation unit, wherein the output pattern image generation unit is configured to generate an output pattern image from the woven pattern image by performing a correction process on the woven pattern image using a loss function, wherein each pixel value of the woven pattern image is binarized to one of the first and second pixel values so as to identify the up-down relationship of the warp and weft threads, the value of the loss function is calculated for each pixel, and in the correction process, the pixel in which the value of the loss function decreases before and after the correction becomes the pixel to be corrected, and the pixel value of the pixel to be corrected is inverted from one of the first and second pixel values to the other pixel value. [Brief explanation of the drawing]
[0009] [Figure 1] Figure 1 is a functional block diagram of a textile manufacturing system 100 including an image generation device 1 according to an embodiment. [Figure 2] Figure 2 is a functional block diagram of the output pattern image generation unit 4 shown in Figure 1, illustrating the data flow during variable setting processing. [Figure 3] Figure 3 is a functional block diagram of the output pattern image generation unit 4 shown in Figure 1, illustrating the data flow during correction processing. [Figure 4] Figure 4A is an example of an input image d1. Figure 4B is an example of a textile pattern image d4 generated from the input image d1 shown in Figure 4A. [Figure 5]Figure 5 shows an example of an output pattern image d5 generated from the fabric pattern image d4 shown in Figure 4B. [Figure 6] Figure 6 schematically shows the pixels in the fabric pattern image d4 whose pixel values are inverted when generating the output pattern image d5 shown in Figure 5 from the fabric pattern image d4 shown in Figure 4B. [Figure 7] Figure 7 shows an example of the pixel value (P) of each pixel in the input image, the threshold value (M) of each pixel in the mask (dither mask), and the pixel value (O) of each pixel in the textile pattern image. [Figure 8] Figure 8 illustrates how a reference pattern image dT is generated from a fabric pattern image d4. [Figure 9] Figure 9 is a diagram illustrating how provisional pattern images are sequentially generated from the fabric pattern image d4. [Figure 10] Figure 10 illustrates how the first provisional pattern image dn1 is generated from the fabric pattern image d4. [Figure 11] Figure 11 illustrates how the first difference matrix Sm1 is obtained from the fabric pattern image d4 and the first provisional pattern image dn1. [Figure 12] Figure 12 illustrates how the second difference matrix Sm2 is obtained from the first provisional pattern image dn1 and the second provisional pattern image dn2. [Figure 13] Figure 13A is an explanatory diagram of the data processing of the filter unit 4C during variable setting processing. Figure 13B is an explanatory diagram of the data processing of the filter unit 4C during correction processing. [Figure 14] Figure 14A is a schematic diagram illustrating the significance of the second loss function. Figure 14B schematically shows an image with each pixel binarized and the pixel of interest pt in that image. Figure 14C is an explanatory diagram of the method for calculating the rightward component of the second loss function at the pixel of interest pt shown in Figure 14B. [Figure 15] Figure 15A is a schematic diagram illustrating the significance of the third loss function. Figure 15B shows the number of inversions for each pixel (the number of adjacent pixels with different pixel values). [Figure 16] Figure 16A shows the pixel of interest pt and surrounding pixels p1 to p8 in the fabric pattern image d4. Figure 16B is an explanatory diagram of the method for calculating the value of the fifth loss function at the pixel of interest pt shown in Figure 16A. [Modes for carrying out the invention]
[0010] Embodiments of the present invention will be described below with reference to the drawings. The various features shown in the embodiments below can be combined with each other. Furthermore, each feature constitutes an independent invention.
[0011] Embodiment 1. Overall Structure Description As shown in Figure 1, the textile manufacturing system 100 comprises an image generation device 1, an output device 20, and a textile manufacturing device 30. The image generation device 1 comprises an acquisition unit 2, a textile pattern image generation unit 3, an output pattern image generation unit 4, an output unit 5, and a storage unit 6. The textile pattern image generation unit 3 comprises a preprocessing unit 3A, a matrix generation unit 3B, and a binarization processing unit 3C. Furthermore, the output pattern image generation unit 4 includes a loss function processing unit 4A, a determination unit 4B, a filter unit 4C, and a setting unit 4D. As shown in Figure 2, the loss function processing unit 4A has a first calculation unit 4A1, a second calculation unit 4A2, a third calculation unit 4A3, a fourth calculation unit 4A4, and a fifth calculation unit 4A5. The determination unit 4B has a pixel determination unit 4B1 and an image determination unit 4B2.
[0012] Each of the above components may be implemented by software or by hardware. When implemented by software, various functions can be realized by the CPU executing a computer program. The program may be stored in an internal memory unit or in a computer-readable non-temporary recording medium. Alternatively, the program stored in an external memory unit may be read and implemented by so-called cloud computing. When implemented by hardware, it can be implemented by various circuits such as ASICs, FPGAs, or DRPs. In the first embodiment, various information and concepts encompassing it are handled, which are represented by high and low signal values as a set of binary bits consisting of 0s and 1s, and communication and calculations can be performed by the above-described software or hardware configurations.
[0013] The output device 20 consists of, for example, a device capable of outputting images, such as a monitor or a printer. The user can proceed with the image generation work while visually confirming various images such as the input image d1, the fabric pattern image d4, the reference pattern image dT, and the output pattern image d5, which will be described later, on the output device 20. The textile manufacturing apparatus 30 is configured to weave a fabric based on the output pattern image d5.
[0014] 2. Description of the configuration of the image generation device 1 The image generation device 1 has a first function of generating a fabric pattern image d4 from an input image d1, and a second function of generating an output pattern image d5 from the fabric pattern image d4. The first function is performed by the fabric pattern image generation unit 3, and the second function is performed by the output pattern image generation unit 4.
[0015] The content of the input image d1 shown in Figure 4A is not particularly limited, and various types of digital image data such as photographs and illustrations can be used. The fabric pattern image d4 shown in Figure 4B is image data in which each pixel is binarized and used when weaving fabric in the fabric manufacturing apparatus 30. In this embodiment, the fabric is a jacquard fabric. Jacquard fabrics can produce complex patterns by weaving the weft threads arbitrarily up and down against a large number of parallel warp threads. In the fabric pattern image d4, the up and down relationship between the warp and weft threads is defined by binary data used to identify the up and down relationship at grid points (points where the warp and weft threads intersect). In this embodiment, the fabric pattern image d4 is an image corresponding to the jacquard structure diagram, and the fabric pattern image d4 is a pattern image obtained by binarizing the pre-processed image d2, which will be described later. The binary data indicates whether to expose either the warp or weft threads. The color of the fabric is expressed based on the frequency with which the warp and weft threads are exposed, the colors of the warp and weft threads, etc. The output pattern image d5 shown in Figure 5 is an image generated by applying a correction process to the fabric pattern image d4 using the loss function L described later. The correction process involves inverting the pixel values of some pixels in the fabric pattern image d4. Therefore, the output pattern image d5, like the fabric pattern image d4, is an image corresponding to the jacquard weave diagram, and is also an image in which the pixel values of each pixel have been binarized. In this embodiment, the output pattern image d5 is not necessarily different from the fabric pattern image d4. That is, as a result of applying the correction process to the fabric pattern image d4, the output pattern image d5 often does not match the fabric pattern image d4, but depending on the calculation result of the loss function value, they may match. The output pattern image d5 shown in Figure 5 is obtained by changing (correcting) the pixel values (colors) of the pixels shown in Figure 6 to the fabric pattern image d4 shown in Figure 4.
[0016] 2-1 Acquisition part 2 The acquisition unit 2 is configured to acquire the input image d1 and input data din. The input data din is acquired by the acquisition unit 2 by an input device (not shown), which corresponds to an operation unit such as a mouse or keyboard. Alternatively, the input image d1 may be stored in the storage unit 6 beforehand, and the acquisition unit 2 may acquire the input image d1 from the storage unit 6. The input data din is data used to set weight coefficients, etc., which will be described later, and the setting unit 4D is used for this purpose.
[0017] 2-2 Fabric pattern image generation unit 3 The textile pattern image generation unit 3 is capable of generating a textile pattern image d4 based on the input image d1. In other words, the textile pattern image generation unit 3 has a function (the first function described above) of converting the input image d1 into a format that can be used to weave a textile in the textile manufacturing apparatus 30. This function can employ various publicly known methods (for example, Japanese Patent Application Publication No. 2015-212440). An example of the function of the textile pattern image generation unit 3 will be described below.
[0018] In this embodiment, as an example of generating a textile pattern image d4, we will describe the case in which a halftoning method is used to represent a grayscale image as a binary representation of black and white. Halftoning is a method of representing gradations by utilizing the ratio of the area of black and white pixels within a certain region. In this embodiment, we will also describe the use of a systematic dithering method. In systematic dithering, the image is binarized using a tither mask (textile threshold matrix) with a preset threshold.
[0019] 2-2-1 Pre-processing section 3A The preprocessing unit 3A has the function of converting the input image d1 into, for example, a 256-level grayscale image data. This allows the preprocessing unit 3A to generate a preprocessed image d2, which is a grayscale image data. The number of levels may be predetermined or can be selected by the user as appropriate. In this case, the preprocessing unit 3A can acquire the number of levels from the input device via the acquisition unit 2.
[0020] 2-2-2 Matrix generation unit 3B The matrix generation unit 3B generates a textile threshold matrix (matrix data d3) corresponding to the tither mask. As shown in Figure 7, the textile threshold matrix has pre-set thresholds associated with each pixel of the input image d1 (pre-processed image d2). In other words, the number of rows and columns of the textile threshold matrix corresponds to the size of the input image d1 (pre-processed image d2). The textile threshold matrix is a matrix created so that the image after binarization of the pre-processed image d2 becomes a textile structure (pattern image). For example, the matrix generation unit 3B can create a textile threshold matrix by arranging multiple textile threshold submatrices. The number of rows and columns of the textile threshold submatrices can be arbitrarily determined. Each component in the textile threshold submatrix has a threshold set for binarizing the pre-processed image d2. The thresholds of each component in the textile threshold submatrix can be selected by the user as appropriate. In this case, the matrix generation unit 3B can acquire the thresholds of each component from the input device via the acquisition unit 2.
[0021] 2-3-3 Binarization Processing Unit 3C The binarization processing unit 3C has the function of binarizing the preprocessed image d2 (an example of an image to be masked) using the textile threshold matrix (matrix data d3) created by the matrix generation unit 3B. In other words, the binarization processing unit 3C generates a textile pattern image d4 from the input image d1 (preprocessed image d2) by performing a masking process on the preprocessed image d7 using the textile threshold matrix. If the pixel value of any pixel in the preprocessed image d2 exceeds the threshold of the corresponding component in the textile threshold matrix, this pixel is processed as white (binarized data 1). Also, if the pixel value of any pixel in the preprocessed image d2 is less than the threshold of the corresponding component in the textile threshold matrix, this pixel is processed as black (binarized data 0). If the pixel value of any pixel in the preprocessed image d2 is the same as the threshold of the corresponding component in the textile threshold matrix, this pixel is processed as either black or white. Whether an image is treated as black or white is predetermined in the binarization processing unit 3C.
[0022] 2-3 Output Pattern Image Generation Unit 4 The output pattern image generation unit 4 is configured to perform correction processing on the fabric pattern image d4 using the loss function L and generate an output pattern image d5 from the fabric pattern image d4. The processes executable by the output pattern image generation unit 4 include variable setting processing and the above-described correction processing. After the output pattern image generation unit 4 executes variable setting processing to set variables such as weight coefficients described later, it performs correction processing on the fabric pattern image d4 and finally generates the output pattern image d5.
[0023] · Variable setting processing In the correction processing, pixels for inverting pixel values are appropriately determined based on the loss function L of the following formula (6), and the output pattern image d5 is generated. In this regard, the loss function L has a plurality of variables (such as weight coefficients described later), and the variables are appropriately set for the user in advance in accordance with the user's intention. That is, the variable setting processing is a process for setting a plurality of variables. The variable setting processing includes determination processing 1 described later.
[0024] Specifically, the loss function L of formula (6) is the values L of the first to fifth loss functions according to the following formulas (1) to (5) I ,L J ,L D ,L M ,L C to the sum of the values multiplied by each weight coefficient w I ,w J ,w D ,w M ,w C is represented. Also, in the second loss function, a threshold value d th is used. Regarding the selection of pixels for inverting pixel values, since the user's experience and the like are taken into account, there may be variations. For this reason, in the embodiment, the weight coefficients w I ,w J ,w D ,w M ,w C and the threshold value d thThe user can freely change (set) this. In other words, in this embodiment, the weight coefficient w is adjusted so that the output result of the output pattern image d5 is appropriate according to the user's experience, etc. I ,w J ,w D ,w M ,w C and threshold d th Set and.
[0025] In the variable setting process according to this embodiment, the user can set the weight coefficients, etc., while visually confirming how adjusting them affects the output pattern image d5. In other words, in this embodiment, it is possible to interactively determine the weight coefficients, etc., in accordance with the user's intentions. I ,w J ,w D ,w M ,w C and threshold d th The process of setting this up will be explained in the "Setting Steps" section of "3 Operation Description" below.
[0026]
number
[0027]
number
[0028]
number
[0029]
number
number
number
[0030] • Correction processing In the correction process, the weight coefficient w that was set in the variable setting process is used. I ,w J ,w D ,w M ,w C and threshold d th The value of the loss function L is calculated using this method. In the correction process, the loss function L is calculated for each pixel. In the correction process, pixels whose loss function value decreases before and after correction become the pixels to be corrected. The pixel value of the pixels to be corrected is then inverted. That is, if the pixel value of the pixels to be corrected is 1 (white), it becomes 0 (black), and if it is 0 (black), it becomes 1 (white). Note that one of the pixel values, 1 or 0, is an example of the first pixel value, and the other is an example of the second pixel value. The correction process includes the decision processes 2 and 3 described below.
[0031] In the correction process according to the embodiment, pixels to be corrected (pixels whose pixel values are inverted) are selected sequentially. In other words, in the correction process according to the embodiment, multiple pixels may be corrected, but at each correction, the number of pixels whose pixel values are inverted at one time is one. That is, as shown in Figure 9, a first provisional pattern image dn1 is generated by inverting one pixel value of the fabric pattern image d4, then a second provisional pattern image dn2 is generated by inverting one pixel value of the first provisional pattern image dn1, and so on, and this process is repeated sequentially. In other words, in the correction process, after generating a first provisional pattern image dn1 by inverting one pixel value of the fabric pattern image d4, the Nth provisional pattern image dn N The N+1th provisional pattern image dn obtained by inverting one pixel value. N+1 The process of generating the pattern image is repeated sequentially (N is an integer greater than or equal to 1). Then, when the image determination unit 4B2 decides to use a certain provisional pattern image as the output pattern image d5, that provisional pattern image is output as the final output pattern image d5.
[0032] 2-3-1 Loss Function Processing Unit 4A The loss function processing unit 4A is configured to calculate a value of the loss function L that takes into account multiple loss functions (first to fifth loss functions in the embodiment). The loss function processing unit 4A calculates the loss function L for each pixel (each pixel of interest pt). In the embodiment, any pixel in the image (all pixels in the image) can be a pixel of interest pt, but is not limited to this; only pixels within a predetermined range in the image may be a pixel of interest pt.
[0033] <First Calculation Unit 4A1> The first loss function is a function that brings the brightness of the output pattern image d5 closer to the brightness of the input image d1. However, since the output pattern image d5 has been binarized, if the loss function is calculated as the difference between the pixel values of the input image d1 and the pixel values of the output pattern image d5, the difference may become too large and may not be an effective loss function. For this reason, in this embodiment, the filter unit 4C performs filtering on various images to blur them, and then calculates the difference between the pixel values of the blurred images.
[0034] The first calculation unit 4A1 calculates the value L of the first loss function for each pixel (each pixel of interest pt). I It is configured to be able to calculate the following. The first loss function for each pixel is expressed as in equation (1) and is based on the difference in pixel values. In equation (1), p is the pixel value of the pixel at any coordinate t in image d1f (the pixel of interest, pt). Here, image d1f is the image obtained by filtering the input image d1 with the filter unit 4C. In equation (1), о is the pixel value of a pixel at any coordinate t (the pixel of interest, pt) in the image dtf, etc. Here, "image dtf, etc." refers to image dtf and image dn N f. The image dtf shown in Figure 13A is the image obtained by filtering the inverted pattern image dt with the filter unit 4C during the variable setting process. The image dn shown in Figure 13B N f is the Nth provisional pattern image dn during the correction process. N This is the image after being filtered by the filter section 4C.
[0035] <Second calculation section 4A2> As schematically shown on the left side of Figure 14A, if the threads skip too much, defects are likely to occur in the fabric. Therefore, the second loss function is defined so that the thread skips remain within a certain interval, as schematically shown on the right side of Figure 14A. Note that if the thread skips are small, there is no problem, so a threshold d th Set the distance from the pixel of interest pt to the inverted pixel pt2 to the threshold d. th It is counted as a loss if it is greater than the specified value.
[0036] The second calculation unit 4A2 calculates the value L of the second loss function for each pixel (each pixel of interest pt). J The system is configured to allow the calculation of the second loss function for each pixel, which is expressed as shown in equation (2) and is based on the inter-pixel distance (distance d, described later). Value L using equation (2) J The specific calculation method for value L will be explained. J This is the component max(0,dd) in each direction (up, down, right, left) starting from the pixel of interest pt. th It is expressed as the sum of ). Here, threshold d th is a positive integer. Furthermore, the distance d corresponds to the number of pixels between the pixel of interest pt and the inverted pixel pt2. Here, the inverted pixel pt2 is the first pixel whose pixel value is inverted relative to the adjacent pixel pt1 in each direction starting from the adjacent pixel pt1 of the pixel of interest pt. Note that the pixel values between the pixel of interest pt and the inverted pixel pt2 are different from the pixel values of the inverted pixel pt2.
[0037] As an example, the method for calculating the rightward component will be explained with reference to Figure 14C. Here, the threshold d th Assume that is 3. The distance d(t,→) is the number of pixels between the pixel of interest pt and the inverted pixel pt2, so it is 5. Therefore, the rightward component is max(0,5-3)=max(0,2)=2. Using the same method, the upward, downward, and leftward components are calculated, and the value of the second loss function L is obtained from the sum of these. J You can obtain it.
[0038] <Third Calculation Unit 4A3> As schematically shown on the left side of Figure 15A, too many intersections in the threads cause a problem where the fabric becomes stiff when woven. Therefore, the third loss function is defined to reduce the number of intersections, as schematically shown on the right side of Figure 15A. In other words, as shown in Figure 15B, the third loss function counts the number of pixel inversions within a predetermined range Rg that includes the pixel of interest pt as a loss. The predetermined range Rg can be set as appropriate.
[0039] The third calculation unit 4A3 calculates the value L of the third loss function for each pixel (each pixel of interest pt). D The system is configured to allow for the calculation of the following. The third loss function for each pixel is expressed as shown in equation (3) and is based on the number of times the threads (warp and weft) cross. Value L using equation (3) D The specific calculation method for is explained below. In equation (3), o is the pixel value of the pixel at any coordinate t in the pattern image (the pixel of interest pt). Also in equation (3), (1,0) and (0,1) correspond to the adjacent directions of the pixel of interest pt (up and left in this embodiment), and N(t) corresponds to a predetermined range Rg around the pixel of interest pt.
[0040] As an example, the value L of an arbitrary pixel (the pixel of interest, pt) D The calculation method is explained below. As shown in Figure 15B, the number of inverted pixels adjacent to the pixel of interest pt in the upward and leftward directions is calculated. Specifically, the pixel ptx adjacent to the left of the pixel of interest pt and the pixel pty adjacent to the upward direction have pixel values that are inverted with respect to the pixel value of the pixel of interest pt, and therefore both are inverted pixels. For this reason, the number of inverted pixels for the pixel of interest pt is 2. In the same manner, the number of inverted pixels is calculated for pixels other than the pixel of interest pt, within a predetermined range Rg. The value of the pixel of interest pt L D Rg is the sum of the inversion numbers within a predetermined range Rg, and in the example in Figure 15B, it is 1+0+1+1+2+0+1+2+0=8.
[0041] <Fourth Calculation Unit 4A4> Correcting the textile pattern image and changing the pixel values corresponds to changing (correcting) the dither mask threshold. Here, since the dither mask is created reflecting the experience of the craftsman, it is considered undesirable for the dither mask to change significantly. Therefore, the fourth loss function counts as a loss when the dither mask corresponding to the pattern image obtained by correcting the textile pattern image deviates from the dither mask used by the textile pattern image generation unit 3.
[0042] The fourth calculation unit 4A4 calculates the value L of the fourth loss function for each pixel (each pixel of interest pt). M It is configured to be able to calculate the fourth loss function for each pixel, which is expressed as in equation (4) and is based on the threshold difference. The threshold difference for the pixel of interest (pt) is the difference between the correction threshold corresponding to the pixel of interest (pt) in the corrected dither mask (an example of the corrected mask) (corresponding to M in equation (4)) and the threshold corresponding to the pixel of interest (pt) in the dither mask used by the textile pattern image generation unit 3 (corresponding to m in equation (4)).
[0043] The corrected dither mask is a dither mask that generates a pattern image obtained by inverting (correcting) the pixel values of the textile pattern image d4. The fourth calculation unit 4A4 receives the dither mask used by the textile pattern image generation unit 3 from the textile pattern image generation unit 3. The fourth calculation unit 4A4 also receives the inverted pattern image dt in the variable setting process and the Nth provisional pattern image dn in the correction process. N Based on this, it is configured to generate a corrected dither mask.
[0044] <5th Calculation Unit 4A5> The fabric patterns (fabric pattern images) generated by dither masking are often regular, neat, and visually pleasing. If the corrected pattern image deviates from the original fabric pattern image, the regularity within the image is lost, increasing the likelihood that it will no longer be in line with the craftsman's experience, etc. Therefore, the loss of regularity is counted as a loss.
[0045] The fifth calculation unit 4A5 calculates the value L of the fifth loss function for each pixel (each pixel of interest pt). C It is configured to be able to calculate the fifth loss function for each pixel, which is expressed as shown in equation (5) and is based on the autocorrelation.
[0046] Value L using equation (5) C The specific calculation method will be explained with reference to Figures 16A and 16B. The autocorrelation is based on the number of pixels with different values between the pixels in the first image region Art and the pixels in the second image region Ar1 to Ar8. In Figure 16A, the first image region Art is an image within a predetermined region containing the pixel of interest pt (an image consisting of the pixel of interest pt, surrounding pixels p5, p7, and p8). In equation (5), N(t) defines the predetermined range surrounding the pixel of interest pt. In Figure 16A, the second image region Ar1 to Ar8 is a region with the same shape as the first image region and is located within a predetermined distance from the first image region. Note that in equation (5) [-w x ,w x ]×[-w y ,w y ] defines a predetermined distance. [-w x ,w x ] is the horizontal distance relative to the pixel of interest pt, [-w y ,w y ] refers to the vertical distance relative to the pixel of interest pt. In the examples in Figures 16A and 16B, w x and w y The value is 1. The predetermined size of the first image region Art, and the predetermined distances between the first image region Art and the second image regions Ar1 to Ar8, can be set as appropriate.
[0047] For example, in Figure 16B, eight numbers can be calculated, such as the number of pixels with different pixel values between the first image region Art and the second image region Ar1, the number of pixels with different pixel values between the first image region Art and the second image region Ar2, ..., the number of pixels with different pixel values between the first image region Art and the second image region Ar8. Here, the number of pixels in the first image region Art with different pixel values from those in the second image region Ar1 is 4. Also, the number of pixels in the first image region Art with different pixel values from those in the second image region Ar2 is 3. Similarly, the remaining 6 can be calculated. The value L in equation (5) C This is the smallest of these eight numbers.
[0048] 2-3-2 Decision section 4B <Pixel determination unit 4B1> During the variable determination process, the pixel determination unit 4B1 is configured to determine which pixels to highlight from among the pixels in the binarized pattern image based on the value of the loss function shown in equation (6). The method for determining which pixels to highlight is as described in determination process 1 below. During the correction process, the pixel determination unit 4B1 is configured to determine which pixels in the pattern image, whose pixel values have been binarized, will have their pixel values inverted (corrected) based on the value of the loss function shown in equation (6). The method for determining the target pixels for the first inversion is as described in determination process 2 below, and the method for determining the target pixels for the second and subsequent inversions is as described in determination process 3 below.
[0049] • Decision process 1: Variable setting process The pixel determination unit 4B1 calculates the difference in the value of the loss function before and after (before and after correction) inverting the pixel value of an arbitrary pixel (the pixel of interest pt). Here, regarding the variable determination process, we will explain using the pixel located in the upper left corner shown in Figure 8 (referred to here as the "pixel in question") as an example.
[0050] The pixel determination unit 4B1 receives the input data din, and therefore the weight coefficient w I ,w J,w D ,w M ,w C The weight coefficient w is set. I ,w J ,w D ,w M ,w C This is a provisional setting and can be adjusted by the user. The pixel determination unit 4B1 then calculates the value L1 of the loss function for the pixel (see Figure 8) based on equation (6). This value L1 corresponds to the value of the loss function for the pixel before correction and can be calculated from equation (6).
[0051] Next, an image (corrected pattern image) is generated by inverting the pixel value of the pixel in question in the fabric pattern image d4. The pixel determination unit 4B1 calculates the value L1t of the loss function of the pixel in question (see Figure 8) based on equation (6). The value L1t corresponds to the value of the corrected loss function of the pixel in question and can be calculated from equation (6). Furthermore, the pixel determination unit 4B1 calculates the difference between the corrected loss function value L1t of the pixel and the uncorrected loss function value L1 of the pixel. The magnitude of this difference in loss function L is used to determine whether or not to highlight the pixel during the variable determination process.
[0052] The above explanation concerned the pixel located in the upper left corner, but the difference in the loss function L is calculated similarly for the remaining pixels. As an example, we will explain the case where the calculation is performed for the pixel to the right of the pixel in question. The pixel determination unit 4B1 calculates the loss function value L2 of the pixel to the right of the current pixel based on equation (6). An image (corrected pattern image) is also generated by inverting the pixel value of the pixel to the right of the current pixel in the fabric pattern image d4. The pixel determination unit 4B1 calculates the loss function value L2t of the pixel to the right of the current pixel in the corrected pattern image based on equation (6). Then, the pixel determination unit 4B1 calculates the difference between the value L2t and the value L2.
[0053] During the variable determination process, the difference in the loss function L (values of the 1st to 5th loss functions L) is used. I ,LJ ,L D ,L M ,L C All pixels whose sum difference (the difference between the sums of the pixels) is greater than a predetermined threshold (an example of a loss function threshold) are determined to be target pixels (pixels that will be highlighted). In other words, these target pixels will be highlighted (see Figure 8). In the variable determination process, all pixels greater than a predetermined threshold are designated as target pixels so that users can understand the trend of pixels that are inverted by adjusting the values of variables such as weight coefficients and see how the variables are affecting the result.
[0054] • Decision processing 2: First inversion during correction processing At the start of the correction process, the weight coefficient w I ,w J ,w D ,w M ,w C Variables such as have been determined. The process for calculating the difference in the loss function L is the same as in determination process 1. That is, as shown in Figure 10, the pixel determination unit 4B1 calculates the value L1 of the loss function for the pixel based on equation (6). This value L1 corresponds to the value of the loss function for the pixel before correction and can be calculated from equation (6).
[0055] Next, an image (corrected pattern image) is generated by inverting the pixel value of the pixel in question in the fabric pattern image d4. The pixel determination unit 4B1 calculates the value L1t of the loss function of the pixel in question (see Figure 10) based on equation (6). The value L1t corresponds to the value of the corrected loss function of the pixel in question and can be calculated from equation (6). Furthermore, the pixel determination unit 4B1 calculates the difference between the corrected loss function value L1t for the pixel in question and the uncorrected loss function value L1 for the pixel in question. The magnitude of this difference in loss function L is used to determine whether or not to invert the pixel value during the first inversion in the correction process. The above explanation concerns the pixel located in the upper left corner, but the difference in loss function L is calculated similarly for the remaining pixels.
[0056] During the first inversion in the correction process, only the pixel with the largest difference in the loss function L (an example of a loss function threshold) is determined to be the target pixel (the pixel to be inverted). In other words, only the pixel value of this target pixel is inverted (see Figure 10). The larger the difference in the loss function L, the more the value of the loss function L can be reduced by inverting the pixel value of the pixel. Therefore, inverting the pixel value in question is likely to align with the modification work of textile patterns by artisans and designers. In other words, for pixels where the difference in the loss function L is greater than a predetermined threshold, the pixel determination unit 4B1 determines that the pixel value should be inverted because it is in line with the modification work of textile patterns by artisans and designers.
[0057] As shown in Figure 10, during the first inversion in the correction process, the pixel value of one pixel in the fabric pattern image d4 is inverted (corrected). The pattern image in which the pixel value of one pixel in the fabric pattern image d4 has been inverted is defined as the first provisional pattern image dn1. "Provisional" means that it has not yet been determined whether this pattern image will become the final output pattern image d5. In decision processing 2, the fabric pattern image d4 and the first provisional pattern image dn1 are examples of the pattern image before correction and the pattern image after correction.
[0058] • Decision processing 3: Second and subsequent inversions during correction processing As shown in Figure 11, the value of the loss function L for each pixel in the first provisional pattern image dn1 is updated. In other words, during the first inversion in the correction process, the value of the loss function for each pixel is calculated assuming that the pixel value of each pixel is inverted. However, since the pixels to be inverted are determined in the first inversion, for the second and subsequent inversions, the loss function L for each pixel is recalculated so that the pixels to be inverted can be determined more appropriately. In Figure 11, the updated value of the loss function is shown as L1'. Then, as shown in FIG. 11, the pixel determination unit 4B1 calculates a difference S1 between the value L1' of the loss function after correction of the pixel and the value L1 of the loss function before correction of the pixel. Similarly, for the other remaining pixels, a difference SN (where N is 2 to 100) of the loss function L is calculated. In the first difference matrix Sm1 shown in FIG. 11, the difference SN of each pixel is specified.
[0059] The pixel (refer to pixel ptr in FIG. 11) for which the pixel determination unit 4B1 reverses the pixel value is the pixel that is larger than a predetermined threshold (an example of a loss function threshold) among the differences SN of the loss function L and has the largest value. By reversing the pixel value by the pixel determination unit 4B1, a second provisional pattern image dn2 is generated. By providing a predetermined threshold, the convergence of the iterative operation for sequentially generating the provisional pattern images in the correction process can be ensured.
[0060] The pixel determination unit 4B1 calculates the loss function of each pixel for the generated second provisional pattern image dn2. In FIG. 12, for example, the value of the loss function of the pixel located at the upper left corner is shown as L1''. The pixel determination unit 4B1 can calculate the difference S1' in the second difference matrix Sm2 using the value L1' of the loss function of the first provisional pattern image dn1 and the value L1'' of the loss function of the generated second provisional pattern image dn2. For the other pixels, the difference SN is calculated in the same manner to complete the second difference matrix Sm2. And the pixel (refer to pixel ptr in FIG. 12) for which the pixel determination unit 4B1 reverses the pixel value is the pixel that is larger than a predetermined threshold among the differences SN (N is 1 to 100) of the loss function L and has the largest value. By repeating the above, the Nth provisional pattern image dn N is sequentially generated. In the determination process 3, the Nth provisional pattern image dn N is the N - 1th provisional pattern image dn N-1 is an example of the pre-correction pattern image and the post-correction pattern image.
[0061] Incidentally, in the process of repeatedly generating the provisional pattern image sequentially, the value of the loss function L for pixels that have already been inverted may increase again. In such a case, the pixels that have already been inverted may be targeted for inversion again. Therefore, if no limit is set on the number of times a pixel can be inverted, the correction process may be less likely to converge. Thus, in the embodiment, the number of times a single pixel can be inverted within the correction process is set to a predetermined number of times, and the number of inversion times is not allowed to exceed the predetermined number of times. That is, the pixel determination unit 4B1 excludes pixels whose number of inversion times has reached the predetermined number of times from the pixels to be inverted. The predetermined number of times is specifically, for example, 2, 3, 4, 5, 6, or 7 times, and may also be within the range between any two of the numerical values exemplified here.
[0062] <Image determination unit 4B2> The image determination unit 4B2 is configured to determine the pattern image to be generated based on the data (coordinates and pixel values) of the pixels to be inverted and output the determined pattern image.
[0063] During the variable setting process, the image determination unit 4B2 generates an inverted pattern image dt. The inverted pattern image dt is generated from the fabric pattern image d4. If the fabric pattern image d4 has, for example, 100 pixels, there will be 100 types of inverted pattern images dt. The image determination unit 4B2 outputs each inverted pattern image dt to the filter unit 4C and the loss function processing unit 4A. Each inverted pattern image dt output to the filter unit 4C will be utilized for calculating the value of the first loss function L I Also, each inverted pattern image dt output to the loss function processing unit 4A is for calculating the values of the first to fifth loss functions L I , L J , L D , L M , L C will be utilized. Also, during the variable setting process, the pixel determination unit 4B1 calculates the difference of the loss function L (the values of the first to fifth loss functions L I , L J , L D , LM ,L C All pixels whose sum difference is greater than a predetermined threshold are determined to be inverted pixels. The image determination unit 4B2 generates a reference pattern image dT in which the inverted pixels are highlighted and outputs it to the output unit 5. The reference pattern image dT is an image in which the inverted pixels are highlighted so as to be superimposed on the fabric pattern image d4 (see Figure 8).
[0064] During the correction process, the image determination unit 4B2 determines the Nth provisional pattern image dn based on the data of the pixels that the pixel determination unit 4B1 has decided to invert (e.g., coordinates and pixel values). N The first provisional pattern image dn1 is generated from the textile pattern image d4. The Nth provisional pattern image dn N This is the N-1 provisional pattern image dn N-1 It is generated from the above. Furthermore, if the pixel determination unit 4B1 determines that there are no differences in the loss function L SN that are greater than a predetermined threshold, the image determination unit 4B2 determines the provisional pattern image generated last (in the final iteration) as the output pattern image d5 and outputs it to the output unit 5.
[0065] 2-3-3 Filter section 4C The filter unit 4C is configured to apply filtering to various pattern images received. In this embodiment, the filter unit 4C employs a Gaussian filter, which makes it possible to blur various pattern images.
[0066] 2-3-4 Setting section 4D The setting unit 4D is configured to accept input data din, and based on the input data din, the setting unit 4D sets a weight coefficient w I ,w J ,w D ,w M ,w C and threshold d thThe system is configured to output setting data dp for setting the value of to the determination unit 4B. During the variable setting process, the setting unit 4D accepts input data din as needed. Therefore, in response to the user changing the input data din, the weight coefficient w I ,w J ,w D ,w M ,w C and threshold d th The value is changed. This causes the pixels highlighted in the reference pattern image dT to change in real time.
[0067] 2-4 Output section 5 The output unit 5 is configured to output various images, such as the input image d1, the fabric pattern image d4, and the output pattern image d5, to the output device 20. Furthermore, the output unit 5 is configured to output the output pattern image d5 to the fabric manufacturing device 30.
[0068] 2-5 Storage section 6 The memory unit 6 has the function of storing various types of data. For example, the memory unit 6 stores various types of data such as the input image d1, the textile threshold matrix used in the textile pattern image generation unit 3, and the loss function used in the output pattern image generation unit 4. The various types of data stored in the memory unit 6 are read out by the textile pattern image generation unit 3 and the output pattern image generation unit 4.
[0069] 3. Operation Description The image generation method of the image generation apparatus 1 according to the embodiment comprises an input image acquisition step, a textile pattern image generation step, a weight coefficient setting step, and an output pattern image generation step.
[0070] 3-1 Input Image Acquisition Step In the input image acquisition step, the acquisition unit 2 acquires the input image d1. The acquisition unit 2 may acquire the input image d1 from an external device of the image generation device 1, or it may acquire the input image d1 from the storage unit 6.
[0071] 3-2 Textile Pattern Image Generation Step In the textile pattern image generation step, the textile pattern image generation unit 3 generates a textile pattern image d4 from the input image d1 by performing threshold processing using a mask. Specifically, the preprocessing unit 3A generates a preprocessed image d2, which is a 256-level grayscale image data, from the input image d1. Then, the binarization processing unit 3C uses the textile threshold matrix (matrix data d3) received from the matrix generation unit 3B to binarize the preprocessed image d2 and generate a textile pattern image d4.
[0072] 3-3 Setup Steps The setup step takes place after the fabric pattern image generation step and before the output pattern image generation step. In the setup step, the setup unit 4D receives input data din from an input device operated by the user. The input data din is the weight coefficient w of the first to fifth loss functions. I ,w J ,w D ,w M ,w C or the second loss function L J threshold d th This data is used to set variables such as the above. In the setting step, the setting unit 4D outputs the setting values (setting data dp) for these variables to the pixel determination unit 4B1 based on the input data din. In the setting step, the setting unit 4D is configured to accept the input data din as needed and output the corresponding setting data dp.
[0073] In the setup step, the pixel determination unit 4B1 executes the above-described variable determination process according to the received input data din. That is, the pixel determination unit 4B1 executes the above-described determination process 1 to determine the target pixels to be emphasized, and the image determination unit 4B2 generates a reference pattern image dT. When the input data din is changed, the pixels to be emphasized in the reference pattern image dT are changed in real time. This allows the user to adjust the weight coefficient w I ,w J ,w D ,w M ,w C and threshold dth By adjusting this, it becomes possible to understand the tendencies of how it affects the correction process in the output pattern image generation step. In other words, the user can refer to the reference pattern image dT and use the weight coefficient w in the subsequent correction process. I ,w J ,w D ,w M ,w C and threshold d th This can be determined. In the setting step, when the user determines the final input data din, the setting unit 4D outputs the corresponding setting data dp, and the control according to the embodiment proceeds to the output pattern image generation step.
[0074] 3-5 Output Pattern Image Generation Step In the first inversion step of the output pattern image generation process, the pixel determination unit 4B1 performs the determination process 2 described above to calculate the value of the loss function L and determines the target pixels whose pixel values will be inverted, and the image determination unit 4B2 generates the first provisional pattern image dn1. Next, in the second and subsequent inversions of the output pattern image generation step, the pixel determination unit 4B1 sequentially executes the determination process 3 described above to sequentially calculate the value of the loss function L and sequentially determines the target pixels to be inverted, and the image determination unit 4B2 generates the Nth provisional pattern image dn N The following are generated sequentially (where N is an integer greater than or equal to 2). Then, if the pixel determination unit 4B1 determines that there are no differences in the loss function L that are greater than a predetermined threshold, the image determination unit 4B2 determines the last generated provisional pattern image as the output pattern image d5 and outputs it to the output unit 5.
[0075] In this way, calculating a loss function each time a provisional pattern image is generated and sequentially generating new provisional pattern images corresponds to how craftsmen and designers modify the textile pattern starting from the most prominent pixels. In other words, the processing of this embodiment is closer to the human process of modifying textile patterns, and it is expected to have the effect of making it easier to bring the final output pattern image d5 closer to the intentions of the craftsman or designer. Traditionally, artisans and designers have modified textile patterns by imagining the finished product from a binarized textile pattern image, or by actually performing test weaving. This requires considering factors such as thread tension and thread color balance, demanding skill and experience from the worker and often increasing the working time. On the other hand, the image generation method according to this embodiment can automatically perform the above-mentioned modifications, making it easy to remove any defects that may be inherent in the textile pattern image d4. This is expected to reduce the required level of skill and experience from the worker and to reduce working time.
[0076] 5 Other Embodiments In the embodiment, the loss function L was described as taking into account the first to fifth loss functions, but it is not limited to this. For example, the loss function L may take into account at least two of the first to fifth loss functions. Also, although it will not be possible to adjust the weight coefficients, the loss function L may consist of only one of the first to fifth loss functions. In this embodiment, the fabric pattern image generation unit 3 and the output pattern image generation unit 4 are described as being mounted in a single device, but the invention is not limited to this. For example, the image generation device 1 may have an output pattern image generation unit 4 but not a fabric pattern image generation unit 3. In this case, the fabric pattern image generation unit 3 is mounted in a separate device from the image generation device 1, and the image generation device 1 can obtain the fabric pattern image d4, etc., from this separate device. In this embodiment, it is optional whether the image generation device 1 includes a preprocessing unit 3A. For example, if the input image d1 is grayscale image data, the image generation device 1 does not need to include a preprocessing unit 3A, in which case the input image d1 is the image to be masked. • The predetermined threshold used in decision-making process 1 of the variable setting process (an example of a loss function threshold) was explained as being the same as the predetermined threshold used in decision-making processes 1 and 2 of the correction process, but it may be different. [Explanation of symbols]
[0077] 1: Image generation device 2: Acquisition part 3: Textile pattern image generation unit 3A: Pre-processing section 3B: Matrix generation unit 3C: Binarization Processing Unit 4: Output pattern image generation unit 4A: Loss function processing section 4A1: First Calculation Unit 4A2: 2nd calculation section 4A3: Third Calculation Unit 4A4: 4th Calculation Unit 4A5: Fifth Calculation Unit 4B: Decision section 4B1: Pixel determination unit 4B2: Image determination unit 4C: Filter section 4D: Setting section 5: Output section 6: Storage section 20: Output device 30: Textile manufacturing equipment 100: Textile manufacturing system
Claims
1. A computer-based image generation method, The output pattern image generation step is included, In the output pattern image generation step, an output pattern image is generated from the fabric pattern image by applying a correction process to the fabric pattern image using a loss function. Each pixel value of the aforementioned fabric pattern image is binarized to one of the first and second pixel values so that the vertical relationship between the warp and weft threads can be identified. The value of the loss function is calculated for each pixel. In the correction process described above, pixels whose loss function value decreases before and after the correction become the pixels to be corrected. An image generation method in which the pixel value of the pixel to be corrected is inverted from one of the first and second pixel values to the other pixel value.
2. The method according to claim 1, The correction process repeatedly generates a corrected pattern image from the pre-correction pattern image. The corrected pattern image is an image in which the pixel values of the pixels to be corrected in the pre-correction pattern image have been inverted. In the first iteration of the correction process, the pre-correction pattern image is the fabric pattern image. A method wherein, in the final iteration of the correction process, the corrected pattern image is the output pattern image.
3. The method according to claim 2, In the correction process, the pixels to be corrected are those where the difference in the value of the loss function before and after the correction is greater than the loss function threshold. The correction process is repeated until there are no pixels where the difference in the value of the loss function is greater than the loss function threshold.
4. A method according to any one of claims 1 to 3, The method wherein the pixel to be corrected in the correction process is the pixel with the largest difference in the value of the loss function before and after the correction.
5. The method according to claim 1, With additional setup steps, In the correction process of the output pattern image generation step, multiple loss functions are used. The value of each loss function is calculated for each pixel. The setting step is performed before the output pattern image generation step, and in the setting step, the weight coefficients of each loss function can be set. In the correction process of the output pattern image generation step, the pixel that decreases in the sum of the values of the multiple loss functions before and after the correction is the pixel to be corrected.
6. The method according to claim 5, The setting step involves highlighting pixels in which, when the pixel value of a pixel of interest in the textile pattern image is inverted, the difference in the sum of the values of the plurality of loss functions is greater than the loss function threshold.
7. A method according to any one of claims 1 to 3, 5, or 6, The system further comprises an input image acquisition step and a textile pattern image generation step. In the input image acquisition step, the input image is acquired, In the above fabric pattern image generation step, the fabric pattern image is generated from the input image by performing a masking process. In the masking process, thresholding is performed on the pixel value of each pixel of the image to be masked using the mask. The method wherein the mask has pre-set thresholds associated with each pixel of the input image.
8. The method according to claim 7, The aforementioned loss function incorporates the first loss function, The first loss function is based on the difference in pixel values. The method wherein the aforementioned pixel value difference is based on the difference in pixel values before and after correction.
9. The method according to claim 7, The aforementioned loss function incorporates a fourth loss function. The fourth loss function is based on the threshold difference. The threshold difference is based on the difference between the correction threshold of the corrected mask and the threshold of the mask used in the fabric pattern image generation step. The correction threshold of the corrected mask is set such that when the masking process is performed, a pattern image corrected in the correction process of the output pattern image generation step is generated.
10. A method according to any one of claims 1 to 3, 5, or 6, The aforementioned loss function incorporates a second loss function. The second loss function is based on the distance between pixels. The aforementioned inter-pixel distance is based on the number of pixels between the pixel of interest and the inverted pixel. A method wherein the pixel value of a pixel located between the pixel of interest and the inverted pixel is different from the pixel value of the inverted pixel.
11. A method according to any one of claims 1 to 3, 5, or 6, The aforementioned loss function incorporates a third loss function. The third loss function is based on the number of crossovers. The method wherein the number of intersections is based on the number of pairs of pixels whose pixel values are inverted within a predetermined range that includes the pixel of interest.
12. A method according to any one of claims 1 to 3, 5, or 6, The aforementioned loss function incorporates a fifth loss function. The fifth loss function is based on autocorrelation, The autocorrelation is based on the number of pixels with different pixel values between the pixels in the first image region and the pixels in the second image region. The first image region is an image within a predetermined region that includes the pixel of interest. A method wherein the second image region is a region having the same shape as the first image region and located within a predetermined distance from the first image region.
13. A program for causing a computer to execute the image generation method described in any one of claims 1 to 3, 5, or 6.
14. It includes an output pattern image generation unit, The output pattern image generation unit is configured to generate an output pattern image from the fabric pattern image by performing a correction process on the fabric pattern image using a loss function. Each pixel value of the aforementioned fabric pattern image is binarized to one of the first and second pixel values so that the vertical relationship between the warp and weft threads can be identified. The value of the loss function is calculated for each pixel. In the correction process described above, pixels whose loss function value decreases before and after the correction become the pixels to be corrected. An image generating device in which the pixel value of the pixel to be corrected is inverted from one of the first and second pixel values to the other pixel value.