A method and system for detecting the colorimetric properties of naphthol AS-PH based on image recognition

Through the color phenol AS-PH detection method based on image recognition, using technologies such as standard whiteboard correction, adaptive sampling and double Gaussian fuzzy denoising, the problems of accuracy instability and noise interference in traditional detection methods are solved, and high-precision and high-reliability color phenol AS-PH detection is achieved.

CN119942148BActive Publication Date: 2025-08-12SHANDONG ANDY NEW MATERIAL CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510006878.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-08-12
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

The traditional color phenol AS-PH detection method relies on manual visual inspection, with unstable accuracy, and image recognition methods have problems with edge noise interference and uneven light, resulting in low stability and reliability of the detection results, making it difficult to accurately capture subtle color differences.

Method used

Using image recognition-based detection methods, the signal-to-noise ratio and detection accuracy are improved through standard whiteboard correction, adaptive sampling, dual Gaussian fuzzy denoising, sub-region stability evaluation and two-level concentration mapping model, including grayscale correction, dual Gaussian fuzzy algorithm, adaptive sampling and two-level concentration mapping model.

Benefits of technology

The high-precision and high-reliability quantitative detection of color phenol AS-PH test strips is realized, and the relative deviation is controlled between ±4% and 12%, and a strict result verification mechanism is established to ensure the accuracy and reliability of the test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119942148B_ABST
    Figure CN119942148B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for detecting the colorimetric properties of naphthol AS-PH based on image recognition, which relates to the field of image recognition technology. The method comprises placing a naphthol AS-PH test paper to be tested on a standard whiteboard, collecting an RGB image of the naphthol AS-PH test paper by a camera; performing grayscale correction on the RGB image to obtain a corrected RGB corrected image; extracting an effective detection area of the naphthol AS-PH test paper from the RGB corrected image, and eliminating edge noise of the effective detection area by a double Gaussian blur algorithm; dividing the effective detection area into a plurality of equal-area sub-areas, calculating the RGB mean of each sub-area, and selecting a central sub-area with the most stable RGB mean as a target detection area; and obtaining a concentration value of the naphthol AS-PH to be tested based on the RGB value of the target detection area and a pre-established naphthol AS-PH concentration-RGB mapping model. The present invention effectively overcomes the problems of image noise, color instability, and measurement error existing in traditional detection methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a method and system for detecting the colorimetry of naphthol AS-PH based on image recognition. Background Art

[0002] As an important biomarker, color phenol AS-PH is of significant significance in medical diagnosis and physiological research. In recent years, with the rapid development of medical testing technology, quantitative detection methods for biomarkers have continued to evolve. Traditional colorimetric detection technologies mainly rely on manual visual inspection or professional spectrophotometers. These methods have prominent problems such as strong subjectivity, unstable detection accuracy, and cumbersome operation. With the iterative updates of digital image processing technology and machine vision algorithms, quantitative detection methods based on image recognition have gradually become a research hotspot, providing a new technical path for biomarker detection.

[0003] Existing technologies for detecting naphthol AS-PH face numerous technical bottlenecks. First, the measurement accuracy of traditional detection methods is often limited by the subjective judgment of the human eye and ambient lighting conditions, making it difficult to achieve accurate, standardized quantitative analysis. Second, existing image recognition methods commonly suffer from edge noise interference and uneven lighting when processing test strip images, resulting in low stability and reliability of detection results. Particularly in scenarios with slight changes in chromaticity, existing technologies often struggle to accurately capture subtle color differences, which severely restricts the sensitivity and accuracy of detection. In contrast, the present invention significantly improves the signal-to-noise ratio and detection accuracy of naphthol AS-PH test strip images through innovative image preprocessing and region selection strategies. Summary of the Invention

[0004] In view of the problems existing in the prior art, the present invention proposes a method and system for detecting the colorimetry of AS-PH based on image recognition.

[0005] Therefore, a method for detecting the colorimetric properties of naphthol AS-PH based on image recognition is provided, which can solve the problems mentioned in the background technology.

[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0007] In a first aspect, an embodiment of the present invention provides a method for detecting the colorimetry of naphthol AS-PH based on image recognition, which comprises:

[0008] A Naphthol AS-PH test paper to be tested is placed on a standard white board, and an RGB image of the Naphthol AS-PH test paper is captured by a camera;

[0009] Grayscale correction is performed on the RGB image to obtain a corrected RGB image; the correction uses a preset reflectance value of a standard white plate area as a reference; the standard white plate area is a rectangular area at a preset distance from the edge of the naphthol AS-PH test paper; and an adaptive sampling method is used in the rectangular area;

[0010] Extracting the effective detection area of the Naphthol AS-PH test paper from the RGB corrected image, and eliminating edge noise of the effective detection area by a double Gaussian blur algorithm;

[0011] Divide the effective detection area into multiple sub-areas of equal area, calculate the RGB mean of each sub-area, and select the central sub-area with the most stable RGB mean as the target detection area;

[0012] According to the RGB value of the target detection area, combined with the pre-established Naphthol AS-PH concentration-RGB mapping model, the concentration value of the Naphthol AS-PH to be measured is obtained.

[0013] As a preferred embodiment of the image recognition-based colorimetric detection method for Naphthol AS-PH of the present invention, the adaptive sampling method includes dividing the rectangular area into nine equal small areas and adopting adaptive weighted sampling at the center point of each small area;

[0014] The calculation of the sampling weight of the adaptive weighted sampling is shown in the following formula:

[0015]

[0016] Among them, x0 represents the coordinate value of the center point of the sampling area in the horizontal direction of the image, y0 represents the coordinate value of the center point of the sampling area in the vertical direction of the image, x represents the coordinate value of the pixel point in the horizontal direction of the image, y represents the coordinate value of the pixel point in the vertical direction of the image, σ is the sampling radius parameter, α is the gradient weight coefficient, is the image gradient at the pixel point (x, y), and ω(x, y) is the sampling weight.

[0017] As a preferred embodiment of the method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition according to the present invention, obtaining the RGB corrected image comprises:

[0018] Calculating the weighted average values of the nine equal small areas according to the sampling weights to obtain the measured RGB mean value of the standard whiteboard area;

[0019] Calculate the correction coefficients of the RGB three channels respectively according to the preset reflection value of the standard whiteboard area;

[0020] A correction mapping function is constructed, and the RGB three-channel value of each pixel point of the RGB image is corrected by the nonlinear correction mapping function to generate the RGB corrected image.

[0021] As a preferred embodiment of the method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition according to the present invention, the calculation of the measured RGB mean value is shown in the following formula:

[0022]

[0023] Among them, I (RGB) (x, y) is the RGB channel value at the pixel point (x, y), V (RGB) is the measured RGB mean, S is the sampling area;

[0024] The calculation of the correction coefficient is shown below:

[0025]

[0026] Among them, β is the correction compensation coefficient, σ (RGB) is the standard deviation of the corresponding channel, κ (RGB) is the correction factor;

[0027] The nonlinear correction mapping function is expressed as follows:

[0028]

[0029] Among them, γ is the nonlinear adjustment coefficient, x1 is the original RGB channel value, M (RGB) (x1) is the nonlinear correction mapping function.

[0030] As a preferred embodiment of the method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition according to the present invention, the double Gaussian blur algorithm includes a first Gaussian blur kernel function and a second adaptive Gaussian blur kernel function;

[0031] The first-level Gaussian blur kernel function is expressed as follows:

[0032]

[0033] Among them, σ1 is the standard deviation, G1(x,y) is the first Gaussian blur kernel function;

[0034] The second adaptive Gaussian blur kernel function is expressed as follows:

[0035]

[0036] Among them, σ2(x,y) is the adaptive standard deviation, G2(x,y) is the second adaptive Gaussian blur kernel function, and the calculation formula is:

[0037]

[0038] Among them, k1 is the benchmark coefficient, k2 is the gradient influence factor, is the edge gradient value of the effective detection area.

[0039] As a preferred embodiment of the method for colorimetric detection of Naphthol AS-PH based on image recognition according to the present invention, wherein: the target detection area is determined according to a sub-region stability evaluation index;

[0040] The stability evaluation indicators include:

[0041] The RGB mean difference δ between the sub-region and its eight adjacent sub-regions i,j , the RGB standard deviation of the sub-region itself σ i,j (R, G, B), the normalized distance d from the sub-region to the center of the effective detection area i,j And the entropy value H of the pixel value in the sub-area i,j ;

[0042] Sort all sub-regions according to the comprehensive evaluation index, and select the sub-region with the best evaluation index and located in the center of the detection area as the target detection area, where the center area is defined as the area with a distance of not less than N / 4 to the edge of the detection area;

[0043] The value of N is dynamically determined by the area S of the effective detection area, and the calculation formula is:

[0044] As a preferred embodiment of the method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition according to the present invention, the Naphthol AS-PH concentration-RGB mapping model includes a primary mapping function and a refined mapping function;

[0045] The primary mapping function divides the entire concentration detection range into multiple subintervals, each subinterval corresponding to a local linear mapping relationship. For an input RGB feature value, the concentration subinterval to which it belongs is determined by calculating the minimum color difference distance between the input RGB feature value and a pre-stored standard color card RGB feature library. After the subinterval is determined, the standard concentration values and RGB feature values corresponding to the two ends of the interval are extracted, and a rough concentration estimate is obtained by linear interpolation.

[0046] The fine mapping function is based on the rough concentration estimate, with the concentration value obtained by the primary mapping as the center, and selects multiple adjacent standard points in the standard concentration sequence, and assigns different weights to these standard points; then, a local regression equation is established using the weighted standard points. Based on the regression equation, the regression parameters are continuously adjusted through multiple rounds of calculation until the difference between two adjacent calculation results is less than a preset threshold or the maximum number of iterations is reached, and the fine concentration value is obtained; the weight is determined by the RGB feature similarity between the point and the point to be measured.

[0047] The higher the similarity, the greater the weight.

[0048] As a preferred embodiment of the method for detecting the colorimetric value of Naphthol AS-PH based on image recognition according to the present invention, obtaining the concentration value comprises:

[0049] Calculate the multi-scale RGB feature vector of the target detection area and perform feature fusion;

[0050] Determine the rough concentration range using the primary mapping function;

[0051] Select adjacent standard points within the range to establish a local mapping relationship;

[0052] applying a fine mapping function to calculate the concentration value;

[0053] Performing reliability assessment on the concentration value;

[0054] The reliability assessment includes:

[0055] The coefficient of variation of the RGB values of the target detection area is less than 3%;

[0056] The correlation coefficient of local mapping is not less than 0.98;

[0057] The deviation between the calculated result and the adjacent standard concentration point does not exceed the allowable range;

[0058] The reliability assessment of the concentration value must meet the above reliability requirements at the same time, otherwise the resampling mechanism will be triggered; when three consecutive calculation results fail the reliability verification, a measurement abnormality will be reported.

[0059] In a second aspect, an embodiment of the present invention provides a system for detecting the colorimetric properties of Naphthol AS-PH based on image recognition, comprising:

[0060] An acquisition module is used to place a naphthol AS-PH test paper to be tested on a standard white board and acquire an RGB image of the naphthol AS-PH test paper through a camera;

[0061] A correction module is configured to perform grayscale correction on the RGB image to obtain a corrected RGB image; the correction uses a preset reflectance value of a standard whiteboard area as a reference; the standard whiteboard area is a rectangular area at a preset distance from the edge of the Naphthol AS-PH test paper; and an adaptive sampling method is used in the rectangular area;

[0062] An effective detection module is used to extract the effective detection area of the Naphthol AS-PH test paper from the RGB corrected image and eliminate edge noise of the effective detection area by a double Gaussian blur algorithm;

[0063] A target detection module is used to divide the effective detection area into multiple sub-areas of equal area, calculate the RGB mean of each sub-area, and select the central sub-area with the most stable RGB mean as the target detection area;

[0064] The concentration calculation module is used to obtain the concentration value of the naphthol AS-PH to be tested according to the RGB value of the target detection area in combination with a pre-established naphthol AS-PH concentration-RGB mapping model.

[0065] The beneficial effect of the present invention is to achieve high-precision and high-reliability quantitative detection of phenol AS-PH test paper. Its core advantage lies in the use of technologies such as standard whiteboard calibration, adaptive sampling, dual Gaussian blur denoising, sub-region stability evaluation, and a two-level concentration mapping model, which effectively overcome the problems of image noise, color instability, and measurement error existing in traditional detection methods. This method not only significantly improves measurement accuracy, controlling the relative deviation of different concentration ranges to between ±4% and 12%, but also establishes a strict result verification mechanism. When the measurement results do not meet the reliability requirements, it can automatically trigger resampling, thereby ensuring the accuracy and reliability of the test results. It has strong practical value and promotion significance. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive effort. Among them:

[0067] Figure 1 The figure is a flow chart of a method for colorimetric detection of naphthol AS-PH based on image recognition. DETAILED DESCRIPTION

[0068] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, the following detailed description of the specific embodiments of the present invention is given in conjunction with the accompanying drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in this field without creative work should fall within the scope of protection of the present invention.

[0069] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0070] Secondly, the term "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in various places throughout this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive of other embodiments.

[0071] The present invention is described in detail with reference to schematic diagrams. For ease of illustration, cross-sectional views of device structures may be partially enlarged and not to scale when describing embodiments of the present invention. Furthermore, the schematic diagrams are merely illustrative and should not limit the scope of the present invention. Furthermore, in actual production, the three-dimensional dimensions of length, width, and depth should be included.

[0072] In the description of the present invention, it should be noted that the terms "upper, lower, inner, and outer" and other references to orientations or positional relationships are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first, second, or third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0073] In this disclosure, unless otherwise specified or limited, the terms "mounted," "connected," and "connected" should be interpreted broadly. For example, they may refer to fixed, removable, or integral connections. They may also refer to mechanical, electrical, or direct connections, indirect connections through an intermediary, or internal communication between two components. Those skilled in the art will understand the specific meanings of these terms in this disclosure.

[0074] Example 1

[0075] Reference Figure 1, which is the first embodiment of the present invention, provides a method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition, comprising:

[0076] S1: placing a naphthol AS-PH test paper to be tested on a standard white board with a preset reflectivity, and capturing an RGB image of the naphthol AS-PH test paper using a camera;

[0077] A naphthol AS-PH test paper to be tested is placed flatly in the center of a detection area of a standard whiteboard with a preset reflectivity of 90%. The standard whiteboard is made of polytetrafluoroethylene and has no scratches on its surface. The side length of the standard whiteboard is 20 cm. A 2-megapixel camera is vertically set 30 cm away from the standard whiteboard. The aperture value of the camera is set to F2.8, and the field of view angle of the camera is set to 45 degrees. Under illumination of a D65 standard light source of 1000 lux, an RGB image of the naphthol AS-PH test paper is captured by the camera.

[0078] S2: performing grayscale correction on the RGB image, using a preset reflectivity value of a standard white plate as a reference, to obtain a corrected RGB image;

[0079] The RGB three-channel values of the standard whiteboard area in the RGB image were sampled and analyzed, wherein the standard whiteboard area was selected as a rectangular area 5 cm outside the edge of the Naphthol AS-PH test paper, recorded as the sampling area S, and the side length of the rectangular area was 10 cm; a nine-point sampling method was used within the rectangular area to divide the rectangular area into nine equal small areas, and RGB values were sampled at the center of each small area; different weight coefficients were set for the RGB values of the nine sampling points, i.e., adaptive weighted sampling, and the calculation formula of the sampling weight is as follows:

[0080]

[0081] Among them, x0 represents the coordinate value of the center point of the sampling area in the horizontal direction of the image, y0 represents the coordinate value of the center point of the sampling area in the vertical direction of the image, x represents the coordinate value of the pixel point in the horizontal direction of the image, y represents the coordinate value of the pixel point in the vertical direction of the image, σ is the sampling radius parameter, which is 1 / 4 of the side length of the sampling area, and α is the gradient weight coefficient, which is 0.5. is the image gradient at the pixel point (x, y).

[0082] Calculate the weighted average of the three RGB channels of the nine sampling points to obtain the measured RGB mean value of the standard whiteboard area, that is:

[0083]

[0084] Among them, I(RGB) (x,y) is the RGB channel value at the pixel point (x,y).

[0085] Based on the preset reflectivity value of 90% of the standard whiteboard, the theoretical whiteboard RGB value is set to (230, 230, 230), and the correction coefficients of the three RGB channels are calculated respectively. The correction coefficients are equal to the ratio of the theoretical RGB value to the measured RGB mean value, that is:

[0086]

[0087] Among them, β is the correction compensation coefficient, which is 0.15, σ (RGB) is the standard deviation of the corresponding channel.

[0088] Furthermore, a nonlinear correction mapping function is constructed:

[0089]

[0090] Among them, γ is the nonlinear adjustment coefficient, which is 0.1, x1 is the original RGB channel value, M (RGB) (x) is the nonlinear correction mapping function.

[0091] Correct the RGB three-channel value of each pixel point of the RGB image through the nonlinear correction mapping function to generate the RGB corrected image:

[0092] I′ (RGB) (x,y)=M (RGB) (I (RGB) (x,y))

[0093] Among them, I′ (RGB) (x,y) is the RGB corrected image.

[0094] By sampling and testing the whiteboard area of the RGB correction image, the standard deviation of the RGB three-channel values must be less than 3 gray levels, and the deviation between the average value and the theoretical value must not exceed 1%.

[0095] S3: extracting the effective detection area of the Naphthol AS-PH test paper from the RGB corrected image, and eliminating edge noise of the effective detection area by a Gaussian blur algorithm;

[0096] The contour of the Naphthol AS-PH test paper was extracted from the RGB corrected image using an adaptive threshold segmentation algorithm, and the contour was shrunk inward by 8 pixels as the effective detection area R of the Naphthol AS-PH test paper. A double adaptive Gaussian blur process was applied to the effective detection area R, and the first Gaussian blur kernel function G1(x, y) was defined as:

[0097]

[0098] Among them, σ1 is the standard deviation, the initial value is set to 1.5, and the kernel size is 7×7 pixels;

[0099] Calculate the edge gradient value of the effective detection area

[0100]

[0101] in, and Calculated by 3×3 pixel Sobel operator.

[0102] The second adaptive Gaussian blur kernel function G2(x,y) is defined as:

[0103]

[0104] Among them, σ2(x,y) is the adaptive standard deviation, and the calculation formula is:

[0105]

[0106] Among them, k1 is the benchmark coefficient, which is 2.0, and k2 is the gradient influence factor, which is 0.1. is the edge gradient value of the effective detection area.

[0107] A weight decay model is established based on the distance from the effective detection area to the edge. The weight decay model uses an exponentially decreasing function, with a weight of 0.3 at the edge and 0.7 at the center, and is defined as:

[0108] W(x,y)=0.7×exp(-λd(x,y))+0.3

[0109] Where d(x,y) is the minimum normalized distance from the pixel point (x,y) to the edge of the effective detection area, and λ is the attenuation coefficient, which is 3.0.

[0110] Finally, the double Gaussian blur results are fused through the weight decay model to obtain the effective detection area after noise reduction:

[0111]

[0112] S4: Divide the effective detection area into multiple sub-areas of equal area, calculate the RGB mean of each sub-area, and select the central sub-area with the most stable RGB mean as the target detection area;

[0113] The effective detection area is divided into N×N equal-area sub-areas, where the value of N is dynamically determined by the area S of the effective detection area. The calculation formula is: Ensure that the area of each sub-region is not less than 100 square pixels; for each sub-region S i,j (i,j∈[1,N] calculate the mean of RGB three channels μ i,j (R,G,B)(i,j∈[1,N]), and calculate the standard deviation σ of the RGB values in each sub-region at the same time i,j (R,G,B).

[0114] Establish sub-region stability evaluation index φ i,j The stability evaluation index comprehensively considers the following factors: First, the RGB mean difference δ between the sub-region and its eight adjacent sub-regions i,j ; Second, the RGB standard deviation σ of the sub-region itself i,j (R, G, B); Third, the normalized distance d from the sub-region to the center of the effective detection area i,j ; Fourth, the entropy value H of the pixel value in the sub-region i,j .

[0115] Specifically, the stability evaluation index φ i,j The calculation process is as follows: first calculate the RGB mean difference between the sub-region and its adjacent sub-regions:

[0116] For each subregion, a 5×5 pixel sliding window was set, and the local variance was calculated pixel by pixel. The region with the smallest local variance was selected as the feature region of the subregion. The RGB mean of the feature region was calculated and used as the representative value of the subregion. The temporal stability analysis of the representative value was performed by continuously collecting 5 frames of images and calculating the temporal variance of the representative value. The spatial stability and temporal stability indicators were weighted and fused to obtain a comprehensive evaluation index.

[0117] All sub-regions are sorted according to the comprehensive evaluation index, and the sub-region with the best evaluation index and located in the center of the detection area is selected as the target detection area. The center area is defined as the area range with a distance to the edge of the detection area not less than N / 4.

[0118] After the target detection area is determined, its boundary is optimized: it is expanded outward by 2 pixels and the contour smoothness judgment criterion is used. If the curvature change of the boundary contour after expansion exceeds the preset threshold, the expansion in that direction is retracted; the integrity of the final target detection area is verified, requiring that the area of the target detection area is not less than 4% of the original effective detection area, and the aspect ratio is between 0.8-1.2.

[0119] S5: According to the RGB value of the target detection area, combined with a pre-established Naphthol AS-PH concentration-RGB mapping model, the concentration value of the Naphthol AS-PH to be measured is obtained.

[0120] Multi-scale RGB feature extraction is performed on the target detection area. First, three sampling grids of different scales are set in the target detection area, namely 4×4, 8×8 and 16×16 pixels, and RGB values are sampled for each grid. An adaptive weighting method is used to fuse the sampling results of different scales, and the weighting coefficient is inversely proportional to the variance of the sampling grid. The fused RGB feature vector is normalized to obtain the standardized RGB feature value ξ(R, G, B).

[0121] A two-level AS-PH concentration mapping model was established, which includes the following components: first, a primary mapping function M1 based on polynomial fitting was established, which mapped the RGB feature values to a rough concentration range; second, a fine mapping function M2 based on local linear regression was constructed, which accurately calculated the concentration values based on the primary mapping.

[0122] Specifically, the primary mapping function first divides the entire concentration detection range into multiple subintervals, each corresponding to a local linear mapping relationship. For an input RGB eigenvalue, the concentration subinterval to which it belongs is determined by calculating the minimum color difference between the input RGB eigenvalue and a pre-stored RGB feature library of standard color cards. After determining the subinterval, the system extracts the standard concentration values and RGB eigenvalues corresponding to the two ends of the interval and derives a rough concentration estimate through linear interpolation.

[0123] The refined mapping function is based on the rough concentration estimate. Centered around the concentration value obtained from the primary mapping, it selects multiple nearby standard points (usually five points) in the standard concentration sequence. These standard points are assigned different weights, determined by the similarity between the RGB features of the point and the point being measured; the higher the similarity, the greater the weight. A local regression equation is then established using these weighted standard points. Based on this regression equation, the regression parameters are continuously adjusted through multiple rounds of calculation until the difference between two consecutive calculation results is less than a preset threshold or the maximum number of iterations is reached. Finally, the calculated refined concentration value is validated.

[0124] Specifically, the calculation process of the concentration value C of the naphthol AS-PH to be measured includes:

[0125] Calculate the multi-scale RGB feature vector of the target detection area and perform feature fusion;

[0126] Determine the rough concentration range using the primary mapping function;

[0127] Select adjacent standard points within the range to establish a local mapping relationship;

[0128] Apply the fine mapping function to calculate the final concentration value;

[0129] Conduct reliability assessment on the calculation results.

[0130] To ensure the reliability of the measurement results, the following verification mechanism is set up:

[0131] The coefficient of variation of the RGB value of the target detection area is required to be less than 3%;

[0132] The correlation coefficient of local mapping is not less than 0.98;

[0133] The deviation between the calculated result and the adjacent standard concentration points shall not exceed the allowable range.

[0134] The concentration value calculation results must meet the above reliability requirements at the same time, otherwise the resampling mechanism will be triggered. If the calculation results fail the reliability verification for three consecutive times, the system will report a measurement anomaly.

[0135] It should be noted that the deviation of the calculation results is limited by a multi-level constraint mechanism:

[0136] Set different tolerance ratios for different concentration ranges:

[0137] When the standard concentration is ≤0.5 mg / L, the allowable relative deviation ε1 shall not exceed ±12%.

[0138] When 0.5 mg / L<standard concentration≤2.0 mg / L, the allowable relative deviation ε2 shall not exceed ±8%.

[0139] When 2.0 mg / L<standard concentration≤5.0 mg / L, the allowable relative deviation ε3 shall not exceed ±6%.

[0140] When the standard concentration is >5.0 mg / L, the relative deviation ε4 is allowed to not exceed ±4%.

[0141] Furthermore, this embodiment also provides a system for detecting the colorimetric properties of naphthol AS-PH based on image recognition, comprising:

[0142] An acquisition module is used to place a naphthol AS-PH test paper to be tested on a standard white board and acquire an RGB image of the naphthol AS-PH test paper through a camera;

[0143] A correction module is configured to perform grayscale correction on the RGB image to obtain a corrected RGB image; the correction uses a preset reflectance value of a standard whiteboard area as a reference; the standard whiteboard area is a rectangular area at a preset distance from the edge of the Naphthol AS-PH test paper; and an adaptive sampling method is used in the rectangular area;

[0144] An effective detection module is used to extract the effective detection area of the Naphthol AS-PH test paper from the RGB corrected image and eliminate edge noise of the effective detection area by a double Gaussian blur algorithm;

[0145] A target detection module is used to divide the effective detection area into multiple sub-areas of equal area, calculate the RGB mean of each sub-area, and select the central sub-area with the most stable RGB mean as the target detection area;

[0146] The concentration calculation module is used to obtain the concentration value of the naphthol AS-PH to be tested according to the RGB value of the target detection area in combination with a pre-established naphthol AS-PH concentration-RGB mapping model.

[0147] This embodiment also provides a computer device suitable for the case of the image recognition-based colorimetric detection method of naphthol AS-PH, comprising a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the image recognition-based colorimetric detection method of naphthol AS-PH proposed in the above embodiment.

[0148] The computer device may be a terminal, comprising a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse.

[0149] This embodiment further provides a storage medium storing a computer program, which, when executed by a processor, implements the method for detecting the colorimetry of naphthol AS-PH based on image recognition as proposed in the above embodiment.

[0150] The storage medium proposed in this embodiment and the data storage method proposed in the above embodiment belong to the same inventive concept. Technical details not fully described in this embodiment can be found in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0151] Example 2

[0152] This is the second embodiment of the present invention, which provides a method for detecting the colorimetric properties of naphthol AS-PH based on image recognition. In order to verify the beneficial effects of the present invention, a scientific demonstration is carried out through simulation experiments.

[0153] To verify the reliability and accuracy of the Naphthol AS-PH test paper concentration detection method, a systematic experimental study was conducted under laboratory conditions. The experiment was conducted in the standard laboratory of the Environmental Science Research Center. High-precision optical systems and professional image processing equipment were used to strictly control the experimental environment and measurement conditions. The experimental equipment included a 2-megapixel industrial-grade CCD camera (model: MV-CA020-10GC), a D65 standard light source (model: TCSS-D65-1000), a polytetrafluoroethylene standard white plate (90% reflectivity), and a high-precision Naphthol AS-PH standard solution.

[0154] Before the experiment, the experimental environment was first standardized. A standard polytetrafluoroethylene white board with a size of 20cm×20cm was selected to ensure that there were no scratches or abnormal reflections on its surface. The camera was installed 30cm away from the white board, placed vertically, with the aperture value set to F2.8 and the field of view angle of 45 degrees. The laboratory light intensity was precisely controlled at 1000lux, and the D65 standard light source was used to ensure the consistency of the spectral distribution. Prepared different concentrations of phenol AS-PH test paper, covering a concentration range of 0.1mg / L to 10mg / L, and made 5 parallel samples for each concentration gradient.

[0155] During the image acquisition process, standardized operations were strictly performed in accordance with the invented method. First, the color phenol AS-PH test paper was placed flat in the center of a standard whiteboard, ensuring that the edge of the test paper was kept 5 cm away from the edge of the whiteboard. A 2-megapixel camera was used for RGB image acquisition, and multiple image processing algorithms were performed. In the image correction stage, a 10 cm × 10 cm rectangular area 5 cm away from the edge of the test paper was selected as the sampling area, and a nine-point adaptive weighted sampling method was used, and image correction was performed through a nonlinear correction mapping function. During the image processing process, focus was placed on the whiteboard area of the RGB corrected image, requiring that the standard deviation of the RGB three-channel values be less than 3 gray levels, and the average value deviate from the theoretical value by no more than 1%.

[0156] The experimental data are recorded in Table 1 below:

[0157] Table 1. Experimental data of phenol AS-PH concentration detection.

[0158]

[0159]

[0160] In-depth analysis of experimental data demonstrated the significant advantages of this inventive method for detecting AS-PH concentrations. First, within the concentration range of 0.1 mg / L to 10 mg / L, the actual measured values were highly consistent with the certified values, with a relative error within ±2.6%, significantly exceeding the error level of traditional detection methods. Second, the relative error showed a decreasing trend with increasing concentration, demonstrating the method's good linear correlation and stability.

[0161] The stability evaluation index gradually increased from 0.92 to 0.98, fully verifying the effectiveness of multi-scale RGB feature extraction and the two-level concentration mapping model. Compared with traditional single linear mapping methods, this method significantly improves the accuracy of concentration detection through the combination of primary polynomial fitting and local linear regression. In particular, in the low concentration range (≤0.5 mg / L), the relative error is controlled within 2.6%, a performance indicator that is at the leading level among similar technologies.

[0162] The trend in RGB mean values also confirms the scientific validity of the detection method. As concentration increases, RGB values exhibit a linear decrease, a regularity that provides an important foundation for establishing a reliable concentration-RGB mapping model. Through adaptive weighted sampling and nonlinear correction mapping, the effects of image noise and illumination fluctuations are successfully eliminated, ensuring the accuracy and repeatability of measurement results.

[0163] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition, characterized in that: include: The naphthol AS-PH test paper to be tested is placed on a standard white board, and an RGB image of the naphthol AS-PH test paper is captured by a camera; Grayscale correction is performed on the RGB image to obtain a corrected RGB image; the correction uses a preset reflectance value of a standard white plate area as a reference; the standard white plate area is a rectangular area at a preset distance from the edge of the naphthol AS-PH test paper; and an adaptive sampling method is used in the rectangular area; Extracting the effective detection area of the Naphthol AS-PH test paper from the RGB corrected image, and eliminating edge noise of the effective detection area by a double Gaussian blur algorithm; Divide the effective detection area into multiple sub-areas of equal area, calculate the RGB mean of each sub-area, and select the central sub-area with the most stable RGB mean as the target detection area; According to the RGB value of the target detection area, combined with the pre-established Naphthol AS-PH concentration-RGB mapping model, the concentration value of the Naphthol AS-PH to be measured is obtained.

2. The method for detecting the colorimetric activity of Naphthol AS-PH based on image recognition according to claim 1, wherein: The adaptive sampling method includes dividing the rectangular area into nine equal small areas and adopting adaptive weighted sampling at the center point of each small area; The calculation of the sampling weight of the adaptive weighted sampling is shown in the following formula: Among them, x0 represents the coordinate value of the center point of the sampling area in the horizontal direction of the image, y0 represents the coordinate value of the center point of the sampling area in the vertical direction of the image, x represents the coordinate value of the pixel point in the horizontal direction of the image, y represents the coordinate value of the pixel point in the vertical direction of the image, σ is the sampling radius parameter, α is the gradient weight coefficient, is the image gradient at the pixel point (x, y), and ω(x, y) is the sampling weight.

3. The method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition as claimed in claim 2, wherein: Obtaining the RGB corrected image includes: Calculating the weighted average values of the nine equal small areas according to the sampling weights to obtain the measured RGB mean value of the standard whiteboard area; Calculate the correction coefficients of the RGB three channels respectively according to the preset reflection value of the standard whiteboard area; A correction mapping function is constructed, and the values of the RGB three channels of each pixel point of the RGB image are corrected by the nonlinear correction mapping function to generate the RGB corrected image.

4. The method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition as claimed in claim 3, wherein: The calculation of the measured RGB mean is shown in the following formula: Among them, I (RGB) (x, y) is the RGB channel value at the pixel point (x, y), V (RGB) is the measured RGB mean, S is the sampling area; The calculation of the correction coefficient is shown below: Among them, β is the correction compensation coefficient, σ (RGB) is the standard deviation of the corresponding channel, κ (RGB) is the correction factor; The nonlinear correction mapping function is expressed as follows: Among them, γ is the nonlinear adjustment coefficient, x1 is the original RGB channel value, M (RGB) (x1) is the nonlinear correction mapping function.

5. The method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition as claimed in claim 4, wherein: The dual Gaussian blur algorithm includes a first Gaussian blur kernel function and a second adaptive Gaussian blur kernel function; The first-level Gaussian blur kernel function is expressed as follows: Among them, σ1 is the standard deviation, G1(x,y) is the first Gaussian blur kernel function; The second adaptive Gaussian blur kernel function is expressed as follows: Among them, σ2(x,y) is the adaptive standard deviation, G2(x,y) is the second adaptive Gaussian blur kernel function, and the calculation formula is: Among them, k1 is the benchmark coefficient, k2 is the gradient influence factor, is the edge gradient value of the effective detection area.

6. The method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition as claimed in claim 5, wherein: The target detection area is determined according to the sub-region stability evaluation index; The stability evaluation indicators include: The RGB mean difference δ between the sub-region and its eight adjacent sub-regions i,j , the RGB standard deviation of the sub-region itself σ i,j (R, G, B), the normalized distance d from the sub-region to the center of the effective detection area i,j And the entropy value H of the pixel value in the sub-area i,j ; Sort all sub-regions according to the comprehensive evaluation index, and select the sub-region with the best evaluation index and located in the center of the detection area as the target detection area. The center area is defined as the area with a distance of not less than N / 4 to the edge of the detection area; The value of N is dynamically determined by the area S of the effective detection area, and the calculation formula is:

7. The method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition according to claim 6, wherein: The naphthol AS-PH concentration-RGB mapping model includes a primary mapping function and a fine mapping function; The primary mapping function divides the entire concentration detection range into multiple subintervals, each subinterval corresponding to a local linear mapping relationship. For an input RGB feature value, the concentration subinterval to which it belongs is determined by calculating the minimum color difference distance between the input RGB feature value and a pre-stored standard color card RGB feature library. After the subinterval is determined, the standard concentration values and RGB feature values corresponding to the two ends of the interval are extracted, and a rough concentration estimate is obtained by linear interpolation. The fine mapping function is based on the rough concentration estimate, with the concentration value obtained by the primary mapping as the center. Multiple adjacent standard points are selected in the standard concentration sequence and different weights are assigned to these standard points. The weighted standard points are then used to establish a local regression equation. Based on the regression equation, the regression parameters are continuously adjusted through multiple rounds of calculation until the difference between two adjacent calculation results is less than a preset threshold or the maximum number of iterations is reached, thereby obtaining a fine concentration value. The weight is determined by the RGB feature similarity between the point and the point to be measured. The higher the similarity, the greater the weight.

8. The method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition according to claim 7, wherein: Obtaining the concentration value includes: Calculate the multi-scale RGB feature vector of the target detection area and perform feature fusion; Determine the rough concentration range using the primary mapping function; Select adjacent standard points within the range to establish a local mapping relationship; applying a fine mapping function to calculate the concentration value; Performing reliability assessment on the concentration value; The reliability assessment includes: The coefficient of variation of the RGB values of the target detection area is less than 3%; The correlation coefficient of local mapping is not less than 0.98; The deviation between the calculated result and the adjacent standard concentration point does not exceed the allowable range; The reliability assessment of the concentration value must meet the above reliability requirements at the same time, otherwise the resampling mechanism will be triggered; when three consecutive calculation results fail the reliability verification, a measurement abnormality will be reported.

9. A system for detecting the colorimetric properties of Naphthol AS-PH based on image recognition, which implements the method for detecting the colorimetric properties of Naphthol AS-PH based on image recognition according to any one of claims 1 to 8, characterized in that: include: An acquisition module is used to place a naphthol AS-PH test paper to be tested on a standard white board and acquire an RGB image of the naphthol AS-PH test paper through a camera; A correction module is configured to perform grayscale correction on the RGB image to obtain a corrected RGB image; the correction uses a preset reflectance value of a standard white plate area as a reference; the standard white plate area is a rectangular area at a preset distance from the edge of the Naphthol AS-PH test paper; and an adaptive sampling method is used in the rectangular area; An effective detection module is used to extract the effective detection area of the Naphthol AS-PH test paper from the RGB corrected image and eliminate edge noise of the effective detection area by a double Gaussian blur algorithm; A target detection module is used to divide the effective detection area into multiple sub-areas of equal area, calculate the RGB mean of each sub-area, and select the central sub-area with the most stable RGB mean as the target detection area; The concentration calculation module is used to obtain the concentration value of the naphthol AS-PH to be tested according to the RGB value of the target detection area in combination with a pre-established naphthol AS-PH concentration-RGB mapping model.

Citation Information

Patent Citations

  • Circuit board golden finger area defect detection method, system and device and medium

    CN114862817A

  • Black tea fermentation state intelligent identification method, apparatus and device, and storage medium

    CN117496254A