Hemolysis recognition method and device, electronic equipment and storage medium
By performing grayscale processing and color analysis on blood sample images, hemolysis can be accurately identified, solving the problem of low efficiency in traditional human eye recognition and achieving high efficiency and accuracy in automated hemolysis identification.
Patent Information
- Application Number
- CN202511042695.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-28
- Publication Date
- 2025-11-18
AI Technical Summary
In existing technologies, blood samples may undergo hemolysis during storage and processing, leading to abnormal experimental results. Furthermore, traditional methods rely on human visual observation for identification, which is inefficient, lacks standards, and cannot effectively identify hemolysis in automated equipment.
By acquiring blood sample images, converting them into grayscale images, using a sliding window to calculate the average grayscale value, determining the peak position, selecting the hemolysis identification area, and using a color mapping matrix to determine the color score, hemolysis is identified when preset conditions are met.
It achieves efficient and accurate hemolysis identification, improves identification efficiency and accuracy, is suitable for automated equipment, and overcomes the shortcomings of human eye recognition.
Smart Images

Figure CN120976524A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, electronic device, and storage medium for identifying hemolysis. Background Technology
[0002] In experiments involving the extraction of peripheral blood mononuclear cells (PBMCs) from blood samples, hemolysis can occur if the blood samples are stored in a blood bank and the temperature and humidity during storage are not strictly controlled, or if the blood samples are not handled properly during collection. Hemolysis in blood samples can lead to abnormal experimental results or discrepancies in the required sample quantity during subsequent experiments. The traditional method involves centrifuging the blood sample and then visually observing the hemolysis status of the supernatant plasma. This method relies on human vision and intuition, lacks a standard for measuring hemolysis quality, has low accuracy, cannot be used in automated equipment, and has low efficiency. Summary of the Invention
[0003] This invention proposes a hemolysis identification method, device, electronic device, and storage medium, aiming to at least partially solve one of the technical problems in related technologies. This invention can accurately identify hemolysis.
[0004] On one hand, embodiments of the present invention provide a method for identifying hemolysis, including:
[0005] Acquire a blood sample image of the blood sample to be identified, and convert the blood sample image into a grayscale image;
[0006] The average gray value of each image row is obtained by iterating through and counting the gray values of each image row using a sliding window.
[0007] The peak position is determined based on the average gray value of each image row, and the hemolysis identification area is selected in the blood sample image based on the peak position;
[0008] Based on the color values of each pixel in the hemolysis detection region, the color score of each color category is determined using a color mapping matrix;
[0009] When the color score of the hemolysis recognition area meets the preset conditions, it is determined that the blood sample to be identified has undergone hemolysis.
[0010] Optionally, before the step of converting the blood sample image to a grayscale image, the method further includes the following steps:
[0011] Get the selection matrix parameters; the selection matrix parameters include the coordinates of the top left corner of the selection matrix, the height of the selection matrix, and the width of the selection matrix;
[0012] The region of interest is determined in the blood sample image based on the bounding box matrix parameters, and the blood sample image is then cropped according to the region of interest.
[0013] Optionally, before the step of converting the blood sample image to a grayscale image, the method further includes the following steps:
[0014] Obtain the orientation angle of the blood sample image;
[0015] Based on the angle difference between the orientation angle and the target angle, the blood sample image is subjected to coordinate rotation transformation.
[0016] Optionally, the average gray value of each image row in the grayscale image is obtained by iterating through and statistically analyzing the grayscale values using a sliding window, including the following steps:
[0017] Initialize the target image rows;
[0018] Boundary determination is performed based on the boundary conditions of the target image rows and the sliding window to obtain the window boundary of the sliding window in the target image rows; the window boundary includes a first boundary and a second boundary.
[0019] Based on the window boundaries and the image width of the grayscale image, the grayscale values of all pixels in the grayscale image of the target image row are summed and averaged to obtain the initial average grayscale value of the target image row.
[0020] The initial average gray value is inverted to obtain the target average gray value of the target image row;
[0021] The expression for the target average gray value is:
[0022]
[0023] In the formula, hiss represents the average grayscale value of the target; W represents the image width of the grayscale image; s y Indicates the first boundary; e y The second boundary is represented; G[i][j] represents the grayscale value of the pixel in the i-th row and j-th column;
[0024] The target image rows are incremented based on a preset row step size, and the process returns to perform the boundary determination step based on the boundary conditions of the target image rows and the sliding window, until the target image rows have been traversed to the grayscale image.
[0025] Optionally, boundary determination is performed based on the boundary conditions of the target image row and the sliding window to obtain the window boundary of the sliding window in the target image row, including the following steps:
[0026] The first determination value is obtained based on the difference between the target image row and half the preset height of the sliding window;
[0027] When the first judgment value is less than 0, the first boundary is set to 0; when the first judgment value is greater than or equal to 0, the first boundary is set to the first judgment value.
[0028] The expression for the first boundary is:
[0029]
[0030] In the formula, s y Indicates the first boundary; y represents the processed image row; H se Indicates the preset height of the sliding window;
[0031] The second determination value is obtained by summing the target image row with half the preset height of the sliding window;
[0032] When the second determination value is greater than the image height of the grayscale image, the second boundary is set to the image height; when the second determination value is less than or equal to the image height of the grayscale image, the second boundary is set to the second determination value.
[0033] The expression for the second boundary is:
[0034]
[0035] In the formula, e y The second boundary is indicated; H represents the image height of the grayscale image; y represents the processed image row; H se Indicates the preset height of the sliding window;
[0036] If the first boundary is greater than or equal to the second boundary, set the second boundary to the first boundary plus 1.
[0037] Optionally, the peak position is determined based on the average gray value of each image row, including the following steps:
[0038] When the average gray value of the target image row is greater than or equal to the preset minimum peak height, and the average gray value of the adjacent image rows of the target image row is less than or equal to the average gray value of the target image row, the target image row is determined to be a candidate peak.
[0039] Based on preset constraints, all candidate peak values are filtered to obtain the target peak value;
[0040] The peak position is determined based on the image row where the target peak is located.
[0041] Optionally, all candidate peaks are filtered based on preset constraints, including the following steps:
[0042] Based on the preset minimum peak prominence, all candidate peaks are screened by prominence constraint;
[0043] The expression for the prominence constraint is:
[0044]
[0045] In the formula, h[p] represents the average gray value of the image row p where the candidate peak is located; W len The default saliency window length is represented by h[i], which represents the average gray value of image row i. min This indicates the minimum prominence of the peak value.
[0046] Optionally, the hemolysis identification region is selected in the blood sample image based on the peak position, including the following steps:
[0047] The upper boundary of the region is determined by the sum of the peak position and the first step value;
[0048] The lower boundary candidate value is determined based on the sum of the peak position and the second step value;
[0049] If the current boundary candidate value is greater than the lower height boundary of the blood sample image, the lower boundary of the region is determined based on the lower height boundary. If the current boundary candidate value is less than or equal to the lower height boundary of the blood sample image, the lower boundary of the region is determined based on the lower boundary candidate value.
[0050] The hemolysis identification region is extracted from the blood sample image based on the upper and lower boundaries of the region.
[0051] Optionally, based on the color values of each pixel in the hemolysis detection region, a color score for each color category is determined using a color mapping matrix, including the following steps:
[0052] Based on the color values of each pixel in the hemolysis detection area, the index value of the corresponding pixel is calculated using a preset formula;
[0053] The color values include blue channel values, green channel values, and red channel values; the expression for the index value is:
[0054] i(x,y)=r(x,y)+16·g(x,y)+256·b(x,y)
[0055] In the formula, i(x,y) represents the index value of pixel (x,y); I red (x,y) represents the red channel value of pixel (x,y); I green (x,y) represents the green channel value of pixel (x,y); I blue (x,y) represents the blue channel value of pixel (x,y); This indicates a round-down operation;
[0056] Based on the index value, the color score of each pixel for each color category is determined by using a color mapping matrix.
[0057] Optionally, when the color score of the hemolysis recognition area meets preset conditions, it is determined that the blood sample to be identified has undergone hemolysis, including the following steps:
[0058] The color scores of all pixels in the hemolysis detection area are averaged to obtain the average score of the target category.
[0059] When the sum of the average scores of all target categories is greater than a set threshold, it is determined that the blood sample to be identified has hemolysis.
[0060] On the other hand, embodiments of the present invention provide a hemolysis detection device, comprising:
[0061] The image acquisition module is used to acquire blood sample images of the blood sample to be identified and convert the blood sample images into grayscale images;
[0062] The gray-scale averaging module is used to iterate and count the gray values of each row in a grayscale image using a sliding window, and obtain the average gray value of each row.
[0063] The hemolysis selection module is used to determine the peak position based on the average gray value of each image row, and to select the hemolysis recognition area in the blood sample image according to the peak position;
[0064] The color mapping module is used to determine the color score of each color category based on the color value of each pixel in the hemolysis recognition area using a color mapping matrix.
[0065] The hemolysis determination module is used to determine that the blood sample to be identified has hemolyzed when the color score of the hemolysis recognition area meets the preset conditions.
[0066] Optionally, the device also includes a selection and cropping module for performing the following operations:
[0067] Get the selection matrix parameters; the selection matrix parameters include the coordinates of the top left corner of the selection matrix, the height of the selection matrix, and the width of the selection matrix;
[0068] The region of interest is determined in the blood sample image based on the bounding box matrix parameters, and the blood sample image is then cropped according to the region of interest.
[0069] Optionally, the device further includes a rotation transformation module for performing the following operations:
[0070] Obtain the orientation angle of the blood sample image;
[0071] Based on the angle difference between the orientation angle and the target angle, the blood sample image is subjected to coordinate rotation transformation.
[0072] On the other hand, embodiments of the present invention provide an electronic device, including: a processor and a memory; the memory is used to store a program; the processor executes the program to implement the above-described hemolysis identification method.
[0073] On the other hand, embodiments of the present invention provide a computer storage medium storing a processor-executable program, which, when executed by a processor, is used to implement the above-described hemolysis identification method.
[0074] This invention acquires a blood sample image of the blood sample to be identified and converts it into a grayscale image. A sliding window is used to iterate and statistically analyze the grayscale values of each row in the grayscale image to obtain the average grayscale value of each row. Peak positions are determined based on the average grayscale values of each row, and hemolysis identification regions are selected within the blood sample image based on these peak positions. Color scores for each color category are determined using a color mapping matrix based on the color values of each pixel within the hemolysis identification region. When the color scores of the hemolysis identification region meet preset conditions, hemolysis is confirmed in the blood sample to be identified. This invention, for blood sample images of the blood sample to be identified, uses grayscale processing to construct a histogram by iterating and statistically analyzing the average grayscale values. It then further selects identification regions by determining peak positions and finally achieves hemolysis identification through color matrix mapping and color score determination. Compared to traditional methods, this invention can achieve hemolysis identification efficiently and accurately. Attached Figure Description
[0075] The accompanying drawings are provided to further understand the technical solutions of the present invention and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the technical solutions of the present invention, and do not constitute a limitation on the technical solutions of the present invention.
[0076] Figure 1 This is a schematic diagram of an implementation environment for hemolysis identification provided in an embodiment of the present invention;
[0077] Figure 2 A flowchart illustrating a hemolysis identification method provided in an embodiment of the present invention;
[0078] Figure 3 A schematic diagram illustrating an application embodiment of the hemolysis identification method provided in this invention;
[0079] Figure 4 This is a schematic diagram illustrating the unfolded process of step S200 provided in an embodiment of the present invention;
[0080] Figure 5 This is a schematic diagram illustrating the expanded process for determining the peak position according to an embodiment of the present invention;
[0081] Figure 6 A schematic diagram illustrating the expansion process of the hemolysis recognition region selection according to an embodiment of the present invention;
[0082] Figure 7 This is a schematic diagram illustrating the unfolded process of step S500 provided in an embodiment of the present invention;
[0083] Figure 8 A schematic diagram illustrating an example of a hemolyzed blood sample image provided in an embodiment of the present invention;
[0084] Figure 9 This is a schematic diagram of the structure of a hemolysis identification device provided in an embodiment of the present invention;
[0085] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0086] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0087] It should be noted that although functional modules are divided in the system diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100," "second / S200," etc., in the specification, claims, and the aforementioned figures are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0088] In this invention, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this invention can be combined with other embodiments.
[0089] like Figure 1 The diagram shown is a schematic representation of an implementation environment provided by an embodiment of the present invention. (Refer to...) Figure 1 The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected via a network, either wirelessly or via a wired connection, to complete data transmission and exchange.
[0090] Server 101 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0091] Additionally, server 101 can also be a node server in a blockchain network. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms.
[0092] Terminal 102 can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. Terminal 102 and server 101 can be directly or indirectly connected via wired or wireless communication, and this embodiment of the invention does not impose any limitations.
[0093] Exemplary based on Figure 1 The implementation environment shown in this embodiment of the invention provides a hemolysis identification method. The following description uses the application of this hemolysis identification method in terminal 102 as an example. It can be understood that this hemolysis identification method can also be applied in server 101.
[0094] Reference Figure 2 , Figure 2 This is a flowchart illustrating a hemolysis detection method applied to a terminal according to an embodiment of the present invention. The executing entity of this hemolysis detection method can be any of the aforementioned computer devices (including servers or terminals). (Refer to...) Figure 2 The method includes the following steps:
[0095] S100: Obtain the blood sample image of the blood sample to be identified, and convert the blood sample image into a grayscale image;
[0096] Exemplary examples, such as in some specific implementations, Figure 3 As shown, a camera 310 can be used to capture images of the blood sample 320 after gradient centrifugation. In some optional embodiments, a camera backlight 330 can be set to highlight the blood sample layer boundaries when the camera captures layered images, facilitating subsequent image processing. In addition, the camera light source can also be changed to a front light source or a combination of front and back light sources, etc.
[0097] In some embodiments, before converting the blood sample image into a grayscale image, the method may further include the following steps: obtaining bounding matrix parameters; the bounding matrix parameters include the coordinates of the upper left corner of the bounding matrix, the height of the bounding matrix, and the width of the bounding matrix; determining the region of interest in the blood sample image based on the bounding matrix parameters, and cropping the blood sample image according to the region of interest.
[0098] For example, in some specific embodiments, in order to accurately locate the region of the blood sample to be identified in the blood sample image to avoid interference from other image regions, the region of interest (ROI) can be obtained based on the bounding rectangle parameter; that is, the region where the layer height information needs to be identified. Specifically, the expression for the ROI region is:
[0099] ROI = BGR[r y ≤y≤r y +r h ,r x ≤x≤r x +r w ]
[0100] Where BGR represents the original color image, ROI represents the selected ROI image, and r y This indicates the y-coordinate (vertical coordinate) of the top-left corner of the selected rectangle, r. x This indicates the x-coordinate (horizontal coordinate) of the top-left corner of the selected rectangle, r. h The height of the selected rectangle is represented by r. w This indicates the width of the rectangle to be selected.
[0101] It should be noted that the beneficial effects of the embodiments of this application are mainly as follows: by cropping the key area according to the bounding box matrix parameters in the preprocessing stage, the efficiency (speed) of subsequent image processing and analysis is greatly improved, and the background noise interference is effectively shielded. This significantly improves the accuracy and reliability (precision) of the core steps of hemolysis identification (grayscale statistics, peak positioning, and region bounding box selection), while maintaining the flexibility and adaptability of the solution.
[0102] It should be understood that if the target image initially includes only the area of the blood sample to be identified, then there is no need to crop the image during image processing.
[0103] In some embodiments, before converting the blood sample image into a grayscale image, the method may further include the following steps: obtaining the orientation angle of the blood sample image; and performing a coordinate rotation transformation on the blood sample image based on the angle difference between the orientation angle and the target angle.
[0104] For example, in some specific implementations, the orientation angle can be determined first based on a specific structure in the target image. For instance, taking a blood sample image as an example, the orientation angle can be determined by the bottom or opening of the test tube containing the blood sample. Then, the target image is subjected to coordinate rotation transformation based on a preset target angle (e.g., the test tube needs to be in a vertical direction with the opening facing upwards).
[0105] It should be noted that the beneficial effects of the embodiments of this application are mainly as follows: by pre-correcting the tilt angle of the blood sample image, systematic errors caused by improper sample placement in subsequent key steps (grayscale statistics, peak location, and region selection) are eliminated, significantly improving the accuracy of grayscale analysis, the precision of the selected region, and the reliability of the final hemolysis determination result, greatly enhancing the robustness and adaptability of the entire technical solution in practical applications. This is an important preprocessing step to ensure that the core recognition logic remains effective under non-ideal imaging conditions. Furthermore, it should be noted that the advantages of the embodiments of this application also lie in the fact that the camera installation angle is not limited, allowing the image to be rotated as needed, whether the shooting direction is horizontal or vertical, to ensure that the image rows are strictly aligned with the actual layering direction of the target object, regardless of the orientation.
[0106] It should be understood that because the angle at which the blood sample image is captured by the installation structure of the blood sample image acquisition device (such as a camera) is at an angle to the vertical direction, the image needs to be rotated during image processing. If the installation structure is changed so that the angle of the captured blood sample image is the same as the vertical direction, then the image does not need to be rotated during image processing.
[0107] Specifically, taking the angle at which the camera mounting structure captures a blood sample image as being at a 90° angle to the vertical direction (i.e., the angle difference) as an example, the rotation coordinate transformation can achieve the following:
[0108]
[0109] Where, x ′ y ′ The coordinates represent the image after rotation, x and y represent the coordinates of the image before rotation, and H represents the height of the image before rotation. After rotation, the height and width of the image are swapped.
[0110] S200. Use a sliding window to iterate and count the gray values of each image row in the grayscale image to obtain the average gray value of each image row.
[0111] It should be noted that in some embodiments, such as Figure 4 As shown, step S200 may include the following steps:
[0112] S201. Initialize the target image row;
[0113] S202. Based on the boundary conditions of the target image row and the sliding window, perform boundary determination to obtain the window boundary of the sliding window in the target image row; wherein, the window boundary includes a first boundary and a second boundary;
[0114] S203. Based on the window boundaries and the image width of the grayscale image, sum and average the grayscale values of all pixels in the grayscale image of the target image row to obtain the initial average grayscale value of the target image row.
[0115] S204. Invert the initial average gray value to obtain the target average gray value of the target image row.
[0116] The expression for the target average gray value is:
[0117]
[0118] In the formula, hiss represents the average grayscale value of the target; W represents the image width of the grayscale image; s y Indicates the first boundary; e y The second boundary is represented; G[i][j] represents the grayscale value of the pixel in the i-th row and j-th column;
[0119] S205. Increment the target image rows based on the preset row step size, and return to the step of performing boundary determination based on the boundary conditions of the target image rows and the sliding window, until the target image rows have been traversed to the grayscale image.
[0120] For example, in some specific implementations, calculating the average grayscale value of each row or interval row in the image based on the sliding window can be specifically implemented as follows: Among them, e y and s y Let W represent the window boundary, and G ∈ R. h×w G[i][j] represents the pixel grayscale value in the i-th row and j-th column, ranging from 0 to 255. In addition, S can be set as the step size of the row where the average grayscale value needs to be calculated, and 1 means that the average grayscale value is calculated for each row.
[0121] It should be noted that the beneficial effects of the embodiments of this application are mainly as follows: the accuracy of sliding window statistics in the entire image range (especially the edges) is ensured by boundary processing, and the key physical gray-scale change features (falling edge) are transformed into mathematical features (peaks) that are easy for standard algorithms to identify by clever gray-scale value inversion, which significantly improves the accuracy, efficiency and reliability of subsequent "peak position" determination, thereby ensuring the accuracy and robustness of the entire hemolysis identification core process (based on peak selection area and color analysis).
[0122] In some embodiments, step S202 may include the following steps: obtaining a first determination value based on the difference between the target image row and half the preset height of the sliding window; setting a first boundary to 0 when the first determination value is less than 0, and setting the first boundary to the first determination value when the first determination value is greater than or equal to 0; obtaining a second determination value based on the sum of the target image row and half the preset height of the sliding window; setting a second boundary to the image height when the second determination value is greater than the image height of the grayscale image, and setting the second boundary to the second determination value when the second determination value is less than or equal to the image height of the grayscale image; and setting the second boundary to the first boundary plus 1 when the first boundary is greater than or equal to the second boundary.
[0123] For example, in some specific implementations, the window boundary s y and e y Defined as:
[0124]
[0125] Where y represents the current image row being processed, y∈{0,S,2S,…,H-1}, and H represents the image height. se Indicates the height of the sliding window; if s y ≥e y Then force e y =s y +1.
[0126] It should be noted that the beneficial effects of the embodiments of this application are mainly as follows: by using pre-designed boundary determination rules, especially for handling critical overlap situations, the problem of out-of-bounds access and invalid windows that may occur when the sliding window performs row statistics at the image edge is fundamentally solved. This not only ensures that the data basis for calculating the average gray value of all image rows is accurate and secure, eliminating potential runtime errors, but also significantly improves the stability and reliability of the entire gray-scale statistics step and even the subsequent peak determination stage. It is a key guarantee to ensure that the technical solution can operate correctly and robustly on various real image data.
[0127] S300: Determine the peak position based on the average gray value of each image row, and select the hemolysis recognition area in the blood sample image according to the peak position;
[0128] It should be noted that, as Figure 5As shown, in some embodiments, determining the peak position based on the average gray value of each image row may include the following steps: S311, when the average gray value of the target image row is greater than or equal to a preset minimum peak height, and the average gray values of the adjacent image rows of the target image row are all less than or equal to the average gray value of the target image row, the target image row is determined to be a candidate peak; S312, all candidate peaks are filtered based on preset constraints to obtain the target peak; S313, the peak position is determined according to the image row where the target peak is located.
[0129] For example, in some specific implementations, peak values and corresponding widths are found based on the average gray values of image rows, wherein the average gray value at point p that satisfies the following condition is identified as a peak value:
[0130]
[0131] Where h[p] is the average gray value of image row p, h[p-1] and h[p+1] are the average gray values of image rows p-1 and p+1 respectively, H min This is the set minimum height for the peak value.
[0132] It should be noted that the beneficial effects of this application's embodiments mainly lie in the following: by introducing the concept of candidate peaks and combining them with preset constraints for fine screening, a robust peak detection mechanism is constructed. This effectively overcomes the shortcomings of simple local maximum detection, which is susceptible to noise interference, and significantly improves the ability to accurately and reliably locate key feature peaks (hemolysis boundaries) in complex blood sample images. This significantly enhances the accuracy and robustness of the core component (peak localization) of the entire hemolysis identification technology solution, providing a crucial guarantee for the reliability of the final judgment result. This design reflects a thorough consideration of complex interference factors in practical application scenarios.
[0133] In some embodiments, step S312 may include the following steps: performing prominence constraint screening on all candidate peaks based on a preset minimum peak prominence.
[0134] The expression for the prominence constraint is:
[0135]
[0136] In the formula, h[p] represents the average gray value of the image row p where the candidate peak is located; W len The default saliency window length is represented by h[i], which represents the average gray value of image row i. min This indicates the minimum prominence of the peak value.
[0137] In addition, in some alternative implementations, the identified peaks also need to satisfy spacing constraints:
[0138] |pq|≥D min
[0139] Where p and q are two adjacent peak values identified, and D min This is the minimum spacing between adjacent peak values.
[0140] It should be noted that the beneficial effects of the embodiments of this application are mainly as follows: by introducing the "minimum peak prominence" constraint in the candidate peak screening stage, the quality of peak detection is significantly improved. It goes beyond basic local maxima and absolute height judgments, filtering out insignificant artifacts and noise by quantifying the relative prominence of peaks, ensuring that the finally located target peak has high reliability and physical meaning (i.e., truly corresponds to a significant hemolysis feature boundary). This is a key improvement in enhancing the accuracy and anti-interference capability of the core step (peak localization) of the entire technical solution, and is particularly suitable for complex and variable blood sample images in practical applications.
[0141] It should also be noted that in some embodiments, such as Figure 6 As shown, the hemolysis identification region is obtained by selecting a bounding box in the blood sample image based on the peak position, which may include the following steps: S321, determine the upper boundary of the region based on the sum of the peak position and the first step value; S322, determine the candidate value of the lower boundary based on the sum of the peak position and the second step value; S323, if the candidate value of the lower boundary is greater than the lower height boundary of the blood sample image, determine the lower boundary of the region based on the lower height boundary; if the candidate value of the lower boundary is less than or equal to the lower height boundary of the blood sample image, determine the lower boundary of the region based on the candidate value of the lower boundary; S324, extract the hemolysis identification region from the blood sample image based on the upper boundary and the lower boundary of the region.
[0142] For example, in some specific implementations, selecting the image region for hemolysis detection (i.e., the hemolysis detection region) based on peak values can achieve the following:
[0143] y1=p+K1
[0144] y2 = min(y1 + K2, H)
[0145] ROI hemolysis =ROI[y1≤y≤y2]
[0146] Where y1 represents the upper boundary of the hemolysis recognition image region, K1 represents the preset first step value; y2 represents the lower boundary of the hemolysis recognition image region, K2 represents the preset second step value, and H represents the lower boundary of the blood sample image height; ROI hemolysis This represents the image region used for hemolysis identification that is cropped from the blood sample image (or the processed blood sample image if it has been pre-cropped or rotated).
[0147] It should be noted that the beneficial effects of the embodiments of this application are mainly as follows: Parametric positioning ensures the accuracy of the relative position of the hemolysis identification region and the key peak (boundary), and proactive lower boundary overshoot checking and forced correction completely solves the image boundary problem, ensuring the safety and validity of the bounding box selection operation in all sample cases. This provides an accurate, complete, and reliable analysis region for subsequent hemolysis determination based on color values, which is a key link in improving the practicality and robustness of the entire technical solution.
[0148] S400: Based on the color values of each pixel in the hemolysis recognition region, the color score of each color category is determined using a color mapping matrix;
[0149] It should be noted that in some embodiments, step S400 may include the following steps:
[0150] S401. Based on the color values of each pixel in the hemolysis detection region, calculate the index value of the corresponding pixel using a preset formula; wherein, the color values include blue channel values, green channel values, and red channel values; the expression for the index value is:
[0151] i(x,y)=r(x,y)+16·g(x,y)+256·b(x,y)
[0152] In the formula, i(x,y) represents the index value of pixel (x,y); I red (x,y) represents the red channel value of pixel (x,y); I green (x,y) represents the green channel value of pixel (x,y); I blue (x,y) represents the blue channel value of pixel (x,y); This indicates a round-down operation;
[0153] S402. Based on the index value, use the color mapping matrix to determine the color score of each color category for each pixel.
[0154] For example, in some specific implementations, the hemolysis detection region is indexed based on the RGB values of each pixel, and color scores are mapped from the color mapping matrix based on the index values, which can be achieved as follows:
[0155]
[0156] i(x,y)=r(x,y)+16·g(x,y)+256·b(x,y)
[0157] scores(x,y) = S[i(x,y)]
[0158] Among them, I blue (x,y), I green (x,y), I red (x,y) represent the B, G, and R channel values of a pixel, respectively. S is a color mapping matrix, a 4096×11 array, representing the probability distribution of various preset color categories, obtained from training on actual images. scores(x,y) is an array of color scores for each preset color at pixel (x,y).
[0159] It should be noted that the beneficial effects of this application's embodiments mainly lie in the following: by introducing index value calculation and a color mapping matrix, the complex multi-channel color space analysis and scoring problem is transformed into an efficient one-dimensional lookup table operation. This not only significantly improves processing speed, but more importantly, it provides a highly flexible, configurable, and consistent mechanism to quantify pixel color features and map them to hemolysis-related categories. This lays an accurate, reliable, and efficient computational foundation for the final hemolysis determination based on "color scores meeting preset conditions," representing a key optimization of this technical solution in the color analysis stage.
[0160] S500: When the color score of the hemolysis recognition area meets the preset conditions, it is determined that the blood sample to be identified has undergone hemolysis.
[0161] It should be noted that in some embodiments, such as Figure 7 As shown, step S500 may include the following steps:
[0162] S501. Average the color scores of the target category for all pixels in the hemolysis recognition area to obtain the average score of the target category;
[0163] For example, in some specific implementations, the average of the various color scores for all pixels is first calculated:
[0164]
[0165] Where score represents the average color score, scores(i,j) represents the color score of pixel (i,j), w is the width of the hemolysis recognition region, and h is the height of the hemolysis image recognition.
[0166] S502. When the sum of the average scores of all target categories is greater than a set threshold, it is determined that the blood sample to be identified has hemolysis.
[0167] For example, in some specific implementations, based on the color characteristics of the hemolyzed sample, the average values of the three color scores (brown, orange, and red) can be added together. If the sum is greater than a set threshold, the blood sample is considered to have hemolyzed; otherwise, it is not hemolyzed.
[0168] It should be noted that the beneficial effects of this application's embodiments mainly lie in the following: by employing a strategy of regional averaging and multi-category score summation, massive amounts of pixel-level color information are robustly and comprehensively aggregated into a single quantitative indicator reflecting the overall hemolysis characteristics, and a final determination is made by comparing it with a preset threshold. This effectively overcomes the noise sensitivity problem of pixel-level analysis, comprehensively considers multiple color features related to hemolysis, significantly improves the reliability, stability, and applicability of the hemolysis determination results to actual complex samples, and provides an accurate and reliable final decision output for the entire technical solution.
[0169] To explain in detail the principle of the technical solution of the present invention, the overall process of the present invention will be described below with reference to some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and should not be regarded as a limitation of the present invention.
[0170] First, it should be noted that existing technologies propose training a hemolysis detection model using several sets of blood images and their corresponding label information. This model is then used to process the collected actual blood images to obtain the hemolysis detection results. The drawback of this method is that training the model requires a large set of blood images with corresponding label information. Furthermore, if the label information for even some images in the training set is incorrect, it will lead to model errors and problems with the entire detection result.
[0171] In view of the shortcomings of existing technologies, the present invention provides a technical solution for hemolysis identification, such as... Figure 3 As shown, embodiments of the present invention can use a camera to capture images of blood samples after gradient centrifugation; specifically, a backlight can be set for the camera to highlight the blood sample layer boundaries when capturing layered images, facilitating subsequent image processing. Furthermore, the camera light source can also be changed to a front light source or a combination of front and back light sources, among other light source configurations. Based on... Figure 3 The application scenarios shown can be implemented through the following process:
[0172] 1. Use a camera to acquire images of the centrifuged blood sample, such as... Figure 8 As shown.
[0173] 2. Obtain the ROI (Region of Interest) of the image based on the bounding rectangle parameters; that is, the region where layer height information needs to be identified.
[0174] ROI = BGR[r y ≤y≤r y +r h ,r x ≤x≤r x +r w ]
[0175] Where BGR represents the original color image, ROI represents the selected ROI image, and r y This indicates the y-coordinate of the top-left corner of the rectangle to be selected, r. x This indicates the x-coordinate of the top-left corner of the rectangle being selected, r h The height of the selected rectangle is represented by r. w This indicates the width of the rectangle to be selected.
[0176] 3. Rotate the ROI image 90° clockwise, and the coordinate transformation is as follows:
[0177]
[0178] Where, x ′ y ′ The coordinates represent the image after rotation, x and y represent the coordinates of the image before rotation, and H represents the height of the image before rotation. After rotation, the height and width of the image are swapped.
[0179] It should be noted that because the camera mounting structure captures blood sample images at a 90° angle to the vertical direction, image rotation is required during image processing. If the camera mounting structure is changed so that the angle of the captured blood sample images is the same as the vertical direction, image rotation is not required during image processing.
[0180] 4. Convert an RGB image to a grayscale image:
[0181] Gray=0.299·R+0.587·G+0.114·B
[0182] Where Gray is the pixel grayscale value (rounded down), and R, G, and B are the red, green, and blue channel values of the RGB image, respectively.
[0183] 5. Calculate the average gray value of each row or every other row in the image based on the sliding window, and then invert the gray values:
[0184]
[0185] Wherein, window boundary s y and e y Defined as
[0186]
[0187] If s y ≥e y Then force e y =s y +1.
[0188] G∈R h×wG[i][j] represents the grayscale image matrix (G[i][j] represents the pixel grayscale value in the i-th row and j-th column, ranging from 0 to 255);
[0189] S is the step size for the rows where the average gray value needs to be calculated; a value of 1 indicates that the average gray value is calculated for each row. se H represents the height of the sliding window; H and W represent the height and width of the image, respectively.
[0190] 6. Find the peak value and its corresponding width based on the average gray value of the image rows. The average gray value at point p that meets the following condition is identified as the peak value:
[0191]
[0192] Where h[p] is the average gray value of image row p, h[p-1] and h[p+1] are the average gray values of image rows p-1 and p+1 respectively, H min The minimum height of the set peak value;
[0193] The identified peaks need to satisfy the spacing constraint:
[0194] |pq|≥D min
[0195] Where p and q are the peak values of the recognition, and D min This is the minimum spacing between adjacent peak values.
[0196] The identified peaks need to meet the salience constraint:
[0197]
[0198] Where h[p] is the average gray value of the row identified as the peak, p is the identified peak value, and W len To calculate the window length for salience, P min Minimum spurity of peak value
[0199] 7. Select the image region for hemolysis identification based on the peak values:
[0200] y1=p+K1
[0201] y2 = min(y1 + K2, H)
[0202] ROI hemolysis =ROI[y1≤y≤y2]
[0203] Where y1 represents the upper boundary of the hemolysis recognition image region, K1 represents the preset first step value; y2 represents the lower boundary of the hemolysis recognition image region, K2 represents the preset second step value, and H represents the lower boundary of the blood sample image height; ROI hemolysisThis represents the image region used for hemolysis identification, which is cropped from the rotated ROI region image according to the boundaries of y1 and y2.
[0204] 8. Calculate the index value of the hemolysis detection area based on the RGB values of each pixel, and map the color score from the color mapping matrix according to the index value:
[0205]
[0206] i(x,y)=r(x,y)+16·g(x,y)+256·b(x,y)
[0207] scores(x,y) = S[i(x,y)]
[0208] Among them, I blue (x,y), I green (x,y), I red (x,y) represent the B, G, and R channel values of a pixel, respectively. S is a color mapping matrix, a 4096×11 array, representing the probability distribution of various preset color categories, obtained from training on actual images. scores(x,y) is an array of color scores for each preset color at pixel (x,y).
[0209] 9. Calculate the average of all color scores for all pixels:
[0210]
[0211] Where score represents the average color score, scores(i,h) represents the color score of pixel (i,j), w is the width of the hemolysis recognition region, and h is the height of the hemolysis image recognition.
[0212] 10. Sum the average scores of the three colors: brown, orange, and red. If the sum is greater than the set threshold, the blood sample is considered to have hemolyzed; otherwise, no hemolysis has occurred.
[0213] In summary, this invention proposes a technical solution for identifying hemolysis in blood samples. By acquiring images of centrifuged plasma, the degree of hemolysis is identified through image processing methods such as grayscale processing, histogram calculation, peak finding, color matrix mapping, and RGB color value scoring of the hemolytic image region, thereby determining whether hemolysis has occurred in the blood sample. Specifically, this invention determines whether a blood sample is hemolyzed by performing image processing on the plasma image, including grayscale processing, histogram calculation, peak finding, color matrix mapping, and RGB color value scoring of the hemolytic image region. The method is simple and easy to implement, facilitating the classification and processing of blood samples under different conditions in automated equipment.
[0214] On the other hand, such as Figure 9As shown, an embodiment of the present invention provides a hemolysis identification device 900, which may include:
[0215] Image acquisition module 901 is used to acquire blood sample images of the blood sample to be identified and convert the blood sample images into grayscale images;
[0216] The gray-scale averaging module 902 is used to traverse and count the gray values of each image row in the gray-scale image using a sliding window to obtain the average gray value of each image row.
[0217] The hemolysis selection module 903 is used to determine the peak position based on the average gray value of each image row, and to select the hemolysis recognition area in the blood sample image according to the peak position;
[0218] Color mapping module 904 is used to determine the color score of each color category based on the color value of each pixel in the hemolysis recognition area using a color mapping matrix.
[0219] The hemolysis determination module 905 is used to determine that the blood sample to be identified has hemolyzed when the color score of the hemolysis recognition area meets the preset conditions.
[0220] In some embodiments, the apparatus may further include a selection and cropping module for performing the following operations:
[0221] Get the selection matrix parameters; the selection matrix parameters include the coordinates of the top left corner of the selection matrix, the height of the selection matrix, and the width of the selection matrix;
[0222] The region of interest is determined in the blood sample image based on the bounding box matrix parameters, and the blood sample image is then cropped according to the region of interest.
[0223] In some embodiments, the apparatus may further include a rotation transformation module for performing the following operations:
[0224] Obtain the orientation angle of the blood sample image;
[0225] Based on the angle difference between the orientation angle and the target angle, the blood sample image is subjected to coordinate rotation transformation.
[0226] The content of the method embodiments of the present invention is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0227] On the other hand, embodiments of the present invention also provide an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0228] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0229] like Figure 10 As shown, Figure 10 This illustration shows a specific example of the hardware structure of an electronic device 1000 according to one embodiment. The electronic device 1000 includes:
[0230] The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.
[0231] The memory 1002 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001.
[0232] Input / output interface 1003 is used to implement information input and output;
[0233] The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0234] Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004);
[0235] The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.
[0236] The electronic device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0237] The content of the method embodiments of the present invention is applicable to the embodiments of the present electronic device. The specific functions implemented by the embodiments of the present electronic device are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0238] Another aspect of this invention provides a computer-readable storage medium storing a program that is executed by a processor to implement the aforementioned method.
[0239] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD to ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein computer-readable program code is carried. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0240] The content of the method embodiments of the present invention is applicable to the computer-readable storage medium embodiments. The specific functions implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0241] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned method.
[0242] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0243] It should be noted that although several modules for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0244] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of the present invention.
[0245] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented in this invention. Alternative embodiments are contemplated, in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.
[0246] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.
[0247] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0248] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution means, apparatus, or device (such as a computer-based device, a processor-including device, or other means that can fetch and execute instructions from, or in conjunction with, an instruction execution means, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution means, apparatus, or device.
[0249] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0250] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution device. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0251] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0252] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0253] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.
Claims
1. A method for identifying hemolysis, characterized in that, Includes the following steps: Acquire a blood sample image of the blood sample to be identified, and convert the blood sample image into a grayscale image; The average gray value of each image row in the grayscale image is obtained by traversing and counting the gray values of each image row using a sliding window. The peak position is determined based on the average gray value of each of the image rows, and the hemolysis identification region is selected in the blood sample image according to the peak position; Based on the color values of each pixel in the hemolysis recognition region, the color score of each color category is determined using a color mapping matrix; When the color score of the hemolysis recognition area meets the preset conditions, it is determined that the blood sample to be identified has undergone hemolysis.
2. The hemolysis identification method according to claim 1, characterized in that, Before the step of converting the blood sample image into a grayscale image, the method further includes the following steps: Obtain the selection matrix parameters; the selection matrix parameters include the coordinates of the top left corner of the selection matrix, the height of the selection matrix, and the width of the selection matrix; Based on the bounding box matrix parameters, a region of interest is determined in the blood sample image, and the blood sample image is cropped according to the region of interest.
3. The hemolysis identification method according to claim 1, characterized in that, Before the step of converting the blood sample image into a grayscale image, the method further includes the following steps: Obtain the orientation angle of the blood sample image; Based on the angle difference between the orientation angle and the target angle, the blood sample image is subjected to coordinate rotation transformation.
4. The hemolysis identification method according to claim 1, characterized in that, The step of using a sliding window to iterate and statistically analyze the grayscale values of each row in the grayscale image to obtain the average grayscale value of each row includes the following steps: Initialize the target image rows; Boundary determination is performed based on the boundary conditions of the target image row and the sliding window to obtain the window boundary of the sliding window in the target image row; the window boundary includes a first boundary and a second boundary; Based on the window boundary and the image width of the grayscale image, the grayscale values of all pixels in the grayscale image of the target image row are summed and averaged to obtain the initial average grayscale value of the target image row. The initial average gray value is inverted to obtain the target average gray value of the target image row; The expression for the target average gray value is as follows: In the formula, hiss represents the average grayscale value of the target; W represents the image width of the grayscale image; s y Indicates the first boundary; e y The second boundary is represented; G[i][j] represents the grayscale value of the pixel in the i-th row and j-th column; The target image rows are incremented based on a preset row step size, and the process returns to the step of boundary determination based on the boundary conditions of the target image rows and the sliding window, until the target image rows have traversed the grayscale image.
5. The hemolysis identification method according to claim 4, characterized in that, The step of determining the boundary based on the boundary conditions of the target image row and the sliding window to obtain the window boundary of the sliding window in the target image row includes the following steps: A first determination value is obtained based on the difference between the target image row and half the preset height of the sliding window; When the first determination value is less than 0, the first boundary is set to 0; when the first determination value is greater than or equal to 0, the first boundary is set to the first determination value. The expression for the first boundary is: In the formula, s y Indicates the first boundary; y represents the processed image row; H se Indicates the preset height of the sliding window; A second determination value is obtained based on the sum of the target image row and half the preset height of the sliding window; When the second determination value is greater than the image height of the grayscale image, the second boundary is set to the image height; when the second determination value is less than or equal to the image height of the grayscale image, the second boundary is set to the second determination value. The expression for the second boundary is: In the formula, e y The second boundary is indicated; H represents the image height of the grayscale image; y represents the processed image row; H se Indicates the preset height of the sliding window; When the first boundary is greater than or equal to the second boundary, the second boundary is set to the first boundary plus 1.
6. The hemolysis identification method according to claim 1, characterized in that, Determining the peak position based on the average gray value of each of the image rows includes the following steps: When the average gray value of the target image row is greater than or equal to the preset minimum peak height, and the average gray value of the adjacent image rows of the target image row is less than or equal to the average gray value of the target image row, the target image row is determined to be a candidate peak. Based on preset constraints, all candidate peak values are filtered to obtain the target peak value; The peak position is determined based on the image row where the target peak is located.
7. The hemolysis identification method according to claim 6, characterized in that, The process of filtering all candidate peak values based on preset constraints includes the following steps: Based on the preset minimum peak prominence, all candidate peaks are filtered by prominence constraint. The expression for the prominence constraint is as follows: In the formula, h[p] represents the average gray value of the image row p where the candidate peak is located; W len The default saliency window length is represented by h[i], which represents the average gray value of image row i. min This indicates the minimum prominence of the peak value.
8. The hemolysis identification method according to claim 1, characterized in that, The step of selecting the hemolysis identification region in the blood sample image based on the peak position includes the following steps: The upper boundary of the region is determined based on the sum of the peak position and the first step value; The lower boundary candidate value is determined based on the sum of the peak position and the second step value; When the candidate value of the lower boundary is greater than the lower height boundary of the blood sample image, the lower boundary of the region is determined according to the lower height boundary; when the candidate value of the lower boundary is less than or equal to the lower height boundary of the blood sample image, the lower boundary of the region is determined according to the candidate value of the lower boundary. The hemolysis identification region is extracted from the blood sample image based on the upper and lower boundaries of the region.
9. The hemolysis identification method according to claim 1, characterized in that, The step of determining the color score for each color category based on the color values of each pixel in the hemolysis detection region using a color mapping matrix includes the following steps: Based on the color values of each pixel in the hemolysis detection area, the index value of the corresponding pixel is calculated using a preset formula; The color values include blue channel values, green channel values, and red channel values; the expression for the index value is: i(x,y)=r(x,y)+16·g(x,y)+256·b(x,y) In the formula, i(x,y) represents the index value of pixel (x,y); I red (x,y) represents the red channel value of pixel (x,y); I green (x,y) represents the green channel value of pixel (x,y); I blue (x,y) represents the blue channel value of pixel (x,y); This indicates a round-down operation; Based on the index value, the color score of each pixel for each color category is determined using a color mapping matrix.
10. The hemolysis identification method according to claim 1, characterized in that, The step of determining that the blood sample to be identified has undergone hemolysis when the color score of the hemolysis recognition area meets a preset condition includes the following steps: The color scores of all pixels in the hemolysis recognition region for the target category are averaged to obtain the average score of the target category. When the sum of the average scores of all the target categories is greater than a set threshold, it is determined that the blood sample to be identified has hemolysis.
11. A hemolysis detection device, characterized in that, include: The image acquisition module is used to acquire a blood sample image of the blood sample to be identified and convert the blood sample image into a grayscale image; The gray-scale averaging module is used to traverse and count the gray values of each image row in the gray-scale image using a sliding window to obtain the average gray value of each image row. The hemolysis selection module is used to determine the peak position based on the average gray value of each of the image rows, and select the hemolysis recognition region in the blood sample image according to the peak position; The color mapping module is used to determine the color score of each color category based on the color value of each pixel in the hemolysis recognition area using a color mapping matrix. The hemolysis determination module is used to determine that the blood sample to be identified has undergone hemolysis when the color score of the hemolysis identification area meets a preset condition.
12. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the method as described in any one of claims 1 to 10.
13. A computer storage medium storing a processor-executable program, which, when executed by a processor, is used to implement the method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Method of detecting Vibrio parahaemolyticus
CN110470840A
Plasma hemolysis discrimination method based on machine learning, electronic equipment and storage medium
CN117079057A
Image edge detection method and device
CN119625008A
Image recognition method and apparatus, storage medium, and processor
WO2021004402A1