A method for determining image color quality in industrial visual inspection
By dividing the inspection field of view into multiple areas and using standard color cards to determine the color quality of industrial visual inspection images, the problem of unstable image color quality is solved, fast and effective online imaging color quality detection is achieved, and product production quality is improved.
Patent Information
- Application Number
- CN202111149967.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-09-29
AI Technical Summary
In industrial manufacturing, computer vision technology is sensitive to light, resulting in unstable color quality of imaging images and affecting production quality.
A method for determining image color quality in industrial visual inspection is adopted. The inspection field of view is divided into multiple regions. A standard color card is used as a benchmark to calculate grayscale and RGB values. The effect of image acquisition and interference colors on color quality is determined, and the regional impact is evaluated through the standard deviation and coefficient of variation of the RGB values.
It realizes fast and effective online imaging color quality detection, ensures the stability of image acquisition, and improves product production quality.
Smart Images

Figure CN114022574B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer machine vision technology, and in particular to a method and system for determining image color quality during industrial visual inspection. Background Art
[0002] In the industrial manufacturing sector, computer vision plays a crucial role in object detection and analysis within intelligent manufacturing. However, in practical applications, the complex and ever-changing production environment and the inherent light sensitivity of computer vision technology make it difficult to effectively guarantee the stability of image color quality, leading to misleading results in actual production. Summary of the Invention
[0003] The present invention aims to solve the problem that the quality of image acquisition on intelligent manufacturing production lines cannot be effectively guaranteed. The purpose of the present invention is to propose an image color quality determination method and system for industrial environment visual inspection, which can quickly and effectively determine the online imaging color quality detection, ensure the stability of online acquired images, and thus improve the quality of product production.
[0004] In order to achieve the above-mentioned purpose, the present invention adopts the following technical solutions:
[0005] The present invention provides an image color quality determination method for industrial visual inspection, which is characterized by comprising: sequentially performing a first detection determination, a second detection determination, and a third detection determination, wherein the first detection determination is to determine whether an image acquisition effect conforms to a color card standard in a grayscale space based on a grayscale value; the second detection determination is to determine the influence of the interference color of an object on the image color quality based on an interference color RGB value; and the third detection determination is to determine whether different regions have an influence on the image acquisition color quality based on a standard deviation and a coefficient of variation of the RGB value.
[0006] Furthermore, in the image color quality determination method for industrial visual inspection provided by the present invention, it is characterized in that the specific steps of the method are as follows: step 1, selecting a standard color card as a reference calibration sample; step 2, dividing the detection field of view of the image acquisition lens into multiple areas to obtain different areas of the detection field of view; step 3, placing the standard color card in the different divided areas, and acquiring the corresponding true color image; step 4, respectively calculating the grayscale values of the six grayscale blocks of white→gray→black on the color card in the true color image, and sorting them; step 5, calculating the grayscale values of the six grayscale blocks of white→gray→black in the standard color card, and performing correlation analysis with the sorted grayscale values obtained in the true color image in step 4, so as to determine the image acquisition effect in grayscale. Whether the space meets the color card standard; Step 6, for each area, select the interference color of the test object, and calculate the RGB values of the standard color card and the corresponding true color image of each interference color block and the proportional relationship of the RGB values; Step 7, cross-judge the RGB value proportional relationship of the standard color card and the interference color block in the corresponding true color image, so as to determine the impact of the interference color of the object on the image color quality; Step 8, calculate the RGB values of the six grayscale color blocks and each interference color block in the true color image of all divided areas, calculate the standard deviation and coefficient of variation of the RGB value of each color in the divided area, and determine whether different areas have an impact on the color quality of image acquisition based on the calculated standard deviation and coefficient of variation results.
[0007] Furthermore, the image color quality determination method for industrial visual inspection provided by the present invention may also have the following characteristics: wherein, the detection field of view in step 2 is rectangular, and the detection field of view is divided into three equal-sized areas on the left, middle, and right, and numbered i=1, 2, 3.
[0008] Furthermore, the image color quality determination method for industrial visual inspection provided by the present invention may also have the following features: wherein, the standard color card is a 24-color standard color card, and in step three, the 24-color standard color card is placed on three areas respectively, and the corresponding true color images are collected.
[0009] Furthermore, the image color quality determination method for industrial visual inspection provided by the present invention may also have the following characteristics: wherein the specific process of step 4 is as follows: the conversion formula for converting RGB values to grayscale values is:
[0010] Y=0.299·R+0.587·G+0.114·B(1)
[0011] In formula (1), R value, G value, and B value represent red value, green value, and blue value respectively; Y value represents grayscale value;
[0012] The RGB values of the six grayscale blocks of the color card white → gray → black in the true color image are expressed as (R i1 ,G i1 ,B i1 )、(R i2 ,G i2 ,B i2 )、(R i3 ,G i3 ,B i3 )、(R i4 ,G i4 ,B i4 )、(R i5 ,G i5 ,B i5 )、(R i6 ,G i6 ,B i6 ), i = 1, 2, 3, the grayscale values corresponding to the six grayscale blocks in the color card in the true color image are calculated by formula (1), which are expressed as Y i1 、Y i2 、Y i3 、Y i4 、Y i5 、Y i6 , i = 1, 2, 3, and sort the obtained grayscale values.
[0013] Furthermore, the image color quality determination method for industrial visual inspection provided by the present invention may also have the following features: wherein the specific process of step five is as follows:
[0014] a) The RGB value of each color block in the standard color card is a known value. Let the RGB values of the six grayscale blocks of white → gray → black in the standard color card be (R1, G1, B1), (R2, G2, B2), (R3, G3, B3), (R4, G4, B4), (R5, G5, B5), and (R6, G6, B6) respectively;
[0015] The corresponding grayscale values of the six grayscale blocks in the standard color card are calculated by formula (1), which are expressed as Y1, Y2, Y3, Y4, Y5, and Y6 respectively, and the obtained grayscale values are sorted;
[0016] b) Compare the grayscale values of the six grayscale blocks of the color cards in different areas with the grayscale values of the six grayscale blocks of the standard color card to calculate the correlation coefficient r i Calculation, i = 1, 2, 3, the calculation formula is as follows:
[0017]
[0018] In formula (2), Y i =[Y i1 ,Y i2 ,Yi3 ,Y i4 ,Y i5 ,Y i6 ], i=1,2,3; Y=[Y1,Y2,Y3,Y4,Y5,Y6]; Cov(Y i ,Y) is Y i Covariance with Y; Var(Y i ) is Y i The variance of ; Var(Y) is the variance of Y;
[0019] c) If the correlation coefficient r i The closer it is to 1, the more the image acquisition effect conforms to the color card standard in the grayscale space.
[0020] Furthermore, the image color quality determination method for industrial visual inspection provided by the present invention may also have the following features: wherein, the specific process of step six is as follows: for each area, at least two interference colors of the inspection object are selected respectively, and the RGB values of each interference color block in the standard color card and the corresponding true color image are calculated, as well as the proportional relationship of the RGB values: when there are two interference colors, let the interference colors be C1 and C2 respectively, for C1 and C2 in the standard color card, the RGB values of C1 and C2 in the standard color card are calculated and expressed as (R c1 ,G c1 ,B c1 )、(R c2 ,G c2 ,B c2 ), and calculate the corresponding RGB value ratio as: a1:b1:c1 and a2:b2:c2; for C1 and C2 in the true color image, calculate the RGB values of C1 and C2 in the standard color card as (R c3 ,G c3 ,B c3 )、(R c4 ,G c4 ,B c4 ), and calculate the corresponding RGB value ratios as: a3:b3:c3 and a4:b4:c4.
[0021] Furthermore, the method for determining the color quality of an image in industrial visual inspection provided by the present invention may also have the following characteristics: wherein the specific process of step seven is as follows:
[0022] a) For the interference color C1, first calculate the correlation coefficient r between the RGB ratio value of the interference color C1 in the true color image and the RGB ratio value of the interference color C1 in the standard color card 11 :
[0023]
[0024] Then, calculate the correlation coefficient r between the RGB ratio value of the interference color C1 in the true color image and the RGB ratio value of the interference color C2 in the standard color card. 12 :
[0025]
[0026] In formulas (3) and (4), Cov(*) represents covariance; Var(*) represents variance;
[0027] b) Compare r 11 With r 12 The size of r 11 >r 12 , it indicates that the interference color C1 has a low impact on the imaging quality; if r 11 <r 12 , which means that the color C1 in the true color image is recognized as C2, indicating that the interference color C1 has a greater impact on the imaging quality;
[0028] c) For the interference color C2, first calculate the correlation coefficient r between the RGB ratio value of the interference color C2 in the true color image and the RGB ratio value of the interference color C2 in the standard color card. 22 :
[0029]
[0030] Then, calculate the correlation coefficient r between the RGB ratio value of the interference color C2 in the true color image and the RGB ratio value of the interference color C1 in the standard color card. 21 :
[0031]
[0032] In formulas (5) and (6), Cov(*) represents covariance; Var(*) represents variance;
[0033] d) Compare r 22 With r 21 The size of r 22 >r 21 , it indicates that the interference color C2 has a low impact on the imaging quality; if r 22 <r 21 , which means that the color C2 in the true color image is recognized as C1, indicating that the interference color C2 has a greater impact on the imaging quality;
[0034] e) If r 11 >r 12 And r 22 >r 21 , which indicates that the online imaging quality is not affected by the interference colors C1 and C2.
[0035] Furthermore, the method for determining the color quality of an image in industrial visual inspection provided by the present invention may also have the following characteristics: wherein the specific process of step eight is as follows:
[0036] a) When the interference colors are C1 and C2, first calculate the RGB values of the six grayscale blocks (G1, G2, G3, G4, G5, G6) in the true color image and the RGB values of the interference color blocks C1 and C2. The RGB values of the eight blocks are expressed as follows:
[0037]
[0038] b) For each of the eight color blocks, calculate the standard deviation and coefficient of variation for the R value, G value, and B value, and obtain the corresponding coefficient of variation:
[0039] The three sets of RGB values for the grayscale block G1 in the three true color images are:
[0040]
[0041] Coefficient of variation of the R value of grayscale color patch G1 Calculated according to the following formula:
[0042]
[0043] In formula (7), N=3; is the standard deviation of the R value of the grayscale patch G1; is the average value of the R value of the grayscale color block G1;
[0044] Coefficient of variation of the G value of grayscale color block G1 Calculated according to the following formula:
[0045]
[0046] In formula (8), N=3; is the standard deviation of the G value of the grayscale color block G1, is the average value of the G value of the grayscale color block G1;
[0047] Coefficient of variation of the B value of grayscale patch G1 Calculated according to the following formula:
[0048]
[0049] In formula (9), N=3; is the standard deviation of the B value of the grayscale patch G1; is the average value of the B value of the grayscale block G1;
[0050] For the R, G, and B value variation coefficients of the grayscale color blocks G2, G3, G4, G5, and G6 and the interference color blocks C1 and C2, the variation coefficients of the RGB values of the grayscale color block G1 can be calculated in the same way by replacing the RGB values of the grayscale color block G1 with the RGB values of the corresponding color blocks through formulas (7) to (9).
[0051] c) Determine whether different areas have an impact on the color quality of image acquisition:
[0052] The coefficient of variation threshold of the RGB value is set to 10%. If all the calculated coefficients of variation are within 10%, it indicates that different regions have no effect on the color quality of image acquisition.
[0053] Function and effect of the present invention:
[0054] The present invention's method for determining image color quality for industrial visual inspection divides the field of view of an imaging acquisition lens into multiple regions. Standard color charts, used as reference calibration samples, are sequentially placed in each of the divided regions, and corresponding true-color images are captured. To verify the image color quality of a specific region, grayscale calculations are performed on designated gradient blocks on the color chart. Correlation analysis is then performed between the grayscale value rankings and the actual color gradients in the standard color chart to determine whether the image acquisition results meet the color chart standard within the grayscale space. To verify the impact of interference colors of the object under inspection on image color quality, the primary interference colors of the object under inspection are selected, and their RGB values in the standard color chart are calculated. Simultaneously, the RGB values and their ratios of the interference colors in each true-color image are calculated and cross-referenced with the RGB ratios of the interference colors in the standard color chart. To test the impact of different regions within the field of view on image color quality, the grayscale blocks and RGB values of each interference color block in the color chart in each region are calculated. The standard deviation and coefficient of variation of the RGB values of the same color block in different regions are calculated, and these standard deviations and coefficients of variation are used to determine the quality of image color. The method of the present invention is simple, effective, and has a fast detection speed. It uses machine vision technology to perform non-destructive testing on industrial images, thereby achieving the effect of quickly evaluating the quality of color of visual inspection images in industrial environments, and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 is a flow chart of a method for determining image color quality during industrial visual inspection according to an embodiment of the present invention;
[0056] Figure 2 24 is a schematic diagram of a 24-color standard color card according to an embodiment of the present invention;
[0057] Figure 3 2 is a schematic diagram of the multi-area division of the detection field of view in an embodiment of the present invention;
[0058] Figure 4 is a true color image of a 24-color standard color card in different areas in an embodiment of the present invention;
[0059] Figure 5 Schematic diagram of cross judgment of interference colors in an embodiment of the present invention. DETAILED DESCRIPTION
[0060] In order to make the technical means, creative features, objectives and effects achieved by the present invention easier to understand, the following embodiments are combined with the accompanying drawings to specifically illustrate the technical solutions of the present invention.
[0061] <Example>
[0062] The method for determining image color quality during industrial visual inspection of the present invention includes sequentially performing a first detection and determination, a second detection and determination, and a third detection and determination. The first detection and determination determines whether the image acquisition effect conforms to the color card standard within the grayscale space based on grayscale values. The second detection and determination determines the impact of the object's interference colors on the image color quality based on the RGB values of the interference colors. The third detection and determination determines whether different regions have an impact on the image acquisition color quality based on the standard deviation and coefficient of variation of the RGB values.
[0063] See Figure 1 The image color quality determination method for industrial visual inspection of this embodiment includes the following steps:
[0064] Step 1: Select a standard color card as the benchmark calibration sample.
[0065] In this embodiment, the 24-color standard color card of Menong is selected as the reference calibration sample, but this is not a limitation. In other embodiments, a 36-color standard color card, a 48-color standard color card, etc. can also be used.
[0066] The 24-color standard color card in this embodiment is as follows Figure 2 As shown, the six color blocks in the last row are black→gray→white grayscale color blocks.
[0067] The actual RGB values of each color block in the Menon 24 standard color card are shown in Table 1, among which #19, #20, #21, #22, #23, and #24 are grayscale color blocks.
[0068] Table 1
[0069]
[0070]
[0071] Step 2: Divide the detection field of view of the image acquisition lens into multiple areas to obtain different areas of the detection field of view. Figure 3As shown, the detection field of view is rectangular, and is divided into three equal-sized areas of left, middle, and right, which are numbered i=1, 2, and 3.
[0072] Step 3: Place the standard color cards in the different divided areas and collect the corresponding true color images. Figure 4 As shown, 24-color standard color cards are placed on the three divided areas respectively. In this embodiment, three true color images are obtained corresponding to the three areas.
[0073] The image acquisition process used in this embodiment is implemented through an industrial visual inspection online imaging acquisition platform, which includes a light source, an image acquisition lens, a camera, and a computer. The image acquisition lens determines the rectangular detection field of view, the camera is used to acquire true color images, and the computer runs a computer program such as steps one to eight.
[0074] Step 4: For each region, calculate the grayscale values of the six grayscale blocks of white, gray, and black on the color card in the true color image and sort them.
[0075] The specific process of step 4 is as follows:
[0076] The conversion formula from RGB value to grayscale value is:
[0077] Y=0.299·R+0.587·G+0.114·B(1)
[0078] In formula (1), R value, G value, and B value represent red value, green value, and blue value, respectively; and Y value represents grayscale value.
[0079] The RGB values of the six grayscale blocks of the color card white → gray → black in the true color image are expressed as (R i1 ,G i1 ,B i1 )、(R i2 ,G i2 ,B i2 )、(R i3 ,G i3 ,B i3 )、(R i4 ,G i4 ,B i4 )、(R i5 ,G i5 ,B i5 )、(R i6 ,G i6 ,B i6 ), where i = 1, 2, 3 correspond to the three true color images on the left, middle, and right. The grayscale values corresponding to the six grayscale blocks in the color card in the true color image are calculated by formula (1), which are expressed as Y i1 、Y i2 、Yi3 、Y i4 、Y i5 、Y i6 , i = 1, 2, 3, and sort the obtained grayscale values.
[0080] When calculating the above RGB values, since the RGB value of each grayscale block in the six color blocks of white → gray → black in the true color image in different areas is not a unique value, in the actual calculation, several representative pixels on each color block (such as the pixels at the four corners and the center position) are selected, and the average RGB value of these pixels is calculated, and the average value is used as the RGB value of the color block.
[0081] In this embodiment, this step uses the RGB value average algorithm to calculate the RGB values of the grayscale blocks in the true color images of the left, middle, and right regions, and the results are shown in Table 2:
[0082] Table 2
[0083]
[0084] In this embodiment, this step calculates the grayscale values of the grayscale blocks in the true color images of the left, middle, and right regions using formula (1), and the obtained results are shown in Table 3:
[0085] Table 3
[0086]
[0087] Step 5: Calculate the grayscale values of the six grayscale blocks from white to gray to black in the standard color card, and perform a correlation analysis with the sorted grayscale values obtained in the true color image in step 4 to determine whether the image acquisition effect meets the color card standard in the grayscale space.
[0088] The specific process of step five is as follows:
[0089] a) The RGB value of each color block in the standard color card is a known value (see the RGB values corresponding to numbers #19 to #24 in Table 1). Let the RGB values of the six grayscale blocks of white → gray → black in the standard color card be (R1, G1, B1), (R2, G2, B2), (R3, G3, B3), (R4, G4, B4), (R5, G5, B5), and (R6, G6, B6) respectively;
[0090] The corresponding grayscale values of the six grayscale blocks in the standard color card are calculated by formula (1), which are expressed as Y1, Y2, Y3, Y4, Y5, and Y6 respectively. The obtained grayscale values are sorted. The calculated grayscale values and sorting are shown in Table 4 below:
[0091] Table 4
[0092]
[0093]
[0094] b) Compare the grayscale values of the six grayscale blocks of the color cards in different areas with the grayscale values of the six grayscale blocks of the standard color card to calculate the correlation coefficient r i Calculation, i = 1, 2, 3, the calculation formula is as follows:
[0095]
[0096] In formula (2), Y i =[Y i1 ,Y i2 ,Y i3 ,Y i4 ,Y i5 ,Y i6 ], i=1,2,3; Y=[Y1,Y2,Y3,Y4,Y5,Y6]; Cov(Y i ,Y) is Y i Covariance with Y; Var(Y i ) is Y i Var(Y) is the variance of Y.
[0097] c) If the correlation coefficient r i The closer it is to 1, the more the image acquisition effect conforms to the color card standard in the grayscale space. i ≥0.99, which means that the image acquisition effect meets the color card standard in the grayscale space.
[0098] According to the grayscale values of the grayscale blocks in Tables 3 and 4, the correlation coefficients between the grayscale values of the grayscale blocks in the true color images of the three different regions and the grayscale values of the grayscale blocks in the standard color card were calculated. The calculated results for the left, middle, and right regions were 0.9904, 0.9924, and 0.9910, respectively, all close to 1. Therefore, the image acquisition effect meets the color block standard in the grayscale space.
[0099] Step 6: For each area, select at least two interference colors of the detected object, and calculate the RGB values of each interference color block in the standard color card and the corresponding true color image, as well as the ratio of the RGB values.
[0100] The specific process of step six is as follows:
[0101] For each area, select at least two interference colors of the object being tested, and calculate the RGB values of each interference color block in the standard color card and the corresponding true color image, as well as the proportional relationship of the RGB values:
[0102] Specifically, for example, if the test sample is tobacco leaves, then its interference colors are yellow #15 and red #12.
[0103] The RGB value of the interference color block of the collected true color image is calculated using the method of calculating the RGB average value of the color block in step 4, and the RGB average value is used to represent the RGB value of the interference color block.
[0104] When there are two interfering colors, let the interfering colors be C1 and C2 respectively. For C1 and C2 in the standard color card, the RGB values of C1 and C2 in the standard color card are calculated and expressed as (R c1 ,G c1 ,B c1 )、(R c2 ,G c2 ,B c2 ), and calculate the corresponding RGB value ratio as: a1:b1:c1 and a2:b2:c2. For C1 and C2 in the true color image, calculate the RGB values of C1 and C2 in the standard color card as (R c3 ,G c3 ,B c3 )、(R c4 ,G c4 ,B c4 ), and calculate the corresponding RGB value ratios as: a3:b3:c3 and a4:b4:c4.
[0105] By using the RGB value average algorithm in step 4 to calculate the RGB values of the interference color blocks in the true color images of the left, middle, and right regions, the results are shown in Table 5:
[0106] Table 5
[0107]
[0108] Step 7: For each area, cross-check the RGB value ratio of the standard color card and the interference color block in the corresponding true color image to determine the impact of the interference color of the object on the image color quality. For the judgment process, refer to Figure 5 .
[0109] The specific process of step seven is as follows:
[0110] a) For the interference color C1, first calculate the correlation coefficient r between the RGB ratio value of the interference color C1 in the true color image and the RGB ratio value of the interference color C1 in the standard color card 11 :
[0111]
[0112] Then, calculate the correlation coefficient r between the RGB ratio value of the interference color C1 in the true color image and the RGB ratio value of the interference color C2 in the standard color card. 12 :
[0113]
[0114] In formulas (3) and (4), Cov(*) represents covariance; Var(*) represents variance;
[0115] b) Compare r 11 With r 12 The size of r 11 >r 12 , it indicates that the interference color C1 has a low impact on the imaging quality; if r 11 <r 12 , which means that the color C1 in the true color image is recognized as C2, indicating that the interference color C1 has a greater impact on the imaging quality;
[0116] c) For the interference color C2, first calculate the correlation coefficient r between the RGB ratio value of the interference color C2 in the true color image and the RGB ratio value of the interference color C2 in the standard color card. 22 :
[0117]
[0118] Then, calculate the correlation coefficient r between the RGB ratio value of the interference color C2 in the true color image and the RGB ratio value of the interference color C1 in the standard color card. 21 :
[0119]
[0120] In formulas (5) and (6), Cov(*) represents covariance; Var(*) represents variance;
[0121] d) Compare r 22 With r 21 The size of r 22 >r 21 , it indicates that the interference color C2 has a low impact on the imaging quality; if r 22 <r 21 , which means that the color C2 in the true color image is recognized as C1, indicating that the interference color C2 has a greater impact on the imaging quality;
[0122] e) If r 11 >r 12 And r 22 >r 21 , which indicates that the online imaging quality is not affected by the interference colors C1 and C2.
[0123] The correlation coefficient of the RGB ratio values of the interference color block in this embodiment is shown in Table 6:
[0124] Table 6
[0125]
[0126] According to the correlation coefficient values in Table 6, the correlation coefficient between the RGB values of the same color block in the standard color card and the true color image is significantly greater than the correlation coefficient between the RGB values of the same color block and the interference color block, so the imaging quality is not affected by the interference color.
[0127] Step 8. Calculate the RGB values of the six grayscale blocks and each interference color block in the true color image of all divided areas, calculate the standard deviation and coefficient of variation of the RGB values of each color in the divided area, and determine whether different areas have an impact on the color quality of image acquisition based on the calculated standard deviation and coefficient of variation results.
[0128] The specific process of step eight is as follows:
[0129] a) When the interference colors are C1 and C2, first calculate the RGB values of the six grayscale blocks (G1, G2, G3, G4, G5, G6) in the true color image and the RGB values of the interference color blocks C1 and C2. The RGB values of the eight blocks are expressed as follows:
[0130]
[0131] b) For each of the eight color blocks, calculate the standard deviation and coefficient of variation for the R value, G value, and B value, and obtain the corresponding coefficient of variation:
[0132] The three sets of RGB values for the grayscale block G1 in the three true color images are:
[0133]
[0134] Coefficient of variation of the R value of grayscale color patch G1 Calculated according to the following formula:
[0135]
[0136] In formula (7), N=3; is the standard deviation of the R value of the grayscale patch G1; is the average value of the R value of the grayscale color block G1;
[0137] Coefficient of variation of the G value of grayscale color block G1 Calculated according to the following formula:
[0138]
[0139] In formula (8), N=3; is the standard deviation of the G value of the grayscale color block G1, is the average value of the G value of the grayscale color block G1;
[0140] Coefficient of variation of the B value of grayscale patch G1 Calculated according to the following formula:
[0141]
[0142] In formula (9), N=3; is the standard deviation of the B value of the grayscale patch G1; is the average value of the B value of the grayscale block G1;
[0143] For the R, G, and B value variation coefficients of the grayscale color blocks G2, G3, G4, G5, and G6 and the interference color blocks C1 and C2, the variation coefficients of the RGB values of the grayscale color block G1 can be calculated in the same way by replacing the RGB values of the grayscale color block G1 with the RGB values of the corresponding color blocks through formulas (7) to (9).
[0144] c) Determine whether different areas have an impact on the color quality of image acquisition:
[0145] The coefficient of variation threshold of the RGB value is set to 10%. If all the calculated coefficients of variation are within 10%, it indicates that different regions have no effect on the color quality of image acquisition, the image color quality meets the requirements of online imaging acquisition, and the image quality is excellent.
[0146] Table 7 below shows the RGB values of the true color images in different regions calculated for the black block (#19), white block (#24), and interference color blocks (#12) and (#15):
[0147] Table 7
[0148]
[0149] According to the above formulas (7), (8), and (9), the RGB value variation coefficients of the black block (#19), the white block (#24), the interference color blocks (#12), and (#15) in the true color images in different regions are calculated, as shown in Table 8:
[0150] Color block number R value coefficient of variation G value variation coefficient B value coefficient of variation #19 0.000674748 0.000135541 0 #20 0.045426323 0.040468346 0.0446135 #21 0.056719843 0.059422245 0.061244339 #22 0.059972792 0.061139557 0.063175145 #23 0.049802218 0.052603555 0.051641597 #24 0.088252883 0.061549299 0.031476074 #12 0.043250388 0.114102896 0.164416456 #15 0.002451095 0.097402145 0.08739066
[0151] The results in Table 8 show that, except for the G and B value variation coefficients of color blocks #12, which exceed 10%, the RGB value variation coefficients of all other color blocks are within 10%, indicating that different regions have little or no effect on the color quality of image acquisition. The color quality of this image generally meets the requirements of online imaging acquisition.
[0152] The above embodiments are only preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.
Claims
1. A method for determining image color quality in industrial visual inspection, characterized by: including performing a first detection and determination, a second detection and determination, and a third detection and determination in sequence, The first detection determination is to determine whether the image acquisition effect meets the color card standard in the grayscale space based on the grayscale value; The second detection and determination is to determine the influence of the interference color of the object on the color quality of the image based on the RGB value of the interference color; The third detection determination is to determine whether different areas have an impact on the color quality of image acquisition based on the standard deviation and coefficient of variation of the RGB values; The specific steps of the image color quality determination method are as follows: Step 1: Select a standard color card as a benchmark calibration sample; Step 2: Divide the detection field of view of the image acquisition lens into multiple regions to obtain different regions of the detection field of view; Step 3: Place the standard color cards in the different divided areas and acquire the corresponding true color images; Step 4: Calculate the grayscale values of the six grayscale blocks of white, gray, and black on the color card in the true color image and sort them; Step 5: Calculate the grayscale values of the six grayscale blocks in the standard color card (white, gray, and black), and perform a correlation analysis with the sorted grayscale values obtained in the true color image in step 4 to determine whether the image acquisition effect meets the color card standard in the grayscale space. Step 6: For each area, select the interference color of the detected object and calculate the RGB value and the ratio of the RGB value of each interference color block in the standard color card and the corresponding true color image; Step 7: Cross-check the RGB value ratio of the standard color card and the interference color block in the corresponding true color image to determine the impact of the object's interference color on the image color quality; Step 8. Calculate the RGB values of the six grayscale blocks and each interference color block in the true color image of all divided areas, calculate the standard deviation and coefficient of variation of the RGB values of each color in the divided area, and determine whether different areas have an impact on the color quality of image acquisition based on the calculated standard deviation and coefficient of variation results.
2. The method for determining image color quality for industrial visual inspection according to claim 1, wherein: in, The detection field of view in step 2 is rectangular, and is divided into three equal-sized areas, namely, left, middle, and right areas, which are numbered i=1, 2, and 3.
3. The method for determining image color quality for industrial visual inspection according to claim 1, wherein: in, The standard color card is a 24-color standard color card. In step three, the 24-color standard color card is placed on the three areas respectively, and corresponding true color images are collected.
4. The method for determining image color quality for industrial visual inspection according to claim 1, wherein: in, The specific process of step 4 is as follows: The conversion formula from RGB value to grayscale value is: Y=0.299·R+0.587·G+0.114·B (1) In formula (1), R value, G value, and B value represent red value, green value, and blue value respectively; Y value represents grayscale value; The RGB values of the six grayscale blocks of the color card white → gray → black in the true color image are expressed as (R i1 ,G i1 ,B i1 )、(R i2 ,G i2 ,B i2 )、(R i3 ,G i3 ,B i3 )、(R i4 ,G i4 ,B i4 )、(R i5 ,G i5 ,B i5 )、(R i6 ,G i6 ,B i6 ), i = 1, 2, 3, the grayscale values corresponding to the six grayscale blocks in the color card in the true color image are calculated by formula (1), which are expressed as Y i1 、Y i2 、Y i3 、Y i4 、Y i5 、Y i6 , i = 1, 2, 3, and sort the obtained grayscale values.
5. The method for determining image color quality for industrial visual inspection according to claim 4, wherein: in, The specific process of step five is as follows: a) The RGB value of each color block in the standard color card is a known value, and the RGB values of the six grayscale color blocks of white → gray → black in the standard color card are (R1, G1, B1), (R2, G2, B2), (R3, G3, B3), (R4, G4, B4), (R5, G5, B5), and (R6, G6, B6) respectively; The corresponding grayscale values of the six grayscale blocks in the standard color card are calculated by formula (1), which are expressed as Y1, Y2, Y3, Y4, Y5, and Y6 respectively, and the obtained grayscale values are sorted; b) Compare the grayscale values of the six grayscale blocks of the color cards in different areas with the grayscale values of the six grayscale blocks of the standard color card to calculate the correlation coefficient r i Calculation, i = 1, 2, 3, the calculation formula is as follows: In formula (2), Y i =[Y i1 ,Y i2 ,Y i3 ,Y i4 ,Y i5 ,Y i6 ], i=1,2,3; Y=[Y1,Y2,Y3,Y4,Y5,Y6]; Cov(Y i ,Y) is Y i Covariance with Y; Var(Y i ) is Y i The variance of ; Var(Y) is the variance of Y; c) If the correlation coefficient r i The closer it is to 1, the more the image acquisition effect conforms to the color card standard in the grayscale space.
6. The method for determining image color quality for industrial visual inspection according to claim 1, wherein: in, The specific process of step six is as follows: For each area, select at least two interference colors of the object being tested, and calculate the RGB values of each interference color block in the standard color card and the corresponding true color image, as well as the proportional relationship of the RGB values: When there are two interfering colors, let the interfering colors be C1 and C2 respectively. For C1 and C2 in the standard color card, the RGB values of C1 and C2 in the standard color card are calculated and expressed as (R c1 ,G c1 ,B c1 )、(R c2 ,G c2 ,B c2 ), and calculate the corresponding RGB value ratio relationship as: a1:b1:c1 and a2:b2:c2; For C1 and C2 in the true color image, the RGB values of C1 and C2 in the standard color card are calculated and expressed as (R c3 ,G c3 ,B c3 )、(R c4 ,G c4 ,B c4 ), and calculate the corresponding RGB value ratios as: a3:b3:c3 and a4:b4:c4.
7. The method for determining image color quality for industrial visual inspection according to claim 6, wherein: in, The specific process of step seven is as follows: a) For the interference color C1, first calculate the correlation coefficient r between the RGB ratio value of the interference color C1 in the true color image and the RGB ratio value of the interference color C1 in the standard color card 11 : Then, calculate the correlation coefficient r between the RGB ratio value of the interference color C1 in the true color image and the RGB ratio value of the interference color C2 in the standard color card. 12 : In formulas (3) and (4), Cov(*) represents covariance; Var(*) represents variance; b) Compare r 11 With r 12 The size of r 11 >r 12 , it indicates that the interference color C1 has a low impact on the imaging quality; if r 11 <r 12 , which means that the color C1 in the true color image is recognized as C2, indicating that the interference color C1 has a greater impact on the imaging quality; c) For the interference color C2, first calculate the correlation coefficient r between the RGB ratio value of the interference color C2 in the true color image and the RGB ratio value of the interference color C2 in the standard color card. 22 : Then, calculate the correlation coefficient r between the RGB ratio value of the interference color C2 in the true color image and the RGB ratio value of the interference color C1 in the standard color card. 21 : In formulas (5) and (6), Cov(*) represents covariance; Var(*) represents variance; d) Compare r 22 With r 21 The size of r 22 >r 21 , it indicates that the interference color C2 has a low impact on the imaging quality; if r 22 <r 21 , which means that the color C2 in the true color image is recognized as C1, indicating that the interference color C2 has a greater impact on the imaging quality; e) If r 11 >r 12 And r 22 >r 21 , which indicates that the online imaging quality is not affected by the interference colors C1 and C2.
8. The method for determining image color quality for industrial visual inspection according to claim 1, wherein: in, The specific process of step eight is as follows: a) When the interference colors are C1 and C2, first calculate the RGB values of the six grayscale blocks (G1, G2, G3, G4, G5, G6) in the true color image and the RGB values of the interference color blocks C1 and C2. The RGB values of the eight blocks are expressed as follows: b) For each of the eight color blocks, calculate the standard deviation and coefficient of variation for the R value, G value, and B value, and obtain the corresponding coefficient of variation: The three sets of RGB values for the grayscale block G1 in the three true color images are: Coefficient of variation of the R value of grayscale color patch G1 Calculated according to the following formula: In formula (7), N=3; is the standard deviation of the R value of the grayscale patch G1; is the average value of the R value of the grayscale color block G1; Coefficient of variation of the G value of grayscale color block G1 Calculated according to the following formula: In formula (8), N=3; is the standard deviation of the G value of the grayscale color block G1, is the average value of the G value of the grayscale color block G1; Coefficient of variation of the B value of grayscale patch G1 Calculated according to the following formula: In formula (9), N=3; is the standard deviation of the B value of the grayscale patch G1; is the average value of the B value of the grayscale block G1; For the R, G, and B value variation coefficients of the grayscale color blocks G2, G3, G4, G5, and G6 and the interference color blocks C1 and C2, the variation coefficients of the RGB values of the grayscale color block G1 can be calculated in the same way by replacing the RGB values of the grayscale color block G1 with the RGB values of the corresponding color blocks through formulas (7) to (9). c) Determine whether different areas have an impact on the color quality of image acquisition: The coefficient of variation threshold of the RGB value is set to 10%. If all the calculated coefficients of variation are within 10%, it indicates that different regions have no effect on the color quality of image acquisition.
Citation Information
Patent Citations
Color card for judging surface color uniformity of colored knitted fabric and preparation method thereof
CN108414456A
Color correction method
CN113132693A