Intelligent detection method for concentration of chlorine test paper based on machine vision

By employing a machine vision-based detection method, utilizing the four-point positioning difference method and an improved YOLOv5s combined with AF-FPN, colorimetric regions are identified and pixel values ​​are calculated. This solves the problems of low efficiency and low accuracy in traditional methods, achieving efficient and accurate detection of chlorine test paper concentration, suitable for rapid detection by customs and other units.

CN115830000BActive Publication Date: 2025-11-07FUJIAN FUJITSU COMM SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211657066.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-22
Publication Date
2025-11-07
Estimated Expiration
2042-12-22

AI Technical Summary

Technical Problem

In existing technologies, the method of observing the concentration of chlorine test strips by human eyes is inefficient and subjective, while traditional image processing methods have low accuracy under uneven lighting conditions, making it difficult to meet the efficient and accurate quarantine needs of customs and other units.

Method used

A machine vision-based detection method is adopted, which combines four-point positioning difference method and improved YOLOv5s with AF-FPN to identify colorimetric areas, obtain R channel pixel values ​​and calculate the mean value, and compare with a standard colorimetric card to reduce errors caused by uneven lighting and achieve efficient and accurate concentration detection.

Benefits of technology

It achieves efficient and accurate chlorine test strip concentration detection, reduces manpower and material resources, improves quarantine efficiency, and is suitable for rapid testing by customs and other units.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115830000B_ABST
    Figure CN115830000B_ABST
Patent Text Reader

Abstract

The application discloses a method for intelligently detecting the concentration of chlorine test paper based on machine vision, which uses artificial intelligence technology to obtain the area in the picture that confirms the concentration of chlorine test paper, combines image processing technology to obtain the pixel value of the specified area, compares the pixel value of the standard color card with the test paper, and finally obtains the concentration value of the chlorine test paper, that is, the concentration of the quarantine article. The application can efficiently and accurately detect the concentration range of hypochlorite, promotes the transformation of the work from manual quarantine to machine quarantine, saves the manpower and material resources of customs quarantine and other organizations, greatly improves the quarantine efficiency while ensuring the accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of quarantine inspection, and particularly relates to a method for intelligently detecting concentration of chlorine test paper based on machine vision. BACKGROUND

[0002] The chlorine test paper can detect the concentration of hypochlorite in chemical substances, and can be used for rapidly detecting the concentration of hypochlorite in samples such as food and beverage, dairy products, agricultural and sideline products, and industrial water treatment. The method has a wide application in customs quarantine. However, the concentration of hypochlorite is finally determined by comparing the chlorine test paper with a standard color card to determine the concentration range of hypochlorite.

[0003] The simplest method is to observe by human eyes to determine the concentration range of the chlorine test paper. However, for units such as quarantine authorities, thousands of quarantine samples will be faced every day, and the observation by human eyes not only consumes manpower, but also has low detection efficiency and subjectivity.

[0004] With the development of image processing technology, researchers have tried to complete the comparison between the chlorine test paper and the standard color card by using traditional image processing methods to determine the concentration range of hypochlorite. This method first binarizes the picture, then determines the position of the chlorine test paper in the picture by using contour extraction technology, then obtains the pixel points in the area where the chlorine test paper is located, and calculates the average value of the R channel of the pixel points in the area, and compares it with the average value of the R channel of the pixel points in each concentration range of the standard color card, and takes the average value of the R channel of the chlorine test paper as the final concentration of the chlorine test paper. Although the traditional image processing technology can replace the human eyes to compare with the color card, it has a high requirement for the quality of the picture, and in the case of insufficient or uneven light, the method will cause a huge error.

[0005] In summary, the method based on human observation is simple and direct, but the observation by human eyes consumes manpower, and has low detection efficiency and subjectivity. The method based on traditional image processing has high efficiency, but low accuracy. SUMMARY

[0006] The present application aims to provide a method for intelligently detecting concentration of chlorine test paper based on machine vision, which has the characteristics of strong robustness, high efficiency and accuracy.

[0007] The technical solution adopted by the present application is as follows:

[0008] The method for intelligently detecting concentration of chlorine test paper based on machine vision comprises the following steps:

[0009] Step 1, automatic acquisition of pictures: a standard color card and a chlorine test paper are placed in the same rectangular frame for shooting to obtain an acquisition picture, which is summarized to an image acquisition system;

[0010] Step 2, detection target recognition: the quarantine colorimetric region and the standard colorimetric card are detected to identify the respective detection regions;

[0011] Step 3, acquisition of colorimetric regions: a four-point positioning difference method is used to extract the colorimetric regions and the standard colorimetric card regions, and the detection regions, wherein the four-point positioning difference method is defined as follows:

[0012]

[0013] wherein i represents a positive integer, used for marking the position relationship of (X i ,Y i ) and (X i+1 ,Y i+1 ) on a two-dimensional image, (X i ,Y i ) represents the updated left lower vertex coordinates of the identified detection region, and (X i+1 ,Y i+1 ) represents the updated right upper vertex coordinates of the identified detection region, and the two coordinates can obtain the detection region to be extracted.

[0014] Specifically, (X i ,Y i ) and (X i+1 ,Y i+1 ) represent the updated vertex coordinates of the identified detection region, including the colorimetric region in the picture of the chlorine test paper and the standard colorimetric card region of each concentration range, S = ΔX x ΔY, wherein According to the four-point difference method , a more accurate detection region is extracted to ensure the accuracy of subsequent colorimetric identification.

[0015] Step 4, acquisition of R channel pixel values of the quarantine region and the standard colorimetric card regions: an image color channel separation method is used to extract the R channel pixel value R TP of the colorimetric region of the chlorine test paper, and the R channel pixel value R Ci of each region of the standard colorimetric card, i = n, and n is the number of color types of the standard colorimetric card;

[0016] Step 5, calculate the average R channel pixel value of each region: obtain the m pixel values of the R channel of each region N according to the color channel separation method, transform the m pixel values of the R channel of each region N obtained to obtain F(R), and solve the R channel pixel value of the colorimetric region of the chlorine test paper and the R channel pixel value of each region of the standard colorimetric card according to F(R) to obtain the average R channel pixel value of the region to be detected and the average R channel pixel value of the colorimetric region of the standard colorimetric card The formula definition of the pixel value transformation F(R) is as follows:

[0017]

[0018] Wherein, m represents the m pixel blocks obtained, k is a positive integer from 0 to m, R k represents the pixel value of the kth pixel block.

[0019] Step 6, calculate the average R channel pixel value of each region: solve the chlorine test paper concentration of the chlorine test paper colorimetric region, and the discrimination method is as follows: let When ω ∈ [0, θ], it is determined that the chlorine test paper concentration ρ TP is consistent with the standard colorimetric card concentration , that is, the standard colorimetric card concentration is the chlorine test paper concentration ρ TP , wherein [0, θ] is the discrimination fault tolerance interval, and θ is the maximum fault tolerance, which is obtained from the sample prediction residual.

[0020] Further, the image acquisition system of step 1 performs preliminary audit on the collected pictures to determine whether the pictures are normal; if yes, then enter step 2; otherwise, reject the abnormal pictures and execute step 1.

[0021] Further, the judgment standard of the picture is: 1) two vertices are detected and are not diagonal points: it is judged that the picture does not conform to the specification; 2) the number of detected vertices is less than two: it is judged that the picture does not conform to the specification.

[0022] Further, in step 2, the improved YOLOv5s is used to detect the quarantine colorimetric region and the individual colorimetric region of the standard colorimetric card, and the AF-FPN is introduced to replace the FPN in the improved YOLOv5s.

[0023] Specifically, based on the improved YOLOv5s, hereinafter referred to as Improved YOLOv5s, the AF-FPN is introduced to replace the FPN in the original model, which improves the multi-scale target recognition ability of the model and effectively balances the recognition speed and accuracy.

[0024] Further, in step 3, five pixels are respectively expanded up, down, left and right from the midpoint of the diagonal line to form a 10*10 pixel block, and the average value of the pixel block is taken as the standard pixel value, so as to obtain accurate single pixel and reduce errors caused by picture reflection and the like.

[0025] Specifically, when obtaining the standard pixel value, the midpoint of the diagonal line is directly taken as the standard pixel value, and in the case of low picture quality, the standard pixel value may be inaccurate due to the shooting of the center point pixel caused by reflection and the like. It is preferable to expand five pixels up, down, left and right from the midpoint of the diagonal line to form a 10*10 pixel block, and the average value of the pixel block is taken as the standard pixel value, so as to reduce errors caused by picture reflection and the like.

[0026] The above technical scheme is adopted, the artificial intelligence technology is used to obtain the area for confirming the concentration of the chlorine test paper in the picture, the image processing technology is combined to obtain the pixel value of the specified area, the pixel value of the standard color card is compared with the pixel value of the test paper, and finally the concentration value of the chlorine test paper, i.e. the concentration of the quarantine article, is obtained. The concentration range of hypochlorite can be efficiently and accurately detected, the work is changed from manual quarantine to machine quarantine, the manpower and material resources of customs quarantine and the like are saved, the accuracy is ensured, and the quarantine efficiency is greatly improved. BRIEF DESCRIPTION OF DRAWINGS

[0027] The application will be further described in detail below in combination with the drawings and specific embodiments.

[0028] Figure 1 The figure is a flowchart of the method for intelligently detecting the concentration of the chlorine test paper based on machine vision. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application.

[0030] As shown in the drawings, Figure 1 The application discloses a method for intelligently detecting the concentration of a chlorine test paper based on machine vision, which comprises the following steps:

[0031] Step 1, automatic picture acquisition: a standard color card and a chlorine test paper are placed in the same rectangular frame for shooting to obtain an acquisition picture, which is summarized to an image acquisition system;

[0032] Step 2, detection target identification: a quarantine color area and a standard color area of the color card are detected to identify respective detection areas;

[0033] Step 3, obtaining the colorimetric region: the colorimetric region and the standard colorimetric card are extracted by using the four-point positioning difference method The definitions are as follows:

[0034]

[0035] wherein i represents a positive integer, used for marking the position relationship of (X i ,Y i ) and (X i+1 ,Y i+1 ) on the two-dimensional image, (X i ,Y i ) represents the updated left lower vertex coordinates of the identified detection region, and (X i+1 ,Y i+1 ) represents the updated right upper vertex coordinates of the identified detection region, and the two coordinates can obtain the detection region to be extracted.

[0036] Specifically, (X i ,Y i ) and (X i+1 ,Y i+1 ) represent the updated vertex coordinates of the identified detection region, including the colorimetric region in the picture of the chlorine test paper and the standard colorimetric card region of each concentration range, S = ΔX x ΔY, wherein, According to the four-point difference method A more accurate detection region is extracted to ensure the accuracy of subsequent colorimetric identification.

[0037] Step 4, obtaining the quarantine region and the standard colorimetric card region R channel pixel value: using the image color channel separation method to extract the R channel pixel value R TP of the colorimetric region of the chlorine test paper, and extracting the R channel pixel value i = n, n is the number of color types of the standard colorimetric card;

[0038] Step 5, calculating the R channel pixel mean value of each region: according to the color channel separation method, the m pixel values of the R channel of N regions are obtained, the m pixel values of the R channel of N regions are transformed to obtain F(R), and the R channel pixel mean value of the detection region is obtained by solving the R channel pixel value of the colorimetric region of the chlorine test paper and the R channel pixel value of each region of the standard colorimetric card according to F(R) and the R channel pixel mean value of the colorimetric region of the standard colorimetric card The formula definition of the pixel value transformation F(R) is as follows:

[0039]

[0040] wherein m represents the m pixel blocks obtained, k is a positive integer from 0 to m, R k represents the pixel value of the kth pixel block.

[0041] Step 6 calculates the average pixel value of each region R channel: for The chlorine test paper concentration of the colorimetric region is determined by the chlorine test paper colorimetric region, and the determination method is as follows: let When ω ∈ [0, θ], the chlorine test paper concentration ρ TP is consistent with the standard colorimetric card concentration , that is, the standard colorimetric card concentration is the chlorine test paper concentration ρ TP , wherein [0, θ] is the fault tolerance interval, and θ is the maximum fault tolerance, which is obtained from the sample prediction residual.

[0042] Further, the image acquisition system of step 1 performs preliminary audit on the collected pictures to determine whether the pictures are normal; if yes, then step 2 is entered; otherwise, the abnormal pictures are rejected and step 1 is executed.

[0043] Further, the judgment standard of the picture abnormality is: 1) two vertices are detected and are not diagonal points: it is judged that the picture does not conform to the specification; 2) the number of detected vertices is less than two: it is judged that the picture does not conform to the specification.

[0044] Further, in step 2, the improved YOLOv5s is used to detect the quarantine colorimetric region and the standard colorimetric card colorimetric region, and the AF-FPN is introduced to replace the FPN in the improved YOLOv5s.

[0045] Specifically, based on the improved YOLOv5s, hereinafter referred to as Improved YOLOv5s, the AF-FPN is introduced to replace the FPN in the original model, which improves the multi-scale target recognition ability of the model and effectively balances the recognition speed and accuracy.

[0046] Further, in step 3, by taking the diagonal midpoint and expanding five pixels up, down, left and right respectively to form a 10*10 pixel block, the average value of the pixel block is taken as the standard pixel value, so as to obtain accurate single pixel and reduce the error caused by picture reflection and the like.

[0047] Specifically, when obtaining the standard pixel value, the midpoint of the diagonal line is directly taken as the standard pixel value. In the case of low picture quality, the center pixel may be inaccurate due to reflection and other reasons. By taking the diagonal midpoint and expanding five pixels up, down, left and right respectively to form a 10*10 pixel block, the average value of the pixel block is taken as the standard pixel value, which can reduce the error caused by picture reflection and the like.

[0048] The present application adopts the above technical scheme, uses artificial intelligence technology to obtain the area of the test paper for measuring chlorine concentration in the picture, combines with image processing technology to obtain the pixel value of the specified area, compares the pixel value of the standard color card with the test paper, and finally obtains the concentration value of the test paper for measuring chlorine, that is, the concentration of the quarantine article. The present application can efficiently and accurately detect the concentration range of hypochlorite, promotes the transformation of this work from manual quarantine to machine quarantine, saves the manpower and material resources of customs quarantine and other institutions, greatly improves the efficiency of quarantine while ensuring the accuracy.

[0049] Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present application is not intended to limit the scope of the claimed application, but only represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

Claims

1. A method for intelligent detection of the concentration of chlorine test paper based on machine vision, characterized in that: It comprises the following steps: Step 1, automatic image acquisition: standard color cards and chlorine test paper are placed in the same rectangular frame for shooting to obtain collected images, which are summarized to an image acquisition system; Step 2, target detection and recognition: the quarantine colorimetric region and the standard colorimetric region are detected to identify their respective detection regions; Step 3, obtaining the colorimetric region: the colorimetric region and each colorimetric region of the standard colorimetric card, the detection region are extracted by using the four-point positioning difference method are defined as follows: wherein i represents a positive integer, used to mark the position relationship of (X i ,Y i ) and (X i+1 ,Y i+1 ) on a two-dimensional image, (X i ,Y i ) represents the updated left-bottom vertex coordinate of the identified detection region, and (X i+1 ,Y i+1 ) represents the updated right-top vertex coordinate of the identified detection region, and the two coordinates can obtain the detection region to be extracted; Step 4, obtaining the R channel pixel value of each area of the quarantine area and the standard color card: using the image color channel separation method to extract the R channel pixel value R of the colorimetric area of the chlorine test paper TP , and extracting the R channel pixel value R of each area of the standard color card Ci , i = n, n is the number of color types of the standard color card; Step 5, calculating the average pixel value of each region R channel: obtaining the m pixel values of the R channel of each region N according to the color channel separation method, transforming the m pixel values of the R channel of each region N obtained to obtain F(R), and solving the R channel pixel value of the colorimetric region of the test paper and the R channel pixel value of each region of the standard color card according to F(R) to obtain the average pixel value of the R channel of the region to be detected and the average pixel value of the R channel of the colorimetric region of the standard color card The formula of the pixel value transformation F(R) is defined as follows: wherein m represents the m pixel blocks obtained, k is a positive integer from 0 to m, R k represents the pixel value of the kth pixel block; Step 6 calculates the average value of each region R channel pixel: to and The chlorine test paper concentration of the colorimetric region is determined by the chlorine test paper, and the determination method is as follows: let When ω∈[0,θ], the chlorine test paper concentration ρ TP is consistent with the standard colorimetric card concentration , that is, the standard colorimetric card concentration is the chlorine test paper concentration ρ TP , wherein [0,θ] is the determination fault tolerance interval, and θ is the maximum fault tolerance, which is obtained from the sample prediction residual.

2. The method of claim 1, wherein the method is characterized by: Step 1: the image acquisition system preliminarily reviews the collected images to determine whether the images are normal; if yes, then go to step 2; otherwise, reject the abnormal images and execute step 1. The judgment criteria for image abnormality are: 1) if two vertices are detected and are not opposite vertices, then the image is judged to be non-compliant; 2) if the number of detected vertices is less than two, then the image is judged to be non-compliant. 3.The method of claim 2, wherein the method further comprises: In step 2, improved YOLOv5s is used to detect the quarantine colorimetric region and the standard colorimetric region, and AF-FPN is introduced to replace FPN in improved YOLOv5s. 4.The method of claim 1, wherein the method further comprises: In step 3, by taking the upper, lower, left and right of the midpoint of the diagonal and expanding five pixels respectively, a 10*10 pixel block is formed, and the average value of the pixel block is taken as the standard pixel value, so as to obtain accurate single pixel points and reduce errors caused by image reflection and the like. 5.The method of claim 1, wherein the method further comprises: The colorimetric area in the picture where the chlorine test paper in step 3 is located and the standard colorimetric card each concentration range area are S = ΔX x ΔY, wherein, 6.The method of claim 1, wherein the method further comprises: ​

Citation Information

Patent Citations

  • PH test paper detection method based on computer vision

    CN110599552A

  • Method for detecting and analyzing mobile phone image of urine test paper

    CN114740189A