JP2024000704A - Image generation method, program, and image generation device - Google Patents

Image generation method, program, and image generation device Download PDF

Info

Publication number
JP2024000704A
JP2024000704A JP2022099559A JP2022099559A JP2024000704A JP 2024000704 A JP2024000704 A JP 2024000704A JP 2022099559 A JP2022099559 A JP 2022099559A JP 2022099559 A JP2022099559 A JP 2022099559A JP 2024000704 A JP2024000704 A JP 2024000704A
Authority
JP
Japan
Prior art keywords
pixel
pattern image
loss function
image
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2022099559A
Other languages
Japanese (ja)
Inventor
正広 豊浦
Masahiro Toyoura
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
University of Yamanashi NUC
Original Assignee
University of Yamanashi NUC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by University of Yamanashi NUC filed Critical University of Yamanashi NUC
Priority to JP2022099559A priority Critical patent/JP2024000704A/en
Publication of JP2024000704A publication Critical patent/JP2024000704A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide an image generation method capable of easily removing a trouble which may be inherent in a fabric pattern image, a program, and an image generation device.
SOLUTION: There is provided an image processing method including an output pattern image generation step. The output pattern image generation step generates an output pattern image from a fabric pattern image by correcting the fabric pattern image using a loss function. Each pixel value of the fabric pattern image is binarized to a first or a second pixel value so that a hierarchical relationship between warp and weft is identified. A value of the loss function is calculated per pixel. In correction processing, a pixel in which the value of the loss function decreases before and after correction serves as a pixel to be corrected. A pixel value of the pixel to be corrected is reversed from one of the first and second pixel values to the other pixel value.
SELECTED DRAWING: Figure 1
COPYRIGHT: (C)2024,JPO&INPIT

Description

本発明は、画像生成方法、プログラム及び画像生成装置に関する。 The present invention relates to an image generation method, a program, and an image generation device.

織物は、経糸と緯糸を上下させて織ることで模様が表現される。そして、経糸と緯糸を組み合わせて平織や綾織等の基本組織で形成した模様は、織物パターンと呼ばれる。この織物パターンのデザインは、職人により手作業で行われていたため、写真やイラスト等のデジタルデータ(入力画像)を用いて織物のデザインを可能とした技術が提案されている(非特許文献1参照)。非特許文献1に記載の技術では、ディザマスクを用いて入力画像の各画素の画素値を二値化し、織物パターン(織物パターン画像)を半自動的に生成することを可能としている。なお、二値化された各画素は、経糸及び緯糸の格子点に対応しており、経糸と緯糸の表裏の関係を特定している。 The patterns of textiles are expressed by weaving the warp and weft up and down. A pattern formed by combining warp and weft yarns to form a basic weave such as plain weave or twill weave is called a textile pattern. Since the design of this textile pattern was done manually by craftsmen, a technology has been proposed that makes it possible to design textiles using digital data (input images) such as photographs and illustrations (see Non-Patent Document 1). ). The technique described in Non-Patent Document 1 uses a dither mask to binarize the pixel value of each pixel of an input image, making it possible to semi-automatically generate a textile pattern (textile pattern image). Note that each binarized pixel corresponds to a grid point of the warp and weft, and specifies the relationship between the front and back of the warp and weft.

M. Toyoura et al., "Generating Jacquard Fabric Pattern with Visual Impressions," IEEE Trans. Industrial Informatics, Vol.15, No.8, pp.4536-4544 (2019)M. Toyoura et al., "Generating Jacquard Fabric Pattern with Visual Impressions," IEEE Trans. Industrial Informatics, Vol.15, No.8, pp.4536-4544 (2019)

非特許文献1における織物パターン(織物パターン画像)を用いて実際に織物を製造すると、織物パターン自体に起因する不具合が織物に発生する場合がある。このような不具合を取り除くには、織物バターンを目視し、不具合を生じさせ得る画素を見極めて適宜反転させる等の作業が必要となる。 When fabrics are actually manufactured using the fabric patterns (textile pattern images) in Non-Patent Document 1, defects caused by the fabric patterns themselves may occur in the fabrics. In order to eliminate such defects, it is necessary to visually observe the fabric pattern, identify pixels that may cause defects, and invert the pixels as appropriate.

本発明はこのような事情に鑑みてなされたものであり、織物パターン画像に内在する可能性がある不具合を取り除くことを容易にする、画像生成方法、プログラム及び画像生成装置を提供することを目的としている。 The present invention has been made in view of the above circumstances, and an object of the present invention is to provide an image generation method, a program, and an image generation device that facilitate the removal of defects that may be inherent in textile pattern images. It is said that

本発明によれば、出力パターン画像生成ステップを備え、前記出力パターン画像生成ステップでは、損失関数を用いて織物パターン画像に補正処理を行うことで、前記織物パターン画像から出力パターン画像を生成し、前記織物パターン画像の各画素値は、経糸及び緯糸の上下関係が特定されるように第1及び第2画素値のうちの一方の画素値に二値化され、前記損失関数の値は、画素ごとに算出され、前記補正処理では、補正前後において前記損失関数の値が低下する画素が、補正対象の画素となり、前記補正対象の画素の画素値は、第1及び第2画素値のうちの一方の画素値から他方の画素値へ反転される、画像生成方法が提供される。 According to the present invention, the present invention includes an output pattern image generation step, in which the output pattern image is generated from the fabric pattern image by performing a correction process on the fabric pattern image using a loss function, Each pixel value of the textile pattern image is binarized into one of the first and second pixel values so that the vertical relationship between the warp and weft is specified, and the value of the loss function is In the correction processing, the pixel whose 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 the pixel value of the first and second pixel values. An image generation method is provided in which one pixel value is inverted to another.

本発明によれば、出力パターン画像生成ステップにおいて、損失関数を用いて織物パターン画像に補正処理を行うことで出力パターン画像を生成することができる。つまり、作業者による目視や技術・経験に頼らなくても、不具合が取り除かれた出力パターン画像を生成することができ、不具合を取り除くことが容易になっている。 According to the present invention, in the output pattern image generation step, the output pattern image can be generated by performing correction processing on the textile pattern image using a loss function. In other words, it is possible to generate an output pattern image in which defects have been removed without relying on the operator's visual observation or skill/experience, making it easy to remove defects.

以下、本発明の種々の実施形態を例示する。以下に示す実施形態は互いに組み合わせ可能である。
(1)出力パターン画像生成ステップを備え、前記出力パターン画像生成ステップでは、損失関数を用いて織物パターン画像に補正処理を行うことで、前記織物パターン画像から出力パターン画像を生成し、前記織物パターン画像の各画素値は、経糸及び緯糸の上下関係が特定されるように第1及び第2画素値のうちの一方の画素値に二値化され、前記損失関数の値は、画素ごとに算出され、前記補正処理では、補正前後において前記損失関数の値が低下する画素が、補正対象の画素となり、前記補正対象の画素の画素値は、第1及び第2画素値のうちの一方の画素値から他方の画素値へ反転される、画像生成方法。
(2)(1)に記載の方法であって、前記補正処理は、補正前パターン画像から補正後パターン画像を生成することを繰り返し、前記補正後パターン画像は、前記補正前パターン画像うち前記補正対象の画素の画素値が反転した画像であり、繰り返しの初回の前記補正処理では、前記補正前パターン画像が前記織物パターン画像であり、繰り返しの最終回の前記補正処理では、前記補正後パターン画像が前記出力パターン画像である、方法。
(3)(2)に記載の方法であって、前記補正処理における前記補正対象の画素は、補正前後における前記損失関数の値の差分が損失関数閾値より大きく、前記補正処理は、前記損失関数の値の差分が前記損失関数閾値より大きい画素がなくなるまで繰り返す、方法。
(4)(1)~(3)の何れか1つに記載の方法であって、前記補正処理における前記補正対象の画素は、補正前後における前記損失関数の値の差分が最大の画素である、方法。
(5)(1)に記載の方法であって、設定ステップを更に備え、前記出力パターン画像生成ステップの前記補正処理では、複数の損失関数が用いられ、各前記損失関数の値は、画素ごとに算出され、前記設定ステップは、前記出力パターン画像生成ステップの前に行われ、且つ、前記設定ステップでは、各前記損失関数の重み係数を設定可能であり、前記出力パターン画像生成ステップの前記補正処理では、補正前後における前記複数の損失関数の値の総和が低下する画素が、前記補正対象の画素となる、方法。
(6)(5)に記載の方法であって、前記設定ステップでは、前記織物パターン画像中の注目画素の画素値を反転させたときにおいて、前記複数の損失関数の値の総和の差分が損失関数閾値より大きい画素を強調表示する、方法。
(7)(1)~(6)の何れか1つに記載の方法であって、入力画像取得ステップと織物パターン画像生成ステップとを更に備え、前記入力画像取得ステップでは、入力画像を取得し、前記織物パターン画像生成ステップでは、マスク処理を行うことで前記入力画像から前記織物パターン画像を生成し、前記マスク処理では、前記マスク処理の対象の画像の各画素の画素値に対してマスクを用いて閾値処理をし、前記マスクには、前記入力画像の各画素に対応付けられた各閾値が予め設定されている、方法。
(8)(7)に記載の方法であって、前記損失関数は、第1損失関数が加味されており、第1損失関数は、画素値差分に基づいており、前記画素値差分は、補正前後における画素値の差分に基づいている、方法。
(9)(7)又は(8)に記載の方法であって、前記損失関数は、第4損失関数が加味されており、第4損失関数は、閾値差に基づいており、前記閾値差は、補正後マスクの補正閾値と、前記織物パターン画像生成ステップで用いられる前記マスクの前記閾値との差分に基づいており、前記補正後マスクの前記補正閾値は、前記マスク処理をしたときに、前記出力パターン画像生成ステップの前記補正処理で補正されたパターン画像が生成されるように設定されている、方法。
(10)(1)~(9)の何れか1つに記載の方法であって、前記損失関数は、第2損失関数が加味されており、第2損失関数は、画素間距離に基づいており、前記画素間距離は、注目画素と反転画素との間にある画素の数に基づいており、前記注目画素と前記反転画素との間にある画素の画素値は、前記反転画素の画素値とは異なる、方法。
(11)(1)~(10)の何れか1つに記載の方法であって、前記損失関数は、第3損失関数が加味されており、第3損失関数は、交差回数に基づいており、前記交差回数は、注目画素を含む予め定められた範囲内において、画素値が反転している対をなす画素の数に基づいている、方法。
(12)(1)~(11)の何れか1つに記載の方法であって、前記損失関数は、第5損失関数が加味されており、第5損失関数は、自己相関度に基づいており、前記自己相関度は、第1画像領域内の画素と、第2画像領域内の画素とのうち画素値が異なる画素の数に基づいており、第1画像領域は、注目画素を含む予め定められた領域内の画像であり、第2画像領域は、第1画像領域と同じ形状の領域であって第1画像領域から予め定められた距離内に位置する領域である、方法。
(13)コンピュータに(1)~(12)の何れか1つに記載の画像生成方法を実行させるためのプログラム。
(14)出力パターン画像生成部を備え、前記出力パターン画像生成部は、損失関数を用いて織物パターン画像に補正処理を行うことで、前記織物パターン画像から出力パターン画像を生成するように構成され、前記織物パターン画像の各画素値は、経糸及び緯糸の上下関係が特定されるように第1及び第2画素値のうちの一方の画素値に二値化され、前記損失関数の値は、画素ごとに算出され、前記補正処理では、補正前後において前記損失関数の値が低下する画素が、補正対象の画素となり、前記補正対象の画素の画素値は、第1及び第2画素値のうちの一方の画素値から他方の画素値へ反転される、画像生成装置。
Various embodiments of the present invention will be illustrated below. The embodiments shown below can be combined with each other.
(1) an output pattern image generation step, in which the output pattern image is generated from the fabric pattern image by performing correction processing on the fabric pattern image using a loss function; Each pixel value of the image is binarized into one of the first and second pixel values so that the vertical relationship between the warp and weft is specified, and the value of the loss function is calculated for each pixel. In the correction processing, a pixel whose value of the loss function decreases before and after correction becomes a pixel to be corrected, and the pixel value of the pixel to be corrected is one of the first and second pixel values. An image generation method in which pixel values are inverted from one value to another.
(2) The method according to (1), wherein the correction process repeatedly generates a corrected pattern image from the pre-correction pattern image, and the corrected pattern image is the corrected pattern image among the pre-correction pattern images. The image is an image in which the pixel value of the target pixel is inverted, and in the first correction process of the repetition, the pre-correction pattern image is the textile pattern image, and in the correction process of the last time of the repetition, the corrected pattern image is the output pattern image.
(3) The method according to (2), wherein the pixel to be corrected in the correction process has a difference between the values of the loss function before and after the correction is larger than a loss function threshold, and the correction process is performed using the loss function The method repeats until there is no pixel for which the difference in values of is greater than the loss function threshold.
(4) The method according to any one of (1) to (3), wherein the pixel to be corrected in the correction process is a pixel with the largest difference in the value of the loss function before and after correction. ,Method.
(5) The method according to (1), further comprising a setting step, wherein a plurality of loss functions are used in the correction processing of the output pattern image generation step, and the value of each loss function is set for each pixel. is calculated, and the setting step is performed before the output pattern image generation step, and in the setting step, it is possible to set a weighting coefficient of each of the loss functions, and the correction of the output pattern image generation step is performed. In the processing, a pixel for which the sum of the values of the plurality of loss functions before and after the correction decreases becomes the pixel to be corrected.
(6) The method according to (5), wherein in the setting step, when the pixel value of the pixel of interest in the textile pattern image is inverted, the difference between the sums of the values of the plurality of loss functions is determined as a loss. A method for highlighting pixels greater than a functional threshold.
(7) The method according to any one of (1) to (6), further comprising an input image acquisition step and a fabric pattern image generation step, wherein the input image acquisition step includes acquiring an input image. In the textile pattern image generation step, the textile pattern image is generated from the input image by performing mask processing, and in the mask processing, a mask is applied to the pixel value of each pixel of the image to be subjected to the mask processing. A method in which threshold processing is performed using the mask, and each threshold value associated with each pixel of the input image is preset in the mask.
(8) The method according to (7), wherein the loss function includes a first loss function, the first loss function is based on a pixel value difference, and the pixel value difference is corrected. The method is based on the difference between the before and after pixel values.
(9) The method according to (7) or (8), wherein the loss function includes a fourth loss function, the fourth loss function is based on a threshold difference, and the threshold difference is , the correction threshold of the corrected mask 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, and the correction threshold of the corrected mask 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, A method, wherein a corrected pattern image is generated in the correction process of the output pattern image generation step.
(10) The method according to any one of (1) to (9), wherein the loss function includes a second loss function, and the second loss function is based on the distance between pixels. The pixel distance is based on the number of pixels between the pixel of interest and the inverted pixel, and the pixel value of the pixel between the pixel of interest and the inverted pixel is equal to the pixel value of the inverted pixel. A different method.
(11) The method according to any one of (1) to (10), wherein the loss function includes a third loss function, and the third loss function is based on the number of intersections. . The number of crossings is based on the number of paired pixels whose pixel values are inverted within a predetermined range including the pixel of interest.
(12) The method according to any one of (1) to (11), wherein the loss function includes a fifth loss function, and the fifth loss function is based on the degree of autocorrelation. The autocorrelation degree 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, and the first image region is A method, wherein the second image area is an area of the same shape as the first image area and located within a predetermined distance from the first image area.
(13) A program for causing a computer to execute the image generation method according to any one of (1) to (12).
(14) An output pattern image generation section is provided, and the output pattern image generation section 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 textile pattern image is binarized into one of the first and second pixel values so that the vertical relationship between the warp and weft is specified, and the value of the loss function is: It is calculated for each pixel, and in the correction process, a pixel for which the value of the loss function decreases before and after correction becomes a pixel to be corrected, and the pixel value of the pixel to be corrected is set to one of the first and second pixel values. An image generation device in which one pixel value of is inverted to another pixel value.

図1は、実施形態に係る画像生成装置1を含む織物製造システム100の機能ブロック図である。FIG. 1 is a functional block diagram of a textile manufacturing system 100 including an image generation device 1 according to an embodiment. 図2は、図1に示す出力パターン画像生成部4の機能ブロック図であって、変数設定処理時におけるデータの流れを示している。FIG. 2 is a functional block diagram of the output pattern image generation section 4 shown in FIG. 1, and shows the flow of data during variable setting processing. 図3は、図1に示す出力パターン画像生成部4の機能ブロック図であって、補正処理時におけるデータの流れを示している。FIG. 3 is a functional block diagram of the output pattern image generation section 4 shown in FIG. 1, and shows the flow of data during correction processing. 図4Aは、入力画像d1の一例である。図4Bは、図4Aに示す入力画像d1から生成される織物パターン画像d4の一例である。FIG. 4A is an example of the input image d1. FIG. 4B is an example of a textile pattern image d4 generated from the input image d1 shown in FIG. 4A. 図5は、図4Bに示す織物パターン画像d4から生成される出力パターン画像d5の一例である。FIG. 5 is an example of an output pattern image d5 generated from the textile pattern image d4 shown in FIG. 4B. 図6は、図4Bに示す織物パターン画像d4から、図5に示す出力パターン画像d5を生成するときにおいて、織物パターン画像d4のうち画素値を反転させる画素を模式的に示している。FIG. 6 schematically shows pixels whose pixel values are inverted in the textile pattern image d4 when the output pattern image d5 shown in FIG. 5 is generated from the textile pattern image d4 shown in FIG. 4B. 図7は、入力画像の各画素の画素値(P)、マスク(ディザマスク)の各画素の閾値(M)、及び、織物パターン画像の各画素の画素値(O)の一例を示している。FIG. 7 shows an example of the pixel value (P) of each pixel of the input image, the threshold value (M) of each pixel of the mask (dither mask), and the pixel value (O) of each pixel of the textile pattern image. . 図8は、織物パターン画像d4から参照パターン画像dTが生成されることを説明するための図である。FIG. 8 is a diagram for explaining that the reference pattern image dT is generated from the textile pattern image d4. 図9は、織物パターン画像d4から、順次、暫定パターン画像が生成されることを説明するための図である。FIG. 9 is a diagram for explaining that provisional pattern images are sequentially generated from the textile pattern image d4. 図10は、織物パターン画像d4から第1暫定パターン画像dnが生成されることを説明するための図である。FIG. 10 is a diagram for explaining that the first provisional pattern image dn1 is generated from the textile pattern image d4. 図11は、織物パターン画像d4及び第1暫定パターン画像dnから第1差分マトリクスSmが得られることを説明するための図である。FIG. 11 is a diagram for explaining that the first difference matrix Sm 1 is obtained from the textile pattern image d4 and the first provisional pattern image dn 1 . 図12は、第1暫定パターン画像dn及び第2暫定パターン画像dnから第2差分マトリクスSmが得られることを説明するための図である。FIG. 12 is a diagram for explaining that the second difference matrix Sm 2 is obtained from the first provisional pattern image dn 1 and the second provisional pattern image dn 2 . 図13Aは、変数設定処理時におけるフィルタ部4Cのデータ処理の説明図である。図13Bは、補正処理時におけるフィルタ部4Cのデータ処理の説明図である。FIG. 13A is an explanatory diagram of data processing by the filter unit 4C during variable setting processing. FIG. 13B is an explanatory diagram of data processing by the filter section 4C during correction processing. 図14Aは、第2損失関数の意義を説明するための模式図である。図14Bは、各画素が二値化された画像と当該画像中の注目画素ptとを模式的に示している。図14Cは、図14Bに示す注目画素ptにおける第2損失関数の右方向成分の算出方法の説明図である。FIG. 14A is a schematic diagram for explaining the significance of the second loss function. FIG. 14B schematically shows an image in which each pixel is binarized and a pixel of interest pt in the image. FIG. 14C is an explanatory diagram of a method for calculating the rightward component of the second loss function at the pixel of interest pt shown in FIG. 14B. 図15Aは、第3損失関数の意義を説明するための模式図である。図15Bは、各画素の反転数(画素値が異なる隣接画素の数)を示している。FIG. 15A is a schematic diagram for explaining the significance of the third loss function. FIG. 15B shows the number of inversions of each pixel (the number of adjacent pixels with different pixel values). 図16Aは、織物パターン画像d4中に、注目画素ptや周辺画素p1~周辺画素p8を示した図である。図16Bは、図16Aに示す注目画素ptにおける第5損失関数の値の算出方法の説明図である。FIG. 16A is a diagram showing the pixel of interest pt and peripheral pixels p1 to p8 in the textile pattern image d4. FIG. 16B is an explanatory diagram of a method for calculating the value of the fifth loss function at the pixel of interest pt shown in FIG. 16A.

以下、図面を用いて本発明の実施形態について説明する。以下に示す実施形態中で示した各種特徴事項は、互いに組み合わせ可能である。また、各特徴事項について独立して発明が成立する。 Embodiments of the present invention will be described below with reference to the drawings. Various features shown in the embodiments described below can be combined with each other. Further, the invention is established independently for each characteristic matter.

実施形態
1 全体構成説明
図1に示すように、織物製造システム100は、画像生成装置1と、出力装置20と、織物製造装置30とを備えている。画像生成装置1は、取得部2と、織物パターン画像生成部3と、出力パターン画像生成部4と、出力部5と、記憶部6とを備えている。
織物パターン画像生成部3は、前処理部3Aと、マトリクス生成部3Bと、二値化処理部3Cとを備えている。
また、出力パターン画像生成部4は、損失関数処理部4Aと、決定部4Bと、フィルタ部4Cと、設定部4Dとを備えている。また、図2に示すように、損失関数処理部4Aは、第1算出部4A1と、第2算出部4A2と、第3算出部4A3と、第4算出部4A4と、第5算出部4A5とを有する。決定部4Bは、画素決定部4B1と、画像決定部4B2とを有する。
Embodiment 1 Overall Configuration Description As shown in FIG. 1, a textile manufacturing system 100 includes an image generation device 1, an output device 20, and a textile manufacturing device 30. The image generation device 1 includes an acquisition section 2, a textile pattern image generation section 3, an output pattern image generation section 4, an output section 5, and a storage section 6.
The textile pattern image generation section 3 includes a preprocessing section 3A, a matrix generation section 3B, and a binarization processing section 3C.
Further, the output pattern image generation section 4 includes a loss function processing section 4A, a determining section 4B, a filter section 4C, and a setting section 4D. Further, as shown in FIG. 2, the loss function processing section 4A includes a first calculation section 4A1, a second calculation section 4A2, a third calculation section 4A3, a fourth calculation section 4A4, and a fifth calculation section 4A5. has. The determining unit 4B includes a pixel determining unit 4B1 and an image determining unit 4B2.

上記の各構成要素は、ソフトウェアによって実現してもよく、ハードウェアによって実現してもよい。ソフトウェアによって実現する場合、CPUがコンピュータプログラムを実行することによって各種機能を実現することができる。プログラムは、内蔵の記憶部に格納してもよく、コンピュータ読み取り可能な非一時的な記録媒体に格納してもよい。また、外部の記憶部に格納されたプログラムを読み出し、いわゆるクラウドコンピューティングにより実現してもよい。ハードウェアによって実現する場合、ASIC、FPGA、又はDRPなどの種々の回路によって実現することができる。第1実施形態においては、様々な情報やこれを包含する概念を取り扱うが、これらは、0又は1で構成される2進数のビット集合体として信号値の高低によって表され、上記のソフトウェア又はハードウェアの態様によって通信や演算が実行され得るものである。 Each of the above components may be realized by software or hardware. When realized by software, various functions can be realized by the CPU executing a computer program. The program may be stored in a built-in storage unit or in a computer-readable non-transitory recording medium. Alternatively, a program stored in an external storage unit may be read and realized by so-called cloud computing. When implemented by hardware, it can be implemented by various circuits such as ASIC, FPGA, or DRP. In the first embodiment, various information and concepts that include this information are handled, and these are expressed by high and low signal values as a binary bit collection consisting of 0 or 1, and are expressed by the software or hardware described above. Communication and computation can be performed depending on the aspect of the hardware.

出力装置20は、例えば、モニターやプリンター等の画像を出力可能な装置から構成される。ユーザーは、後述する入力画像d1、織物パターン画像d4、参照パターン画像dT及び出力パターン画像d5等の各種画像を出力装置20において目視で確認しながら、画像生成作業を進めることができる。
織物製造装置30は、出力パターン画像d5に基づいて、織物を織り上げることができるように構成されている。
The output device 20 includes, for example, a device capable of outputting an image, such as a monitor or a printer. The user can proceed with the image generation work while visually checking various images such as an input image d1, a textile pattern image d4, a reference pattern image dT, and an output pattern image d5, which will be described later, on the output device 20.
The textile manufacturing apparatus 30 is configured to be able to weave a textile based on the output pattern image d5.

2 画像生成装置1の構成説明
画像生成装置1は、入力画像d1から織物パターン画像d4を生成する第1機能と、織物パターン画像d4から出力パターン画像d5を生成する第2機能とを有する。第1機能は、織物パターン画像生成部3で発揮され、第2機能は、出力パターン画像生成部4で発揮される。
2. Configuration description of image generation device 1 The image generation device 1 has a first function of generating a textile pattern image d4 from an input image d1, and a second function of generating an output pattern image d5 from the textile pattern image d4. The first function is performed by the textile pattern image generation section 3, and the second function is performed by the output pattern image generation section 4.

図4Aに示す入力画像d1のコンテンツは、特に限定されるものではなく、例えば、写真やイラスト等の各種のデジタル画像データを採用することができる。
図4Bに示す織物パターン画像d4は、織物製造装置30で織物を織るときに使用される、各画素が二値化された画像データである。なお、実施形態において、織物は、ジャカード織物である。ジャカード織物は、多数並列化された経糸に対して、緯糸を任意に上下させて織ることで、複雑な模様を織り出すことができる。織物パターン画像d4において、経糸と緯糸の上下関係は、格子点(経糸と緯糸とが交差する点)において上下関係を特定するための二値データによって定義される。実施形態において、織物パターン画像d4は、ジャカード組織図に対応する画像であり、また、織物パターン画像d4は、後述する前処理後画像d2を二値化処理したパターン画像である。二値データは、経糸と緯糸のうちのいずれかを表に出すかを示すデータである。織物の色は、経糸と緯糸が表に出る頻度や、経糸及び緯糸の色等に基づいて、表現される。
図5に示す出力パターン画像d5は、織物パターン画像d4に対して、後述の損失関数Lを用いた補正処理を行うことで生成される画像である。補正処理は、織物パターン画像d4の一部の画素の画素値を反転させる処理である。このため、出力パターン画像d5も、織物パターン画像d4と同様に、ジャカード組織図に対応する画像であり、また、各画素の画素値が二値化された画像である。なお、実施形態において、出力パターン画像d5は、織物パターン画像d4とは異なるとは限らない。つまり、織物パターン画像d4に補正処理がなされた結果、出力パターン画像d5が織物パターン画像d4とは一致しないことが多いが、損失関数の値の計算結果によっては、一致することもあり得る。図5に示す出力パターン画像d5は、図4に示す織物パターン画像d4について、図6に示す画素の画素値(色)が変更(補正)されることで得られる。
The content of the input image d1 shown in FIG. 4A is not particularly limited, and various digital image data such as photographs and illustrations can be employed, for example.
The textile pattern image d4 shown in FIG. 4B is image data in which each pixel is binarized and is used when weaving a textile in the textile manufacturing apparatus 30. Note that in the embodiment, the fabric is a jacquard fabric. Jacquard fabrics can weave complex patterns by arbitrarily moving the weft up and down against a large number of parallel warps. In the textile pattern image d4, the vertical relationship between the warp and weft is defined by binary data for specifying the vertical relationship at grid points (points where the warp and weft intersect). In the embodiment, the textile pattern image d4 is an image corresponding to a jacquard organization chart, and the textile pattern image d4 is a pattern image obtained by binarizing a preprocessed image d2, which will be described later. The binary data is data indicating which of the warp and weft is to be exposed. The color of the fabric is expressed based on the frequency with which the warp and weft threads appear, the colors of the warp threads and the weft threads, and the like.
The output pattern image d5 shown in FIG. 5 is an image generated by performing correction processing using a loss function L, which will be described later, on the textile pattern image d4. The correction process is a process of inverting the pixel values of some pixels of the textile pattern image d4. Therefore, like the textile pattern image d4, the output pattern image d5 is also an image corresponding to the Jacquard organization chart, and is also an image in which the pixel value of each pixel is binarized. Note that in the embodiment, the output pattern image d5 is not necessarily different from the textile pattern image d4. That is, as a result of the correction process performed on the textile pattern image d4, the output pattern image d5 often does not match the textile pattern image d4, but depending on the calculation result of the loss function value, they may match. The output pattern image d5 shown in FIG. 5 is obtained by changing (correcting) the pixel values (colors) of the pixels shown in FIG. 6 for the textile pattern image d4 shown in FIG. 4.

2-1 取得部2
取得部2は、入力画像d1や入力データdinを取得可能に構成されている。なお、入力データdinは入力装置(不図示)によって取得部2に取得され、入力装置は、例えばマウスやキーボード等の操作部に対応する。また、入力画像d1が記憶部6に予め格納されており、取得部2が記憶部6から入力画像d1を取得してもよい。入力データdinは、後述する重み係数等を設定するためのデータであり、設定部4Dを用いられる。
2-1 Acquisition part 2
The acquisition unit 2 is configured to be able to acquire the input image d1 and input data din. Note that the input data din is acquired by the acquisition unit 2 by an input device (not shown), and the input device corresponds to an operation unit such as a mouse or a keyboard. Alternatively, the input image d1 may be stored in the storage unit 6 in advance, and the acquisition unit 2 may acquire the input image d1 from the storage unit 6. The input data din is data for setting weighting coefficients, etc., which will be described later, and the setting section 4D is used.

2-2 織物パターン画像生成部3
織物パターン画像生成部3は、入力画像d1に基づいて織物パターン画像d4を生成することが可能である。換言すると、織物パターン画像生成部3は、入力画像d1を、織物製造装置30において織物を織り上げることができるような形式へ変換する機能(上述の第1機能)を有する。この機能は、公知となっている各種の方法(例えば、特開2015-212440号公報)を採用することができる。以下、織物パターン画像生成部3の機能の一例を説明する。
2-2 Textile pattern image generation section 3
The textile pattern image generation unit 3 can generate 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 above-mentioned first function) of converting the input image d1 into a format that allows the textile manufacturing apparatus 30 to weave a textile. This function can employ various known methods (for example, Japanese Patent Application Publication No. 2015-212440). An example of the function of the textile pattern image generation section 3 will be described below.

実施形態では、織物パターン画像d4を生成するにあたり、グレースケール画像を白と黒の二値で表現するハーフトーニング法を用いる場合を一例として説明する。ハーフトーニング法とは、一定領域内の白と黒の画素の面積の割合を利用して階調を表現する方法である。また、実施形態では、組織的ディザ法を用いるものとして説明する。組織的ティザ法では、閾値が予め設定されたティザマスク(織物用閾値マトリクス)を用いて、画像を二値化処理する。 In the embodiment, a case will be described as an example in which a halftoning method is used to express a grayscale image with binary values of white and black when generating the textile pattern image d4. The halftoning method is a method of expressing gradation using the ratio of the areas of white and black pixels within a certain area. Further, in the embodiment, a systematic dither method is used. In the systematic teaser method, an image is binarized using a teaser mask (threshold matrix for textiles) in which a threshold value is set in advance.

2-2-1 前処理部3A
前処理部3Aでは、入力画像d1を、例えば256階調のグレースケール画像データに変換する機能を有する。これにより、前処理部3Aは、グレースケール画像データである前処理後画像d2を生成する。なお、階調数は、予め定められていてもよいし、ユーザーが適宜選択することができてもよい。この場合、前処理部3Aは、取得部2を介して入力装置から階調数を取得することができる。
2-2-1 Pre-processing section 3A
The preprocessing unit 3A has a function of converting the input image d1 into grayscale image data with, for example, 256 gradations. Thereby, the preprocessing unit 3A generates a preprocessed image d2 that is grayscale image data. Note that the number of gradations may be predetermined or may be selected by the user as appropriate. In this case, the preprocessing unit 3A can acquire the number of gradations from the input device via the acquisition unit 2.

2-2-2 マトリクス生成部3B
マトリクス生成部3Bは、ティザマスクに対応する織物用閾値マトリクス(マトリクスデータd3)を生成する。図7に示すように、織物用閾値マトリクスは、入力画像d1(前処理後画像d2)の各画素に対応付けられた各閾値が予め設定されている。つまり、織物用閾値マトリクスの行数及び列数は、入力画像d1(前処理後画像d2)のサイズに対応している。織物用閾値マトリクスは、前処理後画像d2を二値化処理した後の画像が織物組織(パターン画像)となるように作成されたマトリクスである。例えば、マトリクス生成部3Bは、織物用閾値サブマトリクスを複数配置することで織物用閾値マトリクスを作成することができる。織物用閾値サブマトリクスの行数及び列数は、任意に定めることができる。織物用閾値サブマトリクスにおける各成分には、前処理後画像d2を二値化処理するための閾値が設定される。そして、織物用閾値サブマトリクスの各成分の閾値は、ユーザーが適宜選択することが可能である。この場合、マトリクス生成部3Bは、取得部2を介して入力装置から各成分の閾値を取得することができる。
2-2-2 Matrix generation section 3B
The matrix generation unit 3B generates a textile threshold matrix (matrix data d3) corresponding to the teaser mask. As shown in FIG. 7, in the textile threshold matrix, each threshold value associated with each pixel of the input image d1 (preprocessed image d2) is set in advance. In other words, the number of rows and columns of the textile threshold matrix corresponds to the size of the input image d1 (preprocessed image d2). The textile threshold matrix is a matrix created such that the image obtained by binarizing the preprocessed image d2 becomes a textile texture (pattern image). For example, the matrix generation unit 3B can create a textile threshold matrix by arranging a plurality of textile threshold submatrices. The number of rows and columns of the textile threshold submatrix can be arbitrarily determined. A threshold value for binarizing the preprocessed image d2 is set for each component in the textile threshold submatrix. The threshold value of each component of the textile threshold submatrix can be appropriately selected by the user. In this case, the matrix generation unit 3B can acquire the threshold value of each component from the input device via the acquisition unit 2.

2-3-3 二値化処理部3C
二値化処理部3Cは、マトリクス生成部3Bが作成した織物用閾値マトリクス(マトリクスデータd3)を用いて、前処理後画像d2(マスク処理の対象の画像の一例)を二値化処理する機能を有する。換言すると、二値化処理部3Cは、前処理後画像d7に織物用閾値マトリクスを用いたマスク処理を行うことで、入力画像d1(前処理後画像d2)から織物パターン画像d4を生成する。前処理後画像d2の任意の画素の画素値が織物用閾値マトリクスの対応する成分の閾値を超えている場合には、この画素は白(二値化データは1)と処理される。また、前処理後画像d2の任意の画素の画素値が織物用閾値マトリクスの対応する成分の閾値を未満である場合には、この画素は黒(二値化データは0)と処理される。前処理後画像d2の任意の画素の画素値が織物用閾値マトリクスの対応する成分の閾値と同じ値である場合には、この画素は黒又は白と処理される。黒と処理されるか、白と処理されるかについては、二値化処理部3Cにおいて予め定められている。
2-3-3 Binarization processing section 3C
The binarization processing unit 3C has a function of binarizing the preprocessed image d2 (an example of the image to be masked) using the textile threshold matrix (matrix data d3) created by the matrix generation unit 3B. has. In other words, the binarization processing unit 3C generates the textile pattern image d4 from the input image d1 (preprocessed image d2) by performing mask processing 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 of the textile threshold matrix, this pixel is processed as white (binarized data is 1). Furthermore, if the pixel value of any pixel in the preprocessed image d2 is less than the threshold of the corresponding component of the textile threshold matrix, this pixel is processed as black (binarized data is 0). If the pixel value of any pixel in the preprocessed image d2 is the same as the threshold value of the corresponding component of the textile threshold matrix, this pixel is treated as black or white. Whether the color is processed as black or white is predetermined in the binarization processing unit 3C.

2-3 出力パターン画像生成部4
出力パターン画像生成部4は、損失関数Lを用いて織物パターン画像d4に補正処理を行い、織物パターン画像d4から出力パターン画像d5を生成するように構成されている。出力パターン画像生成部4が実行可能な処理には、変数設定処理と、上述の補正処理とが含まれる。出力パターン画像生成部4は、変数設定処理を実行して後述する重み係数等の変数を設定した後に、補正処理を実施して織物パターン画像d4に補正処理を行い、最終的に出力パターン画像d5を生成する。
2-3 Output pattern image generation section 4
The output pattern image generation unit 4 is configured to perform correction processing on the textile pattern image d4 using the loss function L, and generate an output pattern image d5 from the textile pattern image d4. Processes that can be executed by the output pattern image generation section 4 include variable setting processing and the above-described correction processing. The output pattern image generation unit 4 executes a variable setting process to set variables such as weighting coefficients, which will be described later, and then executes a correction process to perform the correction process on the textile pattern image d4, and finally creates an output pattern image d5. generate.

・変数設定処理
補正処理では、以下の式(6)の損失関数Lに基づいて画素値を反転させる画素が適宜決定され、出力パターン画像d5が生成される。これにあたり、損失関数Lは複数の変数(後述する重み係数等)を有しており、当該変数は、予め、ユーザーの意向に沿うようにユーザーに適切化される。つまり、変数設定処理は、複数の変数を設定する処理である。変数設定処理は、後述の決定処理1を含んでいる。
- Variable setting process In the correction process, pixels whose pixel values are to be inverted are appropriately determined based on the loss function L of the following equation (6), and an output pattern image d5 is generated. In this regard, the loss function L has a plurality of variables (such as weighting coefficients to be described later), and the variables are optimized in advance for the user in accordance with the user's intention. In other words, the variable setting process is a process of setting a plurality of variables. The variable setting process includes determination process 1, which will be described later.

具体的には、式(6)の損失関数Lは、以下の式(1)~式(5)に係る第1~第5損失関数の値L,L,L,L,Lに、各重み係数w,w,w,w,wを乗じた値の総和で表される。また、第2損失関数では、閾値dthが用いられる。画素値を反転させる画素の選定については、ユーザーの経験等が加味されるため、ばらつく可能性がある。このため、実施形態では、パラメータとしての重み係数w,w,w,w,w及び閾値dthをユーザーが自由に変更(設定)することができるようになっている。つまり、実施形態では、出力パターン画像d5の出力結果がユーザーの経験等に沿って適切化されるように、重み係数w,w,w,w,wと閾値dthとを設定する。 Specifically, the loss function L of formula (6) is the value L I , L J , L D , L M , L of the first to fifth loss functions according to the following formulas (1) to (5). It is expressed as the sum of values obtained by multiplying C by weighting coefficients w I , w J , w D , w M , and w C. Further, in the second loss function, a threshold value d th is used. The selection of pixels whose pixel values are to be inverted may vary because the user's experience is taken into account. Therefore, in the embodiment, the user can freely change (set) the weighting coefficients w I , w J , w D , w M , w C and the threshold value d th as parameters. That is, in the embodiment, the weighting coefficients w I , w J , w D , w M , w C and the threshold value d th are set so that the output result of the output pattern image d5 is optimized according to the user's experience. Set.

実施形態に係る変数設定処理では、ユーザーが、重み係数等を調整することで、出力パターン画像d5にどのような影響があるかを視覚的に確認しながら、重み係数等を設定することが可能になっている。つまり、実施形態では、ユーザーの意向に沿うように、重み係数等を対話的に決定することが可能である。ユーザーが、重み係数w,w,w,w,wと閾値dthを設定する様子については、後述の「3 動作説明」の「設定ステップ」で説明する。 In the variable setting process according to the embodiment, the user can set the weighting coefficients, etc. while visually checking the effect on the output pattern image d5 by adjusting the weighting coefficients, etc. It has become. That is, in the embodiment, it is possible to interactively determine the weighting coefficients and the like in accordance with the user's intentions. How the user sets the weighting coefficients w I , w J , w D , w M , w C and the threshold value d th will be explained in "Setting Step" in "3 Operation Description" below.

・補正処理
補正処理では、変数設定処理において設定完了した重み係数w,w,w,w,w及び閾値dthを用いて、損失関数Lの値を算出する。補正処理において、損失関数Lは、画素ごとに算出される。また、補正処理では、補正前後において損失関数の値が低下する画素が、補正対象の画素となる。そして、補正対象の画素の画素値は、反転される。つまり、補正対象の画素の画素値が、1(白)の場合には0(黒)になり、0(黒)の場合には1(白)になる。なお、画素値:1及び画素値:0のうちの一方が第1画素値の一例であり、他方が第2画素値の一例である。補正処理は、後述の決定処理2,3を含む。
- Correction process In the correction process, the value of the loss function L is calculated using the weighting coefficients w I , w J , w D , w M , w C and the threshold value d th that have been set in the variable setting process. In the correction process, the loss function L is calculated for each pixel. In addition, in the correction process, a pixel whose loss function value decreases before and after correction becomes a pixel to be corrected. Then, the pixel value of the pixel to be corrected is inverted. That is, when the pixel value of the pixel to be corrected is 1 (white), it becomes 0 (black), and when it is 0 (black), it becomes 1 (white). Note that one of the pixel value: 1 and the pixel value: 0 is an example of the first pixel value, and the other is an example of the second pixel value. The correction process includes determination processes 2 and 3, which will be described later.

なお、実施形態に係る補正処理では、逐次、補正する画素(画素値を反転させる画素)が選定される。つまり、実施形態に係る補正処理では、複数の画素が補正される可能性があるが、各補正時において、一度に画素値が反転する画素の数は、1つである。つまり、図9に示すように、織物パターン画像d4の画素値を1つ反転させた第1暫定パターン画像dnを生成する、次に、第1暫定パターン画像dnの画素値を1つ反転させた第2暫定パターン画像dnを生成する、・・・という処理を順次繰り返していく。換言すると、補正処理では、織物パターン画像d4の画素値を1つ反転させた第1暫定パターン画像dnを生成した後に、第N暫定パターン画像dnの画素値を1つ反転させた第N+1暫定パターン画像dnN+1を生成する、という処理を順次繰り返す(Nは1以上の整数)。そして、画像決定部4B2が、ある暫定パターン画像を出力パターン画像d5とすることを決定すると、当該暫定パターン画像が最終的に出力パターン画像d5として出力される。 Note that in the correction process according to the embodiment, pixels to be corrected (pixels whose pixel values are to be inverted) are sequentially selected. That is, in the correction processing according to the embodiment, there is a possibility that a plurality of pixels are corrected, but the number of pixels whose pixel values are inverted at a time during each correction is one. That is, as shown in FIG. 9, a first provisional pattern image dn 1 is generated by inverting the pixel value of the textile pattern image d4 by one, and then inverting the pixel value of the first provisional pattern image dn 1 by one . The process of generating the second provisional pattern image dn 2 with the specified pattern image dn2 is sequentially repeated. In other words, in the correction process, after generating the first provisional pattern image dn1 in which the pixel value of the textile pattern image d4 is inverted by one, the first provisional pattern image dn1 is generated by inverting the pixel value of the Nth provisional pattern image dnN by one. The process of generating a temporary pattern image dn N+1 is sequentially repeated (N is an integer of 1 or more). Then, when the image determining unit 4B2 determines that a certain provisional pattern image is to be the output pattern image d5, the provisional pattern image is finally output as the output pattern image d5.

2-3-1 損失関数処理部4A
損失関数処理部4Aは、複数の損失関数(実施形態では第1~第5損失関数)が加味された損失関数Lの値を算出可能に構成されている。損失関数処理部4Aは、画素ごと(注目画素ptごと)に損失関数Lを算出する。実施形態において、画像中の任意の画素(画像中の全て画素)は、注目画素ptとなり得るが、これに限定されるものではなく、画像中の予め定められた範囲の画素のみが、注目画素ptであってもよい。
2-3-1 Loss function processing section 4A
The loss function processing unit 4A is configured to be able to calculate the value of the loss function L in which a plurality of loss functions (first to fifth loss functions in the embodiment) are taken into consideration. The loss function processing unit 4A calculates a loss function L for each pixel (for each pixel of interest pt). In the embodiment, any pixel in the image (all pixels in the image) can be the pixel of interest pt, but it is not limited to this, and only pixels in a predetermined range in the image can be the pixel of interest pt. It may be pt.

<第1算出部4A1>
第1損失関数は、出力パターン画像d5の明るさを入力画像d1の明るさに近づけるような関数である。なお、出力パターン画像d5は、二値化処理されているため、入力画像d1の画素値と出力パターン画像d5の画素値との差分と算出すると、当該差分が大きくなり過ぎてしまい、有効な損失関数とならない可能性がある。このため、実施形態では、フィルタ部4Cにおいて各種画像にフィルタ処理をおこなって各種画像をぼかしておき、ぼかした画像の画素値同士の差分を算出する。
<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. Note that since the output pattern image d5 has been binarized, when 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 becomes too large and there is no effective loss. It may not be a function. For this reason, in the embodiment, the filter unit 4C performs filter processing on various images to blur the various images, and calculates the difference between the pixel values of the blurred images.

第1算出部4A1は、画素ごと(注目画素ptごと)に第1損失関数の値Lを算出可能に構成されている。各画素の第1損失関数は、式(1)のように表され、画素値差分に基づいている。
式(1)において、pは、画像d1fの任意の座標tの画素(注目画素pt)の画素値である。ここで、画像d1fは、入力画像d1をフィルタ部4Cでフィルタ処理した画像である。
式(1)において、оは、画像dtf等の任意の座標tの画素(注目画素pt)の画素値である。ここで、画像dtf等とは、画像dtf及び画像dnfである。図13Aに示す画像dtfは、変数設定処理時において、反転パターン画像dtをフィルタ部4Cでフィルタ処理した画像である。図13Bに示す画像dnfは、補正処理時において、第N暫定パターン画像dnをフィルタ部4Cでフィルタ処理した画像である。
The first calculation unit 4A1 is configured to be able to calculate the value LI of the first loss function for each pixel (for each pixel of interest pt). The first loss function for each pixel is expressed as in equation (1) and is based on the pixel value difference.
In equation (1), p is the pixel value of a pixel (target pixel pt) at an arbitrary coordinate t of the image d1f. Here, the image d1f is an image obtained by filtering the input image d1 by the filter section 4C.
In equation (1), о is the pixel value of a pixel (target pixel pt) at an arbitrary coordinate t of the image dtf or the like. Here, the image dtf and the like are the image dtf and the image dnNf . The image dtf shown in FIG. 13A is an image obtained by filtering the inverted pattern image dt by the filter unit 4C during the variable setting process. The image dn N f shown in FIG. 13B is an image obtained by filtering the Nth provisional pattern image dn N by the filter unit 4C during the correction process.

<第2算出部4A2>
図14Aの左側に模式的に示すように糸が飛び過ぎていると、織物に不具合が生じやすくなる。そこで、第2損失関数は、図14Aの右側に模式的に示すように糸の飛びが一定間隔以内になるように定められている。なお、糸の飛びは、小さければ問題ないため、閾値dthを設定し、注目画素ptから反転画素pt2までの距離が閾値dthより大きい場合に損失としてカウントする。
<Second calculation unit 4A2>
If the threads jump too much, as schematically shown on the left side of FIG. 14A, defects are likely to occur in the fabric. Therefore, the second loss function is determined so that the yarn jump is within a certain interval, as schematically shown on the right side of FIG. 14A. Note that thread skipping is not a problem as long as it is small, so a threshold value d th is set, and if the distance from the target pixel pt to the inverted pixel pt2 is greater than the threshold value d th , it is counted as a loss.

第2算出部4A2は、画素ごと(注目画素ptごと)に第2損失関数の値Lを算出可能に構成されている。各画素の第2損失関数は、式(2)のように表され、画素間距離(後述する距離d)に基づいている。
式(2)を用いた値Lの具体的な算出方法について説明する。値Lは、注目画素ptを起点する各方向(上方向、下方向、右方向、左方向)の成分max(0,d-dth)の総和で表される。
ここで、閾値dthは、正の整数である。
また、距離dは、注目画素ptと、反転画素pt2との間の画素数に対応している。ここで、反転画素pt2は、注目画素ptの隣接画素pt1を起点とする各方向において、初めて、隣接画素pt1に対して画素値が反転している画素である。なお、注目画素ptと反転画素pt2との間にある画素値は、反転画素pt2の画素値とは異なっている。
The second calculation unit 4A2 is configured to be able to calculate the value LJ of the second loss function for each pixel (for each pixel of interest pt). The second loss function for each pixel is expressed as in equation (2) and is based on the inter-pixel distance (distance d, which will be described later).
A specific method of calculating the value LJ using equation (2) will be explained. The value L J is expressed as the sum of components max (0, dd th ) in each direction (upward, downward, rightward, leftward) starting from the pixel of interest pt.
Here, the threshold value d th is a positive integer.
Further, 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 a pixel whose pixel value is inverted with respect to the adjacent pixel pt1 for the first time in each direction starting from the adjacent pixel pt1 of the pixel of interest pt. Note that the pixel value between the pixel of interest pt and the inverted pixel pt2 is different from the pixel value of the inverted pixel pt2.

一例として、図14Cを参照して、右方向成分の算出方法について説明する。ここでは、閾値dthは3であるとする。距離d(t,→)は、注目画素ptと、反転画素pt2との間の画素数であるため、5である。このため、右方向成分は、max(0,5-3)=max(0,2)=2となる。同じ要領で、上方向成分、下方向成分及び左方向成分を算出し、これらの総和から第2損失関数の値Lを取得することができる。 As an example, a method for calculating the rightward component will be described with reference to FIG. 14C. Here, it is assumed that the threshold value d th is 3. The distance d(t,→) is 5 because it is the number of pixels between the pixel of interest pt and the inverted pixel pt2. Therefore, the rightward component is max(0,5-3)=max(0,2)=2. In the same manner, the upward component, downward component, and leftward component can be calculated, and the value LJ of the second loss function can be obtained from the sum of these components.

<第3算出部4A3>
図15Aの左側に模式的に示すように糸に交差が多すぎると、織物にしたときに布が固くなる不具合を発生させる。そこで、第3損失関数は、図15Aの右側に模式的に示すように交差回数を抑えるように定められている。つまり、図15Bに示すように、第3損失関数では、注目画素ptを含む予め定められた範囲Rg内の画素の反転数を損失としてカウントする。予め定められた範囲Rgは、適宜、設定することができる。
<Third calculation unit 4A3>
As schematically shown on the left side of FIG. 15A, if the threads have too many intersections, the fabric becomes stiff when woven into a fabric. Therefore, the third loss function is determined to suppress the number of crossings, as schematically shown on the right side of FIG. 15A. That is, as shown in FIG. 15B, in the third loss function, the number of inversions of pixels within a predetermined range Rg including the pixel of interest pt is counted as a loss. The predetermined range Rg can be set as appropriate.

第3算出部4A3は、画素ごと(注目画素ptごと)に第3損失関数の値Lを算出可能に構成されている。各画素の第3損失関数は、式(3)のように表され、糸(経糸と緯糸)の交差回数に基づいている。
式(3)を用いた値Lの具体的な算出方法について説明する。式(3)において、оは、パターン画像の任意の座標tの画素(注目画素pt)の画素値である。また、式(3)において、(1,0)及び(0,1)は、注目画素ptの隣接方向(実施形態では、上方向及び左方向)に対応し、N(t)は、注目画素ptの周囲の予め定められた範囲Rgに対応している。
The third calculation unit 4A3 is configured to be able to calculate the value LD of the third loss function for each pixel (for each pixel of interest pt). The third loss function for each pixel is expressed as in equation (3) and is based on the number of times the threads (warp and weft) intersect.
A specific method of calculating the value LD using equation (3) will be explained. In Equation (3), о is the pixel value of the pixel (target pixel pt) at an arbitrary coordinate t in the pattern image. Further, in equation (3), (1, 0) and (0, 1) correspond to the adjacent direction of the pixel of interest pt (in the embodiment, upward and left directions), and N(t) is the pixel of interest pt. It corresponds to a predetermined range Rg around pt.

一例として、任意の画素(注目画素pt)の値Lの算出方法について説明する。図15Bに示すように、注目画素ptを起点として上方向及び左方向に隣接する反転画素の数を算出する。具体的には、注目画素ptの左方向に隣接する画素ptxと上方向に隣接する画素ptyは、注目画素ptの画素値に対して反転した画素値を有するため、共に反転画素である。このため、注目画素ptの反転数は2である。同じ要領で、注目画素pt以外の、予め定められた範囲Rg内の画素についても、反転数を算出する。注目画素ptの値Lは、予め定められた範囲Rg内の反転数の総和であり、図15Bの例では、1+0+1+1+2+0+1+2+0=8である。 As an example, a method for calculating the value LD of an arbitrary pixel (pixel of interest pt) will be described. As shown in FIG. 15B, the number of inverted pixels adjacent to the pixel of interest pt in the upper and left directions is calculated. Specifically, the pixel ptx adjacent to the left direction of the pixel of interest pt and the pixel pty adjacent to the upper direction of the pixel of interest pt have pixel values that are inverted with respect to the pixel value of the pixel of interest pt, so both are inverted pixels. Therefore, the number of inversions of the pixel of interest pt is two. In the same manner, the number of inversions is calculated for pixels within the predetermined range Rg other than the pixel of interest pt. The value LD of the pixel of interest pt is the sum of the number of inversions within the predetermined range Rg, and in the example of FIG. 15B, it is 1+0+1+1+2+0+1+2+0=8.

<第4算出部4A4>
織物パターン画像を補正して画素値を変更することは、ディザマスクの閾値を変更(補正)することに対応している。ここで、ディザマスクは職人の経験等が反映されて作られているため、ディザマスクが大きく変わってしまうことは好ましくないと考えられる。そこで、第4損失関数は、織物パターン画像を補正して得られるパターン画像に対応するディザマスクが、織物パターン画像生成部3で使用するディザマスクから外れることを損失としてカウントする。
<Fourth calculation unit 4A4>
Correcting the textile pattern image and changing the pixel value corresponds to changing (correcting) the threshold value of the dither mask. Here, since the dither mask is made by reflecting the experience of craftsmen, it is considered undesirable for the dither mask to change significantly. Therefore, the fourth loss function counts as a loss the fact that the dither mask corresponding to the pattern image obtained by correcting the textile pattern image deviates from the dither mask used in the textile pattern image generation section 3.

第4算出部4A4は、画素ごと(注目画素ptごと)に第4損失関数の値Lを算出可能に構成されている。各画素の第4損失関数は、式(4)のように表され、閾値差に基づいている。
注目画素ptの閾値差とは、補正後のディザマスク(補正後マスクの一例)における注目画素ptに対応する補正閾値(式(4)のMに対応)と、織物パターン画像生成部3で使用するディザマスクにおける注目画素ptに対応する閾値(式(4)のmに対応)と、の差分である。
The fourth calculation unit 4A4 is configured to be able to calculate the value L M of the fourth loss function for each pixel (for each pixel of interest pt). The fourth loss function for each pixel is expressed as in equation (4) and is based on the threshold difference.
The threshold difference of the pixel of interest pt is the difference between the correction threshold (corresponding to M in equation (4)) corresponding to the pixel of interest pt in the corrected dither mask (an example of the mask after correction) and the difference used in the textile pattern image generation unit 3. This is the difference between the threshold value (corresponding to m in equation (4)) corresponding to the pixel of interest pt in the dither mask.

なお、補正後のディザマスクとは、織物パターン画像d4の画素値を反転して得られる(補正して得られる)パターン画像を生成するようなディザマスクである。
第4算出部4A4は、織物パターン画像生成部3で使用するディザマスクを織物パターン画像生成部3から受け取る。また、第4算出部4A4は、変数設定処理における反転パターン画像dtや、補正処理における第N暫定パターン画像dnに基づいて、補正後のディザマスクを生成可能に構成されている。
Note that the corrected dither mask is a dither mask that generates a pattern image obtained by inverting (obtaining by 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. Further, the fourth calculation unit 4A4 is configured to be able to generate a corrected dither mask based on the inverted pattern image dt in the variable setting process and the Nth provisional pattern image dnN in the correction process.

<第5算出部4A5>
ディザマスクで生成した織物パターン(織物パターン画像)は規則的で整っており、視覚的に綺麗に見えることが多い。補正して得られるパターン画像が織物パターン画像から外れしまうと、画像中の規則性が損なわれて、職人の経験等にそぐわなくなる可能性が高まるため、規則性が損なわれることを損失としてカウントする。
<Fifth calculation unit 4A5>
A textile pattern (textile pattern image) generated using a dither mask is regular and well-organized, and often looks visually beautiful. If the pattern image obtained by correction deviates from the textile pattern image, the regularity in the image will be lost and there is a high possibility that it will no longer match the experience of the craftsman, so any loss of regularity will be counted as a loss. .

第5算出部4A5は、画素ごと(注目画素ptごと)に第5損失関数の値Lを算出可能に構成されている。各画素の第5損失関数は、式(5)のように表され、自己相関度に基づいている。 The fifth calculation unit 4A5 is configured to be able to calculate the value L C of the fifth loss function for each pixel (for each pixel of interest pt). The fifth loss function for each pixel is expressed as in equation (5) and is based on the degree of autocorrelation.

式(5)を用いた値Lの具体的な算出方法について図16A及び図16Bを参照して説明する。
自己相関度は、第1画像領域Art内の画素と、第2画像領域Ar1~Ar8内の画素とのうち画素値が異なる画素の数に基づいている。
図16Aにおいて、第1画像領域Artは、注目画素ptを含む予め定められた領域内の画像(注目画素pt、周辺画素p5、周辺画素p7及び周辺画素p8からなる画像)である。なお、式(5)中のN(t)は、注目画素ptの周囲の予め定められた範囲を定義している。
図16Aにおいて、第2画像領域Ar1~Ar8は、第1画像領域と同じ形状の領域であって第1画像領域から予め定められた距離内に位置する領域である。なお、式(5)中の[-w,w]×[-w,w]は、予め定められた距離を定義している。[-w,w]は、注目画素ptを基準とする横方向の距離、[-w,w]は、注目画素ptを基準とする縦方向の距離を指す。図16A及び図16Bの例では、w及びwは、1である。
なお、第1画像領域Artの予め定められた領域の広さや、第1画像領域Artと第2画像領域Ar1~Ar8との間の予め定められた距離については、適宜、設定することができる。
A specific method for calculating the value L C using equation (5) will be described with reference to FIGS. 16A and 16B.
The degree of autocorrelation is based on the number of pixels that have different pixel values between the pixels in the first image area Art and the pixels in the second image areas Ar1 to Ar8.
In FIG. 16A, the first image area Art is an image within a predetermined area including the pixel of interest pt (an image consisting of the pixel of interest pt, surrounding pixels p5, surrounding pixels p7, and surrounding pixels p8). Note that N(t) in equation (5) defines a predetermined range around the pixel of interest pt.
In FIG. 16A, second image areas Ar1 to Ar8 are areas having the same shape as the first image area and are located within a predetermined distance from the first image area. Note that [-w x , w x ]×[-w y , w y ] in equation (5) defines a predetermined distance. [-w x , w x ] indicates a distance in the horizontal direction with respect to the pixel of interest pt, and [-w y , w y ] indicates a distance in the vertical direction with respect to the pixel of interest pt. In the example of FIGS. 16A and 16B, w x and w y are 1.
Note that the width of the predetermined area of the first image area Art and the predetermined distance between the first image area Art and the second image areas Ar1 to Ar8 can be set as appropriate.

例えば、図16Bにおいては、第1画像領域Art内の画素と第2画像領域Ar1とのうち画素値が異なる画素の数、第1画像領域Art内の画素と第2画像領域Ar2とのうち画素値が異なる画素の数、・・・第1画像領域Art内の画素と第2画像領域Ar8とのうち画素値が異なる画素の数、といった8つの数を算出することができる。
ここで、第1画像領域Art内の画素と第2画像領域Ar1とのうち画素値が異なる画素の数は、4である。また、第1画像領域Art内の画素と第2画像領域Ar2とのうち画素値が異なる画素の数は、3である。同様にして、残りの6つ数も算出することができる。式(5)の値Lは、これらの8つの数のうち、最も小さい値である。
For example, in FIG. 16B, the number of pixels with different pixel values between the pixels in the first image area Art and the second image area Ar1, the number of pixels between the pixels in the first image area Art and the second image area Ar2, Eight numbers can be calculated: the number of pixels with different values, . . . the number of pixels with different pixel values between the pixels in the first image area Art and the second image area Ar8.
Here, the number of pixels with different pixel values between the pixels in the first image area Art and the second image area Ar1 is four. Furthermore, the number of pixels that have different pixel values between the pixels in the first image area Art and the second image area Ar2 is three. The remaining six numbers can be calculated in the same way. The value L C in equation (5) is the smallest value among these eight numbers.

2-3-2 決定部4B
<画素決定部4B1>
変数決定処理時において、画素決定部4B1は、式(6)に示す損失関数の値に基づいて、画素値が二値化されたパターン画像中の画素のうち、強調表示する画素を決定するように構成されている。強調表示する画素の決定方法は、以下の決定処理1の通りである。
補正処理時において、画素決定部4B1は、式(6)に示す損失関数の値に基づいて、画素値が二値化されたパターン画像中の画素のうち、画素値を反転させる(画素値を補正する)画素を決定するように構成されている。反転1回目における反転の対象画素の決定方法は、以下の決定処理2の通りであり、反転2回目以降における決定方法は、以下の決定処理3の通りである。
2-3-2 Decision section 4B
<Pixel determining unit 4B1>
During the variable determination process, the pixel determining unit 4B1 determines which pixels to highlight among the pixels in the pattern image whose pixel values have been binarized based on the value of the loss function shown in equation (6). It is composed of The method for determining pixels to be highlighted is as described in determination process 1 below.
During the correction process, the pixel determining unit 4B1 inverts the pixel values (inverts the pixel values) of the pixels in the pattern image whose pixel values have been binarized based on the value of the loss function shown in equation (6). the pixel to be corrected). The method for determining the pixel to be inverted in the first inversion is as shown in Determination Process 2 below, and the determination method in the second and subsequent inversions is as in Determination Process 3 below.

・決定処理1:変数設定処理
画素決定部4B1は、任意の画素(注目画素pt)の画素値を反転させる前後(補正前後)における損失関数の値の差分を算出する。ここで、変数決定処理時に関して、図8に示す左上の角に位置する画素(ここでは、当該画素と称する)を例に説明する。
-Determination Process 1: Variable Setting Process The pixel determination unit 4B1 calculates the difference between the values of the loss function before and after inverting the pixel value of an arbitrary pixel (target pixel pt) (before and after correction). Here, the variable determination process will be explained using a pixel located at the upper left corner shown in FIG. 8 (herein referred to as the pixel) as an example.

画素決定部4B1は、入力データdinを受け取っているため、重み係数w,w,w,w,wは設定されている。なお、このときの重み係数w,w,w,w,wは仮決めであり、ユーザーは調整可能である。そして、画素決定部4B1は、式(6)に基づいて当該画素の損失関数の値L1(図8参照)を算出する。この値L1が、当該画素の補正前の損失関数の値に対応し、式(6)から算出することができる。 Since the pixel determination unit 4B1 receives the input data din, the weighting coefficients w I , w J , w D , w M , and w C are set. Note that the weighting coefficients w I , w J , w D , w M , and w C at this time are provisionally determined and can be adjusted by the user. Then, the pixel determination unit 4B1 calculates the loss function value L1 (see FIG. 8) of the pixel based on equation (6). This value L1 corresponds to the value of the loss function of the pixel before correction, and can be calculated from equation (6).

次に、織物パターン画像d4のうち当該画素の画素値を反転させて得られる画像(補正後のパターン画像)が生成される。画素決定部4B1は、式(6)に基づいて、当該画像の画素の損失関数の値L1t(図8参照)を算出する。値L1tが、当該画素の補正後の損失関数の値に対応し、式(6)から算出することができる。
更に、画素決定部4B1は、当該画素の補正後の損失関数の値L1tと、当該画素の補正前の損失関数の値L1との差分を算出する。この損失関数Lの差分の大きさが、変数決定処理時において、画素を強調表示させるか否かを決定するために用いられる。
Next, an image (corrected pattern image) obtained by inverting the pixel value of the pixel in the textile pattern image d4 is generated. The pixel determination unit 4B1 calculates the loss function value L1t (see FIG. 8) of the pixel of the image based on equation (6). The value L1t corresponds to the value of the corrected loss function of the pixel, and can be calculated from equation (6).
Further, the pixel determination unit 4B1 calculates the difference between the value L1t of the loss function after correction of the pixel and the value L1 of the loss function before correction of the pixel. The magnitude of the difference in the loss function L is used to determine whether or not to highlight a pixel during variable determination processing.

以上は、左上の角に位置する画素についての説明であったが、その他の残りの画素についても同様に、損失関数Lの差分を算出する。一例として、当該画素の右隣りの画素について計算する場合について説明する。
画素決定部4B1は、式(6)に基づいて、当該右隣りの画素の損失関数の値L2を算出する。また、織物パターン画像d4のうち当該右隣りの画素の画素値を反転させて得られる画像(補正後のパターン画像)が生成される。画素決定部4B1は、式(6)に基づいて、当該補正後のパターン画像における、右隣りの画素の損失関数の値L2tを算出する。その後、画素決定部4B1は、値L2tと、値L2との差分を算出する。
The above description has been about the pixel located at the upper left corner, but the difference in the loss function L is calculated for the remaining pixels in the same way. As an example, a case will be described in which calculation is performed for the pixel to the right of the current pixel.
The pixel determining unit 4B1 calculates the value L2 of the loss function of the right-hand adjacent pixel based on equation (6). Further, an image (corrected pattern image) obtained by inverting the pixel value of the right-hand adjacent pixel in the textile pattern image d4 is generated. The pixel determining unit 4B1 calculates the value L2t of the loss function of the right-adjacent pixel in the corrected pattern image based on equation (6). After that, the pixel determination unit 4B1 calculates the difference between the value L2t and the value L2.

変数決定処理時では、損失関数Lの差分(第1~第5損失関数の値L,L,L,L,Lの総和の差分)が、予め定められた閾値(損失関数閾値の一例)より大きい画素の全てが、対象画素(強調表示の対象となる画素)と決定される。つまり、この対象画素は、強調表示されることになる(図8参照)。変数決定処理において、予め定められた閾値より大きい画素の全てが対象画素となっているのは、重み係数等の変数の値を調整することで、反転する画素の傾向を把握し、変数がどのように効いてくるかをユーザーが確認するためである。 During the variable determination process, the difference in the loss function L (the difference between the sums of the values L I , L J , L D , L M , L C of the first to fifth loss functions) is determined by a predetermined threshold (loss function (Example of threshold value) All pixels larger than the threshold value are determined to be target pixels (pixels to be highlighted). In other words, this target pixel is highlighted (see FIG. 8). In the variable determination process, all pixels larger than a predetermined threshold value are target pixels. By adjusting the values of variables such as weighting coefficients, the tendency of pixels to be reversed can be grasped, and the This is for the user to check whether it works as expected.

・決定処理2:補正処理時の反転1回目
補正処理時の開始時において、重み係数w,w,w,w,w等の変数は決定されている。損失関数Lの差分を算出する過程は、決定処理1と同様である。つまり、図10に示すように、画素決定部4B1は、式(6)に基づいて当該画素の損失関数の値L1を算出する。この値L1が、当該画素の補正前の損失関数の値に対応し、式(6)から算出することができる。
-Determination Process 2: First Reversal in Correction Process At the start of the correction process, variables such as the weighting coefficients w I , w J , w D , w M , w C , etc. are determined. The process of calculating the difference between the loss functions L is the same as the determination process 1. That is, as shown in FIG. 10, the pixel determination unit 4B1 calculates the value L1 of the loss function of the pixel based on equation (6). This value L1 corresponds to the value of the loss function of the pixel before correction, and can be calculated from equation (6).

次に、織物パターン画像d4のうち当該画素の画素値を反転させて得られる画像(補正後のパターン画像)が生成される。画素決定部4B1は、式(6)に基づいて、当該画像の画素の損失関数の値L1t(図10参照)を算出する。値L1tが、当該画素の補正後の損失関数の値に対応し、式(6)から算出することができる。
更に、画素決定部4B1は、当該画素の補正後の損失関数の値L1tと、当該画素の補正前の損失関数の値L1との差分を算出する。この損失関数Lの差分の大きさが、補正処理時の反転1回目において、画素値を反転させるか否かを決定するために用いられる。以上は、左上の角に位置する画素についての説明であったが、その他の残りの画素についても同様に、損失関数Lの差分を算出する。
Next, an image (corrected pattern image) obtained by inverting the pixel value of the pixel in the textile pattern image d4 is generated. The pixel determination unit 4B1 calculates the loss function value L1t (see FIG. 10) of the pixel of the image based on equation (6). The value L1t corresponds to the value of the corrected loss function of the pixel, and can be calculated from equation (6).
Further, the pixel determination unit 4B1 calculates the difference between the value L1t of the loss function after correction of the pixel and the value L1 of the loss function before correction of the pixel. The magnitude of the difference in the loss function L is used to determine whether or not to invert the pixel value in the first inversion during the correction process. The above description has been about the pixel located at the upper left corner, but the difference in the loss function L is calculated for the remaining pixels in the same way.

補正処理時の反転1回目では、損失関数Lの差分が予め定められた閾値(損失関数閾値の一例)より大きい画素のうち、最も大きい画素のみが対象画素(反転させる対象となる画素)と決定される。つまり、この対象画素の画素値のみが、反転される(図10参照)。
損失関数Lの差分が大きいほど、画素の画素値を反転させることで損失関数Lの値を低減できる。このため、当該画素値を反転させることは、職人やデザイナーによる織物パターンの修正作業に沿う可能性が高い、ということになる。つまり、損失関数Lの差分が、予め定められた閾値よりも大きい画素については、職人やデザイナーによる織物パターンの修正作業に適合するため、画素決定部4B1は、画素値を反転させる画素として決定する。
In the first inversion during correction processing, only the largest pixel among the pixels whose difference in loss function L is larger than a predetermined threshold (an example of a loss function threshold) is determined to be the target pixel (pixel to be inverted). be done. In other words, only the pixel value of this target pixel is inverted (see FIG. 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 is likely to be in line with the work of modifying textile patterns by craftsmen and designers. In other words, for pixels for which the difference in the loss function L is larger than a predetermined threshold value, the pixel determining unit 4B1 determines the pixels whose pixel values are to be inverted, in order to be suitable for correction work of textile patterns by craftsmen and designers. .

図10に示すように、補正処理時の反転1回目において、織物パターン画像d4中の1つの画素の画素値が反転(補正)されたものとする。織物パターン画像d4中の1つの画素の画素値が反転されたパターン画像を、第1暫定パターン画像dnと定義する。「暫定」は、このパターン画像が、最終的な出力パターン画像d5となるかがまだ決定されていないことを意味する。
なお、決定処理2において、織物パターン画像d4及び第1暫定パターン画像dnは、補正前パターン画像及び補正後パターン画像の一例である。
As shown in FIG. 10, it is assumed that the pixel value of one pixel in the textile pattern image d4 is inverted (corrected) in the first inversion during the correction process. A pattern image in which the pixel value of one pixel in the textile pattern image d4 is inverted is defined as a first provisional pattern image dn1 . "Tentative" means that it has not yet been determined whether this pattern image will become the final output pattern image d5.
Note that in the determination process 2, the textile pattern image d4 and the first provisional pattern image dn1 are examples of a pre-correction pattern image and a post-correction pattern image.

・決定処理3:補正処理時の反転2回目以降
図11に示すように、第1暫定パターン画像dnについて、各画素の損失関数Lの値を更新する。つまり、補正処理時の反転1回目では、各画素の画素値が反転することを前提として、各画素の損失関数の値を算出している。しかし、反転1回目において反転させる画素が決定したので、反転2回目以降については、反転する画素をより適切に決定できるよう、各画素の損失関数Lを算出し直すということである。図11において、更新された損失関数の値は、L1'と示されている。
そして、図11に示すように、画素決定部4B1は、当該画素の補正後の損失関数の値L1'と、当該画素の補正前の損失関数の値L1との差分S1を算出する。また、その他の残りの画素についても同様に、損失関数Lの差分SN(ここではNは2~100)を算出する。図11に示す第1差分マトリクスSmには、各画素の差分SNが特定されている。
-Determination process 3: Second and subsequent inversions during correction process As shown in FIG. 11, the value of the loss function L of each pixel is updated for the first provisional pattern image dn1 . That is, in the first inversion during the correction process, the value of the loss function of each pixel is calculated on the premise that the pixel value of each pixel is inverted. However, since the pixels to be inverted have been determined in the first inversion, the loss function L of each pixel is recalculated for the second and subsequent inversions so that the pixels to be inverted can be determined more appropriately. In FIG. 11, the value of the updated loss function is indicated as L1'.
Then, as shown in FIG. 11, the pixel determining 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. Furthermore, for the remaining pixels, the difference SN of the loss function L (here, N is 2 to 100) is calculated in the same way. In the first difference matrix Sm1 shown in FIG. 11, the difference SN of each pixel is specified.

画素決定部4B1が画素値を反転させる画素(図11の画素ptr参照)は、損失関数Lの差分SNのうち、予め定められた閾値(損失関数閾値の一例)より大きく、且つ、最も値が大きい画素である。画素決定部4B1が画素値を反転させることで、第2暫定パターン画像dnが生成される。なお、予め定められた閾値を設けることで、補正処理において、暫定パターン画像を逐次生成する繰り返し演算の収束性を確保することができる。 The pixel whose pixel value is inverted by the pixel determining unit 4B1 (see pixel ptr in FIG. 11) is the one whose value is larger than a predetermined threshold (an example of a loss function threshold) among the differences SN of the loss function L, and whose value is the highest. It is a large pixel. The second provisional pattern image dn2 is generated by the pixel determination unit 4B1 inverting the pixel values. Note that by providing a predetermined threshold value, it is possible to ensure convergence of repeated calculations that sequentially generate provisional pattern images in the correction process.

画素決定部4B1は、生成した第2暫定パターン画像dnについて、各画素の損失関数を算出する。図12において、例えば、左上の角に位置する画素の損失関数の値が、L1''として示されている。画素決定部4B1は、第1暫定パターン画像dnの損失関数の値L1'と、生成した第2暫定パターン画像dnの損失関数の値L1''とを用いて、第2差分マトリクスSm中の差分S1'を算出することができる。その他の画素についても、同様に差分SNを算出し、第2差分マトリクスSmを完成させる。そして、画素決定部4B1が画素値を反転させる画素(図12の画素ptr参照)は、損失関数Lの差分SN(Nは1~100)のうち、予め定められた閾値より大きく、且つ、最も値が大きい画素である。以上を繰り返すことで、第N暫定パターン画像dnを逐次、生成する。
なお、決定処理3において、第N暫定パターン画像dnは、第N-1暫定パターン画像dnN-1は、補正前パターン画像及び補正後パターン画像の一例である。
The pixel determination unit 4B1 calculates a loss function for 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 determining unit 4B1 uses the value L1' of the loss function of the first provisional pattern image dn 1 and the value L1'' of the loss function of the generated second provisional pattern image dn 2 to create a second difference matrix Sm 2 It is possible to calculate the difference S1' in the middle. Differences SN are similarly calculated for other pixels to complete the second difference matrix Sm2 . Then, the pixel whose pixel value is inverted by the pixel determination unit 4B1 (see pixel ptr in FIG. 12) is selected from among the differences SN (N is 1 to 100) of the loss function L, which is larger than a predetermined threshold value and the most This is a pixel with a large value. By repeating the above steps, the Nth provisional pattern image dnN is successively generated.
In the determination process 3, the N-th provisional pattern image dn N and the N-1st provisional pattern image dn N-1 are examples of the pre-correction pattern image and the post-correction pattern image.

ところで、暫定パターン画像を逐次、生成することを繰り返す過程において、既に反転済みの画素の損失関数Lの値が再び増加する場合がある。このような場合には、既に反転した画素が、再度、反転の対象となる可能性がある。このため、同じ画素が、反転できる回数に制限を設けないと、補正処理が収束しにくくなる可能性がある。そこで、実施形態では、1つの画素が、補正処理内で反転できる回数を予め定められた回数までとし、反転回数が当該予め定められた回数を超えないようにしている。つまり、画素決定部4B1は、反転回数が予め定められた回数に到達した画素を反転対象の画素から除外する。なお、予め定められた回数は、具体的には例えば、2,3,4,5,6,7回であり、ここで例示した数値の何れか2つの間の範囲内であってもよい。 By the way, in the process of repeatedly generating temporary pattern images one after another, the value of the loss function L of the already inverted pixels may increase again. In such a case, there is a possibility that a pixel that has already been inverted becomes a target of inversion again. For this reason, unless a limit is placed on the number of times the same pixel can be inverted, it may become difficult for the correction process to converge. Therefore, in the embodiment, the number of times that one pixel can be reversed during the correction process is set to a predetermined number of times, and the number of times of reversal is prevented from exceeding the predetermined number of times. That is, the pixel determining unit 4B1 excludes pixels whose number of inversions has reached a predetermined number of times from pixels to be inverted. Note that the predetermined number of times is specifically, for example, 2, 3, 4, 5, 6, or 7 times, and may be within a range between any two of the numerical values exemplified here.

<画像決定部4B2>
画像決定部4B2は、反転させる画素のデータ(座標や画素値)に基づいて、生成するパターン画像を決定し、当該決定したパターン画像を出力するように構成されている。
<Image determining section 4B2>
The image determining unit 4B2 is configured to determine a pattern image to be generated based on data (coordinates and pixel values) of pixels to be inverted, and output the determined pattern image.

画像決定部4B2は、変数設定処理時においては、反転パターン画像dtを生成する。反転パターン画像dtは、織物パターン画像d4から生成される。織物パターン画像d4が例えば100つの画素を有する場合には、反転パターン画像dtは100種類存在することになる。画像決定部4B2は、各反転パターン画像dtをフィルタ部4C及び損失関数処理部4Aに出力する。フィルタ部4Cに出力された各反転パターン画像dtは、第1損失関数Lの値の算出に活用されることになる。また、損失関数処理部4Aに出力された各反転パターン画像dtは、第1~第5損失関数の値L,L,L,L,Lの算出に活用されることになる。
また、変数設定処理時において、画素決定部4B1は、損失関数Lの差分(第1~第5損失関数の値L,L,L,L,Lの総和の差分)が、予め定められた閾値より大きい画素の全てが反転対象画素と決定している。画像決定部4B2は、反転対象画素を強調表示した参照パターン画像dTを生成し、出力部5に出力する。参照パターン画像dTは、織物パターン画像d4に重畳するように、反転対象画素を強調表示した画像である(図8参照)。
The image determining unit 4B2 generates an inverted pattern image dt during the variable setting process. The reverse pattern image dt is generated from the textile pattern image d4. If the textile pattern image d4 has, for example, 100 pixels, there will be 100 types of inverted pattern images dt. The image determining section 4B2 outputs each inverted pattern image dt to the filter section 4C and the loss function processing section 4A. Each inverted pattern image dt output to the filter section 4C is used to calculate the value of the first loss function LI . Furthermore, each inverted pattern image dt output to the loss function processing unit 4A will be used to calculate the values L I , L J , L D , L M , and L C of the first to fifth loss functions. .
In addition, during the variable setting process, the pixel determining unit 4B1 determines that the difference between the loss functions L (the difference between the sums of the values L I , L J , L D , L M , and L C of the first to fifth loss functions) is All pixels larger than a predetermined threshold are determined to be inversion target pixels. The image determining unit 4B2 generates a reference pattern image dT in which pixels to be inverted are highlighted, and outputs it to the output unit 5. The reference pattern image dT is an image in which pixels to be inverted are highlighted so as to be superimposed on the textile pattern image d4 (see FIG. 8).

画像決定部4B2は、補正処理時においては、画素決定部4B1において反転すると決定された画素のデータ(例えば、座標や画素値)に基づいて、第N暫定パターン画像dnを生成する。第1暫定パターン画像dnは、織物パターン画像d4から生成される。また、第N暫定パターン画像dnは、第N-1暫定パターン画像dnN-1から生成される。また、画素決定部4B1が、損失関数Lの差分SNのうち予め定められた閾値より大きいものがないと判定した場合、画像決定部4B2は、最後(繰り返しの最終回)に生成した暫定パターン画像を出力パターン画像d5と決定し、出力部5に出力する。 During the correction process, the image determining unit 4B2 generates the Nth provisional pattern image dnN based on the data (for example, coordinates and pixel values) of the pixels determined to be inverted by the pixel determining unit 4B1. The first provisional pattern image dn1 is generated from the textile pattern image d4. Further, the Nth provisional pattern image dn N is generated from the N-1st provisional pattern image dn N-1 . Further, when the pixel determining unit 4B1 determines that there is no difference SN of the loss function L that is larger than a predetermined threshold value, the image determining unit 4B2 determines that there is no difference SN of the loss function L that is larger than a predetermined threshold value. is determined as the output pattern image d5 and output to the output section 5.

2-3-3 フィルタ部4C
フィルタ部4Cは、受け付けた各種のパターン画像にフィルタ処理を施すように構成されている。実施形態において、フィルタ部4Cは、ガウシアンフィルタを採用しており、各種のパターン画像をぼかすことが可能となっている。
2-3-3 Filter section 4C
The filter unit 4C is configured to perform filter processing on various pattern images received. In the embodiment, the filter section 4C employs a Gaussian filter, and is capable of blurring various pattern images.

2-3-4 設定部4D
設定部4Dは、入力データdinを受け付けるように構成され、また、設定部4Dは、入力データdinに基づいて、重み係数w,w,w,w,w及び閾値dthの値を設定するための設定データdpを決定部4Bに出力するように構成されている。変数設定処理において、設定部4Dは、随時、入力データdinを受け付けている。このため、ユーザーが入力データdinを変更することに応じて、重み係数w,w,w,w,w及び閾値dthの値が変更される。これにより、参照パターン画像dTにおいて強調表示される画素が、リアルタイムで変更される。
2-3-4 Setting section 4D
The setting unit 4D is configured to receive input data din, and the setting unit 4D determines the weighting coefficients w I , w J , w D , w M , w C and the threshold value d th based on the input data din. It is configured to output setting data dp for setting a value to the determining unit 4B. In the variable setting process, the setting unit 4D accepts input data din at any time. Therefore, the values of the weighting coefficients w I , w J , w D , w M , w C and the threshold value d th are changed in response to the user changing the input data din. Thereby, the highlighted pixels in the reference pattern image dT are changed in real time.

2-4 出力部5
出力部5は、入力画像d1、織物パターン画像d4及び出力パターン画像d5等の各種画像を出力装置20に出力可能に構成されている。また、出力部5は、出力パターン画像d5を織物製造装置30に出力可能に構成されている。
2-4 Output section 5
The output unit 5 is configured to be able to output various images such as the input image d1, the textile pattern image d4, and the output pattern image d5 to the output device 20. Further, the output unit 5 is configured to be able to output the output pattern image d5 to the textile manufacturing apparatus 30.

2-5 記憶部6
記憶部6は、各種データを記憶する機能を有する。記憶部6には、例えば、入力画像d1、織物パターン画像生成部3で用いられる織物用閾値マトリクス、出力パターン画像生成部4で用いられる損失関数等の各種データが格納されている。記憶部6に格納されている各種データは、織物パターン画像生成部3や出力パターン画像生成部4で読み出される。
2-5 Storage section 6
The storage unit 6 has a function of storing various data. The storage unit 6 stores various data such as an input image d1, a textile threshold matrix used in the textile pattern image generation unit 3, and a loss function used in the output pattern image generation unit 4, for example. Various data stored in the storage section 6 are read out by the textile pattern image generation section 3 and the output pattern image generation section 4.

3 動作説明
実施形態に係る画像生成装置1の画像生成方法は、入力画像取得ステップと、織物パターン画像生成ステップと、重み係数設定ステップと、出力パターン画像生成ステップとを備える。
3 Operational Description The image generation method of the image generation device 1 according to the embodiment includes an input image acquisition step, a textile pattern image generation step, a weighting coefficient setting step, and an output pattern image generation step.

3-1 入力画像取得ステップ
入力画像取得ステップでは、取得部2が、入力画像d1を取得する。取得部2は、画像生成装置1の外部装置から入力画像d1を取得してもよいし、記憶部6から入力画像d1を取得してもよい。
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 may acquire the input image d1 from the storage unit 6.

3-2 織物パターン画像生成ステップ
織物パターン画像生成ステップでは、織物パターン画像生成部3が、マスクを用いた閾値処理を行うことで入力画像d1から織物パターン画像d4を生成する。具体的には、前処理部3Aは、入力画像d1から、256階調のグレースケール画像データである前処理後画像d2を生成する。そして、二値化処理部3Cは、マトリクス生成部3Bから受け取った織物用閾値マトリクス(マトリクスデータd3)を用いて、前処理後画像d2を二値化処理し、織物パターン画像d4を生成する。
3-2 Fabric pattern image generation step In the fabric pattern image generation step, the fabric pattern image generation unit 3 generates a fabric 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 grayscale image data with 256 gradations, from the input image d1. Then, the binarization processing unit 3C binarizes the preprocessed image d2 using the textile threshold matrix (matrix data d3) received from the matrix generation unit 3B, and generates a textile pattern image d4.

3-3 設定ステップ
設定ステップでは、織物パターン画像生成ステップの後であって出力パターン画像生成ステップの前に行われる。設定ステップでは、設定部4Dが、ユーザーにより操作される入力装置から入力データdinを受け付ける。なお、入力データdinは、第1~第5損失関数の重み係数w,w,w,w,wや、第2損失関数Lの閾値dthといった変数を設定するためのデータである。そして、設定ステップでは、設定部4Dは、入力データdinに基づいて、これらの変数の設定値(設定データdp)を画素決定部4B1に出力する。なお、設定ステップにおいて、設定部4Dは、随時、入力データdinを受け付け、対応して設定データdpを出力するように構成されている。
3-3 Setting Step The setting step is performed after the fabric pattern image generation step and before the output pattern image generation step. In the setting step, the setting unit 4D receives input data din from an input device operated by the user. Note that the input data din is used to set variables such as the weighting coefficients w I , w J , w D , w M , w C of the first to fifth loss functions, and the threshold value d th of the second loss function L J. It is data. In the setting step, the setting section 4D outputs the setting values of these variables (setting data dp) to the pixel determining section 4B1 based on the input data din. Note that in the setting step, the setting unit 4D is configured to accept input data din at any time and output setting data dp in response.

設定ステップでは、画素決定部4B1は、受け付けた入力データdinに応じて上述の変数決定処理を実行する。すなわち、画素決定部4B1は、上述の決定処理1を実行して強調する対象画素を決定し、画像決定部4B2は参照パターン画像dTを生成する。なお、入力データdinが変更されると、参照パターン画像dTにおいて強調表示される画素がリアルタイムで変更される。これにより、ユーザーは、重み係数w,w,w,w,w及び閾値dthを調整することが、出力パターン画像生成ステップにおける補正処理において、どのように効いてくるかといった傾向を把握することができる。つまり、ユーザーは、参照パターン画像dTを参照しながら、後段の補正処理において使用する重み係数w,w,w,w,w及び閾値dthを決定することができる。設定ステップにおいて、ユーザーが最終的な入力データdinを決定すると、設定部4Dは対応する設定データdpを出力し、実施形態に係る制御は、出力パターン画像生成ステップに移行する。 In the setting step, the pixel determining unit 4B1 executes the above-described variable determining process according to the received input data din. That is, the pixel determining unit 4B1 executes the above-described determining process 1 to determine the target pixel to be emphasized, and the image determining unit 4B2 generates the reference pattern image dT. Note that when the input data din is changed, the highlighted pixels in the reference pattern image dT are changed in real time. This allows the user to understand how adjusting the weighting coefficients w I , w J , w D , w M , w C and the threshold value d th will affect the correction process in the output pattern image generation step. Be able to understand trends. That is, the user can determine the weighting coefficients w I , w J , w D , w M , w C and the threshold value d th to be used in the subsequent correction process while referring to the reference pattern image dT. 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 shifts to the output pattern image generation step.

3-5 出力パターン画像生成ステップ
出力パターン画像生成ステップの反転1回目では、画素決定部4B1は、上述の決定処理2を実行して損失関数Lの値を算出し、画素値を反転させる対象画素を決定し、画像決定部4B2は、第1暫定パターン画像dnを生成する。
続いて、出力パターン画像生成ステップの反転2回目以降では、画素決定部4B1は、上述の決定処理3を逐次実行して損失関数Lの値を逐次算出し、画素値を反転させる対象画素を逐次決定し、画像決定部4B2は、第N暫定パターン画像dnを逐次生成する(ここで、Nは2以上の整数)。
そして、画素決定部4B1が、損失関数Lの差分のうち予め定められた閾値より大きいものがないと判定した場合、画像決定部4B2は、最後に生成した暫定パターン画像を出力パターン画像d5と決定し、出力部5に出力する。
3-5 Output pattern image generation step In the first inversion of the output pattern image generation step, the pixel determination unit 4B1 executes the above-described determination process 2 to calculate the value of the loss function L, and determines the target pixel whose pixel value is to be inverted. The image determining unit 4B2 generates a first provisional pattern image dn1 .
Subsequently, in the second and subsequent inversions of the output pattern image generation step, the pixel determination unit 4B1 sequentially executes the above-described determination process 3 to sequentially calculate the values of the loss function L, and sequentially selects the target pixels whose pixel values are to be inverted. The image determining unit 4B2 sequentially generates the Nth provisional pattern image dnN (here, N is an integer of 2 or more).
Then, when the pixel determining unit 4B1 determines that there is no difference in the loss function L that is larger than a predetermined threshold value, the image determining unit 4B2 determines the last generated provisional pattern image as the output pattern image d5. and outputs it to the output section 5.

このように、暫定パターン画像を生成するごとに損失関数を算出し、新たな暫定パターン画像を逐次生成していくことは、職人やデザイナーが、最も目立つ画素から織物パターンの修正を図ることに対応している。つまり、実施形態の処理は、人間による織物パターンの修正作業に近づけられており、最終的な出力パターン画像d5を職人やデザイナーの意向に沿った内容に近づけやすくなる効果が期待できる。
ここで、従来、職人やデザイナーは二値化された織物パターン画像から織り上がりを想像することによって、或いは、実際に試し織りすることによって、織物パターンの修正を行っている。糸の張り具合や糸の色のバランスなどといった条件を考慮する必要があるため、作業者には技術と経験が求められる上に作業時間も増大しやすい。一方、実施形態に係る画像生成方法は、上述のような修正を自動的に実施することが可能であるため、織物パターン画像d4に内在する可能性がある不具合を容易に取り除くことができる。これにより、作業者に対する技術や経験の要求水準を軽減させたり、作業時間を抑制させたりする効果が期待できる。
In this way, calculating a loss function each time a temporary pattern image is generated and successively generating new temporary pattern images allows craftsmen and designers to modify textile patterns starting from the most noticeable pixels. are doing. In other words, the processing of the embodiment approaches the correction work of textile patterns by humans, and can be expected to have the effect of making the final output pattern image d5 more likely to match the intentions of the craftsman or designer.
Conventionally, craftsmen and designers have corrected textile patterns by imagining the finished weaving from a binarized textile pattern image or by actually trial weaving. Since it is necessary to consider conditions such as thread tension and thread color balance, the operator is required to have skill and experience, and the work time tends to increase. On the other hand, since the image generation method according to the embodiment can automatically perform the above-described corrections, it is possible to easily eliminate defects that may exist in the textile pattern image d4. This can be expected to have the effect of reducing the required level of skill and experience for workers and reducing work time.

5 その他実施形態
・実施形態では、損失関数Lが第1~第5損失関数を加味しているものとして説明したが、これに限定されるものではない。例えば、損失関数Lは、第1~第5損失関数のうちの少なくとも2つを加味するものであってもよい。また、重み係数の調整はできなくなるが、損失関数Lは、第1~第5損失関数のうちのいずれか1つのみで構成されたものであってもよい。
・実施形態では、織物パターン画像生成部3と出力パターン画像生成部4とが1つの装置内に搭載されているものとして説明しているが、これに限定されるものではない。例えば、画像生成装置1は、出力パターン画像生成部4を備えており、織物パターン画像生成部3を備えていなくてもよい。この場合には、織物パターン画像生成部3が画像生成装置1とは別の装置に搭載されており、画像生成装置1は、当該別の装置から、織物パターン画像d4等を取得すればよい。
・実施形態では、画像生成装置1が前処理部3Aを備えるか否かは任意である。例えば、入力画像d1がグレースケール画像データであれば、画像生成装置1は前処理部3Aを備えていなくてもよく、この場合、入力画像d1が、マスク処理の対象の画像である。
・変数設定処理の決定処理1で用いる予め定められた閾値(損失関数閾値の一例)は、補正処理の決定処理1,2で用いる予め定められた閾値と同じであるものとして説明したが、異なっていてもよい。
5. In the other embodiments and embodiments, the loss function L has been described as taking the first to fifth loss functions into consideration, but the present invention 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. Further, although the weighting coefficient cannot be adjusted, the loss function L may be composed of only one of the first to fifth loss functions.
- In the embodiment, the textile pattern image generation section 3 and the output pattern image generation section 4 are described as being installed in one device, but the present invention is not limited to this. For example, the image generation device 1 includes the output pattern image generation section 4 and does not need to include the textile pattern image generation section 3. In this case, the textile pattern image generation section 3 is installed in a device different from the image generation device 1, and the image generation device 1 only needs to acquire the textile pattern image d4 etc. from the other device.
- In the embodiment, it is optional whether or not the image generation device 1 includes the preprocessing section 3A. For example, if the input image d1 is grayscale image data, the image generation device 1 does not need to include the preprocessing section 3A, and in this case, the input image d1 is the image to be masked.
・The predetermined threshold value (an example of a loss function threshold value) used in the determination process 1 of the variable setting process was explained as being the same as the predetermined threshold value used in the determination processes 1 and 2 of the correction process. You can leave it there.

1 :画像生成装置
2 :取得部
3 :織物パターン画像生成部
3A :前処理部
3B :マトリクス生成部
3C :二値化処理部
4 :出力パターン画像生成部
4A :損失関数処理部
4A1 :第1算出部
4A2 :第2算出部
4A3 :第3算出部
4A4 :第4算出部
4A5 :第5算出部
4B :決定部
4B1 :画素決定部
4B2 :画像決定部
4C :フィルタ部
4D :設定部
5 :出力部
6 :記憶部
20 :出力装置
30 :織物製造装置
100 :織物製造システム
1: Image generation device 2: Acquisition unit 3: Textile pattern image generation unit 3A: Preprocessing unit 3B: Matrix generation unit 3C: Binarization processing unit 4: Output pattern image generation unit 4A: Loss function processing unit 4A1: First Calculating unit 4A2: Second calculating unit 4A3: Third calculating unit 4A4: Fourth calculating unit 4A5: Fifth calculating unit 4B: Determining unit 4B1: Pixel determining unit 4B2: Image determining unit 4C: Filter unit 4D: Setting unit 5: Output unit 6 : Storage unit 20 : Output device 30 : Textile manufacturing device 100 : Textile manufacturing system

Claims (14)

出力パターン画像生成ステップを備え、
前記出力パターン画像生成ステップでは、損失関数を用いて織物パターン画像に補正処理を行うことで、前記織物パターン画像から出力パターン画像を生成し、
前記織物パターン画像の各画素値は、経糸及び緯糸の上下関係が特定されるように第1及び第2画素値のうちの一方の画素値に二値化され、
前記損失関数の値は、画素ごとに算出され、
前記補正処理では、補正前後において前記損失関数の値が低下する画素が、補正対象の画素となり、
前記補正対象の画素の画素値は、第1及び第2画素値のうちの一方の画素値から他方の画素値へ反転される、画像生成方法。
Equipped with an output pattern image generation step,
In the output pattern image generation step, 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 into one of the first and second pixel values so that the vertical relationship between the warp and weft is specified,
The value of the loss function is calculated for each pixel,
In the correction process, a pixel whose value of the loss function decreases before and after correction becomes a pixel to be corrected,
An image generation method, wherein 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.
請求項1に記載の方法であって、
前記補正処理は、補正前パターン画像から補正後パターン画像を生成することを繰り返し、
前記補正後パターン画像は、前記補正前パターン画像うち前記補正対象の画素の画素値が反転した画像であり、
繰り返しの初回の前記補正処理では、前記補正前パターン画像が前記織物パターン画像であり、
繰り返しの最終回の前記補正処理では、前記補正後パターン画像が前記出力パターン画像である、方法。
The method according to claim 1,
The correction process repeatedly generates a post-correction pattern image from a pre-correction pattern image,
The post-correction 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 repetition, the pre-correction pattern image is the textile pattern image,
In the correction process at the final time of repetition, the corrected pattern image is the output pattern image.
請求項2に記載の方法であって、
前記補正処理における前記補正対象の画素は、補正前後における前記損失関数の値の差分が損失関数閾値より大きく、
前記補正処理は、前記損失関数の値の差分が前記損失関数閾値より大きい画素がなくなるまで繰り返す、方法。
3. The method according to claim 2,
The pixel to be corrected in the correction process has a difference in the value of the loss function before and after correction that is larger than a loss function threshold;
The method includes repeating the correction process until there are no pixels for which the difference between the values of the loss function is greater than the loss function threshold.
請求項1~請求項3の何れか1つに記載の方法であって、
前記補正処理における前記補正対象の画素は、補正前後における前記損失関数の値の差分が最大の画素である、方法。
The method according to any one of claims 1 to 3,
In the method, the pixel to be corrected in the correction process is a pixel with a maximum difference in the value of the loss function before and after correction.
請求項1に記載の方法であって、
設定ステップを更に備え、
前記出力パターン画像生成ステップの前記補正処理では、複数の損失関数が用いられ、
各前記損失関数の値は、画素ごとに算出され、
前記設定ステップは、前記出力パターン画像生成ステップの前に行われ、且つ、前記設定ステップでは、各前記損失関数の重み係数を設定可能であり、
前記出力パターン画像生成ステップの前記補正処理では、補正前後における前記複数の損失関数の値の総和が低下する画素が、前記補正対象の画素となる、方法。
The method according to claim 1,
With additional configuration steps,
In the correction processing 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, weighting coefficients of each of the loss functions can be set,
In the correction process of the output pattern image generation step, a pixel for which the sum of the values of the plurality of loss functions before and after the correction decreases becomes the pixel to be corrected.
請求項5に記載の方法であって、
前記設定ステップでは、前記織物パターン画像中の注目画素の画素値を反転させたときにおいて、前記複数の損失関数の値の総和の差分が損失関数閾値より大きい画素を強調表示する、方法。
6. The method according to claim 5,
In the setting step, when a pixel value of a pixel of interest in the textile pattern image is inverted, a pixel for which a difference between sums of values of the plurality of loss functions is larger than a loss function threshold is highlighted.
請求項1~3,5,6の何れか1つに記載の方法であって、
入力画像取得ステップと織物パターン画像生成ステップとを更に備え、
前記入力画像取得ステップでは、入力画像を取得し、
前記織物パターン画像生成ステップでは、マスク処理を行うことで前記入力画像から前記織物パターン画像を生成し、
前記マスク処理では、前記マスク処理の対象の画像の各画素の画素値に対してマスクを用いて閾値処理をし、
前記マスクには、前記入力画像の各画素に対応付けられた各閾値が予め設定されている、方法。
The method according to any one of claims 1 to 3, 5, and 6,
further comprising an input image acquisition step and a textile pattern image generation step,
In the input image acquisition step, an input image is acquired;
In the textile pattern image generation step, the textile pattern image is generated from the input image by performing mask processing,
In the mask processing, threshold processing is performed using a mask on the pixel value of each pixel of the image to be subjected to the mask processing,
The method, wherein each threshold value associated with each pixel of the input image is set in advance in the mask.
請求項7に記載の方法であって、
前記損失関数は、第1損失関数が加味されており、
第1損失関数は、画素値差分に基づいており、
前記画素値差分は、補正前後における画素値の差分に基づいている、方法。
8. The method according to claim 7,
The loss function includes a first loss function,
The first loss function is based on pixel value differences,
The method, wherein the pixel value difference is based on a difference in pixel values before and after correction.
請求項7に記載の方法であって、
前記損失関数は、第4損失関数が加味されており、
第4損失関数は、閾値差に基づいており、
前記閾値差は、補正後マスクの補正閾値と、前記織物パターン画像生成ステップで用いられる前記マスクの前記閾値との差分に基づいており、
前記補正後マスクの前記補正閾値は、前記マスク処理をしたときに、前記出力パターン画像生成ステップの前記補正処理で補正されたパターン画像が生成されるように設定されている、方法。
8. The method according to claim 7,
The loss function includes a fourth loss function,
The fourth loss function is based on the threshold difference,
The threshold difference is based on the difference between the corrected threshold of the corrected mask and the threshold of the mask used in the textile pattern image generation step,
The correction threshold of the corrected mask is set such that, when the mask processing is performed, a pattern image corrected by the correction processing of the output pattern image generation step is generated.
請求項1~3,5,6の何れか1つに記載の方法であって、
前記損失関数は、第2損失関数が加味されており、
第2損失関数は、画素間距離に基づいており、
前記画素間距離は、注目画素と反転画素との間にある画素の数に基づいており、
前記注目画素と前記反転画素との間にある画素の画素値は、前記反転画素の画素値とは異なる、方法。
The method according to any one of claims 1 to 3, 5, and 6,
The loss function includes a second loss function,
The second loss function is based on the distance between pixels,
The inter-pixel distance is based on the number of pixels between the pixel of interest and the inverted pixel,
A pixel value of a pixel between the pixel of interest and the inversion pixel is different from a pixel value of the inversion pixel.
請求項1~3,5,6の何れか1つに記載の方法であって、
前記損失関数は、第3損失関数が加味されており、
第3損失関数は、交差回数に基づいており、
前記交差回数は、注目画素を含む予め定められた範囲内において、画素値が反転している対をなす画素の数に基づいている、方法。
The method according to any one of claims 1 to 3, 5, and 6,
The loss function includes a third loss function,
The third loss function is based on the number of crossings,
The number of crossings is based on the number of paired pixels whose pixel values are inverted within a predetermined range including the pixel of interest.
請求項1~3,5,6の何れか1つに記載の方法であって、
前記損失関数は、第5損失関数が加味されており、
第5損失関数は、自己相関度に基づいており、
前記自己相関度は、第1画像領域内の画素と、第2画像領域内の画素とのうち画素値が異なる画素の数に基づいており、
第1画像領域は、注目画素を含む予め定められた領域内の画像であり、
第2画像領域は、第1画像領域と同じ形状の領域であって第1画像領域から予め定められた距離内に位置する領域である、方法。
The method according to any one of claims 1 to 3, 5, and 6,
The loss function includes a fifth loss function,
The fifth loss function is based on the degree of autocorrelation,
The autocorrelation degree is based on the number of pixels having different pixel values between pixels in the first image region and pixels in the second image region,
The first image area is an image within a predetermined area including the pixel of interest,
The second image area is an area having the same shape as the first image area and is located within a predetermined distance from the first image area.
コンピュータに請求項1~3,5,6の何れか1つに記載の画像生成方法を実行させるためのプログラム。 A program for causing a computer to execute the image generation method according to any one of claims 1 to 3, 5, and 6. 出力パターン画像生成部を備え、
前記出力パターン画像生成部は、損失関数を用いて織物パターン画像に補正処理を行うことで、前記織物パターン画像から出力パターン画像を生成するように構成され、
前記織物パターン画像の各画素値は、経糸及び緯糸の上下関係が特定されるように第1及び第2画素値のうちの一方の画素値に二値化され、
前記損失関数の値は、画素ごとに算出され、
前記補正処理では、補正前後において前記損失関数の値が低下する画素が、補正対象の画素となり、
前記補正対象の画素の画素値は、第1及び第2画素値のうちの一方の画素値から他方の画素値へ反転される、画像生成装置。
Equipped with an output pattern image generation section,
The output pattern image generation unit is configured to generate an output pattern image 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 into one of the first and second pixel values so that the vertical relationship between the warp and weft is specified,
The value of the loss function is calculated for each pixel,
In the correction process, a pixel whose value of the loss function decreases before and after correction becomes a pixel to be corrected,
The pixel value of the pixel to be corrected is an image generating device in which the pixel value of one of the first and second pixel values is inverted to the other pixel value.
JP2022099559A 2022-06-21 2022-06-21 Image generation method, program, and image generation device Pending JP2024000704A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2022099559A JP2024000704A (en) 2022-06-21 2022-06-21 Image generation method, program, and image generation device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2022099559A JP2024000704A (en) 2022-06-21 2022-06-21 Image generation method, program, and image generation device

Publications (1)

Publication Number Publication Date
JP2024000704A true JP2024000704A (en) 2024-01-09

Family

ID=89451548

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2022099559A Pending JP2024000704A (en) 2022-06-21 2022-06-21 Image generation method, program, and image generation device

Country Status (1)

Country Link
JP (1) JP2024000704A (en)

Similar Documents

Publication Publication Date Title
CN104517110B (en) The binarization method and system of a kind of image in 2 D code
JP5889431B2 (en) Image processing apparatus and image processing method
JP6463101B2 (en) Region dividing apparatus and method
JP4982475B2 (en) Image processing method and computer program
KR101295649B1 (en) Image processing apparatus, image processing method and storage medium
JP6152520B2 (en) Method, apparatus and program for generating jacquard fabric pattern
CN113838038A (en) Carbon fiber cloth cover defect detection method and device, electronic equipment and storage medium
CN116630464A (en) Image style migration method and device based on stable diffusion
CN111652297A (en) Fault picture generation method for image detection model training
JP2021189527A5 (en)
JP2024000704A (en) Image generation method, program, and image generation device
JP3543103B2 (en) Color image processing method and processing apparatus
CN115511755B (en) Video stream image self-adaptive enhancement method and system
JP5911633B1 (en) Image processing device
JP5596948B2 (en) Image processing apparatus, image processing method, and program
WO2021060165A1 (en) Image recognition device, image recognition system, image recognition method, and program
CN107516299B (en) Symmetric multi-threshold error diffusion method for fabric color level conversion and application thereof
US11282168B2 (en) Image processing apparatus, image processing method, and program
WO2016084253A1 (en) Image processing apparatus and image processing method
JP2015069238A (en) Target image generation support device, target image generation support method, and program
Igarashi et al. Optimizing Dither Masks for Rendering Smooth Tones on Fabric
JP2005303705A (en) Image processing device and image processing method
JP4645918B2 (en) Image signal processing apparatus and method
JP2021182210A (en) Image creation method, program, and image creation device
JP6651776B2 (en) Image processing apparatus, image processing method, and program