A method and terminal for identifying test results from a test kit

By acquiring image data on terminal devices, determining the recognition and verification lines of the test kit using preset heuristic rules, and verifying the recognition results by combining geometric features, the problem of high computational complexity on terminal devices is solved, and rapid and accurate recognition of test results is achieved.

CN115880475BActive Publication Date: 2026-04-17SHANGHAI DAWANG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI DAWANG TECH CO LTD
Filing Date
2022-09-09
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In existing technologies, the methods for identifying test results from antibody or antigen test kits are computationally complex and time-consuming on terminal devices, making it impossible to quickly and reliably identify test results for large populations, resulting in a poor user experience.

Method used

By collecting image data and using preset heuristic rules, the recognition lines and verification lines of the test kit image are determined. Combined with the geometric features of the antigen or antibody test kit, the recognition results are verified based on the pixel set, reducing computational complexity and adapting to different hardware environments.

Benefits of technology

It enables rapid and accurate identification of test results from test kits on terminal devices, improving the reliability and computational efficiency of identification, reducing lag during computation, and adapting to the computational performance requirements of different hardware environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115880475B_ABST
    Figure CN115880475B_ABST
Patent Text Reader

Abstract

This invention discloses a method and terminal for recognizing test results from a test kit. A straight line at a preset position on the test kit image is designated as the recognition line. A first recognition result is determined based on a set of first pixels on the recognition line according to a preset heuristic rule. A straight line at a preset distance from the recognition line is designated as the verification line. A second recognition result is determined based on a set of second pixels on the verification line according to a preset heuristic rule. When the first and second recognition results match, the final recognition result is obtained. This method, combined with the geometric features of the antigen or antibody test kit, identifies the test results based on the image. The final recognition result has been verified and is highly reliable. The entire calculation process has low computational complexity, low requirements for terminal device performance, and can adapt to hardware environments with varying computational performance, reducing lag during calculations. This allows for accurate and rapid recognition of the test kit's results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and in particular to a method and terminal for recognizing the detection results of a detection kit. Background Technology

[0002] Antigen or antibody test kits are widely used in the diagnosis and initial screening of various infectious diseases or physical conditions. Due to their low learning curve, convenient testing process, and short result presentation time, these methods are easily deployed on a large scale. In scenarios such as large-scale epidemics or routine influenza detection and early warning, they can help quickly identify infection status in large populations. However, because antibody or antibody test kits are distributed to individual users for self-testing, and the population targeted for screening is large and diverse, collecting test results faces significant challenges, lacking reliable and efficient methods for identifying test results and collecting data.

[0003] To efficiently identify test results, the image acquisition capabilities (using devices like cameras) and computing power of widely used terminal devices such as mobile phones, tablets, laptops, and smart TVs can be utilized. Images of antibody or antibody test kit results can be captured on these devices, and the results can be identified based on these images before the data is collected and aggregated. However, the computing power of terminal devices is limited. Existing methods involving artificial intelligence neural network calculations and computer vision image processing are time-consuming, poorly adaptable to the complex environments of terminal devices, and cannot operate reliably on them. This results in a poor user experience and hinders the rapid identification of large-scale population infections. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a method and terminal for identifying the test results of a test kit, which can accurately and quickly identify the test results of the test kit.

[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0006] A method for identifying the test results of a test kit, comprising the following steps:

[0007] Acquire image data and obtain an image of the test kit from the image data, wherein the image of the test kit has the long side and short side of the test kit as the image boundary;

[0008] The straight line at a preset position in the image of the test kit is determined as the recognition line, and the first recognition result corresponding to the test result of the test kit is determined based on the first pixel point set on the recognition line according to the preset heuristic rule;

[0009] In the image of the test kit, a straight line at a preset distance from the recognition line is identified as the verification line, and a second recognition result corresponding to the test result of the test kit is determined based on the second pixel point set on the verification line according to the preset heuristic rule;

[0010] Determine whether the first recognition result is consistent with the second recognition result. If so, obtain the final recognition result based on the first recognition result and the second recognition result.

[0011] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows:

[0012] A terminal for recognizing test results from a test kit includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps:

[0013] Acquire image data and obtain an image of the test kit from the image data, wherein the image of the test kit has the long side and short side of the test kit as the image boundary;

[0014] The straight line at a preset position in the image of the test kit is determined as the recognition line, and the first recognition result corresponding to the test result of the test kit is determined based on the first pixel point set on the recognition line according to the preset heuristic rule;

[0015] In the image of the test kit, a straight line at a preset distance from the recognition line is identified as the verification line, and a second recognition result corresponding to the test result of the test kit is determined based on the second pixel point set on the verification line according to the preset heuristic rule;

[0016] Determine whether the first recognition result is consistent with the second recognition result. If so, obtain the final recognition result based on the first recognition result and the second recognition result.

[0017] The beneficial effects of this invention are as follows: An image of the test kit with the long and short sides of the test kit as image boundaries is obtained from the collected image data. A straight line at a preset position in the test kit image is determined as an identification line. Based on the first set of pixels on the identification line, a first identification result corresponding to the test kit's detection result is determined according to a preset heuristic rule. A straight line at a preset distance from the identification line in the test kit image is determined as a verification line. Based on the second set of pixels on the verification line, a second identification result corresponding to the test kit's detection result is determined according to a preset heuristic rule. The final identification result is obtained based on the first and second identification results. This, combined with the geometric features of the antigen or antibody test kit, identifies the detection result based on the image. The final identification result has been verified and has high reliability. Furthermore, the entire calculation process has low computational complexity, low requirements for terminal device performance, and can adapt to hardware environments with different computing performance, reducing lag during calculation, thereby accurately and quickly identifying the test kit's detection result. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating the steps of a method for identifying the test results of a test kit according to an embodiment of the present invention.

[0019] Figure 2 This is a schematic diagram of the structure of a terminal for recognizing the test results of a test kit according to an embodiment of the present invention;

[0020] Figure 3 This is a schematic diagram of the identification process in the identification method of the detection kit according to an embodiment of the present invention;

[0021] Figure 4 This is a schematic diagram of task processing in the method for identifying the detection results of the detection kit according to an embodiment of the present invention;

[0022] Figure 5 This is a schematic diagram of image data in the method for recognizing the detection results of the detection kit according to an embodiment of the present invention;

[0023] Figure 6 This is a schematic diagram of the detection kit image in the method for recognizing the detection results of the detection kit according to an embodiment of the present invention;

[0024] Figure 7 This is a schematic diagram of the identification line and verification line in the identification method of the detection result of the detection kit in an embodiment of the present invention. Detailed Implementation

[0025] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.

[0026] Please refer to Figure 1This invention provides a method for identifying the test results of a test kit, comprising the following steps:

[0027] Acquire image data and obtain an image of the test kit from the image data, wherein the image of the test kit has the long side and short side of the test kit as the image boundary;

[0028] The straight line at a preset position in the image of the test kit is determined as the recognition line, and the first recognition result corresponding to the test result of the test kit is determined based on the first pixel point set on the recognition line according to the preset heuristic rule;

[0029] In the image of the test kit, a straight line at a preset distance from the recognition line is identified as the verification line, and a second recognition result corresponding to the test result of the test kit is determined based on the second pixel point set on the verification line according to the preset heuristic rule;

[0030] Determine whether the first recognition result is consistent with the second recognition result. If so, obtain the final recognition result based on the first recognition result and the second recognition result.

[0031] As can be seen from the above description, the beneficial effects of the present invention are as follows: An image of the test kit with the long and short sides of the test kit as image boundaries is obtained from the collected image data; a straight line at a preset position on the test kit image is determined as an identification line; a first identification result corresponding to the test kit detection result is determined based on the first set of pixels on the identification line according to a preset heuristic rule; a straight line at a preset distance from the identification line in the test kit image is determined as a verification line; a second identification result corresponding to the test kit detection result is determined based on the second set of pixels on the verification line according to a preset heuristic rule; and a final identification result is obtained based on the first and second identification results. This, combined with the geometric features of the antigen or antibody test kit, allows for image-based identification of the detection result. The final identification result has been verified and is highly reliable. Furthermore, the entire calculation process has low computational complexity, low requirements for terminal device performance, and can adapt to hardware environments with varying computational performance, reducing lag during calculation, thereby accurately and quickly identifying the test kit detection result.

[0032] Further, obtaining the test kit image from the image data includes:

[0033] The image data is compressed according to a preset aspect ratio to obtain compressed image data;

[0034] The compressed image data is converted into an HSV color space image;

[0035] The HSV color space image is blurred to obtain a blurred image;

[0036] Perform edge detection on the blurred image to obtain an edge-detected image;

[0037] Perform shape detection on the edge-detected image to obtain a shape-detected image;

[0038] The image after shape detection is subjected to image matching to obtain the vertex coordinates of the detection kit in the image data;

[0039] The HSV color space image is mapped and transformed based on the vertex coordinates to obtain the detection kit image.

[0040] As described above, the image data is compressed according to a preset aspect ratio to obtain compressed image data. The compressed image data is then converted into an HSV color space image. The HSV color space image is then subjected to image blurring, edge detection, shape detection, and graphic matching in sequence to obtain the vertex coordinates of the test kit in the image data. Then, a mapping transformation is performed to obtain the test kit image. The test kit image is extracted through a series of image processing steps without processing other redundant images, thus reducing the computational complexity of the algorithm and improving computational efficiency.

[0041] Further, the step of determining the straight line at a preset position in the image of the test kit as the recognition line includes the following steps:

[0042] Based on the HSV color space image, determine the preset color pixels and other color pixels in the test kit image;

[0043] The image of the test kit is filtered according to the preset color pixels and the other color pixels to obtain the filtered image of the test kit.

[0044] The step of determining the straight line at a preset position in the image of the detection kit as the recognition line includes:

[0045] The straight line at a preset position in the filtered test kit image is determined as the recognition line;

[0046] The step of determining the straight line in the image of the test kit that is at a preset distance from the identification line as the verification line includes:

[0047] In the filtered image of the test kit, a straight line that is spaced at a preset distance from the identification line is identified as the verification line.

[0048] As described above, the preset color pixels and other color pixels in the test kit image are determined based on the HSV color space image. The test kit image is then filtered based on the preset color pixels and other color pixels to obtain a filtered test kit image. Subsequent operations are all based on the filtered test kit image. Image filtering further reduces the objects that the algorithm needs to process, making the algorithm computationally low and enabling recognition without relying on special hardware capabilities, thereby improving the efficiency of test kit detection result recognition.

[0049] Further, the step of determining the first identification result corresponding to the detection result of the detection kit based on the first pixel set on the identification line according to a preset heuristic rule includes:

[0050] Determine the update parameters and initialize the current first pixel index, current moving average, current moving square mean, current moving average variance, current number of jumps and current jump state corresponding to the first pixel set to the first preset values;

[0051] If the index of the current first pixel is less than a second preset value, then increment the index of the current first pixel by one and return to execute the step of determining whether the index of the current first pixel is less than the second preset value. If not, then determine whether the index of the current first pixel is less than a third preset value. If less, then update the current moving average, the current moving square mean, and the current moving average variance based on the target first pixel corresponding to the index of the current first pixel and the update parameters, increment the index of the current first pixel by one, and return to execute the step of determining whether the index of the current first pixel is less than the third preset value. If greater, then determine whether the index of the current first pixel is greater than a fourth preset value.

[0052] If the current first pixel index is greater than the fourth preset value, the current number of jumps is output and the algorithm ends; otherwise, the pixel value of the target first pixel corresponding to the current first pixel index is determined.

[0053] Determine whether the square of the difference between the pixel value and the current moving average is greater than the previous moving average variance. If not, update the current transition state, the current moving average, the current moving square mean, and the current moving average variance. Then, increment the index of the current first pixel and return to execute the step of determining whether the index of the current first pixel is greater than the fourth preset value. If yes, determine whether the current transition state is equal to the fifth preset value.

[0054] If the current transition state is equal to the fifth preset value, then update the current transition state, the current number of transitions, and the current index of the first pixel, and return to execute the step of determining whether the current index of the first pixel is greater than the fourth preset value; otherwise, update the current index of the first pixel, and return to execute the step of determining whether the current index of the first pixel is greater than the fourth preset value.

[0055] The first identification result corresponding to the detection result of the test kit is determined based on the current number of transitions.

[0056] As described above, by using a preset heuristic rule to traverse the first pixel in the first pixel set, and finally determining the first recognition result on the recognition line based on the current number of transitions, the detection result of the test kit can be easily and accurately identified.

[0057] Furthermore, the process of determining the update parameters also includes:

[0058] Determine the stage ratio and the initial length ratio;

[0059] Before determining whether the current index of the first pixel is less than the second preset value, the following steps are included:

[0060] Obtain the first length corresponding to the long side;

[0061] The second preset value, the third preset value, and the fourth preset value are determined based on the first length, the stage ratio, and the initial length ratio.

[0062] As described above, the second, third, and fourth preset values ​​are determined based on the first length corresponding to the long side, the stage ratio, and the initial length ratio. The index of the current first pixel is judged based on the second, third, and fourth preset values, thereby realizing the traversal of pixels on the recognition line and accurately realizing the recognition of the detection results of the test kit.

[0063] Further, updating the current moving average, the current moving squared mean, and the current moving average variance based on the target first pixel corresponding to the current first pixel index and the update parameters includes:

[0064] The current moving average is updated based on the previous moving average, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index;

[0065] The current moving square mean is updated based on the previous moving square mean, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index;

[0066] The current moving average variance is updated based on the updated current moving average and the current moving squared mean.

[0067] As described above, when the index of the current first pixel is not less than the second preset value, the current moving average, the current moving square mean, and the current moving average variance are updated. Subsequent iterations are based on the updated current moving average, the current moving square mean, and the current moving average variance, which improves the rationality of the detection results recognition of the test kit.

[0068] Further, updating the current transition state, the current moving average, the current moving squared mean, and the current moving average variance includes:

[0069] Update the current transition state to the sixth preset value;

[0070] The current moving average is updated based on the previous moving average, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index;

[0071] The current moving square mean is updated based on the previous moving square mean, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index;

[0072] The current moving average variance is updated based on the updated current moving average and the current moving squared mean.

[0073] As described above, when the square of the difference between the pixel value and the current moving average is not greater than the previous moving average variance, the current jump state, the current moving average, the current moving square mean, and the current moving average variance are updated. Subsequently, the recognition result will be judged based on the current jump state, the current moving average, the current moving square mean, and the current moving average variance.

[0074] Further, updating the current transition state, the current transition count, and the current first pixel index includes:

[0075] Update the current transition state to the seventh preset value, and increment the current transition count and the current first pixel index by one.

[0076] As described above, the current transition state is updated to the seventh preset value, and the current transition count and the index of the current first pixel are incremented by one. Finally, the current transition count is used as the basis for judging the detection result, thus realizing the effective recognition of the detection result of the detection kit.

[0077] Further, determining the first identification result corresponding to the detection result of the test kit based on the current number of transitions includes:

[0078] Determine whether the current number of transitions is a sixth preset value. If yes, then determine that the first identification result is negative. Otherwise, determine whether the current number of transitions is a seventh preset value. If yes, then determine that the first identification result is positive.

[0079] As described above, if the current number of transitions is the sixth preset value, the first identification result is determined to be negative; otherwise, if the current number of transitions is the seventh preset value, the first identification result is determined to be positive. This simple and accurate method achieves the identification of the test results from the test kit.

[0080] Please refer to Figure 2 Another embodiment of the present invention provides a terminal for recognizing the test results of a test kit, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements each step of the above-described method for recognizing the test results of a test kit.

[0081] The detection result identification method and terminal of the detection kit described above are applicable to the identification of detection results of antigen or antibody detection kits. The following detailed embodiments illustrate this method:

[0082] Example 1

[0083] Please refer to Figure 1 and Figures 3-7 The method for identifying the test results of a test kit according to this embodiment includes the following steps:

[0084] S1. Acquire image data and obtain an image of the test kit from the image data. The image of the test kit has its long and short sides as image boundaries. Figure 3 As shown, it specifically includes:

[0085] S11. Acquire image data;

[0086] Specifically, image data acquired by the terminal device's camera is collected through the image acquisition interface provided by the terminal device at preset time intervals and preset ratios. Simultaneously, the image data acquired by the terminal device's camera is displayed on the terminal device's screen at a refresh rate supported by the terminal device. Figure 5 As shown, this allows users to easily confirm whether the antigen or antibody reagent is within the image range of the terminal device's camera;

[0087] The acquisition of image data from the terminal device's camera via the image acquisition interface provided by the terminal device at preset time intervals and preset ratios includes:

[0088] like Figure 4As shown, a preset time interval T and a time interval extension step S can be set to determine whether there is an image processing task currently being executed. If so, wait for S and then start executing a new image processing task, and extend T by S and then end the current task. If not, wait for T and then start executing a new image processing task, and collect image data acquired by the terminal device camera according to a preset ratio.

[0089] The preset ratio can be set according to the actual situation. In one optional embodiment, the preset ratio is the same as or approximately the aspect ratio of the test kit, for example, 0.63953.

[0090] S12. The image data is compressed according to a preset aspect ratio to obtain compressed image data, so that the image meets the size requirements;

[0091] The preset aspect ratio can be set according to the actual situation. In one optional embodiment, the long side of the image data does not exceed 650 pixels and the short side of the image data does not exceed 330 pixels.

[0092] S13. Convert the compressed image data into an HSV color space image;

[0093] In another alternative implementation, if the compressed image data contains the HSV color space, then S13 need not be executed.

[0094] S14. Blur the HSV color space image to obtain a blurred image;

[0095] Specifically, the data of each channel of the HSV color space image are sequentially blurred to obtain a blurred image;

[0096] In one alternative implementation, the image blurring uses Gaussian blurring.

[0097] S15. Perform edge detection on the blurred image to obtain an edge-detected image;

[0098] In one alternative implementation, the edge detection uses the Canny algorithm;

[0099] S16. Perform shape detection on the edge-detected image to obtain a shape-detected image;

[0100] In one alternative implementation, the shape detection uses OpenCV tools;

[0101] In another optional implementation, the shape area in the image after shape detection is filtered, that is, when the shape area is less than or equal to a preset threshold, the shape is ignored; otherwise, S17 is executed, wherein the preset threshold is 20% of the area of ​​the image after shape detection.

[0102] S17. Perform graphic matching on the image after shape detection to obtain the vertex coordinates of the detection kit in the image data;

[0103] In one alternative implementation, the graph matching uses the minAreaRect algorithm implemented in OpenCV tools;

[0104] S18. The HSV color space image is mapped and transformed according to the vertex coordinates to obtain a test kit image. The test kit image uses the long and short sides of the test kit as its image boundaries. Figure 6 As shown;

[0105] S2. Determine the preset color pixels and other color pixels in the test kit image based on the HSV color space image;

[0106] In this embodiment, the preset color is red;

[0107] Specifically, each pixel in the image of the test kit is traversed, and the pixel value of the target pixel is determined according to the HSV color space image to be greater than or equal to (0, 43, 46) and less than or equal to (10, 255, 255). If so, the target pixel is a red pixel; otherwise, the target pixel is a pixel of another color.

[0108] Alternatively, based on the HSV color space image, determine whether the pixel value of the target pixel point traversed is greater than or equal to (156, 43, 46) and less than or equal to (180, 255, 255). If so, the target pixel point is a red pixel point; otherwise, the target pixel point is a pixel point of other colors.

[0109] S3. Filter the test kit image according to the preset color pixels and the other color pixels to obtain the filtered test kit image;

[0110] Specifically, the red pixels in the test kit image are set to the maximum pixel value, and the non-red pixels are set to the minimum pixel value, thereby achieving image filtering and obtaining the filtered test kit image.

[0111] S4. Determine the straight line at a preset position on the image of the test kit as the recognition line, and determine the first recognition result corresponding to the test result of the test kit based on the first pixel set on the recognition line according to a preset heuristic rule, such as... Figure 7 As shown, the algorithm calculates and identifies red (close to red) detection lines in the image of the inductive detection kit. Specifically, it determines whether a line is a red area by the proportion of the width of the red region to the width of the overall image, thus achieving the recognition of the detection result. This includes:

[0112] S40. The straight line at the preset position of the filtered test kit image is determined as the recognition line;

[0113] In this embodiment, the preset position is perpendicular to the short side and intersects at the midpoint of the short side;

[0114] Specifically, the line perpendicular to the short side and intersecting the midpoint of the short side in the filtered test kit image is defined as the identification line;

[0115] S41. Determine the update parameters (θ), stage ratio (C) and initial length ratio (W), and initialize the current first pixel index (I), current moving average (M), current moving square mean (S), current moving average variance (D), current number of jumps (J) and current jump state (N) corresponding to the first pixel set to the first preset values.

[0116] In this embodiment, the first preset value is 0;

[0117] In one optional implementation, the update parameter ranges from 0 to 1. First, 100 points are taken equally from 0 to 1, and subsequent processes are performed on 1000 image samples to be identified, resulting in 100 recognition results. The update parameter with the highest recognition accuracy among the 100 corresponding update parameters is used as the final update parameter. The stage ratio is the average of the distance from the red line to the short side to the image boundary in the 1000 image samples to be identified / the length of the long side of the image sample to be identified * 0.9. The initial length ratio is the average of the shorter distance from the short side of the recognition box to the image boundary in the 1000 image samples to be identified / the length of the long side of the image sample to be identified * 0.9.

[0118] S42. Obtain the first length (Width) corresponding to the long side;

[0119] S43. Determine the second preset value, the third preset value, and the fourth preset value based on the first length, the stage ratio, and the initial length ratio;

[0120] Specifically, a second preset value, namely Width×C, is determined based on the first length and the stage ratio;

[0121] A third preset value is determined based on the first length, the stage ratio, and the initial length ratio, namely Width×(W+C);

[0122] A fourth preset value is determined based on the first length and the stage ratio, namely Width×(1-C);

[0123] S44. Determine whether the index of the current first pixel is less than the second preset value. If yes, execute S441; otherwise, execute S442.

[0124] S441. Increment the index of the current first pixel by one, and return to execute S44.

[0125] Specifically, I = I + 1, and return to execute S44;

[0126] S442. Determine whether the index of the current first pixel is less than a third preset value. If it is less, execute S4421; if it is greater, execute S4422.

[0127] S4421. Based on the target first pixel corresponding to the current first pixel index and the update parameters, update the current moving average, the current moving squared mean, and the current moving average variance, and increment the current first pixel index by one, then return to execute the judgment in S442, specifically including:

[0128] S44211. Update the current moving average M based on the previous moving average, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index. I :

[0129] M I =M I-1 ×θ+P I ×(1-θ);

[0130] In the formula, M I-1 P represents the previous moving average. I This represents the pixel value of the target first pixel corresponding to the current first pixel index;

[0131] S44212. Update the current moving squared mean S based on the previous moving squared mean, the updated parameter, and the pixel value of the target first pixel corresponding to the current first pixel index. I :

[0132]

[0133] In the formula, S I-1 This represents the previous moving square mean;

[0134] S44213. Update the current moving average variance based on the updated current moving average and the current moving squared mean, and increment the index of the current first pixel by one, then return to execute the judgment in S442.

[0135] Wherein, the current moving average variance D I :

[0136]

[0137] S4422. Determine whether the index of the current first pixel is greater than the fourth preset value;

[0138] Specifically, if the index of the current first pixel is greater than the fourth preset value, then S44221 is executed; otherwise, S44222 is executed.

[0139] S44221. Output the current number of transitions and end the algorithm;

[0140] S44222 Determine the pixel value of the target first pixel corresponding to the current first pixel index;

[0141] S44223, Determine the square of the difference between the pixel value and the current moving average value (P). I -M I ) 2 Is it greater than the previous moving average variance D? I-1 If not, execute S442231; if yes, execute S442232.

[0142] S442231, Update the current transition state, the current moving average, the current moving squared mean, and the current moving average variance, and increment the index of the current first pixel by one, then return to execute S4422, specifically including:

[0143] S4422311. Update the current transition state to the sixth preset value;

[0144] In this embodiment, the sixth preset value is 0;

[0145] S4422312. Update the current moving average M based on the previous moving average, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index. I :

[0146] M I =M I-1 ×θ+P I ×(1-θ);

[0147] S4422313, Update the current moving squared mean S based on the previous moving squared mean, the updated parameter, and the pixel value of the target first pixel corresponding to the current first pixel index. I :

[0148]

[0149] S4422314. Update the current moving average variance based on the updated current moving average and the current moving square mean, and increment the index of the current first pixel by one before returning to execute S4422.

[0150] Wherein, the current moving average variance D I :

[0151]

[0152] S442232. Determine whether the current transition state is equal to the fifth preset value;

[0153] In this embodiment, the fifth preset value is 0;

[0154] Specifically, if the current transition state is equal to the fifth preset value, then S4422321 is executed; otherwise, S4422322 is executed.

[0155] S4422321, Update the current transition state, the current number of transitions, and the current index of the first pixel, and return to execute S4422;

[0156] Specifically, the current transition state is updated to the seventh preset value, and the current transition count and the current first pixel index are incremented by one, and then the process returns to execute S4422.

[0157] In this embodiment, the seventh preset value is 1;

[0158] S4422322, Update the index of the current first pixel, and return to execute S4422;

[0159] Specifically, increment the index of the current first pixel by one, and return to execute step S4422;

[0160] S45. Determine the first identification result corresponding to the detection result of the detection kit based on the current number of transitions, specifically including:

[0161] S451. Determine whether the current number of transitions is the sixth preset value. If yes, execute S4511; otherwise, execute S4512.

[0162] In this embodiment, the sixth preset value is 1;

[0163] S4511. Determine that the first identification result is negative;

[0164] S4512. Determine whether the current number of transitions is the seventh preset value. If so, determine that the first identification result is positive.

[0165] In this embodiment, the seventh preset value is 2;

[0166] If the current number of transitions is neither the sixth preset value nor the seventh preset value, it is determined to be an abnormal situation, and execution returns to S1;

[0167] S5. In the image of the test kit, determine a straight line at a preset distance from the recognition line as the verification line, and based on the second pixel set on the verification line, determine the second recognition result corresponding to the test result of the test kit according to the preset heuristic rule, such as... Figure 7 As shown;

[0168] In this embodiment, the preset distance is greater than or equal to 1% of the length of the short side, and less than or equal to 3% of the length of the short side;

[0169] Specifically, in the filtered image of the test kit, two straight lines separated from the recognition line by a preset distance are identified as verification lines, and based on the set of second pixels on the verification lines, the second recognition result corresponding to the test result of the test kit is determined according to the preset heuristic rule;

[0170] The verification line and the recognition line are parallel to each other. The preset heuristic rule process is similar to S41 to S45, and will not be described again here.

[0171] S6. Determine whether the first identification result and the second identification result are consistent. If so, obtain the final identification result based on the first identification result and the second identification result.

[0172] In another alternative implementation, the above steps can be performed asynchronously, that is, while the i-th image is being processed, the (i+1)-th image can begin to be processed.

[0173] Example 2

[0174] Please refer to Figure 2 This embodiment provides a terminal for recognizing the test results of a test kit, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements each step of the method for recognizing the test results of the test kit in Embodiment 1.

[0175] In summary, the present invention provides a method and terminal for recognizing the test results of a test kit. The method involves acquiring image data and obtaining a test kit image from the image data, wherein the test kit image has its long and short sides as image boundaries. A straight line at a preset position on the test kit image is designated as a recognition line, and a first recognition result corresponding to the test kit test result is determined based on a first set of pixels on the recognition line according to a preset heuristic rule. A straight line at a preset distance from the recognition line in the test kit image is designated as a verification line, and a second recognition result corresponding to the test kit test result is determined based on a second set of pixels on the verification line according to the preset heuristic rule. When the first recognition result matches the second recognition result, a final recognition result is obtained based on the first and second recognition results. Before determining the recognition line, preset color pixels and other color pixels in the test kit image are identified based on the HSV color space image. The test kit image is then filtered based on these preset color pixels and other color pixels. Subsequent operations are all based on the filtered test kit image. Image filtering further reduces the objects that the algorithm needs to process, resulting in lower computational requirements and lower hardware camera pixel requirements. Recognition can be achieved without relying on special hardware capabilities, thus improving the efficiency of test kit result recognition. Combined with the geometric features of the antigen or antibody test kit, the final recognition result has been verified to be highly reliable. The entire calculation process has low computational complexity and low requirements for the computing performance of the terminal device. It can adapt to hardware environments with different computing performance, reducing lag during calculation, thereby accurately and quickly recognizing the test results of the test kit.

[0176] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for identifying the results of a test kit, characterized in that, Including the following steps: Acquire image data and obtain an image of the test kit from the image data, wherein the image of the test kit has the long side and short side of the test kit as the image boundary; The straight line at a preset position in the image of the test kit is determined as the recognition line, and the first recognition result corresponding to the test result of the test kit is determined based on the first pixel point set on the recognition line according to the preset heuristic rule; In the image of the test kit, a straight line at a preset distance from the recognition line is identified as the verification line, and a second recognition result corresponding to the test result of the test kit is determined based on the second pixel point set on the verification line according to the preset heuristic rule; Determine whether the first identification result is consistent with the second identification result. If so, obtain the final identification result based on the first identification result and the second identification result. The determination of the first recognition result corresponding to the detection result of the detection kit based on the first pixel set on the recognition line according to a preset heuristic rule includes: Determine the update parameters and initialize the current first pixel index, current moving average, current moving square mean, current moving average variance, current number of jumps and current jump state corresponding to the first pixel set to the first preset values; If the index of the current first pixel is less than a second preset value, then increment the index of the current first pixel by one and return to execute the step of determining whether the index of the current first pixel is less than the second preset value. If not, then determine whether the index of the current first pixel is less than a third preset value. If less, then update the current moving average, the current moving square mean, and the current moving average variance based on the target first pixel corresponding to the index of the current first pixel and the update parameters, increment the index of the current first pixel by one, and return to execute the step of determining whether the index of the current first pixel is less than the third preset value. If greater, then determine whether the index of the current first pixel is greater than a fourth preset value. If the current first pixel index is greater than the fourth preset value, the current number of jumps is output and the algorithm ends; otherwise, the pixel value of the target first pixel corresponding to the current first pixel index is determined. Determine whether the square of the difference between the pixel value and the current moving average is greater than the previous moving average variance. If not, update the current transition state, the current moving average, the current moving square mean, and the current moving average variance. Then, increment the index of the current first pixel and return to execute the step of determining whether the index of the current first pixel is greater than the fourth preset value. If yes, determine whether the current transition state is equal to the fifth preset value. If the current transition state is equal to the fifth preset value, then update the current transition state, the current number of transitions, and the current index of the first pixel, and return to execute the step of determining whether the current index of the first pixel is greater than the fourth preset value; otherwise, update the current index of the first pixel, and return to execute the step of determining whether the current index of the first pixel is greater than the fourth preset value. The first identification result corresponding to the detection result of the test kit is determined based on the current number of transitions.

2. The method of claim 1, wherein the test kit is a lateral flow test kit. The step of obtaining the test kit image from the image data includes: The image data is compressed according to a preset aspect ratio to obtain compressed image data; The compressed image data is converted into an HSV color space image; The HSV color space image is blurred to obtain a blurred image; Perform edge detection on the blurred image to obtain an edge-detected image; Perform shape detection on the edge-detected image to obtain a shape-detected image; The image after shape detection is subjected to image matching to obtain the vertex coordinates of the detection kit in the image data; The HSV color space image is mapped and transformed based on the vertex coordinates to obtain the detection kit image.

3. The method of claim 2, wherein the detection kit is a lateral flow assay. Before determining the straight line at a preset position in the image of the detection kit as the recognition line, the following steps are included: Based on the HSV color space image, determine the preset color pixels and other color pixels in the test kit image; The image of the test kit is filtered according to the preset color pixels and the other color pixels to obtain the filtered image of the test kit. The step of determining the straight line at a preset position in the image of the detection kit as the recognition line includes: The straight line at a preset position in the filtered test kit image is determined as the recognition line; The step of determining the straight line in the image of the detection kit that is at a preset distance from the identification line as the verification line includes: In the filtered image of the test kit, a straight line that is spaced at a preset distance from the identification line is identified as the verification line.

4. The method of claim 1, wherein the detection kit is a lateral flow test kit. The process of determining the update parameters also includes: Determine the stage ratio and the initial length ratio; Before determining whether the current index of the first pixel is less than the second preset value, the following steps are included: Obtain the first length corresponding to the long side; The second preset value, the third preset value, and the fourth preset value are determined based on the first length, the stage ratio, and the initial length ratio.

5. The method of claim 1, wherein the test kit is a lateral flow test kit. The step of updating the current moving average, the current moving squared mean, and the current moving average variance based on the target first pixel corresponding to the current first pixel index and the update parameters includes: The current moving average is updated based on the previous moving average, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index; The current moving square mean is updated based on the previous moving square mean, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index; The current moving average variance is updated based on the updated current moving average and the current moving squared mean.

6. The method of claim 1, wherein the test kit is a lateral flow test kit. The updating of the current transition state, the current moving average, the current moving squared mean, and the current moving average variance includes: Update the current transition state to the sixth preset value; The current moving average is updated based on the previous moving average, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index; The current moving square mean is updated based on the previous moving square mean, the update parameter, and the pixel value of the target first pixel corresponding to the current first pixel index; The current moving average variance is updated based on the updated current moving average and the current moving squared mean.

7. The method of claim 1, wherein the test kit is a lateral flow test kit. The updating of the current transition state, the current transition count, and the current first pixel index includes: Update the current transition state to the seventh preset value, and increment the current transition count and the current first pixel index by one.

8. The method of claim 1, wherein the test kit is a lateral flow test kit. The step of determining the first identification result corresponding to the detection result of the detection kit based on the current number of jumps includes: Determine whether the current number of transitions is a sixth preset value. If yes, then determine that the first identification result is negative. Otherwise, determine whether the current number of transitions is a seventh preset value. If yes, then determine that the first identification result is positive.

9. A recognition terminal of a detection result of a detection kit, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements each step of the method for identifying the test results of a test kit according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Quick detecting method of immune chromatography test paper card

    CN107328776A

  • Picture recognition method for automatically detecting ovulation test paper

    CN112288828A