White cloth color deviation detection method and system based on virtual target color calibration

CN122361292BActive Publication Date: 2026-08-07GUSU LAB OF MATERIALS
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUSU LAB OF MATERIALS
Filing Date
2026-06-10
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]然而,在增白布料连续检测场景中,人工目测容易受到光源条件、人员经验和视觉疲劳影响,检测结果的稳定性和可追溯性较弱;测色仪虽然能够获得较准确的颜色数值,但单次测量通常对应有限的布面区域,若需要对连续生产的宽幅布料进行高密度检测,则需要增加测量点位或配置多套检测单元,系统部署成本和维护成本较高;机器视觉检测虽然能够对较大区域布面进行图像采集,但相机采集到的颜色信息容易受到光源、曝光、白平衡、镜头、背景以及拍摄角度等因素影响,直接由相机图像得到的颜色信息难以作为稳定的颜色判断依据

Benefits of technology

[0014]第四方面,本申请提供一种计算机可读存储介质,所述存储介质中存储有程序,所述程序被处理器执行时用于实现如第一方面所述的一种基于虚拟目标色标定的增白布料色偏检测方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122361292B_ABST
    Figure CN122361292B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of textile visual detection, in particular to a whitened fabric color deviation detection method and system based on virtual target color calibration, which comprises the following steps: collecting sample images of multiple calibration samples under fixed imaging conditions, and obtaining colorimeter Lab true values corresponding to the calibration samples; performing cloth surface area extraction and color conversion processing on the sample images to obtain camera imaging Lab data; establishing a color mapping model based on the camera imaging Lab data and the colorimeter Lab true values; obtaining colorimeter Lab true values corresponding to a target color reference, and determining a virtual target color based on the color mapping model; collecting online images of the whitened fabric to be detected and determining camera imaging Lab data to be detected; and determining a color deviation direction, a color deviation degree and a detection result based on the camera imaging Lab data to be detected and the virtual target color. The application can obtain stable detection results capable of representing the color deviation direction and the color deviation degree of the fabric while considering the detection range and the cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of textile visual inspection technology, and in particular to a method and system for detecting color deviation in whitening fabrics based on virtual target color calibration. Background Technology

[0002] Whitening fabrics typically achieve high visual whiteness through bleaching, dyeing, finishing, and fluorescent whitening treatments. Fluorescent whitening agents absorb ultraviolet light energy and emit blue-violet fluorescence in the visible light spectrum, thus using optical color compensation to improve the visual impact caused by the fabric's yellowish undertone. Because factors such as the type and dosage of whitening agent, fiber material, finishing auxiliaries, treatment temperature, treatment time, and dye bath residue can all affect the final color state of the fabric, whitened fabrics do not necessarily present a completely neutral white, but may exhibit different color deviations such as bluish, purplish, or yellowish tints. The target visual appearance and permissible color deviation range of white fabrics also differ for different application scenarios. Therefore, during the production of whitened fabrics, it is necessary to test the fabric's color state to determine whether the fabric meets the corresponding quality control requirements or target color sample requirements.

[0003] Current textile color inspection methods typically include manual visual inspection, colorimeter measurement, and machine vision color difference detection. Manual visual inspection generally involves quality control personnel comparing the fabric to be tested with a standard color sample under standard lighting conditions and judging whether the fabric color is acceptable based on visual observation. Colorimeter measurement typically uses a built-in stable light source to illuminate the fabric sample, obtaining the color value of the fabric sample through spectrophotometry or colorimetry, and judging whether the fabric color is acceptable based on the color difference between the tested fabric and the standard sample. Machine vision color difference detection typically uses an industrial camera to capture images of the fabric surface, converts and analyzes the color information in the image, and then compares the color information of the tested fabric with the color information of the reference sample to obtain the fabric color difference and output the corresponding detection results. For wide-width fabrics produced continuously, machine vision inspection has the advantages of being non-contact, having a large inspection area, and low deployment cost; colorimeter measurement has the advantages of accurate color values ​​and stable detection results, making it an important detection method in fabric color management.

[0004] However, in continuous inspection scenarios for whitening fabrics, manual visual inspection is easily affected by lighting conditions, personnel experience, and visual fatigue, resulting in weak stability and traceability of inspection results. While colorimeters can obtain relatively accurate color values, a single measurement typically corresponds to a limited area of ​​the fabric. If high-density inspection of wide-width fabrics produced continuously is required, additional measurement points or multiple inspection units need to be configured, leading to high system deployment and maintenance costs. Although machine vision inspection can acquire images of larger areas of fabric, the color information captured by the camera is easily affected by factors such as light source, exposure, white balance, lens, background, and shooting angle, making it difficult to use the color information directly obtained from camera images as a stable basis for color judgment. Furthermore, existing machine vision color difference detection typically focuses more on outputting color difference values ​​or pass / fail results, failing to adequately distinguish directional color deviations such as bluish, purplish, and yellowish tints in whitening fabrics. Therefore, in the continuous inspection of whitening fabrics, obtaining stable inspection results that can characterize the direction and degree of color deviation while balancing inspection coverage and cost is a problem that needs to be solved. Summary of the Invention

[0005] This application provides a method and system for detecting color deviation in whitening fabrics based on virtual target color calibration. It can obtain stable detection results that characterize the direction and degree of color deviation in the fabric while balancing detection coverage and cost. The technical solution provided in this application is as follows: In a first aspect, this application provides a method for detecting color deviation in whitening fabrics based on virtual target color calibration, the method comprising: Under fixed imaging conditions, sample images of multiple calibration samples are acquired respectively, and the true value of the colorimeter Lab corresponding to each calibration sample is obtained; The fabric area is extracted from each of the sample images, and the extracted fabric area is color converted to obtain the camera imaging Lab data corresponding to each of the calibration samples. Based on the camera imaging Lab data and colorimeter Lab true values ​​corresponding to each calibration sample, a color mapping model is established to characterize the correspondence between the camera imaging Lab data and the colorimeter Lab true values. Obtain the true value of the colorimeter Lab corresponding to the target color reference, and based on the inverse mapping relationship determined by the color mapping model, convert the true value of the colorimeter Lab corresponding to the target color reference into a virtual target color in the camera imaging space. The target color reference includes standard white or a target color sample. Under the fixed imaging conditions, online images of the whitening fabric to be tested are acquired. The fabric area is extracted and the color is converted from the online images to obtain the Lab data of the camera imaging corresponding to the whitening fabric to be tested. Based on the Lab data of the camera under test and the virtual target color, the color deviation component and total color difference of the whitening fabric under test relative to the target color reference are determined, and the color deviation direction, color deviation degree and detection result of the whitening fabric under test are determined according to the color deviation component and the total color difference.

[0006] In one specific implementation, the step of acquiring sample images of multiple calibration samples under fixed imaging conditions and obtaining the true Lab value of the colorimeter corresponding to each calibration sample includes: Multiple whitening fabric samples covering neutral white, bluish, purplish, and yellowish tones were selected as calibration samples. Each calibration sample was measured using a self-calibrated colorimeter to obtain the true Lab value of the colorimeter for each calibration sample. After the measurement is completed, each of the calibration samples is placed in a standard light source box in sequence, and a matte black background plate is set on the back of each of the calibration samples; Under the conditions that the exposure time, gain, white balance, lens aperture and focal length of the industrial camera are kept fixed, and the shooting distance, shooting angle and field of view of the industrial camera relative to each of the calibration samples are kept fixed, sample images corresponding to each of the calibration samples are acquired respectively. According to the calibration sample identifier, the colorimeter Lab true value and sample image corresponding to the same calibration sample are associated and recorded.

[0007] In one specific implementation, the step of extracting the fabric area from each of the sample images and performing color conversion processing on the extracted fabric area to obtain the camera imaging Lab data corresponding to each of the calibration samples includes: Based on the preset region location or the fabric boundary of the calibrated sample in the sample image, the corresponding initial fabric region is determined from each of the sample images; The initial area of ​​the fabric surface is subjected to boundary shrinkage processing, and pixels in the initial area of ​​the fabric surface that meet the preset abnormal pixel conditions are removed to obtain the fabric surface area corresponding to each sample image. Calculate the average red channel value, average green channel value, and average blue channel value of pixels in each of the fabric areas to obtain the RGB color data corresponding to each of the calibration samples; The RGB color data are sequentially linearized, converted to XYZ color space, and converted to Lab color space to obtain the camera imaging Lab data corresponding to each calibration sample.

[0008] In one specific implementation, the step of establishing a color mapping model to characterize the correspondence between camera imaging Lab data and colorimeter Lab true values ​​based on the camera imaging Lab data and colorimeter Lab true values ​​corresponding to each of the calibration samples includes: According to the calibration sample identifier, the camera imaging Lab data and the colorimeter Lab true value corresponding to the same calibration sample are combined to form a color calibration data pair; The first The camera imaging Lab data corresponding to each calibration sample is represented as follows: , will the The true value of the colorimeter Lab for each calibration sample is expressed as follows: Based on the multiple color calibration data pairs, the following positive mapping relationship is established: ; in, This represents the mapping matrix in a positive mapping relationship. This represents the bias vector in a positive mapping relationship. Indicates the calibrated sample number; Based on the multiple color calibration data pairs, the following dual mapping relationship is established: ; in, This represents the mapping matrix in the dual mapping relation. Represents the bias vector in the dual mapping relation; The forward mapping relationship and the dual mapping relationship are used as the color mapping model.

[0009] In one specific implementation, obtaining the true Lab value of the colorimeter corresponding to the target color reference, and converting the true Lab value of the colorimeter corresponding to the target color reference into a virtual target color in the camera imaging space based on the inverse mapping relationship determined by the color mapping model, includes: When the target color reference is standard white, obtain the true value of the colorimeter Lab corresponding to the standard white; when the target color reference is a target color sample, measure the target color sample using a colorimeter to obtain the true value of the colorimeter Lab corresponding to the target color sample. The true value of the colorimeter Lab corresponding to the target color reference is expressed as: And represent the virtual target color as ; Based on the dual mapping relationship in the color mapping model, the true value of the colorimeter Lab corresponding to the target color reference is converted into the virtual target color. The dual mapping relationship is expressed as follows: ; in, This represents the virtual target color corresponding to the target color reference. This represents the true Lab value of the colorimeter corresponding to the target color reference. This represents the mapping matrix in the dual mapping relation. This represents the bias vector in the dual mapping relation; The virtual target color is associated with and saved with the type of the target color reference, wherein the type of the target color reference includes standard white type or target color sample type.

[0010] In one specific implementation scheme, the online image of the whitening fabric to be tested is acquired under the fixed imaging conditions, and the fabric area is extracted and color converted from the online image to obtain the Lab data of the camera imaging corresponding to the whitening fabric to be tested, including: Under fixed imaging conditions consistent with those for acquiring the sample images, online images of the whitening fabric to be tested are acquired; Based on the preset area location or the fabric boundary of the whitening fabric to be tested in the online image, the initial area of ​​the fabric to be tested is determined from the online image; The initial area of ​​the fabric to be tested is subjected to boundary shrinkage processing, and pixels in the initial area of ​​the fabric to be tested that meet the preset abnormal pixel conditions are removed to obtain the fabric area to be tested. The preset abnormal pixel conditions include at least one of the following: pixel brightness is greater than a preset brightness threshold, any color channel reaches saturation value, or pixel brightness is lower than a preset dark pixel threshold. Calculate the average red channel value, average green channel value, and average blue channel value of the pixels in the area to be tested to obtain the RGB color data corresponding to the whitening fabric to be tested. The RGB color data to be tested is sequentially linearized, converted to XYZ color space, and converted to Lab color space to obtain the Lab data of the camera image corresponding to the whitening fabric to be tested.

[0011] In one specific implementation scheme, the step of determining the color cast component and total color difference of the whitening fabric to be tested relative to the target color reference based on the Lab data of the camera under test and the virtual target color, and determining the color cast direction, color cast degree, and detection result of the whitening fabric to be tested based on the color cast component and the total color difference, includes: The component difference between the Lab data of the camera under test and the virtual target color is calculated in the camera imaging space to obtain the lightness offset component, red-green offset component and yellow-blue offset component of the whitening fabric under test relative to the target color reference. The total color difference between the whitening fabric to be tested and the target color reference is calculated based on the lightness offset component, the red-green offset component, and the yellow-blue offset component. When the absolute value of the red-green hue offset component is less than or equal to the first color deviation threshold, and the yellow-blue hue offset component is less than the negative of the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be bluish. When the absolute value of the red-green hue offset component is less than or equal to the first color deviation threshold, and the yellow-blue hue offset component is greater than the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be yellowish. When the red-green hue offset component is greater than the first color deviation threshold and the yellow-blue hue offset component is less than the negative of the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be purplish. The degree of color deviation of the whitening fabric to be tested is determined based on the relationship between the total color difference and the preset color difference grading threshold, and the detection result is determined based on the direction of color deviation and the degree of color deviation.

[0012] Secondly, this application provides a whitening fabric color deviation detection system based on virtual target color calibration, which adopts the following technical solution: A system for detecting color deviation in whitening fabrics based on virtual target color calibration, comprising: The sample acquisition module is used to acquire sample images of multiple calibration samples under fixed imaging conditions, and obtain the true value of the colorimeter Lab corresponding to each calibration sample. The sample conversion module is used to extract the fabric area from each of the sample images and perform color conversion processing on the extracted fabric area to obtain the camera imaging Lab data corresponding to each of the calibration samples. The model building module is used to establish a color mapping model that characterizes the correspondence between camera imaging Lab data and colorimeter Lab true values ​​based on the camera imaging Lab data and colorimeter Lab true values ​​corresponding to each of the calibration samples. The target generation module is used to obtain the true value of the colorimeter Lab corresponding to the target color reference, and convert the true value of the colorimeter Lab corresponding to the target color reference into a virtual target color in the camera imaging space based on the inverse mapping relationship determined by the color mapping model. The target color reference includes standard white or target color sample. The online conversion module is used to acquire online images of the whitening fabric to be tested under the fixed imaging conditions, extract the fabric area and perform color conversion processing on the online images to obtain the camera imaging Lab data corresponding to the whitening fabric to be tested. The color cast detection module is used to determine the color cast component and total color difference of the whitening fabric under test relative to the target color reference based on the Lab data of the camera under test and the virtual target color, and to determine the color cast direction, color cast degree and detection result of the whitening fabric under test according to the color cast component and the total color difference.

[0013] Thirdly, this application provides an electronic device, the device including a processor and a memory; the memory stores a program, the program being loaded and executed by the processor to implement a method for detecting color deviation of whitening fabric based on virtual target color calibration as described in the first aspect.

[0014] Fourthly, this application provides a computer-readable storage medium storing a program that, when executed by a processor, is used to implement a method for detecting color deviation in whitening fabric based on virtual target color calibration as described in the first aspect.

[0015] By acquiring sample images of multiple calibration samples under fixed imaging conditions and obtaining the true Lab values ​​of the colorimeter for each calibration sample, the sample images are then processed by fabric area extraction and color conversion to obtain the camera imaging Lab data corresponding to each calibration sample. Based on the camera imaging Lab data and the true Lab values ​​of the colorimeter, a color mapping model is established to establish a definite correspondence between the camera imaging data and the colorimeter measurement data. On this basis, the true Lab values ​​of the colorimeter corresponding to the standard white or target color sample are obtained, and the virtual target color in the camera imaging space is converted using the inverse mapping relationship determined by the color mapping model. When testing the whitening fabric to be tested, online images are still acquired under fixed imaging conditions, and the camera imaging Lab data to be tested is obtained through fabric area extraction and color conversion. Based on the camera imaging Lab data to be tested and the virtual target color, the color deviation component and total color difference are determined, thereby determining the color deviation direction, color deviation degree and test result of the whitening fabric to be tested. Therefore, the color detection of the whitening fabric under test can be completed based on online images acquired by an industrial camera, which is beneficial to expand the coverage of fabric detection and reduce the equipment deployment cost in continuous detection. At the same time, the virtual target color and the Lab data of the camera under test are both located in the camera imaging space, so that the color comparison has a consistent data basis, which can reduce the judgment fluctuation caused by the lack of a stable benchmark in the camera imaging data. Furthermore, by jointly determining the color deviation component and the total color difference, it can not only reflect the overall difference between the whitening fabric under test and the target color benchmark, but also characterize the directional shift states such as blue, purple, and yellow, thereby obtaining detection results that can stably characterize the direction and degree of color deviation.

[0016] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, the preferred embodiments of this application are described in detail below with reference to the accompanying drawings. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the method for detecting color deviation in whitening fabric based on virtual target color calibration in the embodiments of this application.

[0018] Figure 2This is a timing diagram of the dual-mode switching operation in an embodiment of this application.

[0019] Figure 3 This is a schematic diagram of the overall process of the whitening fabric color deviation detection method based on virtual target color calibration in the embodiments of this application.

[0020] Figure 4 This is a structural block diagram of the whitening fabric color deviation detection system based on virtual target color calibration in the embodiments of this application.

[0021] Figure 5 This is a block diagram of an electronic device for detecting color deviation in whitening fabric based on virtual target color calibration, as described in this application. Detailed Implementation

[0022] The specific embodiments of this application will be described in further detail below with reference to the accompanying drawings and examples. The following examples are used to illustrate this application, but are not intended to limit the scope of this application.

[0023] Optionally, this application uses the whitening fabric color deviation detection method based on virtual target color calibration provided in various embodiments as an example for application in an electronic device. The electronic device is a terminal or server. The terminal can be a computer, tablet computer, etc. This embodiment does not limit the type of electronic device.

[0024] Reference Figure 1 This is a flowchart illustrating a method for detecting color deviation in whitening fabric based on virtual target color calibration, provided in one embodiment of this application. The method includes at least the following steps: Step S101: Under fixed imaging conditions, acquire sample images of multiple calibration samples respectively, and obtain the true value of the colorimeter Lab corresponding to each calibration sample.

[0025] In step S101, this step is used to obtain the true color values ​​of multiple calibration samples under the measurement conditions of a colorimeter and the sample images under the fixed imaging conditions of an industrial camera, and to establish a definite correspondence between the true color value of the colorimeter Lab and the sample image corresponding to the same calibration sample. Since whitening fabrics may exhibit different color states such as neutral white, bluish, purplish, and yellowish, and the color information of images acquired by industrial cameras is easily affected by lighting, exposure, gain, white balance, shooting distance, shooting angle, field of view, and background reflection, this step selects whitening fabric samples covering typical color shift states and acquires sample images under fixed imaging conditions, so that the obtained sample images can reflect the color differences of different calibration samples under the same imaging conditions.

[0026] Specifically, multiple whitened fabric samples covering neutral white, bluish, purplish, and yellowish tones were first selected as calibration samples. Neutral white corresponds to a whitened fabric color state close to neutral white; bluish corresponds to a whitened fabric color state where the yellow-blue direction shifts towards blue; purplish corresponds to a whitened fabric color state where the color shifts towards purple after shifting in both the red-green and yellow-blue directions; and yellowish corresponds to a whitened fabric color state where the yellow-blue direction shifts towards yellow. Calibration samples preferentially used actual whitened fabric samples that had undergone whitening, bleaching, or finishing treatments to ensure that the fiber structure, surface texture, and reflective properties of the calibration samples were consistent with the object being tested.

[0027] After determining the calibration samples, each calibration sample is measured using a self-calibrated colorimeter to obtain the true Lab value for each sample. The true Lab value includes lightness, red-green, and yellow-blue components, used to characterize the color measurement results of the calibration sample in the Lab color space. Before measurement, the colorimeter is self-calibrated using a standard white board to ensure it is in normal measurement mode. During measurement, the illuminator, observer's field of view, and measuring aperture are set according to the requirements for whitening fabric color detection, and measurements are taken on a flat area of ​​the calibration sample. For the same calibration sample, measurements can be taken on multiple flat areas of the fabric, and the average of the multiple measurements is used as the true Lab value for that calibration sample to reduce the influence of local color differences on the measurement results.

[0028] After completing the colorimeter measurement, each calibration sample is placed sequentially in a standard light source box, with a matte black background plate placed on the back of each sample. The standard light source box contains a standard light source, which can be a D65, D50, or D75 light source. The inner wall of the standard light source box has a matte neutral gray surface, and the box structure isolates external ambient light. The matte black background plate, located on the back of the calibration samples, reduces the impact of fabric light transmission and background reflection on the color information of the sample images.

[0029] When acquiring sample images, the industrial camera's exposure time, gain, white balance, lens aperture, and focal length remain fixed, as do the shooting distance, shooting angle, and field of view relative to each calibration sample. The industrial camera's automatic exposure, automatic gain, and automatic white balance are turned off, ensuring that the sample images for each calibration sample are acquired under consistent lighting conditions, camera imaging parameters, shooting geometry, and background conditions. Therefore, the fixed imaging conditions include the fixed lighting conditions provided by the standard light source box, the fixed background conditions provided by the matte black background board, the fixed imaging parameters of the industrial camera, and the fixed shooting geometry between the industrial camera and the calibration sample.

[0030] Under the aforementioned fixed imaging conditions, sample images corresponding to each calibration sample were acquired. After the sample image acquisition was completed, the colorimeter Lab true value and sample image corresponding to the same calibration sample were associated and recorded according to the calibration sample identifier. The calibration sample identifier is used to distinguish different calibration samples, so that each calibration sample corresponds to a set of colorimeter Lab true values ​​and at least one sample image, thereby obtaining the colorimeter Lab true values ​​and sample images corresponding to multiple calibration samples respectively.

[0031] Step S102: Extract the fabric area from each sample image and perform color conversion processing on the extracted fabric area to obtain the camera imaging Lab data corresponding to each calibration sample.

[0032] In step S102, this step is used to extract image regions that can characterize the fabric color from the sample images of each calibration sample, and convert the color information in the extracted fabric regions into camera imaging Lab data. The sample images may contain calibration sample edges, local areas of the background, pixels with abnormal brightness, or local reflective pixels. If color statistics are performed directly on the entire sample image, non-fabric information or abnormal pixels may easily participate in color calculations, affecting the representation of the calibration sample fabric color by the camera imaging Lab data. Therefore, this step first extracts the fabric regions from the sample images, and then performs color statistics and color conversion processing based on the extracted fabric regions.

[0033] Specifically, the initial fabric region is first determined from each sample image based on the preset region location or the fabric boundary of the calibration sample in the sample image. When the sample placement position and camera field of view are fixed, the initial fabric region can be a preset rectangular area located in the center of the sample image, inside the edge of the calibration sample. If the calibration sample has a positional offset relative to the image field of view, the fabric boundary can be determined based on the grayscale or color difference between the calibration sample and the matte black background in the sample image, and the initial fabric region is determined based on this boundary.

[0034] After determining the initial fabric area, the initial fabric area undergoes boundary shrinkage processing, and pixels in the initial fabric area that meet preset abnormal pixel conditions are removed, resulting in the fabric area corresponding to each sample image. Boundary shrinkage processing refers to shrinking the boundary of the initial fabric area inward by a preset pixel distance, so that the obtained fabric area avoids parts near the edge of the calibration sample that may be affected by the background, shadows, or cropping. The preset abnormal pixel conditions include at least one of the following: pixel brightness is greater than a preset brightness threshold, any color channel reaches saturation, or pixel brightness is lower than a preset dark pixel threshold. By removing pixels that meet the preset abnormal pixel conditions, the influence of local strong reflections, locally dark areas, or camera saturated pixels on the color statistics results can be reduced.

[0035] Then, the average values ​​of the red, green, and blue channels of pixels within each fabric area are calculated to obtain the RGB color data corresponding to each calibration sample. The average value of the red channel is the average value of all valid pixels within the fabric area in the red channel; the average value of the green channel is the average value of all valid pixels within the fabric area in the green channel; and the average value of the blue channel is the average value of all valid pixels within the fabric area in the blue channel. The RGB color data composed of the average values ​​of the red, green, and blue channels is used to represent the average color response of the calibration sample in the industrial camera image.

[0036] After obtaining the RGB color data, each RGB color data point is sequentially processed by linearization, XYZ color space conversion, and Lab color space conversion to obtain the camera imaging Lab data corresponding to each calibration sample. Linearization converts the non-linear RGB color data output by the industrial camera into linear RGB color data; XYZ color space conversion converts the linear RGB color data into XYZ color data; and Lab color space conversion converts the XYZ color data into color data in the Lab color space. The resulting camera imaging Lab data includes camera imaging brightness data, camera imaging red-green hue data, and camera imaging yellow-blue hue data.

[0037] It should be noted that the camera imaging Lab data obtained in this step comes from the fabric area in the sample image and is obtained using the same region extraction rules, pixel statistics method, and color conversion path. The camera imaging Lab data is used to characterize the color response of the calibration sample under fixed industrial camera imaging conditions. Its value is different from the Lab true value directly measured by the colorimeter and belongs to the color data within the industrial camera imaging space.

[0038] Step S103: Based on the camera imaging Lab data and colorimeter Lab true value corresponding to each calibration sample, establish a color mapping model to characterize the correspondence between the camera imaging Lab data and the colorimeter Lab true value.

[0039] In step S103, this step is used to establish a color mapping model between the camera imaging space and the colorimeter measurement space based on the camera imaging Lab data and the colorimeter Lab true value corresponding to multiple calibration samples. The camera imaging Lab data is obtained by color conversion processing of the fabric area in the sample image, and its value is affected by the industrial camera, light source, lens, and fixed imaging conditions. The colorimeter Lab true value is obtained by the colorimeter measuring the color of the same calibration sample. Since the same calibration sample has both camera imaging Lab data and colorimeter Lab true value, the correspondence between the camera imaging Lab data and the colorimeter Lab true value can be established based on the paired data formed by multiple calibration samples.

[0040] Specifically, according to the calibration sample identifier, the camera imaging Lab data and the colorimeter Lab true value corresponding to the same calibration sample are combined to form a color calibration data pair. For the first... For each calibration sample, the camera imaging Lab data is represented as follows: ; in, Indicates the first Camera imaging Lab data corresponding to each calibration sample Indicates the first The camera image brightness component corresponding to each calibration sample. Indicates the first The camera image red-green color components corresponding to each calibration sample Indicates the first The camera image yellow-blue hue component corresponding to each calibration sample This indicates the calibrated sample number.

[0041] No. The true value of the colorimeter Lab for each calibration sample is expressed as: ; in, Indicates the first The true Lab value of the colorimeter corresponding to each calibration sample. Indicates the first The lightness component was measured by a colorimeter corresponding to each calibration sample. Indicates the first The red-green hue components were measured by a colorimeter corresponding to each calibration sample. Indicates the first The yellow-blue hue component was measured by a colorimeter corresponding to each calibration sample. This indicates the calibration sample number.

[0042] After obtaining multiple color calibration data pairs, using the camera imaging Lab data from each color calibration data pair as input and the colorimeter Lab true value from each color calibration data pair as output, a forward mapping relationship is established from the camera imaging Lab data to the colorimeter Lab true value. The forward mapping relationship is expressed as: ; in, Indicates the first The true Lab value of the colorimeter corresponding to each calibration sample. This represents the mapping matrix in a positive mapping relationship. Indicates the first Camera imaging Lab data corresponding to each calibration sample This represents the bias vector in a positive mapping relationship. This indicates the calibration sample number. It is a 3×3 matrix. It is a 3×1 vector.

[0043] The least squares method is used to map the forward mapping relationship on multiple color calibration data pairs. and bias vector By performing a joint solution, the optimization objective is expressed as: ; in, This represents the positive mapping matrix to be solved. This represents the positive bias vector to be solved. Indicates the number of color calibration data pairs. Indicates the calibrated sample number. Indicates the first Camera imaging Lab data corresponding to each calibration sample Indicates the first The true Lab value of the colorimeter corresponding to each calibration sample. Represents the L2 norm, This represents the parameter value that minimizes the objective function.

[0044] To ensure stable conversion of color data from the colorimeter's measurement space to the camera's imaging space, this embodiment also establishes a dual mapping relationship based on the same batch of color calibration data pairs. Using the colorimeter Lab true value from each color calibration data pair as input and the camera imaging Lab data from each color calibration data pair as output, a dual mapping relationship from the colorimeter Lab true value to the camera imaging Lab data is established. This dual mapping relationship is expressed as: ; in, Indicates the first Camera imaging Lab data corresponding to each calibration sample This represents the mapping matrix in the dual mapping relation. Indicates the first The true Lab value of the colorimeter corresponding to each calibration sample. This represents the bias vector in the dual mapping relation. This indicates the calibration sample number. It is a 3×3 matrix. It is a 3×1 vector.

[0045] The least squares method is used to map the dual mapping relationship in multiple color calibration data pairs. and bias vector By performing a joint solution, the optimization objective is expressed as: ; in, Denotes the dual mapping matrix to be solved. Let represent the dual bias vector to be solved. Indicates the number of color calibration data pairs. Indicates the calibrated sample number. Indicates the first The true Lab value of the colorimeter corresponding to each calibration sample. Indicates the first Camera imaging Lab data corresponding to each calibration sample Represents the L2 norm, This represents the parameter value that minimizes the objective function.

[0046] In the specific solution, the input data and constant term can be augmented, and the mapping matrix and bias vector can be combined into an augmented parameter matrix. Taking a positive mapping relationship as an example, the augmented input vector is represented as: ; in, Indicates the first The augmented input vector corresponding to each calibration sample Indicates the first The camera image brightness component corresponding to each calibration sample. Indicates the first The camera image red-green color components corresponding to each calibration sample Indicates the first The camera image yellow-blue hue components corresponding to each calibration sample, where 1 represents a constant term. This indicates the calibration sample number.

[0047] The augmented parameter matrix in the forward mapping relationship is represented as: ; in, This represents the augmented parameter matrix in the forward mapping relationship. This represents the mapping matrix in a positive mapping relationship. This represents the bias vector in a positive mapping relationship. It is a 3×4 matrix.

[0048] Based on the augmented input vector and the augmented parameter matrix, the forward mapping relationship is expressed as follows: ; in, Indicates the first The true Lab value of the colorimeter corresponding to each calibration sample. This represents the augmented parameter matrix in the forward mapping relationship. Indicates the first The augmented input vector corresponding to each calibration sample This represents the index of the calibrated sample. The dual mapping relation can also be solved using the same augmented method.

[0049] When the augmented input matrix formed by multiple color calibration data pairs satisfies the least squares solution condition, the augmented parameter matrix can be solved using closed-form solving, pseudo-inverse, QR decomposition, or singular value decomposition. The number of effective equations provided by multiple color calibration data pairs is not less than the number of parameters to be solved, and the augmented input matrix satisfies full rank or a stable solution condition. Furthermore, the calibration samples cover color variations ranging from neutral white, bluish, purplish, and yellowish, thereby reducing the impact of measurement fluctuations of individual calibration samples on the model parameters.

[0050] Based on the obtained forward and dual mapping relationships, a color mapping model is generated to represent the correspondence between camera imaging Lab data and colorimeter Lab true values. The forward mapping relationship represents the correspondence from camera imaging Lab data to colorimeter Lab true values, and the dual mapping relationship represents the correspondence from colorimeter Lab true values ​​to camera imaging Lab data. Compared to the method of obtaining the inverse transformation simply by inverting the forward mapping matrix, the dual mapping relationship does not require the forward mapping matrix. It satisfies the invertibility condition, thus reducing the impact of non-invertible or ill-conditioned matrices on the stability of the model.

[0051] In one alternative implementation, the color mapping model can also employ a polynomial mapping model or a neural network mapping model. The polynomial mapping model adds second-order terms or cross terms to the camera imaging Lab data and establishes a mapping relationship between the added feature terms and the colorimeter Lab true values. The neural network mapping model uses the camera imaging Lab data as input and the colorimeter Lab true values ​​as output, obtaining model parameters through training. Regardless of whether a linear mapping model, a polynomial mapping model, or a neural network mapping model is used, the camera imaging Lab data and the colorimeter Lab true values ​​corresponding to each calibration sample are used as the basis for fitting or training, and are used to characterize the correspondence between the camera imaging Lab data and the colorimeter Lab true values.

[0052] Step S104: Obtain the true value of the colorimeter Lab corresponding to the target color reference, and based on the inverse mapping relationship determined by the color mapping model, convert the true value of the colorimeter Lab corresponding to the target color reference into a virtual target color in the camera imaging space. The target color reference includes standard white or target color sample.

[0053] In step S104, this step is used to convert the target color reference in the colorimeter's measurement space into a virtual target color in the camera's imaging space. The target color reference includes standard white or a target color sample. Standard white is used as the color reference in the quality control scenario of whitening fabric, and the target color sample is used as the color reference under specified color requirements. Since the whitening fabric to be tested obtains color data in the camera's imaging space during detection, the colorimeter's Lab true value corresponding to the target color reference needs to be converted to the camera's imaging space so that it is in the same color expression space as the color data to be tested in the camera's imaging space.

[0054] Specifically, when the target color reference is standard white, the true Lab value of the colorimeter corresponding to standard white is obtained. The true Lab value of the colorimeter corresponding to standard white can be obtained from the calibration data of the standard white plate that comes with the colorimeter or the factory calibration data. When the target color reference is the target color sample, the target color sample is measured using the colorimeter to obtain the true Lab value of the colorimeter corresponding to the target color sample. The target color sample is the whitening fabric target sample specified by the user or process.

[0055] The true value of the colorimeter Lab corresponding to the target color reference is expressed as: ; in, This represents the true Lab value of the colorimeter corresponding to the target color reference. This indicates the lightness component measured by the colorimeter corresponding to the target color reference. This indicates the red-green hue component measured by the colorimeter corresponding to the target color reference. This indicates the yellow-blue hue component measured by the colorimeter corresponding to the target color reference.

[0056] Virtual target color is represented as: ; in, This represents the virtual target color corresponding to the target color reference. This represents the lightness component of the virtual target color within the camera's imaging space. This represents the red and green hue components of the virtual target color within the camera's imaging space. This represents the yellow-blue hue component of the virtual target color within the camera's imaging space.

[0057] The dual mapping relationship in the color mapping model is used to characterize the correspondence between the colorimeter Lab true value and the camera imaging Lab data. This dual mapping relationship serves as the inverse mapping relationship for transforming the colorimeter measurement space to the camera imaging space. Based on this dual mapping relationship, the colorimeter Lab true value corresponding to the target color reference is converted into a virtual target color, and the calculation formula is as follows: ; in, This represents the virtual target color corresponding to the target color reference. This represents the mapping matrix in the dual mapping relation. This represents the true Lab value of the colorimeter corresponding to the target color reference. Let represent the bias vector in the dual mapping relation. It is a 3×3 matrix. It is a 3×1 vector.

[0058] When the target color reference is standard white, the true value of the colorimeter Lab corresponding to the target color reference is expressed as: ; in, This represents the Lab true value of the colorimeter corresponding to standard white. This indicates the lightness component measured by the colorimeter corresponding to standard white. This indicates the red-green hue component measured by the colorimeter corresponding to standard white. This indicates the yellow-blue hue component measured by the colorimeter corresponding to standard white.

[0059] The virtual target color corresponding to standard white is virtual standard white, which is represented as: ; in, Indicates virtual standard white, This represents the mapping matrix in the dual mapping relation. This represents the Lab true value of the colorimeter corresponding to standard white. This represents the bias vector in the dual mapping relation.

[0060] When the target color reference is the target color sample, the true value of the colorimeter Lab corresponding to the target color sample is expressed as: ; in, This represents the true Lab value of the colorimeter corresponding to the target color sample. This indicates the lightness component measured by the colorimeter corresponding to the target color sample. This indicates the red-green hue component measured by the colorimeter corresponding to the target color sample. This indicates the yellow-blue hue component measured by the colorimeter corresponding to the target color sample.

[0061] The virtual target color corresponding to the target color sample is represented as: ; in, This represents the virtual target color corresponding to the target color sample. This represents the mapping matrix in the dual mapping relation. This represents the true Lab value of the colorimeter corresponding to the target color sample. This represents the bias vector in the dual mapping relation.

[0062] Therefore, the virtual standard white is the virtual target color obtained when the target color reference is standard white, and the equivalent color reference in the camera imaging space corresponding to the target color sample is the virtual target color obtained when the target color reference is the target color sample. After the virtual target color calculation is completed, the virtual target color is associated with and saved as a type of target color reference. The type of target color reference includes standard white type or target color sample type. Optionally, the colorimeter Lab true value, virtual target color, target color reference name, and detection tolerance parameters corresponding to the target color reference can also be associated and saved to form a target color file.

[0063] In one alternative implementation, when the positive mapping matrix in the color mapping model When the invertibility condition is met and the matrix inversion result satisfies the numerical stability requirement, the virtual target color corresponding to the target color reference can also be determined based on the forward mapping relationship. The forward mapping relationship is expressed as: ; in, This represents the Lab true value of the colorimeter. This represents the mapping matrix in a positive mapping relationship. This represents camera imaging Lab data. This represents the bias vector in a positive mapping relationship.

[0064] The inverse transformation determined based on the forward mapping relationship is expressed as: ; in, This represents the virtual target color corresponding to the target color reference. Represents the forward mapping matrix The inverse matrix, This represents the true Lab value of the colorimeter corresponding to the target color reference. This represents the bias vector in the forward mapping relationship. When using this method, the forward mapping matrix... The matrix must be invertible, and the result of matrix inversion must be numerically stable; in the forward mapping matrix... When the reversibility condition is not met or there is a risk of numerical instability, the virtual target color is determined by using a dual mapping relationship.

[0065] Step S105: Acquire online images of the whitening fabric to be tested under fixed imaging conditions, extract the fabric area and perform color conversion processing on the online images to obtain the Lab data of the camera imaging corresponding to the whitening fabric to be tested.

[0066] In step S105, this step is used to acquire an online image of the whitening fabric to be tested under fixed imaging conditions consistent with those of the sample image acquisition, extract an image region from the online image that can characterize the color of the fabric surface, and then convert the color information in the image region into Lab data of the camera under test. Since the Lab data of the camera under test is used to represent the color response of the whitening fabric to be tested in the imaging space of the industrial camera, the acquisition conditions of the online image, the method of fabric surface extraction, and the color conversion processing method need to be consistent with the sample image processing process to reduce the impact of changes in imaging conditions and processing rules on the color data.

[0067] Specifically, when acquiring online images of the whitening fabric under test, the fabric is passed through the imaging area of ​​a standard light source box, with a matte black background placed behind it. The light source type, illumination status, box environment, industrial camera imaging parameters, and the shooting geometry of the industrial camera relative to the whitening fabric under test are all kept consistent with those used when acquiring sample images. The exposure time, gain, white balance, lens aperture, and focal length of the industrial camera are kept constant; automatic exposure, automatic gain, and automatic white balance are turned off. The shooting distance, shooting angle, and field of view of the industrial camera relative to the whitening fabric under test are also kept constant. Through this method, online images of the whitening fabric under test are acquired.

[0068] After acquiring the online image, the initial area of ​​the fabric to be tested is determined from the online image based on the preset region position or the fabric boundary of the fabric to be tested in the online image. When the position of the fabric to be tested relative to the field of view of the industrial camera is stable, the initial area of ​​the fabric to be tested can be a preset rectangular area located in the center of the online image, which is located inside the edge of the fabric to be tested. When there is a positional offset of the fabric to be tested relative to the field of view of the industrial camera, the fabric boundary can be determined based on the grayscale difference or color difference between the fabric to be tested and the matte black background in the online image, and the initial area of ​​the fabric to be tested can be determined according to the fabric boundary.

[0069] After determining the initial area of ​​the fabric to be tested, the boundary of the initial area is shrunken, and pixels that meet preset abnormal pixel conditions are removed, resulting in the final fabric area to be tested. Boundary shrunkenness refers to shrinking the boundary of the initial area of ​​the fabric to be tested inwards by a preset pixel distance, ensuring that the resulting fabric area avoids parts near the edges of the fabric that may be affected by the background, shadows, or cutting. Preset abnormal pixel conditions include at least one of the following: pixel brightness greater than a preset brightness threshold, any color channel reaching saturation, or pixel brightness lower than a preset dark pixel threshold. By removing pixels that meet the preset abnormal pixel conditions, the influence of localized strong reflections, locally overly dark areas, or camera-saturated pixels on the statistical results of the tested color can be reduced.

[0070] Then, the average values ​​of the red, green, and blue channels of the pixels within the tested fabric area are calculated to obtain the RGB color data corresponding to the whitening fabric. The average value of the red channel is the average value of all valid pixels in the red channel within the tested fabric area; the average value of the green channel is the average value of all valid pixels in the green channel within the tested fabric area; and the average value of the blue channel is the average value of all valid pixels in the blue channel within the tested fabric area. The RGB color data composed of the average values ​​of the red, green, and blue channels is used to represent the average color response of the whitening fabric in the industrial camera image.

[0071] After obtaining the RGB color data to be tested, the data is sequentially processed by linearization, XYZ color space conversion, and Lab color space conversion to obtain the Lab data of the whitening fabric to be tested, as captured by the camera. Linearization converts the non-linear RGB color data output by the industrial camera into linear RGB color data; XYZ color space conversion converts the linear RGB color data into XYZ color data; and Lab color space conversion converts the XYZ color data into color data in the Lab color space.

[0072] The Lab data for imaging from the camera under test is represented as follows: ; in, This represents the Lab data of the camera image corresponding to the whitening fabric being tested. This represents the brightness component of the image captured by the camera under test corresponding to the whitened fabric being tested. This represents the red and green hue components of the image captured by the camera corresponding to the whitened fabric being tested. This represents the yellow-blue hue component in the image captured by the camera under test for the whitened fabric being tested. This indicates the label of the whitening fabric to be tested.

[0073] Through the above processing, the Lab data of the camera under test is obtained from the fabric area under test in the online image, and is obtained by using the same region extraction rules, pixel statistics method and color conversion path as the sample image, which can characterize the color response of the whitening fabric under test under fixed industrial camera imaging conditions.

[0074] Step S106: Based on the Lab data of the camera under test and the virtual target color, determine the color deviation component and total color difference of the whitening fabric under test relative to the target color reference, and determine the color deviation direction, color deviation degree and detection result of the whitening fabric under test according to the color deviation component and total color difference.

[0075] In step S106, this step is used to compare the color difference between the whitening fabric to be tested and the virtual target color in the camera imaging space, and to determine the color deviation direction, degree of color deviation, and detection result of the whitening fabric to be tested relative to the target color reference based on the color difference. The virtual target color has been converted from the true value of the colorimeter Lab corresponding to the target color reference to the camera imaging space, and the camera imaging Lab data to be tested also belongs to the color data in the camera imaging space. Therefore, this step directly calculates the component difference and total color difference between the camera imaging Lab data to be tested and the virtual target color in the camera imaging space.

[0076] Specifically, the Lab data of the camera under test is represented as follows: ; in, This represents the Lab data of the camera image corresponding to the whitening fabric being tested. This represents the brightness component of the image captured by the camera under test corresponding to the whitened fabric being tested. This represents the red and green hue components of the image captured by the camera corresponding to the whitened fabric being tested. This represents the yellow-blue hue component in the image captured by the camera under test for the whitened fabric being tested. This indicates the label of the whitening fabric to be tested.

[0077] Virtual target color is represented as: ; in, This represents the virtual target color corresponding to the target color reference. This represents the lightness component of the virtual target color within the camera's imaging space. This represents the red and green hue components of the virtual target color within the camera's imaging space. This represents the yellow-blue hue component of the virtual target color within the camera's imaging space.

[0078] The color shift component of the whitening fabric under test relative to the target color reference is obtained by calculating the component difference between the Lab data of the camera under test and the virtual target color. The color shift component is expressed as: ; in, This represents the lightness shift component of the whitening fabric under test relative to the target color reference. This indicates the red-green tint shift of the whitening fabric under test relative to the target color reference. This indicates the yellow-blue tint shift of the whitening fabric under test relative to the target color reference. This represents the Lab data of the camera image corresponding to the whitening fabric being tested. This represents the virtual target color corresponding to the target color reference. , and These represent the lightness component, red-green hue component, and yellow-blue hue component of the image from the camera under test, respectively, corresponding to the whitened fabric under test. , and These represent the lightness component, red-green component, and yellow-blue component of the virtual target color in the camera's imaging space, respectively.

[0079] Based on the lightness shift component, red-green shift component, and yellow-blue shift component, the total color difference between the tested whitening fabric and the target color reference is calculated. The total color difference is expressed as: ; in, This indicates the total color difference of the whitening fabric to be tested relative to the target color reference. Indicates the lightness shift component. Indicates the red-green tint offset component. This indicates the yellow-blue tint offset component.

[0080] When determining the direction of color shift, a first color shift threshold is set. Second color bias threshold and neutral color difference threshold .in, , and All are preset thresholds greater than 0. Used to determine significant shifts in the red-green hue direction. Used to determine significant shifts in the yellow-blue hue direction. This is used to determine whether the overall color difference is within the neutral tolerance range. The first color deviation threshold, the second color deviation threshold, and the neutral color difference threshold can be set based on the statistical results of the calibration samples, product quality requirements, or target color sample tolerance requirements.

[0081] When satisfied At that time, it was determined that the whitening fabric to be tested had no significant color deviation relative to the target color reference.

[0082] When satisfied At that time, the color deviation direction of the whitening fabric to be tested relative to the target color reference was determined to be bluish.

[0083] When satisfied At that time, the color deviation direction of the whitening fabric to be tested relative to the target color reference was determined to be yellowish.

[0084] When satisfied At that time, the color deviation direction of the whitening fabric to be tested relative to the target color reference was determined to be purplish.

[0085] Optionally, when the following conditions are met When the color shift of the whitening fabric to be tested relative to the target color reference is determined to be reddish-orange; when the condition is met... At that time, the color deviation of the whitening fabric to be tested relative to the target color reference was determined to be greenish. Among other things, Indicates the red-green tint offset component. Indicates the yellow-blue tint offset component. Indicates the total color difference. Indicates the first color bias threshold. Indicates the second color bias threshold. This indicates the neutral color difference threshold.

[0086] When determining the degree of color cast, it is based on the total color difference. The relationship between the color difference and the preset color difference grading thresholds is graded. The preset color difference grading thresholds include a first color difference threshold. Second color difference threshold and the third color difference threshold ,in, .when When the color deviation is determined to be no significant color difference; when At that time, the color cast was determined to be slight; when When the color cast is determined to be moderate; when At that time, the degree of color deviation was determined to be severe.

[0087] in, This represents the first color difference threshold used to distinguish between no significant color difference and slight color difference. This represents the second color difference threshold used to distinguish between slight and moderate color differences. This represents the third color difference threshold used to distinguish between moderate and severe color differences. The first, second, and third color difference thresholds can be set according to the whitening fabric product standards, customer target color sample requirements, or production quality control requirements.

[0088] The test results for the whitening fabric under test are determined based on the direction and degree of color deviation. The test results include the target color reference type, color deviation component, total color difference, color deviation direction, degree of color deviation, and whether the test requirements are met. When the target color reference is standard white, the test results represent the color deviation test result of the whitening fabric under test relative to standard white; when the target color reference is a target color sample, the test results represent the compliance test result of the whitening fabric under test relative to the target color sample. Optionally, when the degree of color deviation exceeds a preset allowable level or the total color difference exceeds a preset acceptable threshold, an alarm message is generated, and the test results are recorded.

[0089] Furthermore, as a preferred option, refer to Figure 2 , Figure 2This is a timing diagram illustrating the dual-mode switching operation in an embodiment of this application. After generating the virtual target color and obtaining the imaging Lab data of the camera under test, this application can switch between the quality control mode and the target color matching mode according to application requirements. The quality control mode and the target color matching mode share the same fixed imaging conditions, the same color mapping model, the same industrial camera image acquisition process, and the same imaging Lab data calculation process of the camera under test. The difference between the two lies in the virtual target color used for comparison.

[0090] Specifically, in the quality control mode, the user selects the mode via a host computer. The host computer loads the virtual target color corresponding to standard white and triggers an industrial camera to acquire online images of the whitening fabric to be tested. After the industrial camera returns the acquired online images to the host computer, the host computer or algorithm module performs fabric area extraction and camera imaging Lab data calculation on the online images. It then calculates the difference between the obtained camera imaging Lab data and the virtual target color corresponding to standard white, determining the lightness shift component, red-green shift component, yellow-blue shift component, and total color difference. Based on the color shift direction determination rules and color shift degree grading rules, it outputs the color shift direction, color shift degree, and whether the whitening fabric meets the standard relative to standard white. This mode is suitable for detecting whether whitening fabric exhibits color shifts such as a bluish, purplish, or yellowish tint relative to neutral white.

[0091] In target color matching mode, the user selects the target color matching mode and the corresponding target color file via the host computer. The target color file stores the virtual target color corresponding to the target color sample. After the host computer loads the virtual target color corresponding to the target color sample, it triggers the industrial camera to acquire an online image of the whitening fabric to be tested, and performs fabric area extraction and camera imaging Lab data calculation on the online image. The algorithm module subtracts the camera imaging Lab data to be tested from the virtual target color corresponding to the target color sample, calculates the lightness shift component, red-green lightness shift component, yellow-blue lightness shift component, and total color difference, and outputs the deviation direction, deviation degree, and whether the whitening fabric to be tested meets the target color sample requirements according to the color deviation direction judgment rules and color deviation degree grading rules. This mode is suitable for determining whether the whitening fabric to be tested meets the target color sample requirements specified by the customer or process.

[0092] Through the aforementioned dual-mode switching method, this application does not require replacing the industrial camera, standard light source box, or matte black background board, nor does it require re-establishing the color mapping model. It can switch between quality control mode and target color matching mode simply by switching the virtual target color used for comparison. Therefore, the system can be used for detecting color deviation defects in whitening fabrics during the production process, as well as for evaluating the compliance of customer target color samples or process target color samples.

[0093] In summary, combining Figure 3This application acquires sample images of multiple calibration samples under fixed imaging conditions and obtains the true values ​​of the colorimeter Lab for each calibration sample. The sample images undergo fabric area extraction and color conversion processing to obtain camera imaging Lab data for each calibration sample. A color mapping model is established based on the camera imaging Lab data and the true values ​​of the colorimeter Lab, creating a calculable color correspondence between the industrial camera imaging space and the colorimeter measurement space. Based on this, the true values ​​of the colorimeter Lab corresponding to the standard white or target color sample are obtained, and a virtual target color within the camera imaging space is obtained based on the inverse mapping relationship determined by the color mapping model. During continuous testing of the whitening fabric to be tested, online images are acquired under fixed imaging conditions. Fabric area extraction and color conversion processing are performed on the online images to obtain the camera imaging Lab data to be tested. The camera imaging Lab data to be tested is then compared with the virtual target color to determine the color deviation component, total color difference, color deviation direction, color deviation degree, and detection result.

[0094] Through the above scheme, the industrial camera can perform non-contact image acquisition of fabric areas under fixed lighting, fixed imaging parameters, fixed shooting geometry, and matte black background conditions. Compared with single-point or small-point color measurement methods, it can cover a larger fabric detection area and reduce the equipment deployment pressure in continuous detection scenarios. At the same time, the color mapping model uses the colorimeter's Lab true value to calibrate the camera's imaging Lab data, so that the color data obtained by the industrial camera is no longer just isolated relative image information, but can form a correspondence with the colorimeter's measurement reference. Furthermore, the standard white or target color sample is converted into a virtual target color in the camera's imaging space. The color comparison of the whitened fabric to be tested is completed in the same camera imaging space, reducing the impact of contamination, aging, and placement errors caused by the real-time participation of the physical standard white or physical target color sample in the detection. Moreover, through the joint calculation of color deviation component and total color difference, not only can the magnitude of the fabric color difference be obtained, but also the directional states such as blue, purple, and yellow deviation can be distinguished, thereby obtaining detection results with a large coverage, low cost, and stable characterization of color deviation direction and degree.

[0095] Figure 4 This is a structural block diagram of a whitening fabric color deviation detection system based on virtual target color calibration according to an embodiment of this application. The system includes at least the following modules: The sample acquisition module is used to acquire sample images of multiple calibration samples under fixed imaging conditions and obtain the true value of the colorimeter Lab for each calibration sample. The sample conversion module is used to extract the fabric area from each sample image and perform color conversion processing on the extracted fabric area to obtain the camera imaging Lab data corresponding to each calibration sample. The model building module is used to establish a color mapping model that characterizes the correspondence between camera imaging Lab data and colorimeter Lab true values ​​based on the camera imaging Lab data and colorimeter Lab true values ​​corresponding to each calibration sample. The target generation module is used to obtain the true value of the colorimeter Lab corresponding to the target color reference, and convert the true value of the colorimeter Lab corresponding to the target color reference into a virtual target color in the camera imaging space based on the inverse mapping relationship determined by the color mapping model. The target color reference includes standard white or target color sample. The online conversion module is used to acquire online images of the whitening fabric under fixed imaging conditions, extract the fabric area and perform color conversion processing on the online images to obtain the corresponding camera imaging Lab data of the whitening fabric. The color deviation detection module is used to determine the color deviation component and total color difference of the whitening fabric under test relative to the target color reference based on the Lab data of the camera under test and the virtual target color, and to determine the color deviation direction, color deviation degree and detection result of the whitening fabric under test based on the color deviation component and total color difference.

[0096] For relevant details, please refer to the above method implementation examples.

[0097] Figure 5 This is a block diagram of an electronic device provided in one embodiment of this application. The device includes at least a processor 501 and a memory 502.

[0098] Processor 501 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 501 may be implemented in at least one hardware form selected from CPU (Central Processing Unit), DSP (Digital Signal Processor), GPU (Graphics Processing Unit), and FPGA (Field-Programmable Gate Array), and may also include a main processor and a coprocessor. The main processor is used to perform image data scheduling, color data calculation, color mapping model invocation, and detection result output; the coprocessor can be used to perform image preprocessing, color space conversion, matrix operations, or other low-power computing tasks. In some embodiments, processor 501 may integrate a GPU, which is used for parallel processing of sample images or online images, or for accelerating surface area extraction, pixel statistics, and color conversion processing.

[0099] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices, flash memory devices, etc. In some embodiments, the memory 502 is used to store at least one instruction, sample images, online images, colorimeter Lab true values, camera imaging Lab data, color mapping models, virtual target colors, and detection result records. The at least one instruction is loaded and executed by the processor 501 to implement the whitening fabric color deviation detection method based on virtual target color calibration provided in the method embodiments of this application.

[0100] Optionally, this application also provides a computer-readable storage medium storing a program that is loaded and executed by a processor to implement the whitening fabric color deviation detection method based on virtual target color calibration in the above method embodiments.

[0101] Optionally, this application also provides a computer product including a computer-readable storage medium storing a program, which is loaded and executed by a processor to implement the whitening fabric color deviation detection method based on virtual target color calibration described in the above method embodiments.

[0102] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0103] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for detecting color deviation in whitening fabrics based on virtual target color calibration, characterized in that, The method includes: Under fixed imaging conditions, sample images of multiple calibration samples are acquired respectively, and the true value of the colorimeter Lab corresponding to each calibration sample is obtained; The fabric area is extracted from each of the sample images, and the extracted fabric area is color converted to obtain the camera imaging Lab data corresponding to each of the calibration samples. Based on the camera imaging Lab data and colorimeter Lab true values ​​corresponding to each calibration sample, a color mapping model is established to characterize the correspondence between the camera imaging Lab data and the colorimeter Lab true values. Obtain the true value of the colorimeter Lab corresponding to the target color reference, and based on the inverse mapping relationship determined by the color mapping model, convert the true value of the colorimeter Lab corresponding to the target color reference into a virtual target color in the camera imaging space. The target color reference includes standard white or a target color sample. Under the fixed imaging conditions, online images of the whitening fabric to be tested are acquired. The fabric area is extracted and the color is converted from the online images to obtain the Lab data of the camera imaging corresponding to the whitening fabric to be tested. Based on the Lab data of the camera under test and the virtual target color, the color deviation component and total color difference of the whitening fabric under test relative to the target color reference are determined, and the color deviation direction, color deviation degree and detection result of the whitening fabric under test are determined according to the color deviation component and the total color difference. The process involves determining the color cast component and total color difference of the whitening fabric under test relative to the target color reference based on the Lab data of the camera under test and the virtual target color, and determining the color cast direction, degree of color cast, and detection result of the whitening fabric under test based on the color cast component and the total color difference, including: The component difference between the Lab data of the camera under test and the virtual target color is calculated in the camera imaging space to obtain the lightness offset component, red-green offset component and yellow-blue offset component of the whitening fabric under test relative to the target color reference. The total color difference between the whitening fabric to be tested and the target color reference is calculated based on the lightness offset component, the red-green offset component, and the yellow-blue offset component. When the absolute value of the red-green hue offset component is less than or equal to the first color deviation threshold, and the yellow-blue hue offset component is less than the negative of the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be bluish. When the absolute value of the red-green hue offset component is less than or equal to the first color deviation threshold, and the yellow-blue hue offset component is greater than the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be yellowish. When the red-green hue offset component is greater than the first color deviation threshold and the yellow-blue hue offset component is less than the negative of the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be purplish. The degree of color deviation of the whitening fabric to be tested is determined based on the relationship between the total color difference and the preset color difference grading threshold, and the detection result is determined based on the direction of color deviation and the degree of color deviation.

2. The method for detecting color deviation in whitening fabric based on virtual target color calibration according to claim 1, characterized in that, The step of acquiring sample images of multiple calibration samples under fixed imaging conditions and obtaining the true Lab value of the colorimeter corresponding to each calibration sample includes: Multiple whitening fabric samples covering neutral white, bluish, purplish, and yellowish tones were selected as calibration samples. Each calibration sample was measured using a self-calibrated colorimeter to obtain the true Lab value of the colorimeter for each calibration sample. After the measurement is completed, each of the calibration samples is placed in a standard light source box in sequence, and a matte black background plate is set on the back of each of the calibration samples; Under the conditions that the exposure time, gain, white balance, lens aperture and focal length of the industrial camera are kept fixed, and the shooting distance, shooting angle and field of view of the industrial camera relative to each of the calibration samples are kept fixed, sample images corresponding to each of the calibration samples are acquired respectively. According to the calibration sample identifier, the colorimeter Lab true value and sample image corresponding to the same calibration sample are associated and recorded.

3. The method for detecting color deviation in whitening fabric based on virtual target color calibration according to claim 1, characterized in that, The step of extracting the fabric area from each of the sample images and performing color conversion processing on the extracted fabric area to obtain the camera imaging Lab data corresponding to each of the calibration samples includes: Based on the preset region location or the fabric boundary of the calibrated sample in the sample image, the corresponding initial fabric region is determined from each of the sample images; The initial area of ​​the fabric surface is subjected to boundary shrinkage processing, and pixels in the initial area of ​​the fabric surface that meet the preset abnormal pixel conditions are removed to obtain the fabric surface area corresponding to each sample image. Calculate the average red channel value, average green channel value, and average blue channel value of pixels in each of the aforementioned fabric areas to obtain the RGB color data corresponding to each of the aforementioned calibration samples; The RGB color data are sequentially linearized, converted to XYZ color space, and converted to Lab color space to obtain the camera imaging Lab data corresponding to each calibration sample.

4. The method for detecting color deviation in whitening fabric based on virtual target color calibration according to claim 1, characterized in that, The step of establishing a color mapping model based on the camera imaging Lab data and the colorimeter Lab true value corresponding to each of the calibration samples to characterize the correspondence between the camera imaging Lab data and the colorimeter Lab true value includes: According to the calibration sample identifier, the camera imaging Lab data and the colorimeter Lab true value corresponding to the same calibration sample are combined to form a color calibration data pair; The first The camera imaging Lab data corresponding to each calibration sample is represented as follows: , will the The true value of the colorimeter Lab for each calibration sample is expressed as follows: Based on the multiple color calibration data pairs, the following positive mapping relationship is established: ; in, This represents the mapping matrix in a positive mapping relationship. This represents the bias vector in a positive mapping relationship. Indicates the calibrated sample number; Based on the multiple color calibration data pairs, the following dual mapping relationship is established: ; in, This represents the mapping matrix in the dual mapping relation. Represents the bias vector in the dual mapping relation; The forward mapping relationship and the dual mapping relationship are used as the color mapping model.

5. The method for detecting color deviation in whitening fabric based on virtual target color calibration according to claim 1, characterized in that, The step of obtaining the true Lab value of the colorimeter corresponding to the target color reference, and converting the true Lab value of the colorimeter corresponding to the target color reference into a virtual target color in the camera imaging space based on the inverse mapping relationship determined by the color mapping model, includes: When the target color reference is standard white, obtain the true value of the colorimeter Lab corresponding to the standard white; when the target color reference is a target color sample, measure the target color sample using a colorimeter to obtain the true value of the colorimeter Lab corresponding to the target color sample. The true value of the colorimeter Lab corresponding to the target color reference is expressed as: And represent the virtual target color as ; Based on the dual mapping relationship in the color mapping model, the true value of the colorimeter Lab corresponding to the target color reference is converted into the virtual target color. The dual mapping relationship is expressed as follows: ; in, This represents the virtual target color corresponding to the target color reference. This represents the true Lab value of the colorimeter corresponding to the target color reference. Denotes the mapping matrix in the dual mapping relation. This represents the bias vector in the dual mapping relation; The virtual target color is associated with and saved with the type of the target color reference, wherein the type of the target color reference includes standard white type or target color sample type.

6. The method for detecting color deviation in whitening fabric based on virtual target color calibration according to claim 1, characterized in that, The process involves acquiring online images of the whitening fabric under the fixed imaging conditions, extracting the fabric area and performing color conversion processing on the online images to obtain the corresponding camera imaging Lab data for the whitening fabric, including: Under fixed imaging conditions consistent with those for acquiring the sample images, online images of the whitening fabric to be tested are acquired; Based on the preset area location or the fabric boundary of the whitening fabric to be tested in the online image, the initial area of ​​the fabric to be tested is determined from the online image; The initial area of ​​the fabric to be tested is subjected to boundary shrinkage processing, and pixels in the initial area of ​​the fabric to be tested that meet the preset abnormal pixel conditions are removed to obtain the fabric area to be tested. The preset abnormal pixel conditions include at least one of the following: pixel brightness is greater than a preset brightness threshold, any color channel reaches saturation value, or pixel brightness is lower than a preset dark pixel threshold. Calculate the average red channel value, average green channel value, and average blue channel value of the pixels in the area to be tested to obtain the RGB color data of the whitening fabric to be tested. The RGB color data to be tested is sequentially linearized, converted to XYZ color space, and converted to Lab color space to obtain the Lab data of the camera image corresponding to the whitening fabric to be tested.

7. A system for detecting color deviation in whitening fabrics based on virtual target color calibration, characterized in that, include: The sample acquisition module is used to acquire sample images of multiple calibration samples under fixed imaging conditions, and obtain the true value of the colorimeter Lab corresponding to each calibration sample. The sample conversion module is used to extract the fabric area from each of the sample images and perform color conversion processing on the extracted fabric area to obtain the camera imaging Lab data corresponding to each of the calibration samples. The model building module is used to establish a color mapping model that characterizes the correspondence between camera imaging Lab data and colorimeter Lab true values ​​based on the camera imaging Lab data and colorimeter Lab true values ​​corresponding to each of the calibration samples. The target generation module is used to obtain the true value of the colorimeter Lab corresponding to the target color reference, and convert the true value of the colorimeter Lab corresponding to the target color reference into a virtual target color in the camera imaging space based on the inverse mapping relationship determined by the color mapping model. The target color reference includes standard white or target color sample. The online conversion module is used to acquire online images of the whitening fabric to be tested under the fixed imaging conditions, extract the fabric area and perform color conversion processing on the online images to obtain the camera imaging Lab data corresponding to the whitening fabric to be tested. The color cast detection module is used to determine the color cast component and total color difference of the whitening fabric under test relative to the target color reference based on the Lab data of the camera under test and the virtual target color, and to determine the color cast direction, color cast degree and detection result of the whitening fabric under test according to the color cast component and the total color difference. The process involves determining the color cast component and total color difference of the whitening fabric under test relative to the target color reference based on the Lab data of the camera under test and the virtual target color, and determining the color cast direction, degree of color cast, and detection result of the whitening fabric under test based on the color cast component and the total color difference, including: The component difference between the Lab data of the camera under test and the virtual target color is calculated in the camera imaging space to obtain the lightness offset component, red-green offset component and yellow-blue offset component of the whitening fabric under test relative to the target color reference. The total color difference between the whitening fabric to be tested and the target color reference is calculated based on the lightness offset component, the red-green offset component, and the yellow-blue offset component. When the absolute value of the red-green hue offset component is less than or equal to the first color deviation threshold, and the yellow-blue hue offset component is less than the negative of the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be bluish. When the absolute value of the red-green hue offset component is less than or equal to the first color deviation threshold, and the yellow-blue hue offset component is greater than the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be yellowish. When the red-green hue offset component is greater than the first color deviation threshold and the yellow-blue hue offset component is less than the negative of the second color deviation threshold, the color deviation direction of the whitening fabric to be tested is determined to be purplish. The degree of color deviation of the whitening fabric to be tested is determined based on the relationship between the total color difference and the preset color difference grading threshold, and the detection result is determined based on the direction of color deviation and the degree of color deviation.

8. An electronic device, characterized in that, The device includes a processor and a memory; the memory stores a program, which is loaded and executed by the processor to implement a method for detecting color deviation in whitening fabric based on virtual target color calibration as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The storage medium stores a program, which, when executed by a processor, is used to implement a method for detecting color deviation in whitening fabric based on virtual target color calibration as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Digital camera-based textile color difference measurement method

    CN107144353A

  • Color calibration method and system based on calibration model, intelligent terminal and medium

    CN114202590A