A method for automatically detecting ovulation test strips using image recognition

Through the online image recognition method, HSV color model and target pixel point screening are used to solve the problems of subjectivity and high resource consumption of ovulation test paper detection results, achieving accurate identification of ovulation test paper and low-cost server resource use.

CN112288828BActive Publication Date: 2024-09-24GUANGZHOU SHENG CHENG MAMA NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010929801.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-07
Publication Date
2024-09-24
Estimated Expiration
2040-09-07

AI Technical Summary

Technical Problem

In the existing technology, the detection results of ovulation test strips are highly subjective, and the artificial naked eye recognition is not accurate enough, resulting in the inability to accurately determine the ovulation period. Moreover, the conventional picture recognition method has a complex structure, consumes a lot of resources, and is costly.

Method used

Using an online image recognition method, the RGB pixels of the ovulation test paper image are extracted and converted into HSV color values, the target pixel points are screened, interference blocks are eliminated, and the color depth differences of the detection lines are compared to achieve accurate identification of the ovulation test paper and reduce server resource usage.

Benefits of technology

It achieves accurate identification of ovulation test strips, reduces development and maintenance costs, reduces server resources and time investment, and the identification results are closer to human color perception.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000
    Figure 00000000_0000
Patent Text Reader

Abstract

The present invention discloses a method for automatically detecting an ovulation test paper image recognition, including a process for identifying whether it is an ovulation test paper and a process for identifying the result of the ovulation test paper. The recognition method adopts an HSV model, which is closer to human color perception, that is, the recognition program's perception of the color of the image is consistent with human senses. Compared with a conventional image recognition method with a complex architecture, this ovulation test paper recognition method does not require support from a massive ovulation test paper resource library, but only customizes rules for ovulation test paper image scenes, and the recognition rules are more accurate, and server resources are less occupied. The ovulation test paper image recognition function can be quickly realized, and the investment in server resources and time costs can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of picture recognition, and in particular to a picture recognition method for automatically detecting ovulation test paper. Background Art

[0002] Ovulation test strips predict ovulation by detecting the peak level of luteinizing hormone (LH). They can be used to qualitatively detect luteinizing hormone (LH) in human urine, thereby determining the time of ovulation and the "safe period" in a woman's menstrual cycle, so as to choose the best time for conception or use the "safe period" for contraception.

[0003] Generally, women use the naked eye to observe, which makes the reading of ovulation test strips subjective. After use, they need to be manually saved for later judgment. In addition, the manual naked eye method of identifying ovulation test strips can only roughly judge negative or positive, so it can only make a rough prediction. In addition, each person's recognition of ovulation test strips is different, so it is impossible to accurately judge whether to deal with the ovulation period, which may lead to missing the best period for conception.

[0004] Therefore, in order to improve the accuracy, it is necessary to use image recognition technology. At present, image recognition mainly relies on the establishment of a massive image resource library, AI intelligent scanning of image pixels, extraction of image features, and identification of image objects. Machine learning continuously improves the intelligence of AI through the support of the image library, which means that the resource cost and development cost are very high. Summary of the invention

[0005] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide an image recognition method for automatically detecting ovulation test strips, which adopts online image recognition, does not require the support of a massive ovulation test strip resource library, has a lighter architecture, and has low development and maintenance costs. Compared with conventional image recognition methods with complex architectures, this ovulation test strip recognition algorithm only customizes rules for ovulation test strip image scenes, has more accurate recognition rules, and occupies less server resources.

[0006] The purpose of the present invention is achieved by the following technical solutions:

[0007] A method for automatically detecting an ovulation test strip image recognition comprises the following steps:

[0008] 1) Extract the picture of ovulation test paper;

[0009] 2) Get the RGB pixels of the image and save the RGB value of each pixel in a two-dimensional matrix array;

[0010] 3) Convert each pixel into the corresponding HSV color value and save it in a two-dimensional matrix array;

[0011] 4) Screen each pixel in the HSV model, select the pixel with H value of 0-60 or 300-360, S value ≥0.1, and V value ≥0.3 as the target pixel, and mark it as 1; mark the non-compliant pixel as 0, and get a 01 matrix; if there is no target pixel among all the pixels, it means that it is not an ovulation test strip, and the test ends;

[0012] Steps 1) to 4) are the process of identifying whether it is an ovulation test paper image. If it is, you can proceed to the next step.

[0013] 5) If there are target pixels, exclude interference blocks according to the obtained 01 matrix, filter rows with less than 5% of 1s horizontally, and filter columns with less than 20% of 1s vertically;

[0014] 6) After obtaining the 01 matrix after horizontal and vertical filtering, continuous pixel blocks are screened out. If the number of pixels marked as 1 in the continuous pixel blocks is less than 2% of the total number of pixel blocks, they are excluded;

[0015] 7) If only one pixel block remains after elimination, the test result is negative; if more than two pixel blocks are obtained after elimination, a pairwise comparison is performed to compare the numbers of the two pixel blocks and select the two closest pixel blocks;

[0016] 8) After obtaining the two closest pixel blocks, take the average value of the pixels in each pixel block to obtain the HSV average values ​​of the two pixel blocks, which are HSV1 and HSV2 respectively;

[0017] 9) Subtract HSV1 from HSV2, and compare to get the absolute value of the difference in saturation S, which is in the range of 0 to 0.9, to get the test result. The absolute value of the difference in saturation S corresponds to the degree of difference in color depth. Generally, when the saturation is above 0.5, the human eye can clearly perceive one as dark and one as light. However, the recognition program of the present technical solution can recognize that the absolute value of the difference in S is between 0 and 0.9. The smaller the difference, the stronger the positive.

[0018] It should be noted that in step 9), when the absolute value of the difference in S is less than 0.2, the test result is strongly positive; if the absolute value of the difference in S is less than 0.27, the test result is positive; when the absolute value of the difference in S is less than 0.34, the test result is positive; when the absolute value of the difference in S is less than 0.41, the test result is weakly positive; when the absolute value of the difference in S is less than 0.48, the test result is weakly positive; when the absolute value of the difference in S is less than 0.56, the test result is weakly positive; when the absolute value of the difference in S is less than 0.66, the test result is weak.

[0019] The recognition process of the present invention is as follows: after uploading the picture of the ovulation test paper, the RGB pixels of the picture are extracted, the RGB model is converted into the HSV model, the pixel blocks are filtered and excluded, and the characteristic rules of the ovulation test paper are formulated, and finally it is identified whether the picture is an ovulation test paper. If it is identified as an ovulation test paper, the test paper result is inferred according to the color depth difference of the test line of the identified test paper, and returned to the client.

[0020] Compared with the prior art, the beneficial effects of the present invention are: the recognition method adopts the HSV model, which is closer to human color perception, that is, the recognition program's perception of the color of the picture is consistent with human senses. Compared with the conventional picture recognition method with complex architecture, this ovulation test paper recognition method does not require the support of a massive ovulation test paper resource library, but only customizes rules for ovulation test paper picture scenes, and the recognition rules are more accurate, and server resources are less occupied. It can quickly realize the ovulation test paper picture recognition function and reduce the investment of server resources and time costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 is a flow chart of steps 1) to 4);

[0022] Figure 2 is a flow chart of steps 5) to 9);

[0023] Figure 3 The HSV color model in Example 1;

[0024] Figure 4 It is the 01 matrix diagram of Example 1;

[0025] Figure 5 This is the 01 matrix diagram after filtering in Example 1. DETAILED DESCRIPTION

[0026] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.

[0027] Example 1

[0028] A method for automatically detecting an ovulation test strip image recognition comprises the following steps:

[0029] like Figure 1 As shown, steps 1) to 4) are the process of identifying whether it is an ovulation test paper. If it is, it can proceed to the next step. Figure 2 As shown, steps 5) to 9) are the process of identifying the ovulation test paper results.

[0030] 1) Accept the client request, obtain the image link, and then download the image;

[0031] 2) Get the RGB pixels of the image and save the RGB value of each pixel in a two-dimensional matrix array;

[0032] Width * height = pixels. A picture is composed of these pixels. The color of each pixel is generally represented by the RGB color model, that is, each pixel is represented by three base colors (red, green, and blue). The RGB color model is biased towards hardware perception, and there may be a deviation between the red understood by the program and the human eye. Therefore, a color model close to the color perception of the human eye is needed to represent the pixels on the picture, that is, the HSV model.

[0033] 3) Convert each pixel into the corresponding HSV color value and save it in a two-dimensional matrix array;

[0034] like Figure 3 The HSV model shown in the figure describes the color by (H, S, V). H is the hue, and the hue value ranges from 0 to 360. Red is 0 to 60, yellow is 60 to 120, and magenta is 300 to 360. S is the saturation, which indicates the degree to which the color is close to the spectral color. A color can be regarded as the result of mixing a certain spectral color with white. The larger the proportion of the spectral color, the higher the degree to which the color is close to the spectral color, and the higher the saturation of the color. The higher the saturation, the deeper and brighter the color. The white light component of the spectral color is 0, and the saturation reaches the highest. The value range is usually 0% to 100%. The larger the value, the more saturated the color. V is the brightness, which indicates the brightness of the color. For the light source color, the brightness value is related to the brightness of the light source; for the object color, this value is related to the transmittance or reflectance of the object. The value range is usually 0% (black) to 100% (white).

[0035] Each RGB space must be accompanied by a unique HSV space, so when the program obtains the RGB value of each pixel, it needs to be converted to the value represented by HSV. The formula for converting RGB values ​​to HSV values ​​is as follows: Let (r, g, b) be the red, green, and blue coordinates of a color, respectively, and their values ​​are real numbers between 0 and 1. Let max be equivalent to the maximum of r, g, and b. Let min be equal to the minimum of these values. To find the c) value in the HSV space, the calculation formula is:

[0036]

[0037]

[0038] V=max

[0039] 4) Filter each pixel in the HSV model, select the pixel with H value of 0-60 or 300-360, S value ≥0.1, and V value ≥0.3 as the target pixel, and mark it as 1; mark the non-compliant pixel as 0, and get the following: Figure 4The 01 matrix shown; if the target pixel does not exist in all the pixels, it means that it is not an ovulation test strip, and the test ends;

[0040] Because we need to compare two red detection lines, the target pixel should be a red pixel. The H hue selects all reds, with a value range of 0-60 or 300-360. The minimum saturation of S is 0.1, and the color of the image is almost not red if it is lower than 0.1. The minimum brightness of V is 0.3.

[0041] In this step, the pseudo code is as follows:

[0042] if(($hsv['h']>=0and$hsv['h']<=60)or($hsv['h']>=300and$hsv['h']<=360))

[0043] and(0.1<=$hsv['s']and$hsv['s']<=1)

[0044] and(0.3<=$hsv['v']&&$hsv['v']<=1):

[0045] / / Find the target pixel and mark it as 1

[0046] 5) If there is a target pixel, according to Figure 4 01 matrix, exclude interference blocks, and horizontally filter the rows where the number of 1s is less than 5%, Figure 4 The 1st and 11th rows are filtered, and the number of vertical filters 1 is less than 20% of the columns. Figure 4 The 57th, 69th and 89th columns of are filtered respectively. After filtering, we get Figure 5 ;

[0047] 6) After obtaining the 01 matrix after horizontal and vertical filtering, continuous pixel blocks are screened out. If the number of pixels marked as 1 in the continuous pixel blocks is less than 2% of the total number of pixel blocks, they are excluded;

[0048] The remaining continuous pixel blocks can be considered as the area of ​​the suspected detection line pattern. Then extract the pixel blocks of the 01 matrix, such as Figure 5 As shown, the 01 matrix has 3 pixel block areas.

[0049] 7) If only one pixel block remains after elimination, the test result is negative; if more than two pixel blocks are obtained after elimination, a pairwise comparison is performed to compare the numbers of the two pixel blocks and select the two closest pixel blocks;

[0050] In this embodiment, 3 pixel blocks are excluded if the number of target pixels of this pixel block marked as 1 is less than 2% of the total number of pixel blocks. For a standard ovulation test strip, the red detection line occupies about one twentieth of the total image size, and here the minimum allowed is 2%.

[0051] 8) After the two closest pixel blocks are obtained through elimination, the pixels of each pixel block are averaged to obtain the HSV average values ​​of the two pixel blocks, which are HSV1 and HSV2 respectively;

[0052] 9) Subtract HSV1 from HSV2, and compare to get the absolute value of the difference in saturation S, which is in the range of 0 to 0.9, to get the test result. The absolute value of the difference in saturation S corresponds to the degree of difference in color depth. Generally, when the saturation is above 0.5, the human eye can clearly perceive one as dark and one as light. However, the recognition program of the present technical solution can recognize that the absolute value of the difference in S is between 0 and 0.9. The smaller the difference, the stronger the positive.

[0053] It should be noted that the difference in color depth corresponds to 8 results, namely: 1. weak; 2. weak positive; 3. weak positive; 4. weak positive; 5. weak positive; 6. positive; 7. positive; 8. strong positive. Ovulation test strips on the market generally have 8 color control groups, indicating the increasing depth of color. The corresponding 8 results of the program can generally allow users to accept the identification results, which is no different from the ovulation test strips used before. From strong positive to weak is an increasing process of the saturation difference of the detection line control group. The result is also weak positive, but the corresponding levels are different (4 and 5). Users can judge a change to weaken from the 8 level numbers, and the corresponding saturation float of 0.7 is taken as a degree of change, and 0.2 and 0.66 are taken as the boundaries, which is consistent with the actual ovulation test strip color control group. Therefore, when the absolute value of the difference in S is less than 0.2, the test result is strongly positive; when the absolute value of the difference in S is less than 0.27, the test result is positive; when the absolute value of the difference in S is less than 0.34, the test result is positive; when the absolute value of the difference in S is less than 0.41, the test result is weakly positive; when the absolute value of the difference in S is less than 0.48, the test result is weakly positive; when the absolute value of the difference in S is less than 0.56, the test result is weakly positive; when the absolute value of the difference in S is less than 0.66, the test result is weak.

[0054] The pseudo code is as follows:

[0055] if s<0.2:

[0056] return 8 / / Strong Yang

[0057] elseif s<0.27:

[0058] return 7 / / yang

[0059] elseif s<0.34:

[0060] return 6 / / yang

[0061] elseif s<0.41:

[0062] return 5 / / weak positive

[0063] elseif s<0.48:

[0064] return 4 / / weak positive

[0065] elseif s<0.56:

[0066] return 3 / / weak positive

[0067] elseif s<0.66:

[0068] return 2 / / weak positive

[0069] else return 1 / / Yang.

[0070] Determine whether it is a strong positive or weak positive based on the final ovulation test result.

[0071] The above-mentioned embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and substitutions made by technicians in this field on the basis of the present invention shall fall within the scope of protection required by the present invention.

Claims

1. A method for automatically detecting an ovulation test paper image recognition, characterized in that: The following steps are involved: 1) Extract the picture of ovulation test paper; 2) Get the RGB pixels of the image and save the RGB value of each pixel in a two-dimensional matrix array; 3) Convert each pixel into the corresponding HSV color value and save it in a two-dimensional matrix array; 4) Filter each pixel in the HSV model, select the pixel with H value of 0-60 or 300-360, S value ≥0.1, and V value ≥0.3 as the target pixel, and mark it as 1; mark the non-compliant pixel as 0, and obtain a 01 matrix; If the target pixel does not exist among all the pixels, it means that it is not an ovulation test strip and the test ends; 5) If there are target pixels, exclude interference blocks according to the obtained 01 matrix, filter rows with less than 5% of 1s horizontally, and filter columns with less than 20% of 1s vertically; 6) After obtaining the 01 matrix after horizontal and vertical filtering, continuous pixel blocks are screened out. If the number of pixels marked as 1 in the continuous pixel blocks is less than 2% of the total number of pixel blocks, they are excluded; 7) If only one pixel block remains after elimination, the test result is negative; if more than two pixel blocks are obtained after elimination, a pairwise comparison is performed to compare the numbers of the two pixel blocks and select the two closest pixel blocks; 8) After obtaining the two closest pixel blocks, take the average value of the pixels in each pixel block to obtain the HSV average values ​​of the two pixel blocks, which are HSV1 and HSV2 respectively; 9) Subtract HSV1 from HSV2, compare the absolute value of the difference in saturation S, and get the test result.

2. The image recognition method for automatically detecting ovulation test paper according to claim 1, characterized in that: In the step 9), when the absolute value of the difference in S is less than 0.2, the test result is strongly positive; if the absolute value of the difference in S is less than 0.27, the test result is positive; when the absolute value of the difference in S is less than 0.34, the test result is positive; when the absolute value of the difference in S is less than 0.41, the test result is weakly positive; when the absolute value of the difference in S is less than 0.48, the test result is weakly positive; when the absolute value of the difference in S is less than 0.56, the test result is weakly positive; when the absolute value of the difference in S is less than 0.66, the test result is weak.