An enzyme test paper recognition method based on image recognition

By combining image recognition methods based on color and shape features, the problem of low recognition accuracy of enzyme test strips has been solved, achieving efficient, fast, and real-time recognition of enzyme test strips, which is suitable for small devices.

CN116778193BActive Publication Date: 2026-03-27NANKAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-26
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In existing technologies, enzyme test strips for non-professionals to perform self-tests suffer from low recognition accuracy, slow speed, and low efficiency. Furthermore, deep learning algorithms are difficult to implement on small devices, making it difficult to meet the demand for high-precision and rapid recognition.

Method used

An image recognition-based enzyme test strip identification method is adopted. By combining color and shape features, Euclidean distance and K-means clustering are used for image segmentation. An HS plane grid model and a color recognition model are established to obtain the color and shape features of the test strip image, calculate the accuracy probability, and finally obtain the identification result through weighted operation.

Benefits of technology

It improves the accuracy and speed of enzyme test strip recognition, is suitable for small-scale equipment applications, reduces resource consumption, and meets the requirements for high precision and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116778193B_ABST
    Figure CN116778193B_ABST
Patent Text Reader

Abstract

The application provides an enzyme test paper recognition method based on image recognition, which comprises the following steps: acquiring a test paper image, converting a single test paper pad image from an RGB color space to an HIS color space, and extracting shape features and color features; training a color recognition model by a grid method based on Euclidean distance through the color features, recognizing a test paper image sample by using the color recognition model, and calculating an accurate probability of a color recognition result; recognizing a shape by an image segmentation method based on K-means clustering through the shape features, and obtaining an accurate probability of shape recognition; obtaining a final classification probability by a weighting operation of the color probability and the shape probability, re-ranking an original result, and obtaining a final recognition result of the test paper image to be recognized. The application fuses color and shape double features of enzyme test paper, can realize fast and accurate recognition of enzyme test paper images, and improves the accuracy of enzyme test paper image recognition.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application is designed in the field of artificial intelligence, and particularly designed as an enzyme test paper recognition method based on image recognition. BACKGROUND

[0002] With the continuous development and progress of medicine, designing different types of test papers and their high-precision recognition methods is of great help to improve the efficiency and accuracy of medical work, and as more and more test paper detection methods emerge, test paper detection is expected to be separated from the medical environment and operated by non-professionals to make preliminary judgments on the condition. However, there is a certain professional and technical threshold for non-professional self-test paper, which may cause difficulty in judgment and even misidentification, and an automatic test paper detection method with high recognition accuracy, speed, efficiency and real-time performance is needed to obtain the best test paper recognition result.

[0003] Currently, in the field of artificial intelligence, neural networks and other deep learning algorithms are mainly used, and such methods mostly have high complexity, occupy more resources, and have high requirements for hardware systems, which are difficult to implement on high-precision, fast and small devices, and a single method is aimed at a single index (such as color, shape, etc.), and the recognition accuracy is low. SUMMARY

[0004] In order to solve the above technical problems, the purpose of the present application is to provide an enzyme test paper recognition method based on image recognition, which mainly aims to provide a high-precision, fast, efficient and real-time specific enzyme test paper detection method and a software solution for the recognition device of the specific enzyme test paper, and to improve the speed and accuracy of the specific enzyme test paper recognition.

[0005] To achieve the above purpose, the present application provides an enzyme test paper recognition method based on image recognition, comprising:

[0006] Obtaining a test paper image, performing test paper pad positioning and light supplementing on the image after scaling, obtaining a single test paper pad image sample, converting the single test paper pad image from RGB color space to HIS color space, and extracting color features and shape features;

[0007] Training a color recognition model based on the Euclidean distance grid method through color features, establishing an HS (hue saturation) plane, and dividing the plane into several grids according to a specified threshold; obtaining average color feature values of the test paper image samples used for training to form a feature coordinate point, and storing the feature coordinate point in the corresponding grid of the HS plane;

[0008] The color concentration samples of various feature coordinate points in the non-empty sub-division in the HS plane are counted, the center point coordinate value of each color concentration is calculated and stored in the corresponding sub-division; and the sub-divisions within a certain distance threshold around the feature coordinate point are assigned the concentration of the feature coordinate point, and the sub-divisions with existing center points are not assigned, to obtain a color recognition model;

[0009] The color recognition model is used to recognize the test paper image sample, the average color feature value of the test paper image sample is obtained to form a test feature coordinate point, it is judged in which sub-division the test feature coordinate point falls, and all the center points in the sub-division are compared to find the center point with the minimum Euclidean distance from the test feature coordinate point;

[0010] If there is no center point in the sub-division where the test feature coordinate point is located, the adjacent sub-division is searched with the point as the center, and the distance comparison is performed again until the center point with the minimum distance is found, and the accuracy probability of the color recognition result is calculated;

[0011] The shape feature is recognized by the image segmentation method based on K-means clustering to obtain a binary segmentation image of the test paper image sample, the pixels of the binary segmentation image are clustered in H and I channels, the clustering number is set to 2, the average values of the H and I channels are used as the initial clustering center μ1, the Euclidean distance between the pixels in the binary segmentation image and the initial clustering center is calculated, and the pixels are assigned to the nearest center according to the shortest distance principle;

[0012] The test paper image sample is clustered, the clustering center position is updated, and the average vector of each class is used as the new clustering center by the clustering formula; the distance calculation between the pixel points of the binary segmentation image and the updating of the clustering center are repeatedly performed until the center point no longer changes or the iteration threshold is reached, to obtain the accuracy probability of the shape recognition result;

[0013] The accuracy probability of the color recognition result and the accuracy probability of the shape recognition result are obtained by a weighting operation to obtain the final classification probability, the original result is re-ranked, and the final recognition result of the test paper image is obtained.

[0014] Further, the test paper image is obtained, the image is cropped according to a proportion, and the test paper pad positioning and light supplementing are performed, to obtain a single test paper pad image sample, the single test paper pad image is converted from the RGB color space to the HIS color space, and the color feature and the shape feature are extracted, including:

[0015] The test paper image is obtained by a camera, the image is scaled, cropped and segmented according to a proportion;

[0016] Positioning the test paper pad image, performing light compensation on the test paper pad with reference to the blank pad to obtain a single test paper pad image sample including the background;

[0017] Converting the single test paper pad image from the RGB color space to the HIS color space, and arranging the H, I, and S values of all pixels in the single test paper pad image to be between 0 and 240, to extract color features and shape features.

[0018] Further, a color recognition model is trained by color features based on a grid method based on Euclidean distance, an HS (hue saturation) plane is established, and the plane is divided into a plurality of grids according to a specified threshold value, average color feature values of the test paper image samples used for training are obtained to form a feature coordinate point, and the feature coordinate point is stored in the corresponding grid of the HS plane, including:

[0019] An HS (hue saturation) plane is established, and the plane is divided into a plurality of grids according to a specified threshold value based on the number of training samples, the more the number of training samples, the smaller the specified threshold value;

[0020] Average color feature values, including average hue, average brightness, and average saturation, of the test paper image samples used for training are obtained to form a feature coordinate point C a (h a ,i a ,s a ), and the feature coordinate point is stored in the corresponding grid of the HS plane.

[0021] Further, color concentration samples of various feature coordinate points in the non-empty grids in the HS plane are counted, center point coordinate values of each color concentration are calculated, and the center point coordinate values are stored in the corresponding grid as a color concentration output;

[0022] Color concentration samples of various feature coordinate points in the non-empty grids in the HS plane are counted, center point coordinate values of each color concentration are calculated, and the center point coordinate values are stored in the corresponding grid as a color concentration output;

[0023] The feature coordinate point is taken as the center, and the grids within a certain distance threshold value around the feature coordinate point are assigned the concentration of the feature coordinate point, so as to enrich the number of non-empty grids of the HS plane and increase the accuracy of the recognition result, wherein the grid threshold value is determined based on the number of training samples;

[0024] The color recognition model, i.e., the HS plane with the assigned values, is obtained.

[0025] Further, the color recognition model is used to recognize the test paper image sample, average color feature values of the test paper image sample are obtained, a test feature coordinate point is formed, it is judged that the test feature coordinate point falls in which grid, and all center points in the grid are compared to find the center point with the minimum Euclidean distance from the test feature coordinate point, comprising:

[0026] Average color feature values of the test paper image sample are obtained, including average hue, average brightness and average saturation, a feature coordinate point P f (h f ,i f ,s f ) is formed.

[0027] It is judged that the feature coordinate point P f (h f ,i f ,s f ) falls in which grid, and distance comparison is performed with all center points C a (h a ,i a ,s a ) in the grid, and the center point with the minimum distance d from the test feature coordinate point is found.

[0028] Further, if there is no center point in the grid where the test feature coordinate point is located, the adjacent grid is searched with the point as the center, and distance comparison is performed again until the center point with the minimum distance is found, and the accuracy probability of the color recognition result is calculated, comprising:

[0029] If there is no center point in the grid where the test feature coordinate point P f (h f ,i f ,s f ) is located, the adjacent grid is searched with the point as the center until a non-empty grid is found.

[0030] The test feature coordinate point P f (h f ,i f ,s f ) is compared with all center points C a (h a ,i a ,s a ) in the non-empty grid until the center point with the minimum distance d from the test feature coordinate point is found, and the accuracy probability of the color recognition result is calculated.

[0031] Further, the shape is identified by the image segmentation method based on K-means clustering through shape features to obtain a binary segmentation image of the test paper image sample, pixels of the binary segmentation image are clustered in H channel and I channel, the number of clusters is set to 2, the average values of the H and I channels are taken as an initial cluster center μ1, the Euclidean distance between the pixels in the binary segmentation image and the initial cluster center is calculated, and the pixels are assigned to the nearest center according to the shortest distance principle, including:

[0032] The boundary parameter of the H channel in the HIS color space of all pixels of the test paper image sample is calculated: the rough segmentation hue threshold of the test paper image sample is determined;

[0033] The binary segmentation image is obtained from the rough segmentation hue threshold: 0 indicates that the pixel is outside the boundary parameter range, and 1 indicates that the pixel is within the boundary parameter range;

[0034] The pixels of the binary segmentation image are clustered in H channel and I channel, and the number of clusters is set to 2, and the average values of the H and I channels are taken as an initial cluster center μ1;

[0035] The Euclidean distance between the pixels of the binary segmentation image and the initial cluster center is calculated, and the pixels are assigned to the nearest center according to the shortest distance principle.

[0036] Further, the test paper image sample is clustered, and the cluster center position is updated, and the average vector of each cluster is taken as a new cluster center by a clustering formula; the distance calculation between the pixels of the binary segmentation image and the update of the cluster center are repeatedly performed until the center point no longer changes or the iteration threshold is reached, to obtain an accurate probability of shape recognition, including:

[0037] The cluster center position is updated, and the average vector of each cluster is taken as a new cluster center by a clustering formula;

[0038] The Euclidean distance calculation between the pixels of the binary segmentation image and the update of the cluster center position are repeatedly performed until the cluster center position no longer changes or the iteration threshold is reached, to obtain an accurate probability of shape recognition result.

[0039] Further, the accurate probability of the color recognition result and the accurate probability of the shape recognition result are obtained through a weighting operation to obtain a final classification probability, the original result is re-ranked, and a final recognition result of the test paper image is obtained, including:

[0040] The accurate probability of the color recognition result and the accurate probability of the shape recognition result are obtained through a weighting operation to obtain a final classification probability;

[0041] determining whether the final probability meets a certain result confidence probability, if yes, outputting the result as the final recognition result, and if no, adding the to-be-recognized test paper into the training set to optimize the training result.

[0042] In the embodiment of the present application, first, the test paper image is acquired, the image is cropped in proportion, and then test paper pad positioning and light supplementing are performed to obtain a single test paper pad image sample. The single test paper pad image is converted from an RGB color space to an HIS color space. The HIS model is more in line with the visual and psychological characteristics of human observation and perception of color than the RGB model, and the description formula of the HIS model is more suitable for computer digital abstraction application. Second, color features and shape features are extracted based on the HIS color space. A color recognition model is trained by a grid method based on Euclidean distance through the color features, an HS (hue saturation) plane is established, and the plane is divided into a plurality of grids according to a specified threshold. The average color feature value of the test paper image sample used for training is obtained to form a feature coordinate point, and the feature coordinate point is stored in the corresponding grid of the HS plane. The color concentration samples of various feature coordinate points in the non-empty grid in the HS plane are counted, the center point coordinate value of each color concentration is calculated, and is stored in the corresponding grid. The grids within a certain distance threshold around the feature coordinate point are assigned the concentration of the feature coordinate point, and the grids with existing center points are not assigned. The color recognition model is obtained. The test paper image sample is identified by using the color recognition model. The average color feature value of the test paper image sample is obtained to form a test feature coordinate point. It is judged in which grid the test feature coordinate point falls, and compared with all the center points in the grid to find the center point with the smallest Euclidean distance from the test feature coordinate point. If there is no center point in the grid where the test feature coordinate point is located, the adjacent grid is searched with the point as the center, and the distance comparison is performed again until the center point with the smallest distance is found. The accuracy probability of the color recognition result is calculated. Compared with neural network and other methods, the grid method based on Euclidean distance has small resource occupation and higher accuracy in recognizing a series of small color differences of similar test paper colors. Further, the image segmentation method based on K-means clustering is used to recognize the shape through the shape features to obtain a binary segmentation image of the test paper image sample. The pixels of the binary segmentation image are clustered in the H channel and the I channel, the clustering number is set to 2, the average values of the H and I channels are used as the initial clustering center μ1, the Euclidean distance between the pixels in the binary segmentation image and the initial clustering center is calculated, and the pixels are assigned to the nearest center according to the shortest distance principle. The test paper image sample is clustered, the clustering center position is updated, and the average vector of each class is used as the new clustering center by the clustering formula. The distance calculation and clustering center updating of the pixels of the binary segmentation image are repeatedly performed until the center point no longer changes or the iteration threshold is reached. The accuracy probability of the shape recognition result is obtained.The image segmentation method based on K-means clustering is relatively simple to realize, and the judgment accuracy of color threshold segmentation can meet the requirements of judging the shape of the effective reaction area of the test paper pad; finally, the final classification probability is obtained by weighting the accurate probability of the color recognition result and the accurate probability of the shape recognition result, the original result is re-ranked, and the final recognition result of the test paper image to be recognized is obtained. Compared with the method of image segmentation by only one feature of color or shape, the accuracy of image recognition is higher, which is suitable for application in test paper recognition technology, and the accuracy of test paper recognition is improved. BRIEF DESCRIPTION OF DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, and the advantages, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, without creative labor, other drawings can also be obtained from these drawings.

[0044] Figure 1 The flow chart of the test paper image recognition method provided by an embodiment of the present application is shown in the figure.

[0045] Figure 2 The detailed flow chart of step S2 in the test paper recognition method provided by an embodiment of the present application is shown in the figure.

[0046] Figure 3 The detailed flow chart of step S3 in the test paper recognition method provided by an embodiment of the present application is shown in the figure.

[0047] Figure 4 The detailed flow chart of step S6 in the test paper recognition method provided by an embodiment of the present application is shown in the figure.

[0048] Figure 5 The detailed flow chart of step S7 in the test paper recognition method provided by an embodiment of the present application is shown in the figure.

[0049] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0050] In order to further illustrate the technical means and effects taken by the present application to achieve the predetermined purpose, the specific implementation, structure, features and effects of the enzyme test paper recognition method based on image recognition according to the present application are described in detail as follows. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. That is, the specific features, structures or characteristics in one or more embodiments can be combined in any form.

[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.

[0052] The specific scheme of the enzyme test paper identification method based on image recognition provided by the application is specifically described below with reference to the drawings.

[0053] Referring to Figure 1 The flowchart of the enzyme test paper identification method based on image recognition provided by an embodiment of the application is shown in the figure, and in the embodiment of the application, the test paper image identification method comprises the following steps S1-S6:

[0054] S1, obtain a test paper image, perform test paper pad positioning and light supplementing and the like on the image after cutting the image according to a proportion, obtain a single test paper pad image sample, and convert the single test paper pad image from an RGB color space to an HIS color space to extract color features and shape features.

[0055] In the embodiment of the application, the test paper image refers to an enzyme test paper composed of four test paper pads with different shapes; in order to identify the color of the test paper, the embodiment first collects a test paper image that has been artificially classified and a test paper image to be identified under the same light source, angle and the like to obtain an RGB image of the test paper.

[0056] In the embodiment of the application, the cutting of the test paper image according to a proportion refers to first arranging the pixels of the test paper image into a specified width-length ratio.

[0057] In the embodiment of the application, the test paper pad positioning and light supplementing and the like are performed to obtain a single test paper pad image sample, which refers to performing test paper pad positioning, automatic light supplementing algorithm and the like in combination with the image recognition device and the electronic equipment, then cutting down the images of the positions of the four test paper pads to obtain an RGB image of a single test paper pad with uniform color including the background;

[0058] In the embodiment of the application, considering that the RGB color space is greatly affected by brightness and does not conform to human eye vision in color representation, and the HIS model separates color information and grayscale information and is more intuitive in the description of the color of the test paper pad picture, the picture is converted to the HIS color space after being obtained by using the RGB color model.

[0059] In the embodiment of the application, considering that a single color identification method has problems such as inaccurate positioning and low accuracy, in order to more accurately describe the color features, the embodiment analyzes the test paper image by fusing the color features and shape features of the test paper pad image.

[0060] The embodiment converts the test paper image to HIS color space according to the three-channel values of each pixel point in the test paper image in the RGB color space, wherein the HIS color space defines the color space from the perspective of being closer to human perception, H represents the hue, which reflects the color system to which the image belongs, such as red, green and blue; I represents the brightness, which refers to the light and dark degree of color, and the closer to black, the lower the brightness, and the closer to white, the higher the brightness; and S represents the saturation, which reflects the purity of the color of the image, such as the high saturation of a bright red image and the low saturation of a dark gray image.

[0061] wherein, after obtaining the picture using the RGB model, the RGB values are first arranged, and all the RGB values are arranged in the interval [0, 255], if a certain R, G or B value is greater than 255, the value is assigned to 255; if a certain RGB value is less than 0, the value is assigned to 0.

[0062] Secondly, the R, G and B values are normalized and converted to the HIS color space, and the specific formula is:

[0063]

[0064] wherein, R∈[0, 255], G∈[0, 255], B∈[0, 255];

[0065]

[0066]

[0067]

[0068] wherein, h represents the normalized hue value, i represents the normalized brightness value, s represents the normalized saturation value, and θ is given by the following formula:

[0069]

[0070] The value range of the normalized h, s and i values calculated by the formula is arranged to [0, 240] to facilitate subsequent calculation, and the specific formula is:

[0071]

[0072] wherein, H represents the hue value, I represents the brightness value, and S represents the saturation value.

[0073] In the embodiment, the pixel points in the test paper image to be recognized and the pixel points in the corresponding HIS image are one-to-one corresponding, and thus the color feature and shape feature extraction are completed.

[0074] S2, training the color recognition model by color features in a grid method based on Euclidean distance, establishing an HS (hue saturation) plane, and dividing the plane into several grids according to a specified threshold; obtaining average color feature values of the test paper image samples used for training to form a feature coordinate point, and storing the feature coordinate point in the corresponding grid of the HS plane.

[0075] As an embodiment of the present application, referring to Figure 2 the color recognition model is trained by color features in a grid method based on Euclidean distance, an HS (hue saturation) plane is established, and the plane is divided into several grids according to a specified threshold; average color feature values of the test paper image samples used for training are obtained to form a feature coordinate point, and the feature coordinate point is stored in the corresponding grid of the HS plane, including the following steps S21-S23:

[0076] S21, specifying a grid threshold according to the number of training samples, the more the number of training samples, the smaller the specified threshold;

[0077] S22, establishing an HS (hue saturation) plane, and dividing the plane into several grids according to a specified threshold;

[0078] S23, obtaining average color feature values of the test paper image samples used for training, including average hue, average saturation and average brightness, to form a feature coordinate point C a (h a ,i a ,s a );

[0079] S24, storing the feature coordinate point C a (h a ,i a ,s a ) in the corresponding grid of the HS plane.

[0080] Among them, the plane is divided into several grids according to a certain rule, which means that the H value and the S value are divided into several squares according to a specified distance threshold, and each square is a grid.

[0081] Further, the feature coordinate point refers to the average color feature value C a (h a ,i a ,s a ) of all pixels in the shape segmentation result of the single test paper pad, and the specific formula is:

[0082]

[0083] Among them, k represents the number of samples in the current grid, h j , ij and s j These are the hue, brightness, and saturation coordinates of the j-th sample, respectively, h a i a and s a These refer to the hue, brightness, and saturation coordinates of the average color feature points of the sample, which are stored in the corresponding cells of the HS plane.

[0084] S3. Collect color concentration samples of various feature coordinate points in the non-empty grids in the HS plane, calculate the center point coordinate value of each color concentration, and store it in the corresponding grid; and take the feature coordinate point as the center, assign the concentration value of the feature coordinate point to the grids within a certain distance threshold around it, and do not assign a value to the grids with existing center points, so as to obtain the color recognition model.

[0085] As an embodiment of the present invention, reference is made to... Figure 3 As shown,

[0086] S31. Collect color concentration samples of various feature coordinate points in the non-empty grids in the HS plane, calculate the center point coordinate value of each color concentration, and store it in the corresponding grid.

[0087] S32. Specify the distance threshold according to the number of training samples. The more training samples there are, the smaller the threshold can be specified.

[0088] S33. Assign the concentration of the non-empty cell's characteristic coordinate point to the cells within a certain distance threshold around the non-empty cell, and do not assign a value to cells with a center point.

[0089] S34. Obtain the color recognition model, i.e., the assigned HS plane.

[0090] Once all feature coordinate points are filled, for all cells in the HS plane that are not empty, the center point coordinates of that cell are calculated and stored in the corresponding cell as a color density output.

[0091] Furthermore, taking the non-empty grid as the center, the color concentration value of the center coordinate point is assigned to the surrounding grids within a specified distance threshold. Non-empty grids cannot be assigned values ​​again. Assigning values ​​can enrich the number of non-empty grids in the HS plane, increasing the accuracy of the recognition results. The color recognition model trained based on the Euclidean distance grid method is the HS plane with assigned values.

[0092] In this embodiment of the invention, the samples used for training the color recognition model are manually classified enzyme test strip images of known concentration, which can ensure the accuracy of model training.

[0093] S4, using the color recognition model to recognize the test paper image sample, obtaining the average color feature value of the test paper image sample, forming a test feature coordinate point, judging which grid the test feature coordinate point falls in, and comparing with all center points in the grid to find the center point with the minimum Euclidean distance from the test feature coordinate point.

[0094] In one embodiment of the application, the average color feature value of the test paper image sample is obtained to form a test feature coordinate point P f (h f ,i f ,s f ), judging which grid the test feature coordinate point falls in, and comparing with all center points C a (h a ,i a ,s a ) in the grid to find the center point with the minimum Euclidean distance d from the test feature coordinate point, and the specific formula is:

[0095]

[0096] S5, if there is no center point in the grid where the test feature coordinate point is located, search the adjacent grid with the point as the center, and then compare the distances until the center point with the minimum distance is found, and the accuracy probability of the color recognition result is calculated.

[0097] In the embodiment of the application, if there is no center point in the grid where the test feature coordinate point P f (h f ,i f ,s f ) is located, search the adjacent grid with the point as the center.

[0098] Wherein, when searching, the test feature coordinate point is taken as the center to search the HS plane, first search the eight surrounding grids, if there is no non-empty grid, search the twelve surrounding grids outside the eight surrounding grids, and so on, until a non-empty grid is found.

[0099] Further, compare the distances until the center point with the minimum distance is found.

[0100] In the embodiment of the application, the accuracy probability of the color recognition result is obtained by the ratio of the distance between the to-be-recognized feature point and different center points in the grid or the surrounding grid, that is, the accuracy probability P c of the color recognition result.

[0101] S6, identifying the shape by shape features to obtain a binary segmentation image of the test paper image sample, clustering the pixels of the binary segmentation image in the H channel and the I channel, setting the clustering number to 2, taking the average values of the H channel and the I channel as an initial clustering center μ1, calculating the Euclidean distance between the pixels in the binary segmentation image and the initial clustering center, and distributing them to the nearest center according to the shortest distance principle.

[0102] In the embodiment of the application, the shape feature refers to the hue value H and the brightness value I,

[0103] As an embodiment of the application, referring to Figure 4 The shape is identified by shape features based on K-means clustering image segmentation method to obtain a binary segmentation image of the test paper image sample, the pixels of the binary segmentation image are clustered in the H channel and the I channel, the clustering number is set to 2, the average values of the H channel and the I channel are taken as an initial clustering center μ1, the Euclidean distance between the pixels in the binary segmentation image and the initial clustering center is calculated, and they are distributed to the nearest center according to the shortest distance principle, comprising the following steps S41-S46:

[0104] S41, calculating the boundary parameters of the H channel in the HSI color space of the test paper image sample: determining the single test paper pad rough segmentation hue threshold;

[0105] S42, obtaining a binary segmentation image of the test paper image sample from the hue threshold, wherein 0 represents that the pixel is outside the boundary parameter range, and 1 represents that the pixel is within the boundary parameter range;

[0106] S43, clustering the pixels of the binary segmentation image in the H channel and the I channel, setting the clustering number to 2, and taking the average values of the H channel and the I channel as an initial clustering center μ1;

[0107] S44, calculating the Euclidean distance between the pixels in the binary segmentation image and the initial clustering center, and distributing them to the nearest center according to the shortest distance principle.

[0108] Wherein, the boundary parameters of the H channel refer to the average value Mean(H min ) and the standard deviation std(H min ) of the minimum hue, the average value Mean(H max ) and the standard deviation std(H max ) of the maximum hue.

[0109] Wherein, the single test paper pad rough segmentation hue threshold is given by the following formula:

[0110]

[0111] Wherein, Ymin represents the minimum threshold of the rough segmentation hue of a single test paper pad, and Ymax represents the maximum threshold of the rough segmentation hue of a single test paper pad.

[0112] Further, the initial clustering center refers to taking the average value of the two channels H and I as an initial clustering center A clustering center is generated by using K-means++

[0113] S7, the test paper image sample is clustered, the clustering center position is updated, the average vector of each category is taken as a new clustering center by a clustering formula, the distance calculation between the pixel points of the binaryzation segmented image is repeatedly updated, and the clustering center is repeatedly updated until the center point no longer changes or the iteration threshold is reached, so that the accurate probability of the shape recognition result is obtained, and the shape recognition result is obtained, as shown in the accompanying drawings Figure 5 , comprising the following steps S51-S56:

[0114] S51, the clustering center position is updated, and the average vector of each category is taken as a new clustering center by a clustering formula;

[0115] S52, the distance calculation between the pixel points of the binaryzation segmented image is repeatedly updated, and the clustering center is repeatedly updated until the center point no longer changes or the iteration threshold is reached;

[0116] S53, the ratio of the pixels of different shapes to the pixels of a single test paper pad is taken as the shape recognition result output, and the accurate probability P of the shape recognition result is obtained d .

[0117] Further, the clustering center position is updated, and the average vector of each category is taken as a new clustering center by a clustering formula, and the specific formula is:

[0118]

[0119] Wherein represents a new clustering center, n represents the number of pixel points in the corresponding clustering cluster, and X refers to the pixel point of the sample X.

[0120] S8, the accurate probability of the color recognition result and the accurate probability of the shape recognition result are obtained through a weighting operation to obtain a final classification probability, the original result is re-ranked, and the final recognition result of the test paper image to be recognized is obtained.

[0121] In an embodiment of the present application, the accurate probability of the color recognition result and the accurate probability of the shape recognition result are obtained through a weighting operation to obtain a final classification probability, and the original result is re-ranked, and the specific formula is:

[0122] Pnew = P c - ε * max[(P d - σ), 0]

[0123] wherein P new represents the final classification probability of the test paper pad image to be identified, P c represents the color probability of the test paper pad image to be identified, and P d represents the shape probability of the test paper pad image to be identified. ε represents the weight of the influence of the shape difference on the result, σ represents the shape difference threshold value that needs to be re-identified, and max[(P d - σ), 0] represents that when the difference P d between the shape features is less than σ, it is considered that the difference between the shape probability information is not large, and the initial identification result will not be affected, so the influence of the shape probability difference on the original result is ignored; when the difference P d between the shape probabilities is greater than σ, ε is taken as the weight of the influence of the shape probability difference on the original identification result, and the initial probability is re-identified through the shape probability difference to obtain the re-identified result.

[0124] In the embodiment of the present application, first, the test paper image is acquired, the image is cropped in proportion, and then test paper pad positioning and light supplementing are performed to obtain a single test paper pad image sample. The single test paper pad image is converted from an RGB color space to an HIS color space. The HIS model is more in line with the visual and psychological characteristics of human observation and perception of color than the RGB model, and the description formula of the HIS model is more suitable for computer digital abstraction application. Second, color features and shape features are extracted based on the HIS color space. A color recognition model is trained by a grid method based on Euclidean distance through the color features, an HS (hue saturation) plane is established, and the plane is divided into a plurality of grids according to a specified threshold. The average color feature value of the test paper image sample used for training is obtained to form a feature coordinate point, and the feature coordinate point is stored in the corresponding grid of the HS plane. The color concentration samples of various feature coordinate points in the non-empty grid in the HS plane are counted, the center point coordinate value of each color concentration is calculated, and is stored in the corresponding grid. The grids within a certain distance threshold around the feature coordinate point are assigned the concentration of the feature coordinate point, and the grids with existing center points are not assigned. The color recognition model is obtained. The test paper image sample is identified by using the color recognition model. The average color feature value of the test paper image sample is obtained to form a test feature coordinate point. It is judged in which grid the test feature coordinate point falls, and compared with all the center points in the grid to find the center point with the smallest Euclidean distance from the test feature coordinate point. If there is no center point in the grid where the test feature coordinate point is located, the adjacent grid is searched with the point as the center, and the distance comparison is performed again until the center point with the smallest distance is found. The accuracy probability of the color recognition result is calculated. Compared with neural network and other methods, the grid method based on Euclidean distance has small resource occupation and higher accuracy in recognizing a series of small color differences of similar test paper colors. Further, the image segmentation method based on K-means clustering is used to recognize the shape through the shape features to obtain a binary segmentation image of the test paper image sample. The pixels of the binary segmentation image are clustered in the H channel and the I channel, the clustering number is set to 2, the average values of the H and I channels are used as the initial clustering center μ1, the Euclidean distance between the pixels in the binary segmentation image and the initial clustering center is calculated, and the pixels are assigned to the nearest center according to the shortest distance principle. The test paper image sample is clustered, the clustering center position is updated, and the average vector of each class is used as the new clustering center by the clustering formula. The distance calculation and clustering center updating of the pixels of the binary segmentation image are repeatedly performed until the center point no longer changes or the iteration threshold is reached. The accuracy probability of the shape recognition result is obtained.The image segmentation method based on K-means clustering is relatively simple to realize, and the judgment accuracy of color threshold segmentation can meet the requirements of judging the shape of the effective reaction area of the test paper pad; finally, the accurate probability of the color recognition result and the accurate probability of the shape recognition result are obtained through a weighting operation to obtain the final classification probability, the original result is re-ranked, and the final recognition result of the test paper image to be recognized is obtained. Compared with the method of image segmentation by only one feature of color or shape, the accuracy of image recognition is higher, which is suitable for application in test paper recognition technology, and the accuracy of test paper recognition is improved.

[0125] It should be understood that the embodiments are only for illustration, and the scope of the patent application is not limited by the structure.

[0126] It is obvious for those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and the present application can be realized in other specific forms without departing from the spirit or essential characteristics of the present application.

[0127] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, the scope of the present application is defined by the appended claims rather than the above description, and therefore all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application. Any additional reference signs in the claims should not be considered as limiting the claims involved.

[0128] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The plurality of units or devices stated in the system claims can also be realized by one unit or device through software or hardware. The second word is used to indicate the name, and does not mean any specific order.

[0129] Finally, it should be pointed out that the above embodiments are only used to illustrate the technical solutions of the present application and are not limiting, although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A method for identifying enzyme test strips based on image recognition, characterized in that, The method includes: Acquire test strip images, crop the images proportionally, and perform processing such as test strip pad positioning and supplemental lighting to obtain a single test strip pad image sample. Convert the single test strip pad image from RGB color space to HIS color space and extract color and shape features. A color recognition model is trained using a grid method based on Euclidean distance based on color features. A hue saturation HS plane is established and the plane is divided into several grids according to a specified threshold. The average color feature value of the test strip image samples used for training is obtained to form a feature coordinate point, and the feature coordinate point is stored in the corresponding grid of the HS plane. Collect color concentration samples of various feature coordinate points in the non-empty grids in the HS plane, calculate the center point coordinate value of each color concentration, and store it in the corresponding grid; and take the feature coordinate point as the center, assign the concentration value of the feature coordinate point to the grids within a certain distance threshold around it, and do not assign values ​​to the grids with existing center points, so as to obtain the color recognition model. The color recognition model is used to identify the test paper image sample. The average color feature value of the test paper image sample is obtained to form a test feature coordinate point. It is determined which grid the test feature coordinate point falls in and compared with all the center points in the grid to find the center point with the smallest Euclidean distance to the test feature coordinate point. If there is no center point in the grid where the feature coordinate point to be tested is located, then search for adjacent grids with that point as the center, and then compare the distances until the center point with the smallest distance is found, and calculate the accurate probability of the color recognition result. Shape features are identified using K-means clustering-based image segmentation to obtain a binarized segmented image of the test paper sample. The pixels of the binarized segmented image are clustered using the H and I channels, with the number of clusters set to 2. The average value of the H and I channels is used as the initial cluster center μ1. The Euclidean distance between the pixels in the binarized segmented image and the initial cluster center is calculated, and the pixels are assigned to the nearest center according to the principle of shortest distance. The test paper image samples are clustered, and the cluster center positions are updated. The average vector of each category is used as the new cluster center by the clustering formula. The distance between pixels of the binarized segmented image is calculated and the cluster center is updated repeatedly until the center point no longer changes or the iteration threshold is reached, so as to obtain the accurate probability of the shape recognition result. The accurate probabilities of the color recognition results and the accurate probabilities of the shape recognition results are weighted to obtain the final classification probability. The original results are then re-ranked to obtain the final recognition result of the test strip image to be recognized.

2. The enzyme test strip identification method based on image recognition as described in claim 1, characterized in that, Acquire test strip images, crop the images proportionally, and then perform processing such as test strip pad positioning and supplemental lighting to obtain individual test strip pad image samples. Convert the individual test strip pad image from RGB color space to HIS color space, and extract color and shape features, including: The test strip image is captured by a camera, and the image is scaled, cropped, and segmented proportionally. The test strip pad image is located, and the test strip pad is illuminated with reference to the blank pad to obtain a single test strip pad image sample including the background. The image of a single test pad is converted from the RGB color space to the HIS color space, and the H, I, and S values ​​of all pixels in the single test pad image are sorted to the range of [0-240] to extract color and shape features.

3. The enzyme test strip identification method based on image recognition as described in claim 1, characterized in that, A color recognition model is trained using a grid-based method based on Euclidean distance to identify color features. An HS (Hue / Saturation) plane is established and divided into several grids according to a specified threshold. Average color feature values ​​are obtained from test strip image samples used for training, forming feature coordinate points. These feature coordinate points are then stored in the corresponding grids of the HS plane. Establish an HS (Hue Saturation) plane, specify the segment threshold according to the number of training samples. The more training samples there are, the smaller the threshold can be specified. Divide the plane into several segments according to the specified threshold. The average color feature values, including average hue, average brightness, and average saturation, are obtained from the test strip image samples used for training, forming a feature coordinate point C. a (h a i a , s a The feature coordinates are then stored in the corresponding grid of the HS plane.

4. The enzyme test strip identification method based on image recognition as described in claim 1, characterized in that, Collect color concentration samples of various feature coordinate points in the non-empty grids within the HS plane, calculate the center point coordinate value of each color concentration, and store it in the corresponding grid; then, using the feature coordinate point as the center, assign the concentration value of that feature coordinate point to the grids within a certain distance threshold around it, leaving the grids with existing center points unassigned, to obtain a color recognition model, including: Collect color density samples of various feature coordinate points in the non-empty grids in the HS plane, calculate the center point coordinate value of each color density, and store the center point coordinate value in the corresponding grid as a color density output; Using the feature coordinate point as the center, the grids within a certain distance threshold around it are assigned the concentration value of the feature coordinate point to enrich the number of non-empty grids in the HS plane and increase the accuracy of the recognition results. The grid threshold is determined by the number of training samples. Obtain the color recognition model, i.e., the assigned HS plane.

5. The enzyme test strip identification method based on image recognition as described in claim 1, characterized in that, The color recognition model is used to identify the test paper image sample. The average color feature value of the test paper image sample is obtained to form a test feature coordinate point. It is determined which grid cell the test feature coordinate point falls in, and compared with all center points in that grid cell. The center point with the smallest Euclidean distance to the test feature coordinate point is found, including: The average color feature values ​​of the test paper image sample are obtained, including average hue, average brightness, and average saturation, forming a feature coordinate point P. f (h f i f , s f ); Determine the feature coordinate point P f (h f i f , s f ) Which cell does it fall in, and what are the center points C of that cell? a (h a i a , s a The distance is compared to find the center point that is the smallest distance d from the coordinate point of the feature to be measured.

6. The enzyme test strip identification method based on image recognition as described in claim 1, characterized in that, If there is no center point in the grid cell containing the feature coordinate point to be tested, then search for adjacent grid cells with that point as the center, and compare the distances until the center point with the smallest distance is found. Calculate the accuracy probability of the color recognition result, including: If the coordinates of the feature point to be measured are P f (h f i f , s f If there is no center point in the cell where the cell is located, then search for adjacent cells with that point as the center until a non-empty cell is found. The coordinate point P of the feature to be measured f (h f i f , s f ) and all center points C in the non-empty grid a (h a i a , s a The comparison continues until the center point with the smallest distance d from the coordinate point of the feature to be tested is found, and the accuracy probability of the color recognition result is calculated.

7. The enzyme test strip identification method based on image recognition as described in claim 1, characterized in that, Shape features are identified using K-means clustering-based image segmentation to obtain a binarized segmented image of the test paper sample. Pixels in the binarized segmented image are clustered using the H and I channels, with a cluster size of 2. The average value of the H and I channels is used as the initial cluster center μ1. The Euclidean distance between pixels in the binarized segmented image and the initial cluster center is calculated, and pixels are assigned to the nearest center based on the shortest distance principle, including: Calculate the boundary parameters of the H channel in the HIS color space of all pixels of the test paper image sample: determine the coarse segmentation hue threshold of the test paper image sample; The binarized segmented image is obtained from the coarse segmentation tone threshold: where 0 indicates that the pixel is outside the boundary parameter range, and 1 indicates that the pixel is within the boundary parameter range; The pixels of the binarized segmented image are clustered using the H and I channels, with the number of clusters set to 2, and the average value of the H and I channels is used as an initial cluster center μ1. Calculate the Euclidean distance between the pixels of the binarized segmented image and the initial cluster center, and assign them to the nearest center according to the principle of shortest distance.

8. The enzyme test strip identification method based on image recognition as described in claim 1, characterized in that, Cluster the test paper image samples, update the cluster center positions, and use the average vector of each category as the new cluster center using the clustering formula; repeatedly calculate the distance between pixels in the binarized segmented image and update the cluster centers until the center points no longer change or the iteration threshold is reached, to obtain the accurate probability of shape recognition, including: Update the cluster center positions by using the average vector of each cluster category as the new cluster center according to the clustering formula; The Euclidean distance between pixels in the binarized segmented image is calculated and the cluster center position is updated repeatedly until the cluster center position no longer changes or the iteration threshold is reached, thus obtaining the accurate probability of the shape recognition result.

9. The enzyme test strip identification method based on image recognition as described in claim 1, characterized in that, The accurate probabilities of the color recognition result and the shape recognition result are weighted to obtain the final classification probability. The original results are then re-ranked to obtain the final recognition result of the test strip image to be recognized, including: The final classification probability is obtained by weighting the accurate probabilities of the color recognition result and the accurate probabilities of the shape recognition result. Determine whether the final classification probability matches the certain probability of a certain result. If it matches, output the result as the final identification result. If it does not match, add the test strip to be identified to the training set to optimize the training results.

Citation Information

Patent Citations

  • Image identification method and system for test strip

    CN103984964A

  • Urine analysis method based on smartphone photographing and detection card

    CN115575391A