Laparoscope bleeding detection auxiliary method and system based on image processing

By employing adaptive threshold segmentation, rapid progress repair, and dense optical flow field analysis, the problem of misjudgment in bleeding detection during laparoscopic surgery has been solved, achieving highly accurate bleeding detection and early warning in complex environments.

CN122048858APending Publication Date: 2026-05-15WEISHAN COUNTY PEOPLES HOSPITAL
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WEISHAN COUNTY PEOPLES HOSPITAL
Filing Date
2026-01-29
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing technologies in laparoscopic surgery are limited by a single color threshold judgment logic, which is easily affected by the reflection of the metal surface of surgical instruments, the bright spots caused by tissue moisture, and the interference of smoke. This can lead to non-bleeding areas being misjudged as bleeding points, and it is impossible to effectively distinguish between normal blood vessels and liquid blood. Furthermore, it lacks dynamic analysis of blood flow and diffusion behavior, resulting in a high frequency of false alarms and a high rate of missed detection of minor bleeding during surgery.

Method used

An adaptive threshold segmentation and fast-moving repair algorithm are used for denoising. Combined with gray-level co-occurrence matrix and dense optical flow field analysis, static blood candidate regions are constructed and blood diffusion trends are quantified by using local texture entropy and energy feature parameters. A weighted logistic regression model is used to generate bleeding risk assessment values ​​to achieve visualized bleeding early warning.

Benefits of technology

It accurately locates and eliminates noise interference from the surgical environment, effectively distinguishes between liquid blood and solid organ textures, dynamically captures active bleeding behavior, generates a high-confidence visual bleeding early warning map, reduces false alarm rate, and improves the accuracy of oozing detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122048858A_ABST
    Figure CN122048858A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of bleeding detection, in particular to a laparoscope bleeding detection auxiliary method and system based on image processing, and the method comprises the following steps: generating a de-noised operation image, converting the de-noised operation image into a Lab color space, and constructing a static blood candidate region in combination with a local entropy value; and calculating optical flow field vectors of adjacent frames, mapping the optical flow field vectors to the candidate regions to extract dynamic diffusion features, fusing textures and spatial-temporal features to calculate a bleeding risk value, and outputting an early warning result. According to the method, by introducing a highlight mask and a morphological repair mechanism, light reflection of a surgical instrument and illumination interference of a wet tissue surface are eliminated, liquid blood and solid visceral organ tissues with red characteristics are effectively distinguished by utilizing texture energy characteristics extracted by a gray-level co-occurrence matrix, and an inter-frame optical flow field analysis means is combined, so that the detection accuracy is improved. The dynamic diffusion behavior of blood under the action of gravity or pressure is accurately captured, and the problem that old bloodstains and active hemorrhage cannot be recognized through a static color discrimination method is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of bleeding detection technology, and in particular to an auxiliary method and system for laparoscopic bleeding detection based on image processing. Background Technology

[0002] The field of bleeding detection technology involves utilizing computer vision and image analysis to assist doctors in identifying and locating bleeding points in real time during minimally invasive surgery, aiming to improve surgical safety and visual clarity. This technology is widely used in medical scenarios such as laparoscopy and endoscopy, reducing the risk of omissions due to human observation through automated analysis of the color, texture, and shape of video images. Traditional image processing-based laparoscopic bleeding detection methods rely on the endoscope's built-in light source and camera system to acquire images inside the body. This primarily depends on doctors' visual observation and experience through monitors, or, in early digital systems, simply setting a fixed threshold based on the proportion of red pixels in the RGB color model. When the proportion of red pixels in the image exceeds the set value, it is considered bleeding, and the bleeding is simply highlighted on the screen.

[0003] Existing technologies, in the complex abdominal environment of laparoscopic surgery, are limited by a single color threshold judgment logic. They are easily affected by the reflection of the metal surface of surgical instruments, the bright spots caused by tissue moisture, and the interference of smoke. This causes the algorithm to misidentify non-bleeding areas as bleeding points. Relying solely on color features cannot effectively distinguish between normal red blood vessels, congested organ tissues and real liquid blood. Furthermore, it lacks the ability to dynamically analyze blood flow and diffusion behavior, and cannot accurately identify the difference between active bleeding and old bloodstains in the early stages of bleeding. This results in a high frequency of false alarms and a high rate of missed detection of minor bleeding during surgery, which seriously interferes with the surgeon's normal surgical operation and judgment. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the existing technology and to propose an auxiliary method and system for laparoscopic bleeding detection based on image processing.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: an image processing-based auxiliary method for laparoscopic bleeding detection, comprising the following steps: S1: Acquire the original video stream of the laparoscopy, extract the serialized frames to obtain a single frame image, traverse the pixel brightness values ​​of the single frame image, identify the highlight connected regions in the image through adaptive threshold segmentation, construct a highlight binary mask, and use the fast marching inpainting algorithm to perform pixel interpolation filling on the region covered by the highlight binary mask to generate a denoised surgical image. S2: Convert the denoised surgical image from RGB color space to Lab color space, extract the a-channel component image, calculate the local texture entropy value and energy feature parameters of the a-channel component image based on the gray-level co-occurrence matrix, perform pixel-level logical AND operation in combination with preset color threshold, remove non-blood tissue interference, and construct static blood candidate regions; S3: Obtain the temporally adjacent associated image of the denoised surgical image, perform dense optical flow calculation on it to generate an optical flow field vector, calculate the magnitude and orientation angle of the optical flow field vector, map the optical flow field vector to the static blood candidate region, analyze the outward expansion trend of the region edge, calculate the region area growth rate, and construct a dynamic spatiotemporal feature matrix. S4: After normalizing the local texture entropy value, the energy feature parameter and the dynamic spatiotemporal feature matrix, input them into the weighted logistic regression model to calculate the bleeding risk assessment value. Compare the value with the preset alarm threshold. If it is higher than the threshold, generate a bleeding location marker box, superimpose it on the original laparoscopic video stream and output a visual bleeding warning map.

[0006] As a further aspect of the present invention, step S1 specifically comprises: S11: Use the video capture interface to read the original video stream of the laparoscopy in real time, extract the video frame sequence according to the preset time interval, calculate the global brightness mean and brightness standard deviation of the current single frame image, and combine the preset local window size to traverse each pixel in the image to calculate the local statistical features in the neighborhood of the pixel. S12: Based on the local statistical features, set an adaptive brightness threshold, determine the pixels with brightness values ​​higher than the threshold as specular noise, mark them as foreground pixels, and mark the remaining pixels as background pixels. Extract the spatial distribution of all specular noise points through a connected component analysis algorithm, and establish the specular binary mask. S13: For the damaged area marked by the specular binary mask, initialize the known pixel set and the narrowband set to be repaired by the fast traversal algorithm, calculate the priority weight based on the geodesic distance between the pixel to be repaired and the boundary of the known pixel, estimate the brightness information of the pixel to be repaired by weighting the gray values ​​of the known neighboring pixels, and iterate from the outside to the inside until all damaged areas are filled, thereby generating the denoising surgical image.

[0007] As a further aspect of the present invention, step S2 specifically comprises: S21: Call the color space conversion function to nonlinearly map the red, green and blue components of the denoised surgical image to the CIE-Lab color mode, separate the a-channel component image, and perform Gaussian smoothing filtering on the component image; S22: Set the generation step size and direction parameters of the gray-level co-occurrence matrix, traverse each pixel block in the a-channel component image, count the probability distribution of joint occurrence of pixel gray levels, and construct the gray-level co-occurrence matrix. S23: Calculate the local texture entropy value and the energy feature parameter based on the gray-level co-occurrence matrix, and simultaneously obtain the pixel gray-level values ​​of the a-channel component map; S24: Compare the pixel grayscale value of the a-channel component image with the preset lower limit threshold of blood color, and at the same time determine whether the corresponding local texture entropy value is less than the preset texture disorder threshold. Only when both conditions are met, mark the pixel area as a potential bleeding point, and connect the edges of the broken area through morphological closing operation to construct the static blood candidate area.

[0008] As a further aspect of the present invention, step S3 specifically comprises: S31: Extract the previous frame image that is adjacent to the denoised surgical image on the time axis from the original laparoscopic video stream as a reference frame, and use the Farneback dense optical flow algorithm to calculate the displacement vector of each pixel between the reference frame and the current frame to generate an original optical flow field containing horizontal and vertical components. S32: Perform polar coordinate transformation on the original optical flow field, calculate the magnitude and orientation angle of the optical flow field vector corresponding to each pixel position, and use a median filter to remove isolated abnormal optical flow vectors to obtain smoothed motion field data; S33: The static blood candidate region is used as a spatial mask to cover the smoothed motion field data, and the effective optical flow vectors located inside and at the edge of the candidate region are screened out. The radial projection component of the effective optical flow vector relative to the centroid of the region is calculated to quantify and analyze the outward expansion trend of the edge caused by blood diffusion. S34: Calculate the proportion of pixels with positive radial projection components within the static blood candidate region to the total number of pixels in the region. Combine this with the average intensity of the optical flow modulus to calculate the area growth rate of the region. Then, combine this growth rate with the consistency index of the optical flow direction to construct the dynamic spatiotemporal feature matrix.

[0009] As a further aspect of the present invention, step S4 specifically comprises: S41: Obtain the local texture entropy value, the energy feature parameter, and the growth rate data in the dynamic spatiotemporal feature matrix corresponding to the static blood candidate region, and use the maximum-minimum normalization method to map the above multidimensional feature data to a closed interval from zero to one, thereby eliminating the influence of dimensional differences on the model weights. S42: Input the normalized multidimensional feature vector into the pre-trained weighted logistic regression model, use the weight coefficient matrix inside the model to perform linear weighted summation of the feature vector, and use the Sigmoid activation function to map the summation result into a probability form to calculate the bleeding risk assessment value. S43: Compare the bleeding risk assessment value with the preset alarm threshold. When the assessment value exceeds the alarm threshold, determine the current area as a confirmed bleeding point, calculate the coordinates of the bounding rectangle of the area, draw a red border on the corresponding frame of the original laparoscopic video stream, and overlay the risk value label to output the visualized bleeding warning map.

[0010] As a further aspect of the present invention, the feature parameter calculation process in S23 specifically includes: The value of each element in the gray-level co-occurrence matrix is ​​obtained and used as the normalized joint probability density. The information entropy of the probability density is calculated using the logarithmic function to obtain the local texture entropy value. The energy feature parameter is obtained by calculating the sum of squares of the probability density values. The distribution of non-zero elements in the gray-level co-occurrence matrix is ​​used as the basis for judgment. If the non-zero elements are concentrated near the main diagonal, it is determined to be a tissue region with fine texture and smooth gray-level changes. If the non-zero elements are scattered, it is determined to be a non-blood tissue region with coarse texture and messy texture. Combining the grayscale mean of the a-channel component image, the inverse difference moment feature is further calculated to describe the local uniformity of the image texture. This inverse difference moment feature is used as an auxiliary discrimination parameter and together with the local texture entropy value, it constitutes a static texture feature set for subsequent logical filtering.

[0011] As a further aspect of the present invention, the calculation process of the regional area growth rate in S34 relies on the following formula: ; in, This represents the growth rate of the area of ​​the region. This represents the total pixel area of ​​the static blood candidate region. Represents the set of pixels within the candidate region. Representing coordinates The optical flow field vector at that location, This represents the unit normal vector pointing from the centroid of the region to that pixel. Represents the optical flow modulus. This represents the Heaviside step function, used to filter out components in the expansion direction.

[0012] As a further aspect of the present invention, the calculation process of the weighted logistic regression model in S42 depends on the following formula: ; in, This represents the bleeding risk assessment value. This represents the normalized local texture entropy value. This represents the normalized energy characteristic parameter. This represents the growth rate of the area of ​​the region. , , These represent the weight coefficients of the corresponding features. The bias term represents the model. is the base of the natural logarithm.

[0013] As a further aspect of the present invention, the pixel interpolation filling process in S13 specifically includes: Construct a neighborhood window centered on the pixel to be repaired, identify all known valid pixels within the window, calculate the Euclidean distance from the valid pixels to the pixel to be repaired, and use the reciprocal of this Euclidean distance as a distance weight factor. The gradient vector of the effective pixel is obtained, and the gray value of the pixel to be repaired is weighted and estimated by combining the distance weight factor and the orientation consistency factor to ensure that the texture orientation of the repaired pixel remains continuous with the surrounding tissue. A heap data structure is used to maintain the pixel set within the narrow band. Each time, the pixel with the minimum cost value is selected first for updating, and the updated pixel is marked as a known state. Its surrounding unrepaired neighbor nodes are added to the narrow band set. The above process is repeated until all pixels within the specular binary mask are assigned new grayscale values.

[0014] A laparoscopic hemorrhage detection assistance system based on image processing, the system being used to implement the aforementioned laparoscopic hemorrhage detection assistance method based on image processing, the system comprising: The image preprocessing module is used to acquire the original video stream of laparoscopy and extract single-frame images, generate a specular binary mask through adaptive threshold segmentation, and perform denoising processing using a fast advancing repair algorithm to generate denoised surgical images. The static feature extraction module is used to convert the denoised surgical image to a color space to obtain an a-channel component map, calculate the local texture entropy value and energy feature parameters, and remove interference through logical AND operation to construct a static blood candidate region. The dynamic feature analysis module is used to calculate the dense optical flow field based on temporally correlated images, map the optical flow field vector to candidate regions to analyze the edge expansion trend, calculate the region area growth rate, and construct a dynamic spatiotemporal feature matrix. The risk assessment and early warning module is used to normalize the extracted multidimensional features, calculate the bleeding risk assessment value through a weighted logistic regression model, and generate a visual bleeding early warning chart when the value exceeds the limit.

[0015] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, by introducing a specular binary mask extraction and fast-moving repair algorithm, the interference of metallic reflections and tissue moisture specular highlights in the surgical environment is accurately located and eliminated, restoring the texture details of the occluded areas. The local texture entropy and energy characteristics of the image are analyzed using the gray-level co-occurrence matrix, effectively distinguishing the smooth texture of liquid blood from the rough texture of solid organs at the physical material level, avoiding misjudgment caused by similar colors. Combined with optical flow field vector analysis technology, the diffusion trend and area growth rate of blood in the spatiotemporal dimension are quantified, realizing the dynamic capture of active bleeding behavior. Even in complex scenarios where there is minor bleeding or coexistence of old bloodstains, a high-confidence visual bleeding warning map can be generated. Attached Figure Description

[0016] Figure 1 This is a flowchart of an image processing-based auxiliary method for laparoscopic hemorrhage detection according to the present invention. Figure 2 Flowchart for generating denoised surgical images for this invention; Figure 3 A flowchart for constructing a static blood candidate region for this invention; Figure 4 Flowchart for constructing the dynamic spatiotemporal feature matrix for this invention; Figure 5 This invention outputs a flowchart of a visual bleeding early warning diagram. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the software-based technical solution is described in detail below with reference to system architecture diagrams and embodiments. It should be understood that the specific embodiments described herein are only for explaining the technical solutions of this invention and do not constitute a limitation on the scope of protection.

[0018] In the description of this invention, the system architecture relationships or data processing flows indicated by terms such as "layer," "module," "interface," "data flow," "client," and "server" are all defined based on the architecture diagram or flowchart corresponding to the embodiments. This way of describing is only used to clearly illustrate the logical relationships between the elements in the technical solution, and not to limit the physical deployment form. The term "multiple" includes two or more technical units, including but not limited to multiple data nodes, processing threads, service instances, or functional components and other scalable elements. The specific number is determined according to the actual business scenario and needs to be specifically specified.

[0019] Please see Figure 1 and Figure 2 This invention provides a technical solution: an image processing-based auxiliary method for laparoscopic hemorrhage detection, comprising the following steps: S1: Acquire the original laparoscopic video stream, extract its serialized frames to obtain single-frame images, traverse the pixel brightness values ​​of the single-frame images, identify the highlight connected regions in the images through adaptive threshold segmentation, construct a highlight binary mask, and use the fast marching inpainting algorithm to perform pixel interpolation filling on the regions covered by the highlight binary mask to generate a denoised surgical image.

[0020] The specific steps of S1 are as follows: S11: Use the video capture interface to read the original video stream of the laparoscopy in real time, extract the video frame sequence according to the preset time interval, calculate the global brightness mean and brightness standard deviation of the current single frame image, and combine the preset local window size to traverse each pixel in the image to calculate the local statistical features in the neighborhood of the pixel. S12: Based on local statistical features, an adaptive brightness threshold is set. Pixels with brightness values ​​higher than the threshold are identified as specular noise and marked as foreground pixels. The remaining pixels are marked as background pixels. The spatial distribution of all specular noise is extracted by a connected component analysis algorithm to establish a specular binary mask. S13: For the damaged areas marked by the specular binary mask, initialize the known pixel set and the narrowband set to be repaired by the fast traversal algorithm, calculate the priority weight based on the geodesic distance between the pixel to be repaired and the boundary of the known pixels, estimate the brightness information of the pixel to be repaired by weighting the gray values ​​of the known neighboring pixels, and iterate from the outside to the inside until all damaged areas are filled, generating a denoised surgical image.

[0021] The pixel interpolation filling process specifically includes: Construct a neighborhood window centered on the pixel to be repaired, identify all known valid pixels within the window, calculate the Euclidean distance from the valid pixels to the pixel to be repaired, and use the reciprocal of this Euclidean distance as a distance weight factor. Obtain the gradient vector of the effective pixel, and combine the distance weighting factor and the orientation consistency factor to perform a weighted estimation of the gray value of the pixel to be repaired, so as to ensure that the texture orientation of the repaired pixel remains continuous with the surrounding tissue. A heap data structure is used to maintain the set of pixels within the narrow band. Each time, the pixel with the minimum cost value is selected first for updating, and the updated pixel is marked as a known state. Its surrounding unrepaired neighbor nodes are added to the narrow band set. The above process is repeated until all pixels within the specular binary mask are assigned new grayscale values.

[0022] The system uses a video capture interface to read the raw video stream from the laparoscopy unit in real time. Video frames are captured at preset time intervals, and the global mean and standard deviation of brightness for each frame are calculated. Combined with a preset local window size, each pixel in the image is traversed to calculate the local statistical features within its neighborhood. Specifically, a physical connection is established between a high-performance video capture card (such as a BlackmagicDeckLink8KPro) and the medical laparoscopy unit. The raw YUV format video stream with a resolution of 1920×1080 pixels is received at a rate of 60 frames per second via the SDI (Serial Digital Interface) channel. A double-buffered queue is allocated in memory, and the YUV data stream is converted into a digital matrix in RGB color space in real time using the VideoCapture interface in the OpenCV library. Downsampling is performed at 5-frame intervals to reduce the computational load of subsequent processing, resulting in the video frame sequence to be processed. The captured single-frame image is then processed. First, convert it to a single-channel grayscale image, then iterate through the image... The global average brightness is calculated by summing the grayscale values ​​of all pixels and dividing by the total number of pixels. At the same time, the global brightness standard deviation is calculated based on this mean. Then, define a size as A local sliding window of pixels, which is raster-scanned from the top-left corner of the image. Iterate through each row to the bottom right corner. For each center pixel covered by the window... Extract the brightness values ​​of 225 pixels within the window and calculate the average brightness of this local area. with standard deviation This is used as a local statistical feature to describe the illumination distribution in the neighborhood of the pixel. For example, when processing a typical laparoscopic image, the measured global mean brightness is 112.5 and the standard deviation is 45.2; while in a local area with strong reflection, the calculated local mean may reach 230.1 and the local standard deviation is 15.4. These statistical data will be cached in a feature matrix of the same size as the original image for subsequent threshold determination.

[0023] An adaptive brightness threshold is set based on local statistical features. Pixels with brightness values ​​higher than this threshold are identified as specular noise and marked as foreground pixels, while the remaining pixels are marked as background pixels. The spatial distribution of all specular noise is extracted using a connected component analysis algorithm to establish a specular binary mask. Specifically, to accurately distinguish between specular reflections from the laparoscopic light source on moist tissue surfaces and normal bright tissue (such as fat or instrument reflections), a NiBlack adaptive thresholding algorithm based on local statistics is used. This applies to each pixel location in the image. Read the local mean calculated in the previous steps. With local standard deviation Set correction coefficient The adaptive threshold is calculated using a coefficient of 0.2 (selected through testing on 1000 labeled images, effectively covering 98% of the highlight area with a false detection rate of less than 5%). If the grayscale value of the current pixel and If a global hard threshold constraint is applied, the pixel is determined to be a specular noise point, and its position is determined in the binary mask image. The corresponding position in the image is marked as 1 (white foreground), otherwise it is marked as 0 (black background). After completing the full image traversal, the binary mask is... A two-pass connected component labeling algorithm is executed. The first pass records all equivalent pairs of non-zero pixels, and the second pass resolves label conflicts, thus merging adjacent specular pixels into independent connected regions. Next, the area (number of pixels) of each connected region is calculated, and an area threshold of 10 pixels is set. Isolated noise pixels with areas smaller than this threshold are removed, resulting in a clean specular binary mask. During this process, if the local mean of a pixel is 230 and the standard deviation is 15, its adaptive threshold is... If the actual brightness of the point is 250, it is accurately marked as a highlight.

[0024] For the damaged areas marked by the specular binary mask, the known pixel set and the narrowband set to be repaired are initialized using the fast traversal algorithm. Priority weights are calculated based on the geodesic distance between the pixels to be repaired and the boundaries of known pixels. The brightness information of the pixels to be repaired is estimated using the grayscale values ​​of known neighboring pixels. This process is iteratively updated from the outside in until all damaged areas are filled, generating a denoised surgical image. The specific execution process is as follows: The specular binary mask is read. The area with a value of 1 in the mask is defined as the area to be repaired. The region with a value of 0 is defined as the known region. Initialize a range field matrix of the same size as the original image. ,Will Set the distance value of all pixels in the array to 0. The distance values ​​for all pixels in the array are set to infinity. (Recognition) and The boundary line, which belongs to the boundary line The pixels on the side are added to the "NarrowBand" set, and these points are then... The value in the matrix is ​​updated to the Euclidean distance to its nearest known pixel. The specific operation of pixel interpolation padding is as follows: Construct the pixel to be repaired... Centered Neighborhood window, identifies all known valid pixels within the window. Calculate each valid pixel. arrive Euclidean distance Calculate the distance weighting factor Simultaneously, the gradient vector at the effective pixels is calculated using the Sobel operator. , combined and position vector Calculate the directional consistency factor Final repair value It is obtained by weighted average of all effective neighboring pixels: A min-heap data structure is used to maintain the narrowband set, with elements in the heap ordered by distance value. The pixels are sorted from smallest to largest. Each time, the pixel with the lowest cost (i.e., closest to the known area) is taken from the top of the heap as the current repair target. Its grayscale value is updated using the weighted estimation described above, and its status is marked as "known." Then, the unrepaired nodes within the four-neighborhood of this point are checked, their distance values ​​are updated, and their positions in the heap are added or updated. This process continuously shrinks from the edge of the highlight area towards the center until the heap is empty, meaning all highlight pixels are filled with the texture information of the surrounding normal tissue, generating a smooth, specular-free denoised surgical image.

[0025] The aforementioned fast-moving algorithm is a numerical method used to solve boundary value problems of functional equations. In this embodiment, the algorithm is improved for image inpainting. The core idea is to orderly advance the update of pixel values ​​along the front wavefront (i.e., narrow band) of information propagation, ensuring that the inpainting process follows the geodesic distance constraint of a smooth transition from known structures to unknown regions, thus avoiding the blurring effect produced by traditional interpolation methods at complex texture boundaries.

[0026] Please see Figure 1 and Figure 3 S2: Convert the denoised surgical image from RGB color space to Lab color space, extract the a-channel component image, calculate the local texture entropy value and energy feature parameters of the a-channel component image based on the gray-level co-occurrence matrix, perform pixel-level logical AND operation in combination with preset color threshold, remove non-blood tissue interference, and construct static blood candidate regions.

[0027] The specific steps of S2 are as follows: S21: Call the color space conversion function to nonlinearly map the red, green and blue components of the denoised surgical image to the CIE-Lab color mode, separate the a-channel component map, and perform Gaussian smoothing filtering on the component map; S22: Set the generation step size and direction parameters of the gray-level co-occurrence matrix, traverse each pixel block in the a-channel component image, count the probability distribution of joint occurrence of pixel gray levels, and construct the gray-level co-occurrence matrix. S23: Calculate the local texture entropy value and energy feature parameters based on the gray-level co-occurrence matrix, and simultaneously obtain the pixel gray-level values ​​of the a-channel component map; The specific steps in calculating the characteristic parameters include: Obtain the value of each element in the gray-level co-occurrence matrix and use it as the normalized joint probability density. Calculate the information entropy of the probability density using the logarithmic function to obtain the local texture entropy value. Calculate the sum of squares of the probability density values ​​to obtain the energy feature parameters. The distribution of non-zero elements in the gray-level co-occurrence matrix is ​​used as the basis for judgment. If the non-zero elements are concentrated near the main diagonal, it is judged as a tissue area with fine texture and smooth gray-level changes. If the non-zero elements are scattered, it is judged as a non-blood tissue area with coarse texture and messy texture. By combining the gray-level mean of the a-channel component image, the inverse difference moment feature is further calculated to describe the local uniformity of the image texture. This inverse difference moment feature is used as an auxiliary discrimination parameter and together with the local texture entropy value to form a static texture feature set, which is used in the subsequent logical filtering process.

[0028] S24: Compare the pixel grayscale values ​​of the a-channel component map with the preset lower limit threshold of blood color, and at the same time determine whether the corresponding local texture entropy value is less than the preset texture disorder threshold. Only when both conditions are met, mark the pixel area as a potential bleeding point, and connect the edges of the broken area through morphological closing operation to construct a static blood candidate area.

[0029] The color space conversion function is called to nonlinearly map the red, green, and blue components of the denoised surgical image to the CIE-Lab color mode, separating the a-channel component image, and then performing Gaussian smoothing filtering on this component image. Specifically, the process involves using color conversion interfaces in the image processing library (such as cv2.cvtColor) to map the RGB denoised image generated by S1 pixel-by-pixel to the CIE-Lab color space. The RGB to Lab conversion first passes through the XYZ color space, which involves a nonlinear gamma correction function. (when (Time), to simulate the non-linear perception of color by the human eye. In the Lab model, Represents brightness. Represents the color weights from magenta to green. Representing the yellow to blue component. Because fresh bleeding points in the abdominal cavity appear as highly saturated red on the spectrum, this... The channel shows a significant positive response (large numerical value), while the surrounding fat or intestinal wall tissue is usually yellowish or white. The response on the channel is low. Therefore, it is necessary to isolate it separately. The channel component map serves as the basis for subsequent analysis. To suppress minor color fluctuations caused by thermal noise from the image sensor, the extracted... Gaussian smoothing filtering was applied to the channel component maps. (Selection / Option) Gaussian kernel, standard deviation Set the value to 0.8 to perform a convolution operation on the entire image. For example, if the original RGB value of a pixel is... (Fresh blood), after conversion The channel value is 180 (approximately 200 after normalization to the 0-255 range), while the yellow fat region... of The channel value is close to 128 (neutral point). The filtered image has smoother edges, which is beneficial for subsequent texture feature extraction.

[0030] The generation step size and direction parameters of the gray-level co-occurrence matrix are set. Each pixel block in the a-channel component image is traversed, and the probability distribution of the joint occurrence of pixel gray levels is statistically analyzed to construct the gray-level co-occurrence matrix. The specific execution process is as follows: Define a channel component map A sliding window of pixels is used for overlapping sampling with a step size of 4 pixels. For each image patch within the window, a gray-level co-occurrence matrix (GLCM) is constructed. To reduce computational complexity and improve robustness to noise, the first step is to... The 256-level grayscale of the channel is compressed to 32 levels. The distance step size for GLCM generation is set. Select Four directions. Traverse all pixel pairs within the window. Statistics show that, under specific directions and distances, the grayscale level is... The pixels and gray levels are The frequency of adjacent pixels is used to fill the matrix. The corresponding position After completing the statistics, the matrix will be... Dividing each element in the matrix by the total number of pixel pairs within the window yields the normalized joint probability density matrix. This matrix intuitively reflects the spatial correlation of color intensity within a local area: if the matrix elements are concentrated on the main diagonal, it indicates that adjacent pixels have similar colors and uniform texture (such as blood clots); if the elements are scattered in areas far from the diagonal, it indicates that the color changes drastically and the texture is messy (such as the edge of a surgical instrument).

[0031] The local texture entropy and energy feature parameters are calculated based on the gray-level co-occurrence matrix, and the pixel gray-level values ​​of the a-channel component map are obtained simultaneously. The specific execution process is as follows: based on the normalized GLCM matrix constructed in the previous steps... We calculate key statistics describing texture features. First, we calculate the local texture entropy, which measures the randomness of image texture. Then, we iterate through the matrix... Calculate all non-zero elements in the set. When the area under consideration is a smooth blood surface, the GLCM matrix elements are concentrated, resulting in a low entropy value; however, when the area contains complex tissue folds, the matrix elements are dispersed, leading to a higher entropy value. Next, the energy characteristic parameter (Energy), also known as the second angular moment (ASM), is calculated to measure the uniformity and orderliness of the texture. The calculation formula is as follows: For homogeneous bleeding areas, the energy value tends to be 1; for cluttered backgrounds, the energy value tends to be 0. Furthermore, combined with... The grayscale mean of the channel component images is used to calculate the inverse moment (homogeneity) as an auxiliary parameter. This parameter is sensitive to the depth of texture grooves. Practical example: for a texture containing tiny bleed points. For each pixel block, the sum of the main diagonal elements of its normalized GLCM matrix accounts for 85% of the total probability. Substituting these values ​​into the formula above, we obtain: a local texture entropy of 1.2 (low), an energy feature parameter of 0.75 (high), and an inverse moment of 0.88. These values ​​quantify the visual characteristics of the blood region as "uniformly red and finely textured."

[0032] The pixel grayscale values ​​of the a-channel component image are compared with a preset lower threshold for blood color. Simultaneously, it is determined whether the corresponding local texture entropy value is less than a preset texture disorder threshold. Only when both conditions are met is the pixel region marked as a potential bleeding point. Morphological closing operations are used to connect the edges of the broken regions, constructing static blood candidate regions. The specific execution process is as follows: To accurately separate blood regions from the complex abdominal cavity background, a dual threshold filtering strategy is adopted. The first filtering step: setting a lower threshold for blood color. (Quantized in 0-255) In the channel, 128 is neutral gray, while values ​​greater than 145 usually appear distinctly red. Traversing the entire image, if a pixel's... Channel value If the color characteristics match those of blood, then it is considered that the color features are consistent with blood. Second screening: setting a texture disorder threshold. If the local texture entropy value of the window corresponding to that pixel... If the texture is sufficiently smooth, then coarse tissue that appears reddish (such as the texture of congested mesenteric vessels) is excluded. Only when and When both conditions are met, the pixel is marked as a candidate foreground (logic value 1); otherwise, it is marked as background (logic value 0), generating a preliminary binarized candidate image. Due to noise interference, the preliminary candidate image may contain holes or breaks. Morphological closing operations are performed on it: first, a circular structuring element with a radius of 3 is used for dilation to fill small gaps; then, the same structuring element is used for erosion to restore the original boundary of the region. This process effectively connects the edges of bleeding areas broken by reflections or shadows, ultimately constructing a connected and complete static blood candidate region.

[0033] The aforementioned Gray-Level Co-occurrence Matrix (GLCM) is a statistical analysis method that reflects comprehensive information about the direction, interval, magnitude of change, and speed of an image by calculating the joint conditional probability density between the gray levels of two pixels at a certain distance and in a certain direction. It is a core tool for texture feature extraction.

[0034] Please see Figure 1 and Figure 4 S3: Obtain the temporally adjacent associated images of the denoised surgical image, perform dense optical flow calculation on them to generate optical flow field vectors, calculate the magnitude and orientation angle of the optical flow field vectors, map the optical flow field vectors to the static blood candidate region, analyze the outward expansion trend of the region edge, calculate the region area growth rate, and construct a dynamic spatiotemporal feature matrix.

[0035] The specific steps for S3 are as follows: S31: Extract the previous frame image that is immediately adjacent to the denoised surgical image on the time axis from the original laparoscopic video stream as the reference frame. Use the Farneback dense optical flow algorithm to calculate the displacement vector of each pixel between the reference frame and the current frame to generate the original optical flow field containing horizontal and vertical components. S32: Perform polar coordinate transformation on the original optical flow field, calculate the magnitude and orientation angle of the optical flow field vector corresponding to each pixel position, and use a median filter to remove isolated abnormal optical flow vectors to obtain smoothed motion field data; S33: The static blood candidate region is used as a spatial mask to cover the smoothed motion field data. The effective optical flow vectors located inside and at the edge of the candidate region are screened out. The radial projection component of the effective optical flow vector relative to the centroid of the region is calculated to quantify the outward expansion trend of the edge caused by blood diffusion. S34: Calculate the proportion of pixels with positive radial projection components within the static blood candidate region to the total number of pixels in the region. Combine this with the average intensity of the optical flow modulus to calculate the region area growth rate. Then, combine this growth rate with the consistency index of the optical flow direction to construct a dynamic spatiotemporal feature matrix.

[0036] The calculation of the regional area growth rate relies on the following formula: ; in, Represents the growth rate of the region's area. This represents the total pixel area of ​​the static blood candidate region. Represents the set of pixels within the candidate region. Representing coordinates The optical flow vector at that location, This represents the unit normal vector pointing from the centroid of the region to that pixel. Represents the optical flow modulus. This represents the Heaviside step function, used to filter out components in the expansion direction.

[0037] The preceding frame in time to the denoised surgical image is extracted from the raw laparoscopic video stream as a reference frame. The Farneback dense optical flow algorithm is used to calculate the displacement vector of each pixel between the reference frame and the current frame, generating a raw optical flow field containing horizontal and vertical components. The specific execution process is as follows: the current processing frame is retrieved back from the memory buffer. The previous frame of (denoised surgical image) As a reference frame, the Gunnar Farneback dense optical flow algorithm is used to capture subtle blood diffusion motion. This algorithm is based on polynomial expansion, assuming that the image signal in the local neighborhood can be approximated by a quadratic polynomial. In the OpenCV implementation, the algorithm parameters are configured as follows: the number of pyramid layers is set to 3 (to detect motion at different scales), the window size is set to 15 pixels (to balance detail and noise), and the number of iterations is set to 3. The algorithm processes each coordinate in the image... By comparison and By varying the coefficients in the polynomial domain, the displacement vector at that point can be calculated. ,in Indicates horizontal displacement. This represents displacement in the vertical direction. For example, for a region that is slowly bleeding, the calculated displacement vector might be... This indicates that the pixel shifted approximately 0.7 pixels to the lower right between the two frames. Ultimately, a two-channel floating-point matrix is ​​generated, representing the original optical flow field, with dimensions similar to the original... Figure 1 To.

[0038] The original optical flow field is transformed into polar coordinates. The magnitude and orientation angle of the optical flow vector corresponding to each pixel position are calculated. A median filter is then used to remove isolated outlier optical flow vectors, resulting in smoothed motion field data. Specifically, the process involves iterating through each vector in the original optical flow field. The coordinates are then transformed into polar coordinates using the coordinate transformation formula. The formula for calculating the magnitude (velocity) is: The formula for calculating the direction angle (direction of motion) is: The result is mapped to arrive The interval. Due to the presence of micro-vibrations or lighting flicker in the surgical environment, the original optical flow field often contains noise points with abrupt amplitude changes (such as a sudden appearance of a large displacement vector at a static background point). Therefore, the magnitude matrix and orientation angle matrix are respectively applied... The median filter replaces the vector value of the current pixel with the median of all vector values ​​in its neighborhood, effectively removing isolated impulse noise while preserving the overall motion trend of the blood diffusion edge, resulting in smooth and continuous motion field data.

[0039] Static blood candidate regions are used as spatial masks over smoothed motion field data. Effective optical flow vectors located within and at the edges of these candidate regions are selected. The radial projection components of these effective optical flow vectors relative to the region's centroid are calculated to quantify the outward expansion trend caused by blood diffusion. Specifically, the binary image of the static blood candidate regions generated by S2 is used as a mask and ANDed with the smoothed motion field data generated in the previous step. Only effective optical flow vectors within and at the boundaries of the candidate regions are retained, while vectors in other background regions are set to zero. For each independent blood candidate region, its geometric centroid is first calculated. Iterate through every non-zero pixel within the region. Construct a unit normal vector pointing from the centroid to the pixel. Then, the optical flow vector corresponding to that point is obtained. ,calculate exist Projection components in the direction: ,in This is the angle between the direction of motion and the radial direction. If This indicates that the fluid at that location is moving outwards away from the center of mass (i.e., expansion / bleeding); if This indicates that the fluid is stationary or contracting inward (possibly due to tissue peristalsis). This radial projection analysis effectively distinguishes between the active diffusion behavior of blood and the global motion caused by the panning of the entire field of view.

[0040] The proportion of pixels with positive radial projection components within the static blood candidate region is statistically analyzed out of the total number of pixels in the region. Combined with the average intensity of the optical flow modulus, the region area growth rate is calculated. This growth rate is then combined with the consistency index of the optical flow direction to construct a dynamic spatiotemporal feature matrix. The specific execution process is as follows: Based on the analysis results of the preceding steps, the bleeding risk is further quantified. The calculation of the region area growth rate relies on the following formula: ; in, Represents the growth rate of the region's area; The total pixel area representing the static blood candidate region; Represents the set of pixels within the candidate region; Representing coordinates The optical flow vector at that location; This represents the unit normal vector pointing from the centroid of the region to that pixel. Represents the optical flow modulus; This represents the Heaviside step function, used to filter out the component in the direction of expansion (value is 1 when the input is greater than 0, otherwise it is 0).

[0041] Example illustration: Assume that in a candidate region containing 100 pixels, 40 pixels exhibit significant outward expansion (positive projection component) at the edge, with an average outward expansion rate of 0.8 pixels / frame. The remaining 60 pixels are stationary. Then the accumulated value is... The final calculated regional area growth rate The results indicate that the region exhibits an equivalent area expansion trend of approximately 32% per unit time, with higher values ​​representing more severe bleeding. Finally, the calculated... The directional consistency index of all effective optical flow vectors in the region (i.e., the reciprocal of the standard deviation of all vector angles) is combined to form a multi-dimensional vector, which constructs a dynamic spatiotemporal feature matrix, providing a temporal dimension criterion for subsequent classifiers.

[0042] Please see Figure 1 and Figure 5 S4: After normalizing the local texture entropy value, energy feature parameters and dynamic spatiotemporal feature matrix, input them into the weighted logistic regression model to calculate the bleeding risk assessment value. Compare the value with the preset alarm threshold. If it is higher than the threshold, generate a bleeding location marker box, overlay it on the original laparoscopic video stream and output a visual bleeding warning map.

[0043] The specific steps for S4 are as follows: S41: Obtain the local texture entropy value, energy feature parameters and growth rate data in the dynamic spatiotemporal feature matrix corresponding to the static blood candidate region, and use the maximum-minimum normalization method to map the above multidimensional feature data to a closed interval from zero to one to eliminate the influence of dimensional differences on model weights. S42: Input the normalized multidimensional feature vector into the pre-trained weighted logistic regression model, use the weight coefficient matrix inside the model to perform linear weighted summation of the feature vector, and use the Sigmoid activation function to map the summation result into a probability form to calculate the bleeding risk assessment value. The calculation process of the weighted logistic regression model relies on the following formula: ; in, This represents a bleeding risk assessment value. This represents the normalized local texture entropy value. Represents the normalized energy characteristic parameters, Represents the growth rate of the region's area. , , These represent the weight coefficients of the corresponding features. The bias term represents the model. is the base of the natural logarithm.

[0044] S43: Compare the bleeding risk assessment value with the preset alarm threshold. When the assessment value exceeds the alarm threshold, determine the current area as a confirmed bleeding point, calculate the coordinates of the bounding rectangle of the area, draw a red border on the corresponding frame of the original laparoscopic video stream, and overlay the risk value label to output a visual bleeding warning map.

[0045] The local texture entropy value, energy feature parameters, and growth rate data from the dynamic spatiotemporal feature matrix corresponding to the static blood candidate region are obtained. The max-min normalization method is used to map these multidimensional feature data to a closed interval between zero and one, eliminating the influence of dimensional differences on the model weights. Specifically, the process involves extracting three core feature data from the preceding steps: the local texture entropy value calculated in S23... (Typical range 0.5-0.5~3.0), energy characteristic parameters (Typical range 0.1~0.9), and the regional area growth rate calculated by S34. (Typical range 0.0~2.0). Because the physical dimensions and numerical ranges of these three features differ significantly (e.g., entropy is a logarithmic calculation, while growth rate is a ratio of speeds), directly inputting them into the model would lead to slow gradient descent convergence. Therefore, a Max-Min normalization method is used. The global maximum value of each feature is pre-calculated based on 3000 labeled clinical samples. and minimum value For features Its normalized value For example, if the current measurement is The results obtained from the statistics are set. Then the normalized entropy value Similarly, other features are processed by mapping all feature values ​​to... Construct standardized feature vectors for closed intervals. .

[0046] The normalized multidimensional feature vectors are input into a pre-trained weighted logistic regression model. The feature vectors are linearly weighted and summed using the model's internal weight coefficient matrix. The summation result is then mapped to a probability form using the Sigmoid activation function to calculate the bleeding risk assessment value. Specifically, the normalized feature vectors generated in the previous steps are input into the weighted logistic regression model. This model has been trained offline using a dataset containing 500 positive samples (confirmed bleeding points) and 500 negative samples (background interference similar to bleeding). The training process uses binary cross-entropy as the loss function and iteratively updates the weight coefficients using the Adam optimizer (learning rate set to 0.01) until the loss converges. During online inference, the weighted logistic regression model's computation relies on the following formula: .

[0047] in, This represents a value used to assess the risk of bleeding. This represents the normalized local texture entropy value; Represents the normalized energy characteristic parameters; This represents the normalized regional area growth rate. Weighting coefficients representing texture entropy values; Weighting coefficients representing energy characteristics; Weighting coefficients representing the growth rate of regional area; The bias term represents the model; It represents the base of the natural logarithm.

[0048] Table 1. Parameters of the bleeding risk assessment model; As shown in Table 1, the normalized data in the aforementioned examples (assuming...) , , Substituting the weights from Table 1 into the formula: Linear Weighted Sum Calculate the probability. The results indicate that despite some textural features, the bleeding risk in this region is only 47% due to insufficient expansion rate and the suppressive effect of the bias term, which does not yet meet the diagnostic criteria. If the growth rate increases to 0.8, the calculated probability will increase significantly, exceeding the alarm threshold.

[0049] The bleeding risk assessment value is compared with a preset alarm threshold. When the assessment value exceeds the alarm threshold, the current area is identified as a confirmed bleeding point. The coordinates of the bounding rectangle of this area are calculated, a red border is drawn on the corresponding frame of the original laparoscopic video stream, and a risk value label is overlaid, outputting a visual bleeding warning map. The specific execution process is as follows: The system's alarm threshold is set to... (This threshold is selected based on the optimal operating point of the ROC curve, balancing sensitivity and specificity.) Read the values ​​calculated in the preceding steps. Numerical value. If The current static blood candidate region is determined to be an "active bleeding point". The bounding rectangle parameters of this region are calculated using a connected component analysis algorithm (such as cv2.boundingRect). ,in The coordinates of the top left corner The width and height are specified. On the current original video frame, a drawing function is called to draw a rectangular border with a width of 3 pixels using red lines (RGB values: 255,0,0). Simultaneously, the text label "BLEEDING:XX%" is overlaid above the border, where XX is the width and height. The integer value. Finally, the image frame with visual markers is rendered to a medical monitor via the video output interface to help doctors quickly locate tiny bleeding points. If If a risk is not identified, it will not be marked to avoid visual interference for doctors and to ensure that the system only issues a warning when the risk is significant.

[0050] An image processing-based laparoscopic hemorrhage detection assistance system is provided. This system is used to execute the aforementioned image processing-based laparoscopic hemorrhage detection assistance method. The system includes: The image preprocessing module is used to acquire the original video stream of laparoscopy and extract single-frame images, generate a specular binary mask through adaptive threshold segmentation, and perform denoising processing using a fast advancing repair algorithm to generate denoised surgical images. The static feature extraction module is used to convert the denoised surgical image to a color space to obtain the a-channel component map, calculate the local texture entropy value and energy feature parameters, and remove interference through logical AND operation to construct static blood candidate regions; The dynamic feature analysis module is used to calculate the dense optical flow field based on temporally correlated images, map the optical flow field vector to candidate regions to analyze the edge expansion trend, calculate the region area growth rate, and construct a dynamic spatiotemporal feature matrix. The risk assessment and early warning module is used to normalize the extracted multidimensional features, calculate the bleeding risk assessment value through a weighted logistic regression model, and generate a visual bleeding early warning chart when the value exceeds the limit.

[0051] The above embodiments illustrate preferred embodiments of the present invention. Any equivalent adjustments to the technical solution based on software engineering methods are within the scope of protection, including but not limited to: implementing algorithm logic using different programming languages, refactoring functional modules into services, adjusting data interaction protocols, and optimizing resource scheduling strategies. Any implementation scheme derived from reasonable modifications to the data processing flow, service call chain, or system architecture layer without departing from the core technology of the present invention should be considered within the protection scope defined by the technical solution of the present invention.

Claims

1. A method for assisting in the detection of laparoscopic bleeding based on image processing, characterized in that, Includes the following steps: S1: Acquire the original video stream of the laparoscopy, extract the serialized frames to obtain a single frame image, traverse the pixel brightness values ​​of the single frame image, identify the highlight connected regions in the image through adaptive threshold segmentation, construct a highlight binary mask, and use the fast marching inpainting algorithm to perform pixel interpolation filling on the region covered by the highlight binary mask to generate a denoised surgical image. S2: Convert the denoised surgical image from RGB color space to Lab color space, extract the a-channel component image, calculate the local texture entropy value and energy feature parameters of the a-channel component image based on the gray-level co-occurrence matrix, perform pixel-level logical AND operation in combination with preset color threshold, remove non-blood tissue interference, and construct static blood candidate regions; S3: Obtain the temporally adjacent associated image of the denoised surgical image, perform dense optical flow calculation on it to generate an optical flow field vector, calculate the magnitude and orientation angle of the optical flow field vector, map the optical flow field vector to the static blood candidate region, analyze the outward expansion trend of the region edge, calculate the region area growth rate, and construct a dynamic spatiotemporal feature matrix. S4: After normalizing the local texture entropy value, the energy feature parameter and the dynamic spatiotemporal feature matrix, input them into the weighted logistic regression model to calculate the bleeding risk assessment value. Compare the value with the preset alarm threshold. If it is higher than the threshold, generate a bleeding location marker box, superimpose it on the original laparoscopic video stream and output a visual bleeding warning map.

2. The laparoscopic hemorrhage detection auxiliary method based on image processing according to claim 1, characterized in that, The specific steps of S1 are as follows: S11: Use the video capture interface to read the original video stream of the laparoscopy in real time, extract the video frame sequence according to the preset time interval, calculate the global brightness mean and brightness standard deviation of the current single frame image, and combine the preset local window size to traverse each pixel in the image to calculate the local statistical features in the neighborhood of the pixel. S12: Based on the local statistical features, set an adaptive brightness threshold, determine the pixels with brightness values ​​higher than the threshold as specular noise, mark them as foreground pixels, and mark the remaining pixels as background pixels. Extract the spatial distribution of all specular noise points through a connected component analysis algorithm, and establish the specular binary mask. S13: For the damaged area marked by the specular binary mask, initialize the known pixel set and the narrowband set to be repaired by the fast traversal algorithm, calculate the priority weight based on the geodesic distance between the pixel to be repaired and the boundary of the known pixel, estimate the brightness information of the pixel to be repaired by weighting the gray values ​​of the known neighboring pixels, and iterate from the outside to the inside until all damaged areas are filled, thereby generating the denoising surgical image.

3. The laparoscopic hemorrhage detection auxiliary method based on image processing according to claim 1, characterized in that, The specific steps of S2 are as follows: S21: Call the color space conversion function to nonlinearly map the red, green and blue components of the denoised surgical image to the CIE-Lab color mode, separate the a-channel component image, and perform Gaussian smoothing filtering on the component image; S22: Set the generation step size and direction parameters of the gray-level co-occurrence matrix, traverse each pixel block in the a-channel component image, count the probability distribution of joint occurrence of pixel gray levels, and construct the gray-level co-occurrence matrix. S23: Calculate the local texture entropy value and the energy feature parameter based on the gray-level co-occurrence matrix, and simultaneously obtain the pixel gray-level values ​​of the a-channel component map; S24: Compare the pixel grayscale value of the a-channel component image with the preset lower limit threshold of blood color, and at the same time determine whether the corresponding local texture entropy value is less than the preset texture disorder threshold. Only when both conditions are met, mark the pixel area as a potential bleeding point, and connect the edges of the broken area through morphological closing operation to construct the static blood candidate area.

4. The laparoscopic hemorrhage detection auxiliary method based on image processing according to claim 1, characterized in that, The specific steps of S3 are as follows: S31: Extract the previous frame image that is adjacent to the denoised surgical image on the time axis from the original laparoscopic video stream as a reference frame, and use the Farneback dense optical flow algorithm to calculate the displacement vector of each pixel between the reference frame and the current frame to generate an original optical flow field containing horizontal and vertical components. S32: Perform polar coordinate transformation on the original optical flow field, calculate the magnitude and orientation angle of the optical flow field vector corresponding to each pixel position, and use a median filter to remove isolated abnormal optical flow vectors to obtain smoothed motion field data; S33: The static blood candidate region is used as a spatial mask to cover the smoothed motion field data, and the effective optical flow vectors located inside and at the edge of the candidate region are screened out. The radial projection component of the effective optical flow vector relative to the centroid of the region is calculated to quantify and analyze the outward expansion trend of the edge caused by blood diffusion. S34: Calculate the proportion of pixels with positive radial projection components within the static blood candidate region to the total number of pixels in the region. Combine this with the average intensity of the optical flow modulus to calculate the area growth rate of the region. Then, combine this growth rate with the consistency index of the optical flow direction to construct the dynamic spatiotemporal feature matrix.

5. The laparoscopic hemorrhage detection auxiliary method based on image processing according to claim 1, characterized in that, The specific steps of S4 are as follows: S41: Obtain the local texture entropy value, the energy feature parameter, and the growth rate data in the dynamic spatiotemporal feature matrix corresponding to the static blood candidate region, and use the maximum-minimum normalization method to map the above multidimensional feature data to a closed interval from zero to one, thereby eliminating the influence of dimensional differences on the model weights. S42: Input the normalized multidimensional feature vector into the pre-trained weighted logistic regression model, use the weight coefficient matrix inside the model to perform linear weighted summation of the feature vector, and use the Sigmoid activation function to map the summation result into a probability form to calculate the bleeding risk assessment value. S43: Compare the bleeding risk assessment value with the preset alarm threshold. When the assessment value exceeds the alarm threshold, determine the current area as a confirmed bleeding point, calculate the coordinates of the bounding rectangle of the area, draw a red border on the corresponding frame of the original laparoscopic video stream, and overlay the risk value label to output the visualized bleeding warning map.

6. The laparoscopic hemorrhage detection auxiliary method based on image processing according to claim 3, characterized in that, The feature parameter calculation process in S23 specifically includes: The value of each element in the gray-level co-occurrence matrix is ​​obtained and used as the normalized joint probability density. The information entropy of the probability density is calculated using the logarithmic function to obtain the local texture entropy value. The energy feature parameter is obtained by calculating the sum of squares of the probability density values. The distribution of non-zero elements in the gray-level co-occurrence matrix is ​​used as the basis for judgment. If the non-zero elements are concentrated near the main diagonal, it is determined to be a tissue region with fine texture and smooth gray-level changes. If the non-zero elements are scattered, it is determined to be a non-blood tissue region with coarse texture and messy texture. Combining the grayscale mean of the a-channel component image, the inverse difference moment feature is further calculated to describe the local uniformity of the image texture. This inverse difference moment feature is used as an auxiliary discrimination parameter and together with the local texture entropy value, it constitutes a static texture feature set for subsequent logical filtering.

7. The laparoscopic hemorrhage detection auxiliary method based on image processing according to claim 4, characterized in that, The calculation of the regional area growth rate in S34 relies on the following formula: ; in, This represents the growth rate of the area of ​​the region. This represents the total pixel area of ​​the static blood candidate region. Represents the set of pixels within the candidate region. Representing coordinates The optical flow field vector at that location, This represents the unit normal vector pointing from the centroid of the region to that pixel. Represents the optical flow modulus. This represents the Heaviside step function, used to filter out components in the expansion direction.

8. The laparoscopic hemorrhage detection auxiliary method based on image processing according to claim 5, characterized in that, The calculation process of the weighted logistic regression model in S42 depends on the following formula: ; in, This represents the bleeding risk assessment value. This represents the normalized local texture entropy value. This represents the normalized energy characteristic parameter. This represents the growth rate of the area of ​​the region. , , These represent the weight coefficients of the corresponding features. The bias term represents the model. is the base of the natural logarithm.

9. The laparoscopic hemorrhage detection auxiliary method based on image processing according to claim 2, characterized in that, The pixel interpolation filling process in S13 specifically includes: Construct a neighborhood window centered on the pixel to be repaired, identify all known valid pixels within the window, calculate the Euclidean distance from the valid pixels to the pixel to be repaired, and use the reciprocal of this Euclidean distance as a distance weight factor. The gradient vector of the effective pixel is obtained, and the gray value of the pixel to be repaired is weighted and estimated by combining the distance weight factor and the orientation consistency factor to ensure that the texture orientation of the repaired pixel remains continuous with the surrounding tissue. A heap data structure is used to maintain the pixel set within the narrow band. Each time, the pixel with the minimum cost value is selected first for updating, and the updated pixel is marked as a known state. Its surrounding unrepaired neighbor nodes are added to the narrow band set. The above process is repeated until all pixels within the specular binary mask are assigned new grayscale values.

10. A laparoscopic hemorrhage detection auxiliary system based on image processing, characterized in that, The system is used to implement the image processing-based laparoscopic hemorrhage detection auxiliary method according to any one of claims 1-9, the system comprising: The image preprocessing module is used to acquire the original video stream of laparoscopy and extract single-frame images, generate a specular binary mask through adaptive threshold segmentation, and perform denoising processing using a fast advancing repair algorithm to generate denoised surgical images. The static feature extraction module is used to convert the denoised surgical image to a color space to obtain an a-channel component map, calculate the local texture entropy value and energy feature parameters, and remove interference through logical AND operation to construct a static blood candidate region. The dynamic feature analysis module is used to calculate the dense optical flow field based on temporally correlated images, map the optical flow field vector to candidate regions to analyze the edge expansion trend, calculate the region area growth rate, and construct a dynamic spatiotemporal feature matrix. The risk assessment and early warning module is used to normalize the extracted multidimensional features, calculate the bleeding risk assessment value through a weighted logistic regression model, and generate a visual bleeding early warning chart when the value exceeds the limit.