A rapid real-time urine test paper color recognition method and system
By using high-sensitivity sensors and intelligent algorithm optimization, the problem of inaccurate results from urine test strips has been solved, achieving high accuracy and stability in urine component detection and adapting to testing needs under different environmental conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUJIANG HOSPITAL OF SOUTHERN MEDICAL UNIVERSITY
- Filing Date
- 2025-02-17
- Publication Date
- 2026-04-24
AI Technical Summary
Existing urine test strips are inaccurate, easily affected by light intensity, and the results are unstable, making it impossible to obtain accurate results.
High-sensitivity sensors are used to acquire urine test data. Through techniques such as smoothing, color data classification, feature analysis, function fitting, and weight allocation, the recognition algorithm is optimized to improve detection accuracy and efficiency.
It achieves high accuracy and stability in urine test results, adapts to testing needs under different environmental conditions, and meets the stringent requirements for urine component testing.
Smart Images

Figure CN120253813B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical testing technology, and in particular to a rapid, real-time method and system for color recognition of urine test strips. Background Technology
[0002] With the increasing accessibility of medical technology, people's demand for health prevention and disease management is growing, leading to the widespread use of urine test strips in daily life. Traditional testing methods require hospital visits, with the entire process from sample collection to instrument analysis completed in a hospital setting. This process is cumbersome and results are often delayed. Therefore, urine test strips are becoming increasingly popular for home testing. However, most urine test strips on the market require dedicated testing equipment; the sample must be placed into the specific device for analysis. Some standalone urine testing instruments have various technical issues, resulting in inaccurate results.
[0003] 1. Since urine needs to be sampled through test strips and reacts by adhering to the surface of the test strips, the light source of urine testing instruments is prone to producing bright reflective spots.
[0004] 2. This means that the test results presented are mostly a range of colors, while the urine testing instrument obtains the average value of the colors, which can lead to errors in subsequent test results.
[0005] 3. Due to the influence of light intensity, the recognition results are not stable and are prone to deviation from the actual color range. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of existing technologies by providing a fast and real-time method for color recognition of urine test strips, thereby achieving accurate acquisition of the results presented by the urine test strips.
[0007] On one hand, the present invention provides a rapid and real-time method for color recognition of urine test strips, comprising:
[0008] Urine test data is acquired using sensors and then smoothed to obtain smoothed color data.
[0009] Based on the preset standard range of color values for each component, the smoothed color data is classified into ranges using the dichotomy and ternary methods to obtain the color range generated by each target component under different indicators.
[0010] Based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of urine test data.
[0011] Based on the indicators of urine test data, function fitting and weight allocation were used for verification to obtain the verified indicators;
[0012] Based on the reviewed indicators, algorithms are used to optimize and improve color recognition and imaging efficiency.
[0013] Furthermore, urine test data is acquired using sensors and smoothed to obtain smoothed color data, including:
[0014] The window size M is determined based on the characteristics of the urine test data and the required smoothness.
[0015] Arrange the urine test data into a data sequence x in order. w ;
[0016] Based on the window size M, in the data sequence x w In the middle, select M consecutive data points;
[0017] Calculate the average of M data points to obtain the smoothed data points, i.e., the smoothed color data.
[0018] Furthermore, based on the preset standard color value ranges for each component, the smoothed color data is categorized using a binary and ternary method to obtain the color ranges generated by each target component under different indicators, including:
[0019] Based on the preset range of standard color values for each component's reaction, the upper and lower boundaries are determined using a dichotomy method.
[0020] For each smoothed data point, the median value is calculated based on the upper and lower bounds;
[0021] The smoothed data points are compared with the median value to obtain the binary comparison result;
[0022] Update the upper and lower bounds based on the results of the binary comparison;
[0023] Repeat the above steps until a range of standard color values containing the color data point is found, or it is determined that the color data point does not belong to any known range.
[0024] If the dichotomy method fails to classify the color data points into a smaller color range, the ternary method is used to divide the preset standard range of color values for each component reaction into three parts, and two intermediate values are selected to compare with the smoothed data points to obtain the three-part comparison result.
[0025] Update the search range based on the results of the three-way comparison;
[0026] Repeat the above steps until the best matching color range is found.
[0027] Furthermore, based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of the urine test data, including:
[0028] Obtain the color range generated by each target component under different indicators;
[0029] Obtain the RGB values of the urine detection data collected by the sensor, and construct a three-dimensional space with x, y, and z as the three dimensions;
[0030] The RGB values of urine test data and the RGB values of the color ranges generated by each target component under different indicators are respectively used as points in three-dimensional space;
[0031] use Calculate the straight-line distance between each urine test data point and each color range point to obtain multiple straight-line distances, where x, y, and z represent the coordinates of each dimension in three-dimensional space. This represents the Euclidean distance between points;
[0032] Determine the minimum distance point based on multiple straight-line distances;
[0033] Based on the color range generated by each target component under different indicators, the color range of the minimum distance point is obtained, which is the indicator of urine test data.
[0034] Furthermore, based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of the urine test data, which also includes:
[0035] A curve is generated by comparing the RGB values of urine test data with the RGB values of each target component under different indicators.
[0036] Based on the curve graph, calculate and compare the area enclosed by the points on the curve and the X and Y axes to obtain the comparison results;
[0037] Based on the comparison results, the color range with the smallest difference in area from the urine test data points is determined to obtain the color range with the smallest difference, which is the index of the urine test data.
[0038] Furthermore, based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of the urine test data, which also includes:
[0039] The covariance matrix is constructed by combining the RGB values of urine test data with the color ranges generated by each target component under different indicators;
[0040] Based on the covariance matrix, the eigenvalues and eigenvectors are obtained using the Jacobi iterative method;
[0041] The urine test data is mapped to the feature vector corresponding to the largest feature value to obtain a set of data reduced to one dimension.
[0042] The data reduced to one dimension is compared to obtain the comparison results;
[0043] Based on the comparison results, the indicators for urine test data were determined.
[0044] Furthermore, based on the indicators of the urine test data, function fitting and weight allocation were used for verification to obtain the verified indicators, including:
[0045] Color features were extracted based on the indicators in the urine test data;
[0046] The extracted features are fitted using a fitting function model;
[0047] Assign a weight value to each color feature;
[0048] The weighted urine component index is calculated using the weights and the results of the fitting function to obtain the weighted index.
[0049] The weighted index is compared with the index based on urine test data to obtain the comparison results;
[0050] If the difference is within the preset range based on the comparison results, the review result is confirmed.
[0051] If the difference is not within the preset range based on the comparison results, the function fitting and weight allocation will be re-performed until the difference is within the preset range.
[0052] On the other hand, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the fast and real-time urine test strip color recognition method as described above.
[0053] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the fast real-time urine test strip color recognition method as described in any of the above.
[0054] On the other hand, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the fast real-time urine test strip color recognition method as described above.
[0055] The present invention provides a rapid, real-time urine test strip color recognition method. Utilizing high-sensitivity and high-precision sensor technology, this invention not only enables continuous monitoring and imaging of urine test strip changes, but also captures minute changes in urine samples through this advanced sensing technology, thus providing more accurate data support for medical diagnosis. This elevates the accuracy of urine testing to a new level. In constructing a large-scale intelligent detection algorithm model for urine images, this invention not only improves the robustness of the algorithm but also ensures the stability and universal applicability of urine test results through a systematic algorithm platform. This allows urine component detection technology to adapt to the testing needs of different populations and under different environmental conditions, meeting the stringent requirements for the accuracy of urine test results. Attached Figure Description
[0056] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0057] Figure 1 This is a flowchart illustrating the rapid and real-time urine test strip color recognition method provided in this embodiment of the invention.
[0058] Figure 2 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0060] Figure 1 This is one of the flowcharts illustrating the rapid and real-time urine test strip color recognition method provided in this embodiment of the invention.
[0061] like Figure 1 As shown in the figure, the rapid and real-time urine test strip color recognition method provided by the embodiments of the present invention mainly includes the following steps:
[0062] 11. Use sensors to acquire urine test data and smooth it to obtain smoothed color data;
[0063] 12. Based on the preset standard range of color values for each component, use the dichotomy and ternary methods to classify the smoothed color data into ranges to obtain the color range generated by each target component under different indicators.
[0064] 13. Based on the color range generated by each target component under different indicators, perform feature analysis on the smoothed color data components to confirm the indicators of the urine test data;
[0065] 14. Based on the indicators of the urine test data, use function fitting and weight allocation to verify the results and obtain the verified indicators.
[0066] 15. Based on the reviewed indicators, use algorithm optimization to improve color recognition and imaging efficiency.
[0067] In this embodiment of the invention, firstly, a sensor is used to acquire color data on a urine test strip. Since the raw data may contain noise or unstable factors, it needs to be smoothed to reduce data fluctuations and improve the accuracy of subsequent analysis. Based on the known relationship between urine components and color reactions, a preset range of standard color values for each component under different indicators is established. Using search algorithms such as binary or ternary search, the smoothed color data is categorized into the corresponding standard value ranges, with each color data point corresponding to one or more urine components and their indicator ranges. Spatial analysis, area analysis, and PCA are used to perform feature analysis on the color data. Spatial analysis focuses on the distribution of color within a specific space; area analysis calculates the area ratio of a specific color region; and PCA is used to extract the main feature components of the color data, reducing data dimensionality. These three methods can be used individually or in combination for more comprehensive analysis. This invention aims to accurately identify the target components in urine test data and their states under different indicators. A mathematical model between color data and urine components is established using function fitting techniques. Different weights are assigned based on the importance of each feature to optimize model performance. The original indicators are substituted into the model for verification. By comparing the model predictions with actual data, model parameters are adjusted until satisfactory verification results are obtained. Based on the verified indicators and existing color recognition algorithms, algorithm optimization is performed, including improving the accuracy of the color recognition algorithm, increasing imaging speed, and reducing computational resource consumption. Through algorithm optimization, the fast and real-time urine test strip color recognition process becomes more efficient and accurate. The fast and real-time urine test strip color recognition method provided by this invention can achieve rapid and accurate detection of multiple components in urine, not only improving the efficiency and accuracy of urine testing but also providing strong data support for subsequent disease diagnosis and health monitoring.
[0068] like Figure 1As shown in Figure 11, urine test data is acquired using a sensor and then smoothed to obtain smoothed color data, including:
[0069] 111. Determine the window size M based on the characteristics of the urine test data and the required smoothness;
[0070] 112. Arrange the urine test data into a data sequence x in order. w ;
[0071] 113. Based on the window size M, in the data sequence x w In the middle, select M consecutive data points;
[0072] 114. Calculate the average of M data points to obtain the smoothed data points, i.e., the smoothed color data.
[0073] In this embodiment of the invention, by To obtain stable values , which is the smoothed data point, where x represents the urine test data, M represents the window size, and n represents the index of the current test data;
[0074] Step 111: The window size M determines the smoothing effect. A larger M value results in a stronger smoothing effect because more data points are averaged, thus reducing data fluctuations; a smaller M value retains more original data details but has a weaker smoothing effect. The M value should be selected based on the characteristics of the urine test data and the required smoothing level. If the data is relatively stable, a smaller M value can be chosen; if the data fluctuates significantly and a stronger smoothing effect is needed, a larger M value should be chosen. Step 112: Arrange the urine test data sequentially into a one-dimensional data sequence x. w This facilitates subsequent processing and ensures that the temporal order of the data remains unchanged. This is crucial for smoothing, as smoothing is based on the temporal continuity of the data; Step 113 involves the data sequence x. w In this process, M consecutive data points are selected for smoothing at each step. The smoothing is performed locally, which can better adapt to changes in the data. By using a sliding window, the data is processed segment by segment to ensure that each data point is smoothed. Step 114 calculates the average of the M data points, which can significantly reduce data fluctuations. Noise and outliers in the original data are averaged out, making the data more stable. The smoothed data points, when connected, form a smoother curve, which better reflects the overall trend of the urine test data without being disturbed by local fluctuations. Although the smoothing process reduces data fluctuations, it can still retain the main trends and characteristics of the data.
[0075] like Figure 1As shown, 12. Based on the preset standard color value ranges for each component, the smoothed color data is categorized using a binary and ternary method to obtain the color ranges generated by each target component under different indicators, including:
[0076] 121. Based on the preset range of standard color values for each component's reaction, use the dichotomy method to determine the upper and lower boundaries;
[0077] 122. For each smoothed data point, calculate the median value based on the upper and lower bounds;
[0078] 123. Compare the smoothed data points with the median value to obtain the binary comparison result;
[0079] 124. Update the upper and lower bounds based on the results of the binary comparison;
[0080] 125. Repeat the above steps until a range of standard color values containing the color data point is found, or it is determined that the color data point does not belong to any known range.
[0081] 126. If the dichotomy method fails to classify the color data points into a smaller color range, the ternary method is used to divide the preset standard value range of each component reaction color into three parts, and two intermediate values are selected to compare with the smoothed data points to obtain the three-part comparison result.
[0082] 127. Update the search range based on the results of the three-way comparison;
[0083] 128. Repeat the above steps until the best matching color range is found.
[0084] In this embodiment of the invention, an initial search range is set for the color data points to be classified based on the preset standard value range of each component's reaction color. The binary search method effectively narrows the color space to be searched by continuously halving the search range, thus improving classification efficiency. For each smoothed data point, the median value of the upper and lower bounds is calculated as a comparison benchmark. The median value provides a clear reference for subsequent binary comparisons, helping to determine which half of the search range the data point should be located in. The smoothed data point is compared with the median value, and the data point is classified into half of the search range based on the comparison result. The result of the binary comparison directly guides the next step of updating the upper and lower bounds, ensuring that the search range gradually approaches the target color range. Based on the result of the binary comparison, the upper and lower bounds are updated to make the search range more accurate, providing a new search range for the next iteration and laying the foundation for finally finding the target color range. By continuously repeating the above steps, the classification is gradually... The search range is narrowed until a standard color value range containing the color data point is found. If a data point does not belong to any known range, an exclusion mechanism during the iteration process determines that the data point is an anomaly or does not belong to the currently preset component range. When the binary search method cannot classify the color data point into a smaller color range, the ternary search method improves the classification accuracy by dividing the preset standard color value range into three parts, providing the possibility for more accurate comparison. By selecting two intermediate values to compare with the smoothed data point, the ternary search method can more accurately determine the color range to which the data point belongs. Based on the results of the ternary comparison, the search range is dynamically updated, making the search more efficient and accurate. By continuously repeating the steps of the ternary search method until the color range that best matches the smoothed data point is found, the iterative process of the ternary search method ensures the accuracy of classification, and can find the most suitable color range even in complex or edge cases.
[0085] like Figure 1 As shown in Figure 13, based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of the urine test data, including:
[0086] Obtain the color range generated by each target component under different indicators;
[0087] Obtain the RGB values of the urine detection data collected by the sensor, and construct a three-dimensional space with x, y, and z as the three dimensions;
[0088] The RGB values of urine test data and the RGB values of the color ranges generated by each target component under different indicators are respectively used as points in three-dimensional space;
[0089] use Calculate the straight-line distance between each urine test data point and each color range point to obtain multiple straight-line distances, where x, y, and z represent the coordinates of each dimension in three-dimensional space. This represents the Euclidean distance between points;
[0090] Determine the minimum distance point based on multiple straight-line distances;
[0091] Based on the color range generated by each target component under different indicators, the color range of the minimum distance point is obtained, which is the indicator of urine test data.
[0092] In this embodiment of the invention, by calculating the straight-line distance between urine test data points and the color range points of each target component, the color range point closest to the urine data can be found. Matching based on distance in color space improves the accuracy of detection. The color range matching method can more accurately determine the target components in the urine and reduce the possibility of misjudgment. Constructing the RGB values of the urine test data into a three-dimensional space makes the data more intuitive and visual, helping to better understand the color distribution and characteristics of the urine data. Mapping the color ranges generated by each target component under different indicators into this three-dimensional space also allows for a direct view of the color range distribution of different components, facilitating analysis and comparison. The entire feature analysis process can be automated through programming, greatly improving analysis efficiency. Results can be obtained quickly without the need for tedious manual comparison and judgment. By calculating the straight-line distance and determining the minimum distance point, the color range and target component corresponding to the urine data can be quickly located, reducing analysis time.
[0093] like Figure 1 As shown in Figure 13, based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of urine test data, which also includes:
[0094] A curve is generated by comparing the RGB values of urine test data with the RGB values of each target component under different indicators.
[0095] Based on the curve graph, calculate and compare the area enclosed by the points on the curve and the X and Y axes to obtain the comparison results;
[0096] Based on the comparison results, the color range with the smallest difference in area from the urine test data points is determined to obtain the color range with the smallest difference, which is the index of the urine test data.
[0097] In this embodiment of the invention, a curve is generated by comparing the RGB values of urine test data with the RGB values of the color ranges of each target component under different indicators. This visually displays the changing trends and similarities between data points, helping to quickly identify the correlation between urine data and the color ranges of target components. By calculating and comparing the areas enclosed by each point on the curve and the X and Y axes, the differences between urine data points and the color ranges of target components can be distinguished more precisely. The area provides additional information beyond linear distance, helping to more comprehensively assess the similarity between data points. Area comparison takes into account the overall distribution and shape of data points, rather than just the position of individual points, helping to reduce the bias caused by individual data points. This approach aims to improve the accuracy of urine tests by mitigating misjudgments caused by point fluctuations or anomalies. Based on area comparisons, it identifies the color range with the smallest area difference from urine test data points, thus finding the target component color range that best matches the urine data. Combining spatial distance and area difference measures enhances matching precision. Determining the minimum difference color range provides crucial information for subsequent urine component analysis and diagnosis. By generating curves and performing area comparisons, the target component color range that best matches the urine data can be quickly identified, reducing tedious manual comparison and judgment processes and improving testing efficiency. Multi-dimensional feature analysis and precise matching results enhance the credibility and reliability of urine test data.
[0098] like Figure 1 As shown in Figure 13, based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of urine test data, which also includes:
[0099] The covariance matrix is constructed by combining the RGB values of urine test data with the color ranges generated by each target component under different indicators;
[0100] Based on the covariance matrix, the eigenvalues and eigenvectors are obtained using the Jacobi iterative method;
[0101] The urine test data is mapped to the feature vector corresponding to the largest feature value to obtain a set of data reduced to one dimension.
[0102] The data reduced to one dimension is compared to obtain the comparison results;
[0103] Based on the comparison results, the indicators for urine test data were determined.
[0104] In this embodiment of the invention, by forming a covariance matrix with the RGB values of urine test data and the color ranges generated by each target component under different indicators, the correlation and differences between data can be comprehensively captured. The covariance matrix, as a statistical descriptive tool, effectively reveals the intrinsic relationship between urine data and the color ranges of target components. The covariance matrix is eigenvalued using the Jacobi iterative method to obtain eigenvalues and eigenvectors, achieving dimensionality reduction of the data and converting high-dimensional data into a low-dimensional representation while retaining the main characteristic information. By selecting the eigenvector corresponding to the largest eigenvalue, the urine test data is mapped onto this eigenvector, resulting in a set of data reduced to one dimension. This not only simplifies the data analysis process but also improves the accuracy and efficiency of the analysis. Comparing the size of the one-dimensional data allows for a direct view of the similarity and differences between the urine test data and the color ranges of the target components, providing a clear and concise explanation that facilitates rapid identification of urine data indicators. Based on the comparison results of the one-dimensional data, the indicators of the urine test data can be accurately determined, reflecting the degree of matching between the urine data and the color ranges of the target components, providing an important basis for subsequent urine component analysis and diagnosis.
[0105] First, calculate the mean and standard deviation of the data. Extract the average value from each column. ;
[0106] Calculate the standard deviation using the mean. The n-1 part was subjected to unbiased estimation.
[0107] Decentralization involves normalizing the data to ensure it is arranged in the range [0,1]. The scaling formula for each data point is as follows: The results are =0, Features;
[0108] Calculate the covariance matrix of the data, and then convert the data into a covariance matrix by placing it into a Cov matrix. ,
[0109]
[0110]
[0111]
[0112]
[0113] At this point, if the elements of the covariance matrix Cov are positive, the coefficients are positively correlated; otherwise, they are negatively correlated. If the coefficients approach 0, there is no linear relationship.
[0114] The Jacobi iterative method is used to find eigenvalues and eigenvectors. The steps of the Jacobi iterative method are as follows:
[0115] Set the number of iterations to less than 100;
[0116] Enter the Cov matrix and find the element with the largest absolute value;
[0117] Set the iteration stopping condition: max < 0.0001, where max is...
[0118] Perform a Givens rotation on Cov to make Cov[i][j] equal to 0, but the matrix remains symmetric and the eigenvalues remain unchanged;
[0119] The number of iterations is calculated and the iteration results are updated simultaneously. After the final iteration, the diagonal elements of the result are the eigenvalues, and the elements of each column are the eigenvectors.
[0120] Find the largest eigenvalue using the formula , where A is the Cov matrix and V is the eigenvector;
[0121] Find the maximum value in the case of Cov(n*n) (n>1). The values are obtained by eigenvalues and eigenvectors.
[0122] like Figure 1 As shown in Figure 14, based on the indicators of the urine test data, function fitting and weight allocation are used for verification to obtain the verified indicators, including:
[0123] 141. Extract color features based on the indicators in the urine test data;
[0124] 142. Use a fitting function model to fit the extracted features;
[0125] 143. Assign a weight value to each color feature;
[0126] 144. Calculate the weighted urine component index using the weights and the results of the fitting function to obtain the weighted index;
[0127] 145. Compare the weighted index with the index based on urine test data to obtain the comparison results;
[0128] 146. If the difference is within the preset range based on the comparison results, then confirm the review results;
[0129] 147. Based on the comparison results, if the difference is not within the preset range, the function fitting and weight allocation are re-performed until the difference is within the preset range.
[0130] In this embodiment of the invention, key color features are accurately extracted from urine test data, which comprehensively reflects the color information of urine and provides a reliable foundation for subsequent fitting and weight allocation. By selecting an appropriate fitting function model, the extracted color features are fitted to obtain a fitting function that describes the color change pattern of urine, which helps to more accurately understand the relationship between urine color and composition. According to the importance of the color features, a reasonable weight value is assigned to each feature, which can reflect the contribution of different color features in urine composition analysis and improve the accuracy of the analysis. Combining the weight values and the results of the fitting function, a weighted urine composition index is calculated, which comprehensively considers the importance of color features and the accuracy of the fitting function, and can more comprehensively reflect the actual situation of urine. The weighted urine composition index is compared with the original index to evaluate the difference between the two. The difference helps verify the accuracy and reliability of the weighted indicators. If the difference between the weighted indicators and the original indicators is within the preset range, it indicates that the verification process is accurate and reliable, and the verification results can be confirmed, which helps improve the accuracy and reliability of urine component analysis. If the difference between the weighted indicators and the original indicators exceeds the preset range, it indicates that there may be errors or deficiencies in the verification process, and it is necessary to re-fit the function and re-allocate the weights until the difference is controlled within the preset range, ensuring the accuracy and stability of the verification process and avoiding misjudgments or omissions caused by errors. By verifying the indicators of urine test data through function fitting and weight allocation, the actual situation of urine can be more accurately reflected, improving the accuracy and reliability of urine component analysis. It has self-correcting capabilities and can make timely adjustments and optimizations when errors are found, ensuring the accuracy and stability of the verification results.
[0131] Figure 2 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention.
[0132] like Figure 2 As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640. The processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions from the memory 630 to execute a fast, real-time urine test strip color recognition method.
[0133] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0134] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the fast and real-time urine test strip color recognition method provided by the above methods.
[0135] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the fast real-time urine test strip color recognition method provided by the methods described above.
[0136] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0137] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A rapid, real-time method for color recognition of urine test strips, characterized in that, include: Urine test data is acquired using a sensor and then smoothed to obtain smoothed color data. This process includes: determining the window size M based on the characteristics of the urine test data and the required degree of smoothness; and arranging the urine test data sequentially into a data sequence x. w Based on the window size M, in the data sequence x w In this process, select M consecutive data points; calculate the average of the M data points to obtain the smoothed data points, i.e., the smoothed color data; Based on the preset standard color value ranges for each component's reaction, the smoothed color data is categorized using a binary and ternary search method to obtain the color ranges generated by each target component under different indicators. This includes: determining upper and lower bounds using a binary search method based on the preset standard color value ranges for each component's reaction; calculating the median value for each smoothed data point based on the upper and lower bounds; comparing the smoothed data point with the median value to obtain a binary comparison result; updating the upper and lower bounds based on the binary comparison result; repeating the above steps until a color standard value range containing the color data point is found, or it is determined that the color data point does not belong to any known range; if the binary search method fails to categorize the color data point into a smaller color range, the preset standard color value ranges for each component's reaction are divided into three parts using a ternary search method, and two median values are selected and compared with the smoothed data point to obtain a ternary comparison result; updating the search range based on the ternary comparison result; repeating the above steps until the best matching color range is found. Based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of urine test data, including: obtaining the color range generated by each target component under different indicators; obtaining the RGB values of the urine test data collected by the sensor, and constructing a three-dimensional space with x, y, and z as the three dimensions; and using the RGB values of the urine test data and the RGB values of the color range generated by each target component under different indicators as points in the three-dimensional space respectively. use Calculate the straight-line distance between each urine test data point and each color range point to obtain multiple straight-line distances, where x, y, and z represent the coordinates of each dimension in three-dimensional space. It represents the Euclidean distance between points; it determines the minimum distance point based on multiple straight-line distances; it obtains the color range of the minimum distance point based on the color range generated by each target component under different indicators, which is the indicator of urine test data. Based on the indicators from the urine test data, a function fitting and weight allocation process is used for verification to obtain the verified indicators. This process includes: extracting color features from the urine test data indicators; fitting the extracted features using a fitting function model; assigning a weight value to each color feature; calculating the weighted urine component indicators using the weights and the results of the fitting function; comparing the weighted indicators with the indicators based on the urine test data to obtain the comparison results; if the difference is within a preset range, the verification result is confirmed; if the difference is not within the preset range, the function fitting and weight allocation are repeated until the difference is within the preset range. Based on the reviewed indicators, algorithms are used to optimize and improve color recognition and imaging efficiency.
2. The rapid and real-time urine test strip color recognition method according to claim 1, characterized in that, Based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of urine test data, which also includes: A curve is generated by comparing the RGB values of urine test data with the RGB values of each target component under different indicators. Based on the curve graph, calculate and compare the area enclosed by the points on the curve and the X and Y axes to obtain the comparison results; Based on the comparison results, the color range with the smallest difference in area from the urine test data points is determined to obtain the color range with the smallest difference, which is the index of the urine test data.
3. The rapid and real-time urine test strip color recognition method according to claim 2, characterized in that, Based on the color range generated by each target component under different indicators, feature analysis is performed on the smoothed color data components to confirm the indicators of urine test data, which also includes: The covariance matrix is constructed by combining the RGB values of urine test data with the color ranges generated by each target component under different indicators; Based on the covariance matrix, the eigenvalues and eigenvectors are obtained using the Jacobi iterative method; Urine test data are mapped to the eigenvector corresponding to the largest eigenvalue to obtain a set of data reduced to one dimension; The data reduced to one dimension is compared to obtain the comparison results; Based on the comparison results, the indicators for urine test data were determined.
4. An electronic device, 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 program, it implements the fast real-time urine test strip color recognition method as described in any one of claims 1 to 3.
5. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the fast real-time urine test strip color recognition method as described in any one of claims 1 to 3.
6. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the fast real-time urine test strip color recognition method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Detection equipment and system based on urine analysis
CN117269160A
Method and device for monitoring premature infant based on uropeptiomics, electronic equipment, computer readable storage medium and computer program product
CN118430805A