Image processing-based urine test paper color change recognition method and system

CN122453736BActive Publication Date: 2026-09-25GUILIN ZHONGHUI TECH DEV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610543618.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-04-23
Publication Date
2026-09-25
Estimated Expiration
2046-04-23

AI Technical Summary

Technical Problem

对环境温度的适配性极差,尿液试纸的核心显色反应均为酶促反应,环境温度不仅会直接影响反应速率,还会改变反应平衡状态下的最终显色深度,而现有技术大多采用固定反应时长进行静态图像采集与判读,低温环境下易出现反应不充分、高温环境下易出现反应过度的问题,同时未针对不同温度对标准比色卡的显色特征进行校正,导致不同环境温度下的检测结果出现严重的系统性偏差,检测准确性大幅下降;

Benefits of technology

本发明构建了全温度区间的双重温度校正机制,彻底解决了现有技术环境温度适配性差的技术缺陷,通过预构建的校正系数矩阵,对标准比色卡的九维颜色特征向量进行实时温度校正,消除温度对显色平衡深度的影响;另一方面基于阿伦尼乌斯方程构建分项目的酶促反应温度补偿逻辑,对反应速率进行自适应校正,动态确定不同温度下各检测项目的最佳反应时长,避免了固定反应时长在低温下反应不充分、高温下反应过度的问题;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122453736B_ABST
    Figure CN122453736B_ABST
Patent Text Reader

Abstract

The application discloses a urine test paper color change recognition method and system based on image processing and relates to the technical fields of urine detection and image processing; the method collects a urine test paper and urine sample reaction whole-process video and real-time environmental temperature, completes automatic positioning and segmentation of a whole region of the test paper and each detection pad ROI, and constructs an HSV color space nine-dimensional color moment feature vector; standard colorimetric card feature correction is combined with the environmental temperature to calculate color similarity, realize color grade matching and interpolation concentration quantification of a detection item, temperature compensation logic is constructed based on the Arrhenius equation, a reaction time-color change curve is fitted, and the best reaction length and a target image frame are adaptively determined, and the application solves the problems of poor temperature adaptability and low detection precision in the prior art, and significantly improves the accuracy of urine detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of urine detection and image processing technology, and more specifically, to a method and system for recognizing color changes in urine test strips based on image processing. Background Technology

[0002] Urine dry chemistry analysis is a core technology for routine clinical urinalysis. It uses urine test strips to react with the analytes in the urine via specific enzymatic colorimetric reactions, enabling rapid qualitative and quantitative detection of more than ten urinary indicators, including glucose, occult blood, bilirubin, ketones, urobilinogen, and protein. It has the advantages of fast detection speed, low operation threshold, and low detection cost, and is widely used in various scenarios such as initial screening of clinical urinary system diseases and systemic diseases, monitoring of chronic kidney disease, on-site testing in primary healthcare, and family health self-management. It is an indispensable and important component of the in vitro diagnostics field.

[0003] With the rapid development of machine vision technology and mobile smart terminals, urine test strip colorimetric interpretation technology based on image processing has gradually become a research hotspot in the industry. However, existing related technical solutions still have the following technical shortcomings: The adaptability to ambient temperature is extremely poor. The core colorimetric reaction of urine test strips is an enzymatic reaction. Ambient temperature not only directly affects the reaction rate, but also changes the final color depth at the reaction equilibrium state. Most existing technologies use a fixed reaction time for static image acquisition and interpretation. Insufficient reaction is likely to occur at low temperatures and over-reaction is likely to occur at high temperatures. At the same time, the colorimetric characteristics of the standard colorimetric card are not corrected for different temperatures, resulting in serious systematic deviations in the test results at different ambient temperatures and a significant decrease in test accuracy. The lack of dynamic kinetic analysis of the entire colorimetric reaction process, and the processing of only a single frame of static image at a fixed time, makes it impossible to adapt to the differences in reaction kinetics under different detection items and different ambient temperatures. It is also difficult to capture the optimal detection time when the reaction reaches equilibrium, which further reduces the detection accuracy.

[0004] To address this, a method and system for recognizing color changes in urine test strips based on image processing has been developed. Summary of the Invention

[0005] To overcome the above-mentioned deficiencies of the prior art, embodiments of the present invention provide a method and system for recognizing color changes in urine test strips based on image processing.

[0006] To achieve the above objectives, the present invention provides the following technical solution: A urine test strip color change recognition method based on image processing includes: S1: Perform dynamic video acquisition and key frame static image acquisition of the entire reaction process between urine test strip and urine sample, collect the reaction environment temperature in real time, and simultaneously complete the calibration of the reaction start time; S2: Automatically locate and segment the overall area of ​​the test strip and each test strip pad ROI by using preset positioning marks. After converting the segmented test strip pad ROI images from RGB to HSV color space, and combining them with the reaction environment temperature correction processing, output a nine-dimensional color feature vector. Use the nine-dimensional color feature vector to calculate the similarity between the color of each test strip pad ROI and the color of the temperature-corrected standard colorimetric card. S3: Using the standard colorimetric card that comes with the urine test strip, each test item corresponds to 7 color levels. Each level corresponds to a unique clinical concentration value and the temperature-corrected HSV channel standard mean value. Through pre-edited fusion classification logic, the color of each test strip ROI is matched and classified with the temperature-corrected standard colorimetric card. Combining the similarity of the temperature-corrected color vector, the matching color level and concentration quantification of each urine test item are output. S4: Extract the color feature vector of each test pad frame by frame from the video of the entire reaction process, fit and generate the time-color change curve corresponding to each test item, construct the enzyme reaction temperature compensation logic for each item based on the Arrhenius equation, analyze and determine the optimal reaction time of each test item at the current temperature, and extract the target image frame corresponding to the optimal reaction time.

[0007] Specifically, the logic for constructing a nine-dimensional color feature vector; The segmented ROI image is converted from the original RGB color space to the HSV color space, where the HSV color space outputs three channel parameters: hue (H), saturation (S), and lightness (V). For the three channels of the HSV color space, the first, second, and third moments are extracted respectively to form a nine-dimensional color moment feature vector.

[0008] Specifically, corrections are made based on the ambient temperature of the reaction environment; Based on the current reaction environment temperature, a pre-edited environment correction logic is used for correction, and the correction formula is as follows: ,in The nine-dimensional color feature vector of the standard colorimetric card at the preset reference temperature. This is the correction coefficient matrix corresponding to the current temperature T. This is the color feature vector of the standard colorimeter card after correction at the current temperature; The environmental correction logic involves pre-storing correction coefficient matrices for different reaction ambient temperatures, and then matching the corresponding correction coefficient matrix after reading the current reaction ambient temperature.

[0009] Specifically, the similarity calculation process; The similarity between the colors of each test strip pad and the temperature-corrected standard colorimetric card was calculated using weighted Euclidean distance. The calculation formula is: ; in, , , The average value of the three channels of HSV for each test strip pad. , , This represents the average of the three HSV channels of the standard colorimetric card color patch after temperature correction. , , The preset weighting coefficients for each channel.

[0010] Specifically, the logic for determining the matching color level; The similarity between the test paper and all seven levels of color patches on the standard color chart is calculated sequentially. Based on the preset similarity reference value, the matching color level of the test paper is determined. Select color patch grades with similarity less than the similarity reference value, and then locate the color patch grade with the lowest similarity as the matching color grade of the test paper.

[0011] Specifically, the logic for determining concentration quantification; When there are two or more groups of color patch grades that are less than the similarity reference value, the absolute difference between the minimum similarity and the second minimum similarity is calculated and recorded as the adjacent difference. If the adjacent difference is less than the preset adjacent reference difference, the concentration quantification is determined by interpolation calculation. Otherwise, the clinical concentration value of the color patch grade corresponding to the minimum similarity is directly used as the concentration quantification. Interpolation calculation is performed using the formula Quantitative concentration was obtained through calculation ;in and The clinical concentration values ​​for the color patch levels corresponding to the least similarity and the second least similarity are given. and These represent the minimum similarity value and the second minimum similarity.

[0012] Specifically, the process of determining the time-color change curve; Using the calibrated reaction start time as the zero point and the duration as the step size, the entire reaction process video is analyzed frame by frame, and a nine-dimensional color feature vector is extracted from the test strip pad for each time frame. The first moment of the nine-dimensional color feature vector between adjacent frames is extracted and Euclidean distance is calculated to obtain the rate of color change per unit time. , The Euclidean distance is the first moment of the color feature vectors of adjacent frames. The time interval between adjacent frames; Using time as the horizontal axis and the first moment in the color feature vector as the vertical axis, the original time-color change curves of each detection item are fitted and generated. By using time as the horizontal axis and the rate of change as the vertical axis, a color change rate curve for each detection item is generated through fitting.

[0013] Specifically, the process of determining the optimal reaction time; The temperature compensation logic is as follows: ;in Let A be the rate constant of the enzyme-catalyzed reaction, and A be the pre-exponential factor. The activation energy of the colorimetric reaction of the test item is used, where R is the universal gas constant and T is the thermodynamic temperature of the reaction environment; Based on reference temperature Derive the current temperature The reaction rate correction factor f is obtained by dividing the Arrhenius equation at the two temperatures and eliminating the pre-exponential factor A, resulting in: ; Correct for the measured rate of color change at the current temperature: ; The corrected standard reaction rate; the plateau determination threshold at the preset reference temperature. Then the judgment threshold at the current temperature pass ×f is determined; The rate of color change after correction of 10 consecutive frames of images ≤ If the condition evaluation coefficient is higher than the preset reference evaluation coefficient, the reaction is determined to have entered the chemical equilibrium plateau period. The start time of the plateau period is taken as the end time of the reaction. Combined with the start time of the reaction, the optimal reaction time for the target detection item at the current temperature is determined. The end time of the reaction is the optimal reaction time.

[0014] Specifically, the calculation logic for the conditional evaluation coefficients; The condition evaluation coefficients are obtained by comprehensively processing the overall fluctuation index and saturation compliance rate of 10 frames of images; Extract the first moment sequences of the H channel and the first moment sequences of the S channel of the target detection ROI region from 10 frames of images, and calculate the relative standard deviation of the two channels respectively; take the maximum value of the relative fluctuation amplitude of the two channels as the comprehensive fluctuation index; Using the end frame of 10 frames as the judgment frame, the similarity between the ROI to be tested in the judgment frame and the seven levels of the standard colorimetric card after temperature correction is calculated. The standard colorimetric card level corresponding to the minimum similarity is taken as the current best matching level. The mean value of the S channel of the standard colorimetric card corresponding to the best matching level is extracted. The ratio between the mean value of the first moment of the S channel of the judgment frame and the mean value of the first moment of the S channel of the best matching level is calculated to obtain the saturation compliance rate.

[0015] A urine test strip color change recognition system based on image processing includes: The acquisition module is used to perform dynamic video acquisition and key frame static image acquisition of the entire reaction process between the urine test strip and the urine sample; to acquire the reaction environment temperature in real time; and to calibrate the reaction start time. The feature extraction module is used to automatically locate and segment the overall area of ​​the test strip and each test strip pad ROI through preset positioning marks, complete the color space conversion of the ROI image, and extract and output a nine-dimensional color feature vector. The temperature correction module is used to perform temperature correction of the color characteristics of the standard colorimetric card and temperature compensation correction of the enzyme-catalyzed reaction rate based on the real-time collected reaction environment temperature. The matching and quantification module is used to calculate the color similarity between the test paper and the temperature-corrected standard colorimetric card, complete the matching and classification between the test paper and the standard colorimetric card, output the matching color level, and output the concentration quantification result of the test item based on the matching result. The reaction kinetics analysis module is used to analyze the entire reaction process video frame by frame, fit and generate time-color change curves and color change rate curves, and combine temperature compensation logic to determine the optimal reaction time and the optimal reaction moment target image frame for each detection item. The report generation module is used to integrate test data and generate standardized urine test reports.

[0016] The technical effects and advantages of this invention are as follows: This invention constructs a dual temperature correction mechanism covering the entire temperature range, completely solving the technical defect of poor environmental temperature adaptability in existing technologies. Through a pre-constructed correction coefficient matrix, the nine-dimensional color feature vector of the standard colorimetric card is corrected in real time by temperature, eliminating the influence of temperature on the color development balance depth. On the other hand, based on the Arrhenius equation, a temperature compensation logic for the enzyme-catalyzed reaction of each item is constructed to adaptively correct the reaction rate and dynamically determine the optimal reaction time for each detection item at different temperatures, avoiding the problem of insufficient reaction at low temperatures and excessive reaction at high temperatures when the reaction time is fixed. This invention constructs a nine-dimensional color moment feature vector in the HSV color space, integrating the first, second, and third moments of the hue, saturation, and lightness channels. This comprehensively quantifies the overall color tendency, uniformity, and distribution asymmetry of the color patches. Compared to traditional single mean features, it has stronger resistance to interference from light fluctuations, equipment color differences, and uneven color development. Simultaneously, it designs a fusion classification logic of hierarchical matching and interpolation quantification, achieving continuous concentration quantification at discrete standard levels. This significantly improves detection resolution and can accurately reflect subtle concentration changes of the analyte, meeting the needs of precise clinical testing. This invention analyzes the entire reaction process video frame by frame, fits and generates time-color change curves and color change rate curves for each detection item, and combines the corrected rate threshold and condition evaluation coefficient as dual constraints to accurately determine the reaction equilibrium plateau period and lock in the optimal detection time. Attached Figure Description

[0017] Figure 1 This is a flowchart of the urine test strip color change recognition method based on image processing according to the present invention; Figure 2 This is a flowchart of the urine test strip color change recognition system based on image processing according to the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Example 1

[0020] like Figure 1 As shown, the urine test strip color change recognition method based on image processing is as follows: S1: Dynamic video acquisition and key frame static image acquisition of the entire reaction process between urine test strip and urine sample are performed through a sealed optical acquisition cavity. The reaction environment temperature is collected in real time through a high-precision temperature sensor built into the cavity, and the reaction start time is calibrated simultaneously. Distortion correction, filtering and noise reduction, and color space standardization preprocessing are performed sequentially on the acquired raw images and video frames; Distortion correction: Radial and tangential distortion correction of the camera lens is completed by using a checkerboard calibration plate to eliminate image distortion caused by wide-angle shooting and restore the true size and shape of the test strip; Filtering and noise reduction: The image is smoothed using a 3×3 window mean filtering algorithm to remove salt and pepper noise and Gaussian noise during the acquisition process, while preserving the color edge features of the test strip color blocks. Color standardization: White balance correction is performed using a standard whiteboard, and the RGB three-channel response values ​​of different acquisition devices are linearly standardized to the 0-255 range to eliminate color response differences between different mobile phone cameras.

[0021] S2: Automatically locate and segment the overall area of ​​the test strip and each test pad ROI by using preset positioning marks to obtain a single-item color block image without background interference. After converting the segmented test pad ROI images from RGB to HSV color space, and after combining the reaction environment temperature correction processing, output a nine-dimensional color feature vector. Use the nine-dimensional color feature vector to calculate the similarity between the color of each test pad ROI and the color of the temperature-corrected standard colorimetric card. Supplementary ROI positioning and segmentation: The coordinate positioning and tilt angle correction of the entire test strip area are completed by the isosceles right triangle positioning mark at the end of the test strip. Taking the right-angle vertex of the triangle mark as the coordinate origin, the coordinate range of each test strip pad is automatically calculated according to the preset test strip pad size and fixed spacing of the urine test strip, and 12 independent ROI areas are segmented. Each ROI area contains only the reaction color block of a single detection item. First, white balance and color standardization are performed using the CIELAB color space: RGB images captured by different devices are converted to the CIELAB color space, color calibration is performed between devices, and then converted back to the RGB color space for subsequent HSV conversion and feature extraction, eliminating color response deviations between different cameras from the source.

[0022] Specifically: The segmented ROI image is converted from the original RGB color space to the HSV color space. The HSV color space outputs three channel parameters: hue (H), saturation (S), and lightness (V). The H channel value ranges from 0 to 360°, and the S and V channels value ranges from 0 to 1. For the three channels of the HSV color space, the first moment (mean), second moment (variance), and third moment (skewness) are extracted respectively to form a nine-dimensional color moment feature vector, which serves as the core basis for color quantization. The first moment represents the average level of pixel color within the channel, the second moment represents the dispersion of pixel color, and the third moment represents the asymmetry of color distribution. The first moment is obtained by calculating the mean values ​​of the H, S, and V channels respectively; it represents the average level of pixel color within the channel and reflects the overall color tendency of the color block. The formula is expressed as: ; , , These represent the average values ​​calculated for the H, S, and V channels, respectively. N is the total number of pixels contained within the ROI region of a single test strip after segmentation, and i is the pixel number. , , These are the values ​​for the three channels; The second moment is obtained by calculating the variance of the H, S, and V channels respectively; it characterizes the dispersion of pixel colors within a channel and reflects the uniformity of color blocks. The formula is expressed as: ; , , These represent the variances calculated for the three channels, respectively. The third moment is obtained by calculating the skewness of the H, S, and V channels respectively; it characterizes the asymmetry of pixel color distribution within the channel and reflects the offset direction of the color block. The formula is expressed as: ; , , These represent the skewness calculated for the three channels, respectively. The first, second, and third moments of the H, S, and V channels are combined in sequence to form a 9-dimensional color feature vector F, which serves as the core input for subsequent color quantization and classification. .

[0023] The colorimetric reaction of urine test strips is an enzymatic reaction. Ambient temperature not only affects the reaction rate but also the colorimetric balance, resulting in differences in colorimetric depth for samples of the same concentration at different temperatures. Therefore, it is necessary to construct a temperature correction matrix for the standard colorimetric card in advance through gradient temperature experiments, and then perform correction based on the current reaction ambient temperature using pre-edited environmental correction logic. The correction formula is as follows: ,in The nine-dimensional color feature vector of the standard colorimetric card at the preset reference temperature. This is the correction coefficient matrix corresponding to the current temperature T. This is the color feature vector of the standard colorimeter card after correction at the current temperature; The environmental correction logic involves pre-storing correction coefficient matrices for different reaction ambient temperatures, and then reading the current reaction ambient temperature to match the corresponding correction coefficient matrix. Supplement the establishment process, Through recorded gradient temperature experiments, a color feature correction matrix for each level of color patch on the standard colorimetric card was established within the range of 5℃ to 40℃, with each 1℃ interval. 50 sets of valid data were collected for each temperature point and each level, and the average value was taken as the standard color feature vector for that level at that temperature. For a preset reference temperature, the 9-dimensional color feature vector of the j-th standard colorimetric card level recorded at the reference temperature is denoted as... ; Let the measured standard color feature vector of the j-th level at the test temperature T be denoted as... ; For each element k (k=1, ...,9) in the 9-dimensional feature vector, calculate the correction coefficient for the j-th level at the test temperature T. ; for The kth element, for The kth element; Since the temperature correction coefficients are consistent across different levels of the same testing item, the average value of the correction coefficients for all levels of the same testing item is taken as the universal correction coefficient for that item, constructing a 9×9 diagonal temperature correction coefficient matrix. : ; This is the universal correction coefficient for the k-th feature element; Based on the currently collected reaction environment temperature, the corresponding temperature correction coefficient matrix is ​​invoked.

[0024] The similarity between the colors of each test strip pad and the temperature-corrected standard colorimetric card was calculated using weighted Euclidean distance. The calculation formula is: ; in, , , The average value of the three channels of HSV for each test strip pad. , , This represents the average of the three HSV channels of the standard colorimetric card color patch after temperature correction. , , The D value is a preset weighting coefficient for each channel. The smaller the D value, the higher the color similarity.

[0025] S3: Using the standard colorimetric card that comes with the urine test strips, each test item corresponds to 7 color levels, and each level corresponds to a unique clinical concentration value and the temperature-corrected HSV channel standard mean value (i.e., , , Through pre-edited fusion classification logic, the system matches and classifies the ROI color of each test strip with the standard color chart after temperature correction. Combining the similarity of the temperature-corrected color vectors, the system outputs the matching color level and concentration quantification of each test item in urine. Specifically: The similarity between the test paper and all seven levels of color patches on the standard color chart is calculated sequentially. Based on the preset similarity reference value, the matching color level of the test paper is determined. The color patch grades with similarity less than the similarity reference value are selected, and the color patch grade with the lowest similarity is selected as the matching color grade of the test paper. Additional information: When the D value of all 7 levels is greater than the similarity reference value, it is determined that the test strip is invalid, the sample is contaminated, the image is stained, or the operation is abnormal, triggering an alarm and prompting the user to retest.

[0026] When there are two or more groups of color patch grades that are less than the similarity reference value, the absolute difference between the minimum similarity and the second minimum similarity is calculated and recorded as the adjacent difference. If the adjacent difference is less than the preset adjacent reference difference, the concentration quantification is determined by interpolation calculation. Otherwise, the clinical concentration value of the color patch grade corresponding to the minimum similarity is directly used as the concentration quantification. Interpolation calculation is performed using the formula Quantitative concentration was obtained through calculation ;in and The clinical concentration values ​​for the color patch levels corresponding to the least similarity and the second least similarity are given. and The minimum similarity value and the second minimum similarity; S4: Extract the color feature vector of each test pad frame by frame from the video of the entire reaction process, fit and generate the time-color change curve corresponding to each test item, construct the enzyme reaction temperature compensation logic for each item based on the Arrhenius equation, analyze and determine the optimal reaction time of each test item at the current temperature, and extract the target image frame corresponding to the optimal reaction time. Specifically: Using the calibrated reaction start time as the zero point and the duration as the step size, the entire reaction process video is analyzed frame by frame, and a nine-dimensional color feature vector is extracted from the test strip pad for each time frame. The first moment of the nine-dimensional color feature vector between adjacent frames is extracted and Euclidean distance is calculated to obtain the rate of color change per unit time. , The Euclidean distance is the first moment of the color feature vectors of adjacent frames. The time interval between adjacent frames; Only the first moments (mean values) of the H, S, and V channels directly reflect the changes in color depth of the enzyme-catalyzed reaction, and are the core characterization of the reaction process.

[0027] Identify and remove abnormal frames: Frames that simultaneously meet the following two conditions are identified as interference abnormal frames and removed from the rate sequence; Condition 1: The relative deviation between the measured rate of this frame and the average rate of the two adjacent frames is higher than the preset threshold deviation; Condition 2: The increase in the second moment (variance) of the H and S channels of the ROI region in this frame compared to the previous frame is higher than the preset reference increase. For the removed abnormal frames, linear interpolation is performed using the rate values ​​of the three adjacent frames to complete the sequence, ensuring the temporal continuity of the rate sequence and preventing interruption in the determination of subsequent consecutive frames.

[0028] Using time as the horizontal axis and the first moment in the color feature vector as the vertical axis, the original time-color change curves of each detection item are fitted and generated. Using time as the horizontal axis and the rate of change as the vertical axis, a color change rate curve for each detection item is fitted and generated. The colorimetric reactions for key indicators such as glucose, occult blood, bilirubin, and ketone bodies in urine test strips are all enzymatic reactions. The relationship between their reaction rates and ambient temperature follows the Arrhenius equation. Based on this, a temperature compensation logic is constructed, with the following formula: ;in is the rate constant of the enzyme-catalyzed reaction, and A is the pre-exponential factor (determined by technicians based on the reaction system and remains constant). The activation energy (unit: J / mol, determined by preliminary experiment) of the colorimetric reaction is used to determine the reaction. R is the universal gas constant (fixed value). T is the thermodynamic temperature of the reaction environment, in K (T = 273.15 + t, where t is the temperature in Celsius).

[0029] Based on reference temperature Derive the current temperature The reaction rate correction factor f is obtained by dividing the Arrhenius equation at the two temperatures and eliminating the pre-exponential factor A, resulting in: ; The physical meaning of the reaction rate correction factor is: the reaction rate at the current temperature is f times that at the reference temperature. When T> At high temperatures, when f > 1, the reaction rate increases, and the optimal reaction time decreases; when T < 1, the reaction rate increases, and the optimal reaction time decreases. At low temperatures, f < 1, the reaction rate slows down, and the optimal reaction time is prolonged.

[0030] Additional test item: activation energy of colorimetric reaction The core item calibration values ​​are as follows: glucose 42kJ / mol, occult blood 38kJ / mol, ketone bodies 35kJ / mol, bilirubin 45kJ / mol, and urobilinogen 40kJ / mol.

[0031] The measured color change rate at the current temperature is corrected to eliminate the rate deviation caused by temperature. The correction formula is as follows: ; This is the corrected standard reaction rate; Plateau period determination threshold at preset reference temperature ( Then the judgment threshold at the current temperature. pass ×f is determined; Adaptive thresholds can avoid misjudging the plateau phase due to the fast reaction rate at high temperatures, and missing the plateau phase due to the slow reaction rate at low temperatures.

[0032] The rate of color change after correction of 10 consecutive frames of images ≤ If the condition evaluation coefficient is higher than the preset reference evaluation coefficient, the reaction is determined to have entered the chemical equilibrium plateau phase. The start time of the plateau phase is taken as the end time of the reaction. Combined with the start time of the reaction, the optimal reaction time for the target detection item at the current temperature is determined. The end time of the reaction is the optimal reaction time. The condition evaluation coefficients are obtained by comprehensively processing the overall fluctuation index and saturation compliance rate of 10 frames of images; Extract the first moment sequence of the H channel and the first moment sequence of the S channel of the target detection ROI region from 10 frames of images, and calculate the relative standard deviation of the two channels respectively. The specific calculation process is as follows: Calculate the arithmetic mean of the 10 frame averages of the H channel. ; Calculate the sample standard deviation of the H channel. ; Calculate the relative fluctuation amplitude of the H channel. ; Following the same logic, the relative fluctuation amplitude of channel S was calculated. .

[0033] The maximum relative fluctuation amplitude of the two channels is taken as the comprehensive fluctuation index; Using the end frame of 10 frames as the judgment frame, calculate the similarity between the ROI to be tested in the judgment frame and the seven levels of the standard colorimetric card after temperature correction. Take the standard colorimetric card level corresponding to the minimum similarity as the current best matching level, and extract the average value of the S channel of the standard colorimetric card corresponding to the best matching level. The saturation compliance rate is obtained by calculating the ratio between the mean first moment of the S-channel of the judgment frame and the mean first moment of the S-channel of the best matching level. The ratio is calculated by using the mean of the first-order moments of the S-channel of the judgment frame as the numerator and the mean of the first-order moments of the S-channel of the best matching level as the denominator.

[0034] The formula for the conditional evaluation coefficient is as follows: After normalizing the comprehensive fluctuation index and saturation compliance rate, the reference indexes preset in the medical testing scenario are combined; the reference indexes include the reference relative fluctuation amplitude and reference saturation compliance rate of the two channels. Conditional evaluation coefficient ; , These represent the maximum relative fluctuation amplitudes of the H channel and the S channel, respectively. , These represent the reference relative fluctuation ranges corresponding to the H and S channels, respectively.

[0035] Indicates the saturation compliance rate. Indicates the reference saturation compliance rate; to These are preset weighting coefficients, and their sum is one.

[0036] Additional information: If the test strip fails to meet the criteria for plateauing, it will be deemed invalid, triggering an alert and prompting the user to retest.

[0037] S5: Integrate the original image of the target analysis frame at the best reaction time of each project, the nine-dimensional color feature vector, the matching color level, the concentration quantification, and the time-color change curve, and fill them into the pre-edited report template to generate a urine test report.

[0038] Example 2

[0039] Please see Figure 2 As shown, based on the image processing-based urine test strip color change recognition method provided in Embodiment 1 of this application, Embodiment 2 of this application proposes an image processing-based urine test strip color change recognition method. Embodiment 2 is merely a preferred embodiment of Embodiment 1, and the implementation of Embodiment 2 will not affect the individual implementation of Embodiment 1.

[0040] Specifically, the urine test strip color change recognition system based on image processing provided in Embodiment 2 of this application includes: The acquisition module is used to perform dynamic video acquisition and key frame static image acquisition of the entire reaction process between the urine test strip and the urine sample; to acquire the reaction environment temperature in real time; and to calibrate the reaction start time. The feature extraction module is used to automatically locate and segment the overall area of ​​the test strip and each test strip pad ROI through preset positioning marks, complete the color space conversion of the ROI image, and extract and output a nine-dimensional color feature vector. The temperature correction module is used to perform temperature correction of the color characteristics of the standard colorimetric card and temperature compensation correction of the enzyme-catalyzed reaction rate based on the real-time collected reaction environment temperature. The matching and quantification module is used to calculate the color similarity between the test paper and the temperature-corrected standard colorimetric card, complete the matching and classification between the test paper and the standard colorimetric card, output the matching color level, and output the concentration quantification result of the test item based on the matching result. The reaction kinetics analysis module is used to analyze the entire reaction process video frame by frame, fit and generate time-color change curves and color change rate curves, and combine temperature compensation logic to determine the optimal reaction time and the optimal reaction moment target image frame for each detection item. The report generation module is used to integrate test data and generate standardized urine test reports.

[0041] The above formulas are all dimensionless calculations. Dimensionless calculations can be performed using various methods such as standardization, which will not be elaborated here. The formulas are derived from software simulations based on a large amount of collected data, and the preset parameters in the formulas can be set by those skilled in the art according to the actual situation.

[0042] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, ATA hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. The semiconductor medium can be a solid-state ATA hard disk.

[0043] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0044] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0045] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0046] 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; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0047] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0048] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion 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 this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable ATA hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0049] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for recognizing color changes in urine test strips based on image processing, characterized in that, include: S1: Perform dynamic video acquisition and key frame static image acquisition of the entire reaction process between urine test strip and urine sample, collect the reaction environment temperature in real time, and simultaneously complete the calibration of the reaction start time; S2: Automatically locate and segment the overall area of ​​the test strip and each test strip pad ROI by using preset positioning marks. After converting the segmented test strip pad ROI images from RGB to HSV color space, and combining them with the reaction environment temperature correction processing, output a nine-dimensional color feature vector. Use the nine-dimensional color feature vector to calculate the similarity between the color of each test strip pad ROI and the color of the temperature-corrected standard colorimetric card. S3: Using the standard colorimetric card that comes with the urine test strip, each test item corresponds to 7 color levels. Each level corresponds to a unique clinical concentration value and the temperature-corrected HSV channel standard mean value. Through pre-edited fusion classification logic, the color of each test strip ROI is matched and classified with the temperature-corrected standard colorimetric card. Combining the similarity of the temperature-corrected color vector, the matching color level and concentration quantification of each urine test item are output. S4: Extract the color feature vector of each test pad frame by frame from the video of the entire reaction process, fit and generate the time-color change curve corresponding to each test item, construct the enzyme reaction temperature compensation logic for each item based on the Arrhenius equation, analyze and determine the optimal reaction time of each test item at the current temperature, and extract the target image frame corresponding to the optimal reaction time. The process of determining the optimal reaction time; The temperature compensation logic is as follows: ;in Let A be the rate constant of the enzyme-catalyzed reaction, and A be the pre-exponential factor. The activation energy of the colorimetric reaction of the test item is used, where R is the universal gas constant and T is the thermodynamic temperature of the reaction environment; Based on reference temperature Derive the current temperature The reaction rate correction factor f is obtained by dividing the Arrhenius equation at the two temperatures and eliminating the pre-exponential factor A, resulting in: ; Correct for the measured rate of color change at the current temperature: ; The corrected standard reaction rate; the plateau determination threshold at the preset reference temperature. Then the judgment threshold at the current temperature pass ×f is determined; The rate of color change after correction of 10 consecutive frames of images ≤ If the condition evaluation coefficient is higher than the preset reference evaluation coefficient, the reaction is determined to have entered the chemical equilibrium plateau period. The start time of the plateau period is taken as the end time of the reaction. Combined with the start time of the reaction, the optimal reaction time for the target detection item at the current temperature is determined. The end time of the reaction is the optimal reaction time.

2. The urine test strip color change recognition method based on image processing according to claim 1, characterized in that: Logic for constructing a nine-dimensional color feature vector; The segmented ROI image is converted from the original RGB color space to the HSV color space, where the HSV color space outputs three channel parameters: hue (H), saturation (S), and lightness (V). For the three channels of the HSV color space, the first, second, and third moments are extracted respectively to form a nine-dimensional color moment feature vector.

3. The urine test strip color change recognition method based on image processing according to claim 2, characterized in that: Correction was performed based on the ambient temperature of the reaction environment; Based on the current reaction environment temperature, a pre-edited environment correction logic is used for correction, and the correction formula is as follows: ,in The nine-dimensional color feature vector of the standard colorimetric card at the preset reference temperature. This is the correction coefficient matrix corresponding to the current temperature T. This is the color feature vector of the standard colorimeter card after correction at the current temperature; The environmental correction logic involves pre-storing correction coefficient matrices for different reaction ambient temperatures, and then matching the corresponding correction coefficient matrix after reading the current reaction ambient temperature.

4. The urine test strip color change recognition method based on image processing according to claim 3, characterized in that: Similarity calculation process; The similarity between the colors of each test strip pad and the temperature-corrected standard colorimetric card was calculated using weighted Euclidean distance. The calculation formula is: ; in, , , The average value of the three channels of HSV for each test strip pad. , , This represents the average of the three HSV channels of the standard colorimetric card color patch after temperature correction. , , The preset weighting coefficients for each channel.

5. The urine test strip color change recognition method based on image processing according to claim 4, characterized in that: The logic for determining the matching color level; The similarity between the test paper and all seven levels of color patches on the standard color chart is calculated sequentially. Based on the preset similarity reference value, the matching color level of the test paper is determined. Select color patch grades with similarity less than the similarity reference value, and then locate the color patch grade with the lowest similarity as the matching color grade of the test paper.

6. The urine test strip color change recognition method based on image processing according to claim 5, characterized in that: The logic for determining concentration quantification; When there are two or more groups of color patch grades that are less than the similarity reference value, the absolute difference between the minimum similarity and the second minimum similarity is calculated and recorded as the adjacent difference. If the adjacent difference is less than the preset adjacent reference difference, the concentration quantification is determined by interpolation calculation. Otherwise, the clinical concentration value of the color patch grade corresponding to the minimum similarity is directly used as the concentration quantification. Interpolation calculation is performed using the formula Quantitative concentration was obtained through calculation ;in and The clinical concentration values ​​for the color patch levels corresponding to the least similarity and the second least similarity are given. and These represent the minimum similarity value and the second minimum similarity.

7. The urine test strip color change recognition method based on image processing according to claim 6, characterized in that: The process of determining the time-color change curve; Using the calibrated reaction start time as the zero point and the duration as the step size, the entire reaction process video is analyzed frame by frame, and a nine-dimensional color feature vector is extracted from the test strip pad for each time frame. The first moment of the nine-dimensional color feature vector between adjacent frames is extracted and Euclidean distance is calculated to obtain the rate of color change per unit time. , The Euclidean distance is the first moment of the color feature vectors of adjacent frames. The time interval between adjacent frames; Using time as the horizontal axis and the first moment in the color feature vector as the vertical axis, the original time-color change curves of each detection item are fitted and generated. By using time as the horizontal axis and the rate of change as the vertical axis, a color change rate curve for each detection item is generated through fitting.

8. The urine test strip color change recognition method based on image processing according to claim 7, characterized in that: Logic for calculating conditional evaluation coefficients; The condition evaluation coefficients are obtained by comprehensively processing the overall fluctuation index and saturation compliance rate of 10 frames of images; Extract the first moment sequences of the H channel and the first moment sequences of the S channel of the target detection ROI region from 10 frames of images, and calculate the relative standard deviation of the two channels respectively; take the maximum value of the relative fluctuation amplitude of the two channels as the comprehensive fluctuation index; Using the end frame of 10 frames as the judgment frame, calculate the similarity between the ROI to be tested in the judgment frame and the seven levels of the standard colorimetric card after temperature correction. Take the standard colorimetric card level corresponding to the minimum similarity as the current best matching level, and extract the average value of the S channel of the standard colorimetric card corresponding to the best matching level. The saturation compliance rate is obtained by calculating the ratio between the mean first moment of the S-channel of the judgment frame and the mean first moment of the S-channel of the best matching level.

9. A urine test strip color change recognition system based on image processing, applied to the urine test strip color change recognition method based on image processing as described in any one of claims 1-8, characterized in that, include: The acquisition module is used to perform dynamic video acquisition and key frame static image acquisition of the entire reaction process between the urine test strip and the urine sample; Real-time acquisition of the reaction environment temperature; simultaneous calibration of the reaction initiation time; The feature extraction module is used to automatically locate and segment the overall area of ​​the test strip and each test strip pad ROI through preset positioning marks, complete the color space conversion of the ROI image, and extract and output a nine-dimensional color feature vector. The temperature correction module is used to perform temperature correction of the color characteristics of the standard colorimetric card and temperature compensation correction of the enzyme-catalyzed reaction rate based on the real-time collected reaction environment temperature. The matching and quantification module is used to calculate the color similarity between the test paper and the temperature-corrected standard colorimetric card, complete the matching and classification between the test paper and the standard colorimetric card, output the matching color level, and output the concentration quantification result of the test item based on the matching result. The reaction kinetics analysis module is used to analyze the entire reaction process video frame by frame, fit and generate time-color change curves and color change rate curves, and combine temperature compensation logic to determine the optimal reaction time and the optimal reaction moment target image frame for each detection item. The report generation module is used to integrate test data and generate standardized urine test reports.

Citation Information

Patent Citations

  • Color measurement algorithm of urine test strip

    CN109557093A

  • Urine test paper analysis device and detection method thereof

    CN117849043A