A medical endoscope image noise suppression system and method based on FPGA

CN122887715APending Publication Date: 2026-10-09WEYO SURGICAL TECHNOLOGY LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611004040.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-07
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

在医用内窥镜的应用场景中,若缺乏对场景运动状态的实时识别与参数目标值的自适应决策机制,采集帧率的盲目切换反而可能导致曝光不当、亮度骤变或噪声异常放大,进一步劣化图像质量

Benefits of technology

[0017]本发明的有益效果:本发明将图像噪声抑制逻辑从后端ISP迁移至前端采集链路;在图像传感器采集阶段直接调节帧率与曝光时间,减少图像传感器端增益带来的信噪比下降;通过FPGA实现实时运动检测与参数控制闭环,使降噪不依赖后端算法计算;利用FPGA的多层运动判别模块,实时区分静态与动态场景,对不同场景采用差异化参数策略;在静态场景与动态场景发生切换时,通过跨帧时序控制模块在若干帧内对帧率与曝光时间进行联动的渐进调整,根据对应帧率逐步改变曝光时间来控制单位时间内的入射光量和噪声水平,使采集参数平滑过渡至新的工作点,避免画面亮度突变和流畅度骤变,从而保证成像稳定性和观察连续性;采用基于FPGA的可综合流水线架构,在硬件内部集成跨帧运动判别与时序控制模块,并与ISP自动参数测量模块协同运行,实现图像状态的实时识别与参数反馈。通过采集控制模块与图像处理链路的闭环协同控制,提高噪声抑制效率与图像质量的稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122887715A_ABST
    Figure CN122887715A_ABST
Patent Text Reader

Abstract

The application discloses a medical endoscope image noise suppression system and method based on FPGA, relates to hardware image processing technology, and migrates image noise suppression logic from a rear-end ISP to a front-end acquisition link; frame rate and exposure time are directly adjusted in an image sensor acquisition stage, and signal-to-noise ratio reduction caused by an image sensor end gain is reduced; real-time motion detection and parameter control closed loop are realized through FPGA, so that noise reduction is not dependent on rear-end algorithm calculation; a multilayer motion discrimination module of the FPGA is used to distinguish static and dynamic scenes in real time, and different parameter strategies are adopted for different scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to hardware image processing technology, and more particularly to an FPGA-based medical endoscope image noise suppression system and method. Background Technology

[0002] Medical endoscopic imaging systems rely on real-time image acquisition by miniature CMOS image sensors within the confined spaces of body cavities. Image quality directly impacts the accuracy of clinical diagnosis and the safety of surgical procedures. Due to the slender structure of the endoscope, the physical size and photosensitive area of ​​the sensor are severely limited. In deep cavities, narrow spaces, or environments filled with body fluids, the intensity of incident light is often significantly insufficient, resulting in a raw image signal-to-noise ratio that is significantly lower than that of conventional imaging equipment. To obtain brightness levels sufficient for clinical observation, the system typically needs to increase sensor gain to amplify weak signals or extend exposure time to accumulate more incident photons. However, both of these compensation methods introduce inherent image degradation mechanisms: gain enhancement inevitably amplifies various noise components, including readout noise, dark current shot noise, and photon shot noise, resulting in dense color noise and graininess, blurring the fine textures and edge contours of lesions; extended exposure time, when capturing dynamic scenes such as heartbeats, tissue peristalsis, or endoscopic manipulation, easily produces motion blur and ghosting artifacts, reducing the spatiotemporal resolution of the image. The aforementioned degradation effect is particularly pronounced when observing minute lesions under high magnification, directly limiting the clinical application value of endoscopy in precision diagnosis and treatment. How to achieve synergistic optimization of image brightness, noise level, and motion clarity in low-light endoscopic environments has become a core technical challenge that urgently needs to be solved in this field.

[0003] To address the aforementioned image quality degradation issue, existing technologies have proposed several technical solutions involving the adjustment of image acquisition parameters. For example, patent US20250063252A1 proposes a multi-mode camera frame-sharing algorithm for CV features in XR head-mounted devices. When image parameters are determined to meet a preset threshold, the image acquisition frame rate is reduced to decrease the number of image frames that need to be processed per unit time, thereby reducing the processor's computational burden and lowering system power consumption. The adjustment basis of this technical solution is whether the image acquisition parameters (gain, exposure, etc.) meet the threshold conditions, and the control target focuses on optimizing processor load and power consumption, rather than suppressing image noise or improving image quality. Specifically, this technical solution does not establish a linkage adjustment mechanism between frame rate changes and sensor exposure time and gain, nor does it adapt parameter targets according to the differentiated imaging requirements of different scene content. During the frame rate reduction process, the exposure time is not extended accordingly to maintain the signal-to-noise ratio, and the gain parameter is not adjusted in a coordinated manner to control the noise level. Therefore, it cannot fundamentally solve the trade-off between noise and motion blur in low-light endoscopy scenarios. Furthermore, its triggering conditions are based on image parameter threshold judgment, lacking the ability to recognize local motion states in the image in real time, making it difficult to meet the needs of scene-adaptive imaging in the complex and ever-changing imaging environment of endoscopic clinical operations.

[0004] For example, patent CN113630572B addresses the issue of screen stuttering during refresh rate switching in electronic devices by proposing a frame rate switching method and related devices. When the system needs to switch refresh rates, timing coordination between software-issued frame-switching commands and hardware execution avoids TE (Time Limit Exceeded) issues and screen stuttering caused by refresh rate switching. This technical solution provides a useful means for timing control of display refresh rate switching, but its technical field is display driving, and the switching object is the display refresh rate rather than the image sensor's frame rate. It does not address the coordinated adjustment mechanism of exposure time and gain, nor does it provide scene-adaptive judgment criteria for frame rate switching trigger conditions. In medical endoscope applications, without real-time recognition of scene motion states and adaptive decision-making mechanisms for parameter target values, blind switching of the acquisition frame rate may lead to improper exposure, sudden brightness changes, or abnormal noise amplification, further degrading image quality. This technical solution does not establish a correlation between acquisition frame rate switching and image quality optimization, nor does it consider differentiated acquisition strategies based on image content. Summary of the Invention

[0005] The purpose of this section is to outline some aspects of the embodiments of the present invention and to briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section, as well as in the abstract and title of the invention, to avoid obscuring the purpose of this section, the abstract and title of the invention, and such simplifications or omissions shall not be used to limit the scope of the invention.

[0006] In view of the aforementioned existing problems, the present invention is proposed.

[0007] To address the problems mentioned above, this invention provides the following technical solution: a medical endoscope image noise suppression system based on FPGA, characterized in that it includes: an image acquisition and caching module for controlling an image sensor to acquire image frames and caching the current frame image and the previous frame image data; a motion discrimination module for calculating the motion amplitude based on the current frame image and the previous frame image and judging the motion state of the current image; a cross-frame smoothing control module for confirming the motion discrimination results of multiple consecutive frames and, when the motion state changes, controlling the frame rate and exposure time to be progressively adjusted within a preset number of frames; and an adaptive control module for adaptively generating adjustment instructions including frame rate, exposure time, and gain based on the confirmed motion state and image brightness measurement results, and outputting them to the image sensor; the image sensor acquires images according to the adjustment instructions to form a closed-loop adjustment.

[0008] In a preferred embodiment of the present invention, the motion discrimination module includes a coarse detection unit and a fine detection unit. The coarse detection unit performs multi-scale downsampling on the current frame image and the previous frame image, calculates the inter-frame grayscale difference at each scale, compares it with the frame difference threshold corresponding to each scale, generates a multi-scale binary motion mask, and outputs a suspected motion determination signal based on the comparison result of the number of moving pixels at each scale with the corresponding counting threshold. The fine detection unit performs feature point detection and optical flow calculation on the candidate motion region after receiving the suspected motion determination signal, and outputs the final motion state based on the optical flow motion amplitude.

[0009] As a preferred embodiment of the present invention, the multi-scale downsampling includes performing Gaussian filtering on the image and then downsampling every other row and column to generate at least three scale images with different resolutions; the scale images are stored in the FPGA internal block memory for coarse detection and fine detection multiplexing.

[0010] In a preferred embodiment of the present invention, the frame difference thresholds corresponding to each scale in the coarse detection unit are dynamically corrected based on the brightness perturbation reference amount and the effective gain of the current frame; the motion pixel counting threshold is calculated based on the preset minimum effective motion area according to the downsampling ratio of each scale.

[0011] In a preferred embodiment of the present invention, the fine detection unit determines the region of interest by upsampling and fusing the binary motion masks at each scale, performs feature point detection within the region of interest, and controls the number of detected feature points by a limit; after the lower limit of the number of feature points is met, the multi-scale image stored in the coarse detection unit is reused to perform pyramid optical flow calculation, and the final motion state is determined based on the motion amplitude of each layer of optical flow.

[0012] In a preferred embodiment of the present invention, the cross-frame smoothing control module includes a state cache unit and a frame rate exposure gradient control unit; the state cache unit is used to store the motion state of multiple consecutive frames, and confirms the final stable state when the same state reaches a preset number of frames; the frame rate exposure gradient control unit is used to update the frame rate level frame by frame according to a preset gradient function when the motion state switches, and to adjust the exposure time in conjunction with the frame rate until the target frame rate is reached.

[0013] In a preferred embodiment of the present invention, the adaptive control module includes a brightness statistics unit and a parameter update unit; the brightness statistics unit is used to calculate the weighted average brightness of the central region of the image and the proportion of overexposed pixels; the parameter update unit is used to adjust the gain according to the deviation between the average brightness and the target brightness in a dynamic state, to prioritize reducing the frame rate and synchronously extend the exposure time in a static state, and to perform gain back-off adjustment when the overexposed proportion exceeds the threshold.

[0014] In a preferred embodiment of the present invention, the adaptive control module also operates in conjunction with the automatic parameter measurement unit of the image signal processing unit, and receives the pixel brightness statistics output by the automatic parameter measurement unit as the brightness measurement result.

[0015] This invention provides the following technical solution: a noise suppression method for medical endoscope images based on FPGA, comprising: controlling an image sensor to acquire image frames according to current acquisition parameters, and buffering the current frame image and the previous frame image data; calculating the motion amplitude based on the current frame image and the previous frame image, and determining the motion state of the current image; confirming the motion determination results of multiple consecutive frames, and when the motion state changes, controlling the frame rate and exposure time to be progressively adjusted within a preset number of frames; adaptively generating an acquisition parameter adjustment command including frame rate, exposure time and gain based on the confirmed motion state and image brightness measurement results, and outputting it to the image sensor; the image sensor acquiring images according to the adjustment command and performing the next round of adjustment.

[0016] As a preferred embodiment of the present invention, the determination of the motion state of the current frame includes: a coarse detection stage, which calculates the inter-frame grayscale difference at each scale after multi-scale downsampling of the current frame image and the previous frame image, generates a multi-scale binary motion mask, and outputs a suspected motion determination signal based on the number of moving pixels at each scale; and a fine detection stage, which performs feature point detection on the candidate motion region after receiving the suspected motion determination signal, reuses the multi-scale image stored in the FPGA internal memory after downsampling in the coarse detection stage to perform pyramid optical flow calculation, and outputs the final motion state based on the optical flow motion amplitude.

[0017] The beneficial effects of this invention are as follows: This invention migrates image noise suppression logic from the backend ISP to the frontend acquisition link; it directly adjusts the frame rate and exposure time during the image sensor acquisition stage, reducing the signal-to-noise ratio drop caused by the gain at the image sensor end; it implements real-time motion detection and parameter control closed-loop through FPGA, making noise reduction independent of backend algorithm calculations; it utilizes the multi-layer motion discrimination module of FPGA to distinguish between static and dynamic scenes in real time, and adopts differentiated parameter strategies for different scenes; when switching between static and dynamic scenes, the cross-frame timing control module performs progressive adjustments to the frame rate and exposure time in linkage within several frames, gradually changing the exposure time according to the corresponding frame rate to control the incident light amount and noise level per unit time, so that the acquisition parameters smoothly transition to the new working point, avoiding sudden changes in image brightness and smoothness, thereby ensuring imaging stability and observation continuity; it adopts a synthesizable pipeline architecture based on FPGA, integrating the cross-frame motion discrimination and timing control module internally, and cooperating with the ISP automatic parameter measurement module to achieve real-time recognition of image status and parameter feedback. Through closed-loop collaborative control between the acquisition control module and the image processing link, it improves noise suppression efficiency and image quality stability. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a flowchart of the FPGA-based medical endoscope image noise suppression method of the present invention.

[0019] Figure 2 This is an FPGA architecture diagram of a medical endoscope image noise suppression system.

[0020] Figure 3 This is a diagram of the internal structure of S3.

[0021] Figure 4This is a flowchart of the frame rate exposure gradient module.

[0022] Figure 5 This is a diagram showing the internal architecture of S4.

[0023] Figure 6 This is a comparison chart of the experiments. Detailed Implementation

[0024] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0025] Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without inventive effort should fall within the scope of protection of this invention.

[0026] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0027] Example 1

[0028] Unlike traditional back-end digital filtering and noise reduction techniques, this invention proposes a noise suppression method implemented before image acquisition. The entire system is controlled by an FPGA, such as... Figure 1 As shown, after an image sensor (CIS) acquires an image, a layered motion detection module determines the motion state of the current scene. When a static scene is detected, the acquisition parameters are adjusted to reduce the frame rate and gain, and extend the exposure time, thereby improving the signal-to-noise ratio. When a dynamic scene is detected, a high frame rate and short exposure are maintained to reduce motion blur, and gain is used to compensate for insufficient brightness caused by short exposure. When a static-to-dynamic transition is detected, the frame rate is gradually increased and a smooth transition is performed to ensure stable image brightness and smoothness. Finally, the image sensor (CIS) is reconfigured in real time according to parameter changes, achieving differentiated acquisition control for still and moving images, suppressing image noise at its source.

[0029] Combination Figure 1 The flowchart shown illustrates a method for suppressing noise in medical endoscope images based on FPGA, comprising the following steps: The system controls the image sensor to acquire image frames according to the current acquisition parameters and caches the current frame image and the previous frame image data; it calculates the motion amplitude based on the current frame image and the previous frame image to determine the motion state of the current image; it confirms the motion determination results of multiple consecutive frames, and when the motion state changes, it controls the frame rate and exposure time to be adjusted progressively within a preset number of frames; based on the confirmed motion state and image brightness measurement results, it adaptively generates acquisition parameter adjustment instructions including frame rate, exposure time and gain, and outputs them to the image sensor; the image sensor acquires images according to the adjustment instructions and performs the next round of adjustment.

[0030] like Figure 2 As shown, the FPGA-based medical endoscope image noise suppression system is designed using the above method. Figure 2 In the architecture shown, S1 is the image acquisition and caching module, which is used for image acquisition and caching, providing a stable data stream input for motion discrimination within the FPGA; S2 is the motion discrimination module, which determines the motion state of the current image by calculating the motion amplitude between two frames, providing a basis for subsequent adaptive parameter adjustment strategies; S3 is the cross-frame smoothing control module, which confirms and makes a final determination on the results of multiple consecutive frames output by S2, and controls the gradual adjustment of frame rate and exposure time during static-motion state transitions; S4 is the adaptive control module, which adaptively adjusts parameters and generates image sensor register control command outputs based on the motion state finally confirmed by S3 and the brightness measurement results in the image signal processing unit.

[0031] Specifically, in this embodiment of the invention, the S1 image acquisition and caching module includes: video images entering from the left side of the architecture, image frames being acquired by an image sensor controlled by an FPGA according to initial parameters, and an external DDR memory being controlled by a frame buffer control module to cache the image data of the previous frame and the current frame to support subsequent motion detection.

[0032] In this embodiment of the invention, the S2 motion discrimination module specifically includes two stages: coarse detection and fine detection. In the coarse detection stage, downsampling processing at three scales is first performed based on the current frame image and the previous frame image. Multi-scale downsampling employs a Gaussian filtering followed by interlaced row and column downsampling. The Gaussian filter kernel size is 3×3, and the standard deviation is 1.0, to eliminate aliasing effects and improve the accuracy of frame difference calculation. The downsampled three-scale images are simultaneously stored in the FPGA's internal BRAM for reuse in both coarse detection frame difference calculation and fine detection optical flow calculation, avoiding redundant calculations and saving hardware resources.

[0033] In clinical image acquisition, exposure control requires high real-time accuracy in handling motion. While performing multi-scale calculations directly at the original resolution during the coarse detection stage can preserve more detail, it increases the computational burden of frame difference calculations, threshold comparisons, and motion pixel statistics, potentially causing exposure adjustments to lag behind actual image changes. Therefore, this embodiment sets the three coarse detection scales to half-scale, quarter-scale, and eighth-scale. The half-scale is used to preserve major edges and local motion information, the quarter-scale is used to detect motion in medium-range areas, and the eighth-scale is used to detect large-scale overall displacement trends.

[0034] By combining the above scales, the coarse detection calculation link can be shortened while ensuring the stability of motion state judgment, so that the motion state can be input into the subsequent calculation module more timely, and the lag of exposure time, frame rate and gain adjustment can be reduced.

[0035] Next, the inter-frame grayscale difference calculation module is entered. Based on the current frame image and the previous frame image at half-scale, quarter-scale, and eighth-scale, pixel-by-pixel grayscale difference calculations are performed. Specifically, at the same scale, the grayscale value of a pixel in the current frame image is subtracted from the grayscale value at the same coordinate position in the previous frame image, and the absolute value of the difference is taken to obtain the inter-frame grayscale difference value of that pixel. The frame difference map is used to characterize the brightness variation distribution between adjacent frames at the corresponding scale and serves as input for thresholding processing in the subsequent motion mask generation module. Then, the frame difference map is input to the motion mask generation module and binarized by comparing it with the frame difference threshold corresponding to each scale.

[0036] It should be noted that the frame difference thresholds corresponding to the half-scale, quarter-scale, and eighth-scale are determined using a combination of a base threshold and frame-level brightness perturbation correction. Specifically, the full-scale grayscale range of the image is determined based on the image grayscale bit width, and the base frame difference threshold for each scale is set according to the downsampling factor of each scale. Since a larger downsampling factor results in a greater degree of attenuation of local noise and fine textures through averaging, the base frame difference threshold for the eighth-scale is lower than that for the quarter-scale, and the base frame difference threshold for the quarter-scale is lower than that for the half-scale. For example, when the grayscale data is 8 bits, the base frame difference threshold for the half-scale is 8 to 16 gray levels, the base frame difference threshold for the quarter-scale is 6 to 12 gray levels, and the base frame difference threshold for the eighth-scale is 4 to 10 gray levels. For example, in this embodiment of the invention, the dynamic range of the frame difference threshold corresponding to the half-scale is 8 to 36, the dynamic range of the frame difference threshold corresponding to the quarter-scale is 6 to 30, and the dynamic range of the frame difference threshold corresponding to the eighth-scale is 4 to 24.

[0037] During real-time operation, the current frame image is uniformly divided into several pixel blocks (e.g., 16×16 pixel blocks), and the brightness variance of each block is calculated. The maximum or average value of the variances of all blocks is taken as the brightness perturbation reference for the current frame. In this embodiment, the maximum value of the variances of all blocks is used as the brightness perturbation reference for the current frame, and the basic frame difference thresholds at each scale are slightly modified in conjunction with the effective gain of the current frame. When the brightness perturbation reference for the current frame increases or the effective gain increases, the frame difference threshold at the corresponding scale is increased to reduce false triggering caused by noise, reflection, and brightness fluctuations; when the brightness perturbation reference for the current frame is small and the effective gain is low, the frame difference threshold at the corresponding scale is decreased or maintained to improve the response capability to slight motion. After being limited by the lower and upper threshold limits, the modified frame difference threshold is written to the threshold register of the corresponding scale at the end of the frame and is used by the motion mask generation module of the next frame.

[0038] In the hardware implementation, the frame difference thresholds for each scale are stored in the FPGA's threshold register as integers or fixed-point numbers. During the pixel stream input process, the motion mask generation module compares the inter-frame grayscale difference of the current pixel with the corresponding scale frame difference threshold using a comparator. It outputs 1 when the inter-frame grayscale difference is greater than the corresponding scale frame difference threshold, and outputs 0 otherwise. This yields the first-scale binary motion mask, the second-scale binary motion mask, and the third-scale binary motion mask.

[0039] Motion pixel statistics are performed on the motion binary mask image. The first-scale binary motion mask, the second-scale binary motion mask, and the third-scale binary motion mask are input into the motion pixel statistics module. The number of motion pixels marked as 1 at each scale is counted to obtain the number of motion pixels at the first scale, the number of motion pixels at the second scale, and the number of motion pixels at the third scale.

[0040] The number of moving pixels at the first, second, and third scales are input to the coarse motion determination module for comprehensive judgment. The coarse motion determination module pre-stores motion pixel count thresholds for each scale, calculated based on the minimum effective motion region area. If the number of moving pixels at half the scale exceeds its count threshold, or if the number of moving pixels at the quarter and eighth scales simultaneously exceeds their respective count thresholds, a suspected motion determination signal is output, and the process enters the fine detection stage; otherwise, a static candidate state is output to the S3 cross-frame smoothing control module.

[0041] The motion pixel counting threshold at each scale is calculated based on the minimum effective motion region area. Specifically, the minimum effective motion region area required to trigger motion detection in the original image is first determined. This minimum effective motion region area can be determined based on the minimum continuous motion region that needs to respond in the endoscopic field of view. Based on the downsampling factor of each scale, this minimum effective motion region area is converted to the corresponding scale to obtain the minimum effective motion pixel count at that scale. Then, based on the ratio of the minimum effective motion pixel count at that scale to the total number of pixels in the image at that scale, the motion ratio judgment threshold for that scale is obtained. The minimum effective motion region area is determined based on the minimum continuous motion support region at the lowest resolution scale. Specifically, to avoid coarse detection triggered by isolated noise points, local reflections, or single-pixel brightness disturbances, the motion region is required to form at least a continuous motion region of a preset size at the lowest resolution scale. Let this preset size be q×q pixels, and the downsampling factor of the lowest resolution scale be D. max Then the area of ​​the minimum effective motion region in the original image satisfies A min =(q×D max ) 2 For example, when the three coarse detection scales are half-scale, quarter-scale, and eighth-scale, the lowest resolution scale is the eighth-scale, D. max =8. If the preset size is 3×3, the minimum effective motion region area in the original image is 576 pixels. Based on this minimum effective motion region area, the minimum effective motion pixel count for each scale is calculated according to the downsampling ratio, and this minimum effective motion pixel count is used as the motion pixel counting threshold. During real-time operation, the FPGA directly compares the current scale motion pixel count with the corresponding counting threshold, without performing real-time division operations.

[0042] It should be noted that the output of the coarse motion determination module is used to trigger the fine detection stage, not directly as the final dynamic determination result. This is because the coarse detection stage relies primarily on inter-frame grayscale differences and the proportion of moving pixels for rapid judgment, making it susceptible to localized reflections, noise, brightness variations, and slight sensor jitter. Directly using the coarse detection result as the dynamic determination result could lead to frequent adjustments to exposure time, frame rate, and gain, affecting the brightness stability of clinical images.

[0043] Therefore, after the coarse detection stage outputs a suspected motion determination signal, it proceeds to the fine detection stage. The fine detection stage performs feature point detection, image pyramid construction, gradient calculation, and optical flow solving based on candidate motion regions to determine whether there is a stable spatial displacement between two image frames. Coarse detection is used to quickly filter out obviously static frames, reducing invalid starts of subsequent fine detection; fine detection is used to accurately confirm suspected motion frames, reducing false positives caused by noise and brightness disturbances. Through the cooperation of coarse and fine detection, the reliability of motion state determination can be improved while ensuring real-time performance.

[0044] In fine-grained detection, binary masks at three scales are input into a scale alignment module for upsampling and fusion to obtain a unified motion mask. The scale alignment module uses nearest-neighbor interpolation to upsample the quarter-scale and eighth-scale binary motion masks to half-scale resolution, and then uses a logical OR operation to fuse the upsampled masks at the three scales. The logical OR operation ensures that if motion is detected at any scale, it is marked as a motion region in the unified mask, avoiding missed detections. The region of interest (ROI) is determined based on the unified motion mask: the bounding rectangle of the pixels with a value of 1 in the mask is searched, and this bounding rectangle is extended outward by a preset boundary (e.g., 16 pixels) to obtain the coordinates of the ROI. Sub-images are extracted from the corresponding coordinates of the current frame and the previous frame as the ROI images for the current and previous frames. Feature point detection is performed in the ROI images of the current frame and the previous frame using the FAST corner detection method. Specifically, a rectangular sliding window centered on the current pixel to be detected is constructed based on a line buffer and a shift register, and neighboring pixels at preset positions are selected from the rectangular sliding window as corner comparison pixels. The grayscale difference between the center pixel and each corner pixel is compared using a parallel comparator. When a predetermined number of consecutive corner pixels are all greater than the sum of the grayscale value of the center pixel and the corner grayscale difference threshold, or are all less than the difference between the grayscale value of the center pixel and the corner grayscale difference threshold, the pixel to be detected is marked as a feature point.

[0045] The number of consecutive preset pixels is determined based on the neighborhood size of FAST corner detection, the stability requirements of feature points, and the real-time requirements of the hardware. For example, the rectangular sliding window is a 7×7 window, and the corner comparison pixels are 16 preset position pixels selected around the center pixel within this window. The number of consecutive preset pixels ranges from 9 to 12, preferably 9. This method can adapt to the FPGA's row buffer, shift register, and parallel comparator pipeline structure while maintaining the FAST corner detection judgment logic.

[0046] The corner grayscale difference threshold is stored in a threshold register. During system initialization or clinical observation mode loading, the host computer writes the corner grayscale difference threshold into the corner threshold register in one go, based on the image grayscale bit width, clinical observation mode, and image sensor noise level. During real-time operation, the FPGA directly reads this corner grayscale difference threshold for FAST corner detection, ensuring the stability of the feature point detection pipeline. For example, when the grayscale data is 8 bits, the corner grayscale difference threshold is set to 10 to 20 grayscale levels; when the clinical mode has high requirements for weak texture response, the host computer initializes and writes a lower threshold; when there is strong reflection, noise, or texture disturbance in the clinical mode, the host computer initializes and writes a higher threshold.

[0047] Furthermore, to ensure that optical flow calculation is completed within a single frame period, this embodiment of the invention implements hardware-based quota control for the number of feature points. Specifically, the upper limit of the number of feature points is determined based on the hardware throughput capability of the optical flow calculation unit. Based on the effective number of clock cycles available for optical flow calculation within a single frame period, the number of feature points processed in parallel by the optical flow calculation unit per cycle, and the average number of clock cycles required for a single feature point to complete the optical flow solution, the maximum number of feature points that can be processed per frame is determined, multiplied by a safety factor, and written to the feature point upper limit register. The safety factor, ranging from 0.7 to 0.85, is used to reserve clock margins for image pyramid construction, gradient calculation, cache read / write, and state determination. For example, the upper limit of the number of feature points is between 256 and 1024, preferably 512.

[0048] During pixel stream input, the FAST corner detection unit, corner response calculation unit, feature point counter, and feature point cache writing unit operate in a pipelined parallel manner. For each valid feature point detected, the feature point counter is incremented by 1, and the feature point coordinates and corner response value are written to the feature point cache. When the feature point count reaches the upper limit of the number of feature points, subsequent feature points are no longer directly written to the feature point cache. To efficiently replace low-response feature points, this embodiment of the invention uses a min-heap data structure to maintain the corner response values ​​of cached feature points. The top element of the heap is the feature point with the lowest response value in the current cache. When a newly detected feature point has a response value higher than the top element, the top element is popped, the new feature point is pushed into the heap, and the feature point cache is updated. The min-heap is implemented using a binary tree structure, and insertion and pop operations can be completed within O(log2512) = 9 clock cycles, meeting real-time requirements. In this way, more stable feature points can be retained without increasing the optical flow computation burden.

[0049] The lower limit for the number of feature points is determined based on the minimum spatial constraints required for optical flow motion confirmation. For example, the lower limit for the number of feature points is between 16 and 64, preferably 32. When the feature point count is lower than the lower limit at the end of a frame, it is determined that the optical flow confirmation conditions for the current frame are insufficient. The dynamic state is not directly output based on the optical flow result of that frame, and the corner grayscale difference threshold is not modified during real-time operation. The next frame can continue the judgment by expanding the region of interest, widening the candidate region boundary, or reverting to the coarse detection result. The final confirmation is then performed by the cross-frame smoothing control module combining the results of multiple consecutive frames. This avoids both delays in optical flow solution caused by too many feature points and instability in motion determination caused by too few feature points.

[0050] Next, the feature point set is input to the optical flow pyramid module for optical flow calculation. This embodiment of the invention employs the Lucas-Kanade (LK) optical flow algorithm for motion estimation in the fine detection stage. This algorithm has low computational cost and simple hardware implementation, making it suitable for real-time embedded applications. The module adopts a layer-by-layer iterative calculation architecture from coarse to fine scales, directly reusing the three-scale images already generated and stored in the FPGA's internal BRAM during the coarse detection stage, avoiding repeated downsampling calculations and significantly saving FPGA hardware resources. The optical flow calculation window size is 7×7, and the number of iterations per layer is 3. With a maximum of 512 feature points, the calculation can be completed within a single frame period. Specifically, for each level, based on the coordinates of the region of interest and the scale factor of that level, image patches are directly extracted from the current frame and the previous frame cached images of the corresponding scale in the BRAM, and the extracted image patches are output to the gradient calculation unit without further filtering and downsampling processing.

[0051] First, top-level optical flow calculation is performed. The input consists of the current frame image corresponding to the third scale, the previous frame image, and the corresponding coordinates of the uniform feature points scaled down to this scale. A coarse-grained optical flow estimation is then performed based on the low-resolution image at this scale using a top-level parallel optical flow calculation unit. The output is the initial optical flow vector (u2, v2) for each feature point at this scale.

[0052] Next, intermediate layer optical flow calculations are performed. The inputs are the current frame image corresponding to the second scale, the previous frame image, the coordinates of the unified feature points scaled down to the corresponding coordinates at this scale, and the initial optical flow vector output from the top layer. This initial optical flow vector, after scale amplification, serves as the initial estimate for this layer. Through the intermediate layer parallel optical flow calculation unit, medium-granularity optical flow refinement is performed based on the coarse estimation result from the top layer. The output is the refined optical flow vector (u1, v1) for each feature point at this scale.

[0053] Finally, low-level optical flow calculations are performed. The inputs are the current frame image corresponding to the first scale, the previous frame image, unified feature point coordinates, and the refined optical flow vector output from the intermediate layer. This refined optical flow vector, after scale magnification, serves as the initial estimate for this layer. Through the low-level parallel optical flow calculation unit, fine-grained final optical flow calculations are performed based on the intermediate layer results. The output is the final optical flow vector (u0, v0) for all feature points at half the scale, which can be converted back to the original image coordinate system according to the scale ratio.

[0054] Initial optical flow values ​​are transferred between layers via dedicated data registers, and inter-layer calculations are executed in parallel using a pipelined approach. Once the top layer completes the optical flow calculation for the first feature point and outputs the result, intermediate layers can begin refining the calculation for that feature point without waiting for all feature points in the top layer to complete. The entire optical flow calculation process works in conjunction with the pixel clock and frame synchronization signal, allowing each layer's optical flow calculation to be completed within a single frame cycle, even with a limited number of feature points. Finally, the three layers' optical flow vectors are input to their respective motion amplitude calculation units to calculate the motion displacement and its vector amplitude for two frames. To ensure real-time performance, the Manhattan distance approximation is used when calculating the motion vector amplitude. .

[0055] In the fine motion determination unit, it is determined whether the motion amplitude of each layer exceeds the motion amplitude determination threshold of the corresponding layer. When the motion amplitude of a feature point in the corresponding layer exceeds the motion amplitude determination threshold of that layer, the feature point is marked as a valid motion point. When the number of valid motion points exceeds a preset valid point number threshold, and the proportion of the number of valid motion points to the total number of feature points exceeds a preset valid point proportion threshold, it is determined to be dynamic; otherwise, it is determined to be static. For example, the valid point number threshold is 16, and the valid point proportion threshold is 30%. According to the needs of the clinical scenario, the host computer can write the corresponding registers during the initialization phase and output the motion status to the S3 module.

[0056] In this invention, the basic motion amplitude determination threshold for each level is determined based on the pixel scale of the optical flow pyramid levels. The bottom layer optical flow image has the highest resolution, retaining the most pixel-level texture and local perturbations; therefore, the bottom layer's basic motion amplitude determination threshold is set to the highest. The middle layer image undergoes one downsampling, partially smoothing out local perturbations, resulting in a lower basic motion amplitude determination threshold than the bottom layer. The top layer image has the lowest resolution and is mainly used to determine the overall displacement trend; therefore, its basic motion amplitude determination threshold is the lowest. During system initialization or clinical observation mode loading, the host computer writes the basic motion amplitude determination threshold, lower threshold, and upper threshold determined according to the above-mentioned hierarchical scale relationship into the amplitude threshold register of the FPGA. For example, when using a three-layer optical flow pyramid and using Manhattan distance to approximate the motion amplitude, the bottom layer's basic motion amplitude determination threshold is 2 to 4 pixel units, the middle layer's basic motion amplitude determination threshold is 1 to 3 pixel units, and the top layer's basic motion amplitude determination threshold is 1 to 2 pixel units. The lower threshold is set at 0.5 to 0.8 times the corresponding basic motion amplitude judgment threshold, and the upper threshold is set at 1.2 to 1.8 times the corresponding basic motion amplitude judgment threshold. This is to prevent false judgments due to noise caused by excessively low thresholds, or false judgments due to excessively high thresholds. In this embodiment of the invention, the specific architecture of the S3 cross-frame smoothing control module is as follows: Figure 3 As shown, the flowchart of the frame rate exposure gradient control unit is as follows: Figure 4 As shown. Specifically, the motion state output in S2 is first input into the state buffer unit to store the motion state of the most recent s frames. The state buffer unit adopts a shift register structure. At the end of each frame, the new motion state is shifted in, and the oldest state is shifted out. The continuous state determination logic counts the maximum length of consecutive identical states in the shift register: if the maximum length is ≥ t, then the state is confirmed as the final stable state; otherwise, the final stable state of the previous frame remains unchanged. Here, parameter s is the number of state buffer frames, and parameter t is the number of continuous state determination frames. The two parameters are set in combination with the imaging characteristics of the medical endoscope and the real-time detection requirements. While filtering out instantaneous noise in the image and misjudgments caused by slight mechanical disturbances of the equipment, it avoids state determination delays due to an excessive number of frames. The value range of the state buffer frame number s is 8 to 20, and the value range of the continuous state determination frame number t is 5 to 12. For example, in this embodiment of the invention, the buffer frame number s is preferably 12, and the continuous state determination frame number t is preferably 7.

[0057] When a motion state transition is detected, the frame rate and exposure gradation control unit performs multi-cycle progressive adjustments to the frame rate and exposure time. During the frame rate gradation process, the current frame rate register is updated periodically via an incrementing accumulator, and the transition process ends when the target frame rate is reached, and the motion state is re-detected; otherwise, the calculation and updating of the current frame rate register continues.

[0058] To maintain a relatively constant brightness, the module simultaneously adjusts the exposure time inversely proportional to the frame rate. The final output of the adjusted frame rate and exposure time is used to drive subsequent image sensor (CIS) parameter configuration.

[0059] In this embodiment of the invention, the specific internal architecture of the S4 adaptive control module is as follows: Figure 5 As shown. In this embodiment of the invention, the analog gain adjustment range of the CIS is 1× to 32×, and the digital gain adjustment range is 1× to 8×. The analog gain is adjusted first, and the digital gain is adjusted only after the analog gain reaches the upper limit of 32×; when the gain is below the lower limit of 1×, the gain is kept constant at 1×. The upper limit of the exposure time is the current frame period minus the CIS readout time (approximately 2ms), and the lower limit is the minimum exposure time of the CIS (1μs). The threshold for slight overexposure is 0.5% to 2%, preferably 1%; the threshold for severe overexposure is 0.1% to 0.5%, preferably 0.2%.

[0060] Data is input from the right side of the block diagram. The Automatic Parameter Measurement (APM) unit provides statistical results of pixel brightness. Brightness statistics and overexposure counts are performed in the pixel statistics unit, and the average brightness of the image and the area ratio of overexposed pixels in the image are calculated in the frame statistics unit.

[0061] Compared to the global arithmetic average method, which is susceptible to interference from dark edges and localized highlights, this embodiment of the invention employs a central region weighted average method. The specific implementation is as follows: The entire image is divided into nine 3×3 grid regions. Each grid region is then assigned an independent weight coefficient, resulting in a weight distribution with higher weights at the center and lower weights at the edges, ensuring that the weight distribution aligns with the doctor's visual attention distribution. For example, in this embodiment, the weight of the central region is set to 0.45~0.55, the weights of the four center edges (top, bottom, left, and right) are each 0.07~0.09, and the weights of the four corner regions are each 0.04~0.05, ensuring that the sum of all region weights is 1.0, satisfying the normalization condition. During pixel inflow, the cumulative brightness of each region is calculated in parallel, and the weighted average brightness is calculated according to the weight coefficients during frame blanking.

[0062] When determining overexposed pixels, this invention employs a dual-threshold overexposure detection mechanism, simultaneously detecting severe and slight overexposure. The pixel statistics unit counts the number of pixels exceeding both thresholds in parallel; the frame statistics unit calculates the severe exposure ratio and the slight exposure pixel ratio separately. The two thresholds of the dual-threshold overexposure detection mechanism are determined based on the image's full-scale grayscale range and the image sensor's saturation output characteristics. The severe overexposure threshold is used to identify pixels approaching saturation or showing loss of bright details, while the slight overexposure threshold is used to identify pixels whose brightness is close to saturation but have not yet completely lost details. The severe and slight overexposure thresholds can be written into the FPGA's overexposure threshold register by the host computer during the initialization phase, based on the image sensor model, grayscale bit width, and clinical observation mode. For example, when the grayscale data is 8 bits, the severe overexposure threshold is preferably 251 to 253, and the slight overexposure threshold is preferably 245 to 250; the weight of the severe overexposure ratio is 1.0, and the weight of the slight overexposure ratio is 0.3. For example, in this embodiment of the invention, the severe overexposure threshold is preferably 251~253, and the slight overexposure threshold is preferably 245~250; the weight of the severe overexposure ratio is 1.0, and the weight of the slight overexposure ratio is 0.3.

[0063] When the final stable state is dynamic, a high frame rate and short exposure are maintained, and the gain is adjusted based on the average brightness. Specifically, the deviation between the current frame's average brightness and the target brightness is calculated, and then the gain is adjusted using a piecewise adaptive step size based on the magnitude of the deviation. When the deviation is greater than 20, the gain is increased by 5%; when the deviation is greater than 10 and less than or equal to 20, the gain is increased by 2%; when the deviation is greater than or equal to -10 and less than or equal to 10, the gain remains unchanged; when the deviation is less than -10 and greater than or equal to -20, the gain is decreased by 2%; and when the deviation is less than -20, the gain is decreased by 5%. The target brightness is a benchmark value set based on human visual comfort and clinical diagnostic needs. For example, in this embodiment of the invention, the default target brightness center value is preferably 125~135 (8-bit grayscale image), and more preferably 130.

[0064] When the final stable state is static, the image signal-to-noise ratio is prioritized, employing a coordinated control strategy that prioritizes exposure time and supplements it with gain compensation. First, the frame rate is reduced and the exposure time is simultaneously extended by controlling the frame rate exposure update unit until the slight overexposure ratio exceeds the slight overexposure ratio threshold, or the severe overexposure ratio exceeds the severe overexposure ratio threshold, or the current frame rate reaches the minimum frame rate limit. Frame rate adjustment uses a fixed-level hardware encoding method with integer division of the highest frame rate. Five levels—10fps, 15fps, 20fps, 30fps, and 60fps—are pre-encoded as 3-bit binary values ​​and stored in the FPGA register. Each adjustment only jumps between adjacent levels, achieving single-step switching through a state machine to avoid sudden frame rate changes that cause screen stuttering. Simultaneously, a comparator sets the minimum frame rate limit, preferably 8-12fps, and more preferably 10fps, to ensure basic smoothness in clinical operations.

[0065] During frame rate adjustment, the current gain register value remains unchanged. The single-frame exposure time changes synchronously and inversely to the frame rate. The exposure time register value for the corresponding level is directly obtained through a pre-built frame rate-exposure time lookup table (LUT), eliminating the need for real-time division operations. All parameter updates are completed within the frame blanking period, ensuring synchronization with the image sensor (CIS) timing and avoiding sudden changes in image brightness. Fine-tuning of the gain begins when the slight overexposure ratio exceeds the slight overexposure ratio threshold or the severe overexposure ratio exceeds the severe overexposure ratio threshold.

[0066] Upon entering the gain fine-tuning process, the gain update unit adjusts the current gain back based on the slight overexposure ratio and the severe overexposure ratio. If the slight overexposure ratio is greater than the slight overexposure ratio threshold and the severe overexposure ratio does not exceed the severe overexposure ratio threshold, the current gain is reduced by a first gain back-off step size; if the severe overexposure ratio is greater than the severe overexposure ratio threshold, the current gain is reduced by a second gain back-off step size, where the second gain back-off step size is greater than the first gain back-off step size. If neither the slight overexposure ratio nor the severe overexposure ratio exceeds the corresponding threshold, the current gain remains unchanged. The gain update result is also subject to a minimum gain constraint to avoid insufficient overall image brightness. For example, the first gain back-off step size is 1% to 3% of the current gain, and the second gain back-off step size is 3% to 8% of the current gain. When both the slight overexposure ratio and the severe overexposure ratio are lower than the corresponding threshold within a consecutive preset number of frames (where the consecutive preset number of frames ranges from 5 to 15 frames, preferably 8 frames), it is determined that the bright area overexposure has been eliminated, the gain back-off stops, and the current exposure time and current gain are maintained to enter a stable output state.

[0067] When switching between static and dynamic states, a gradual adjustment mode is entered. This invention defaults to using an S-shaped curve gradient as the standard implementation. The S-shaped curve gradient has the characteristics of slow start-fast transition-slow end, which conforms to the human eye's visual perception habits and can minimize the discomfort caused by changes in screen brightness and smoothness, making it particularly suitable for clinical observation scenarios using medical endoscopes. Its specific implementation is as follows: When a switch from static to dynamic state is detected, the FPGA reads the current frame rate F. s Dynamic target frame rate F d Current exposure time E s and dynamic target exposure time E d And start the static-to-rotational gradient counter. The static-to-rotational gradient frame number N1 ranges from 8 to 15 frames, with a default value of 10 frames. The normalized gradient function for the S-curve is:

[0068] Where i is the current gradient frame number (0≤i≤N1), and k is the curve steepness coefficient, with a default value of 0.8. This function calculates the normalized coefficient f(i) for the i-th frame, and then obtains the target frame rate and exposure time for the i-th frame.

[0069] Since this embodiment of the invention uses discrete frame rate levels, the calculated F(i) is rounded to the nearest preset level (10fps, 20fps, 25fps, 30fps, 60fps) during actual operation, and the precise exposure time register value of the corresponding level is obtained through the frame rate-exposure time lookup table. For example, when switching from 10fps to 60fps, with a 10-frame gradient, the level sequence generated by the S-curve is: 10fps (2 frames), 20fps (1 frame), 25fps (2 frames), 30fps (2 frames), 60fps (3 frames).

[0070] When a dynamic state transition to a static state is detected, the FPGA reads the current frame rate F. d Static target frame rate F s Current exposure time E d and static target exposure time E s The dynamic-to-static gradient counter is activated. The dynamic-to-static gradient frame count N2 ranges from 15 to 30 frames, with a default value of 20 frames. The same S-curve function is used, but the curve steepness coefficient k is set to 0.5 by default to achieve a smoother transition and avoid the risk of overexposure caused by a rapid increase in exposure time. For example, when switching from 50fps to 10fps with a gradient frame count of 20 frames, the generated stop sequence is: 60fps (5 frames), 30fps (4 frames), 25fps (4 frames), 20fps (4 frames), 10fps (3 frames).

[0071] To avoid consuming FPGA resources through real-time floating-point operations, this embodiment of the invention employs a pre-calculated lookup table method to implement the S-curve gradient. During system initialization, based on the preset number of gradient frames and steepness coefficient, the normalized coefficients and target levels corresponding to all frame numbers are pre-calculated and stored in the FPGA's internal ROM. During real-time operation, the gradient counter directly serves as the ROM address to read the corresponding level value. The entire process requires only one clock cycle, fully meeting the hardware real-time requirements.

[0072] To avoid sudden changes in brightness, the exposure time is updated synchronously with the frame rate update, and the exposure time is limited to the allowable upper limit after deducting the readout time from the current frame period. When the calculated exposure time exceeds the allowable upper limit, the exposure time is limited to the allowable upper limit, and the remaining brightness difference is compensated by the gain control unit. The frame rate step size and exposure step size can be stored as fixed-point numbers in the step size register. The FPGA completes the update once in each frame synchronization period through adders, subtractors, and comparators, thereby realizing synthesizable hardware pipelined control.

[0073] Finally, the adjusted parameters are written into the image sensor control register via the instruction control unit module to achieve adaptive adjustment of frame rate, exposure, and gain.

[0074] Upon receiving a new instruction, the image sensor immediately begins image acquisition according to the new configuration parameters in the next frame or the next frame cycle. The images acquired under the new parameters are then sent back to the FPGA to form a closed-loop adjustment. Finally, the images acquired with optimized parameters are transmitted to the display device through the image output module for clinical observation.

[0075] For example, this invention can be implemented using a Xilinx Zynq UltraScale+XCZU7EV FPGA. This device integrates an ARM Cortex-A53 processor and FPGA programmable logic, making it ideal for applications such as medical endoscopes that require simultaneous high-speed image processing and system control. With the above configuration, the overall resource consumption of this embodiment is approximately 100,000 to 220,000 lookup tables, 120,000 to 280,000 triggers, 150 to 300 BRAM36 memory blocks, and 150 to 350 DSP multiply-accumulate units, providing ample implementation margin in the XCZU7EV device.

[0076] It should be noted that the gradual adjustment of frame rate and exposure time during the transition between static and dynamic states is not limited to linear gradual increase or decrease. It can also adopt any monotonic gradual change function such as piecewise linear, exponential change, or pure lookup table control. As long as a smooth transition from static parameters to dynamic parameters or from dynamic parameters to static parameters is completed within a few frames, it constitutes an equivalent alternative to this system.

[0077] Example 2

[0078] like Figure 6 The images shown are images of the same area acquired using different methods under the same conditions. Figure (a) is a noisy image with excessive gain; Figure (b) is obtained by applying a traditional back-end filtering method to this image, which reduces noise but smooths out details. Figure (c) shows a motion blur effect caused by improper adjustment of the image sensor (CIS) parameters when the scene is moving under fixed parameters. Figures (d) and (e) are the results of this system in static and moving scenes, respectively, demonstrating its ability to automatically identify scenes while maintaining both clear details and smooth motion.

[0079] As can be seen, this invention suppresses noise by adjusting the sensor's own operating parameters (exposure time, gain), which is superior to back-end digital filtering. It can better preserve image details and can automatically identify scene content in real time, making a dynamic optimal trade-off between the two key indicators of image signal-to-noise ratio and motion smoothness.

[0080] The system also includes one or more processors and memory.

[0081] The memory is used to store operable instructions that, when executed by the one or more processors, cause the one or more processors to perform operations, including the flow of an FPGA-based medical endoscope image noise suppression system according to the foregoing embodiments, particularly... Figure 1 The flowchart of the method is shown.

[0082] Other aspects disclosed in the embodiments of the present invention also propose a computer-readable medium for storing software including instructions executable by one or more computers, which, upon execution, cause the one or more computers to perform operations including the flow of an FPGA-based medical endoscope image noise suppression system of the foregoing embodiments, particularly... Figure 1 The flowchart of the method is shown.

[0083] It should be recognized that embodiments of the present invention may be implemented or carried out by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable storage medium.

[0084] The method can be implemented using standard programming techniques, including a non-transitory computer-readable storage medium configured with a computer program in the computer program, wherein the storage medium is configured such that the computer operates in a specific and predefined manner.

[0085] Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with the computer system; however, if required, the program can be implemented in assembly or machine language.

[0086] In any case, the language can be either compiled or interpreted.

[0087] Furthermore, for this purpose, the program can run on programmed application-specific integrated circuits.

[0088] The processes described herein (or variations and / or combinations thereof) can be executed under the control of one or more computer systems configured with executable instructions, and can be implemented by hardware or a combination thereof as code (e.g., executable instructions, one or more computer programs, or one or more applications) that commonly executes on one or more processors. The computer program includes a plurality of instructions executable by one or more processors.

[0089] Furthermore, the method can be implemented in any suitable computing platform, including but not limited to personal computers, minicomputers, mainframes, workstations, networked or distributed computing environments, standalone or integrated computer platforms, or in communication with charged particle tools or other imaging devices.

[0090] Various aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether portable or integrated into a computing platform, such as a hard disk, optical read and / or write storage medium, RAM, ROM, etc., such that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the processes described herein.

[0091] Furthermore, machine-readable code, or parts thereof, can be transmitted via wired or wireless networks.

[0092] When such media includes instructions or programs that combine with a microprocessor or other data processor to implement the steps described above, the invention described herein includes these and other different types of non-transitory computer-readable storage media.

[0093] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A medical endoscope image noise suppression system based on FPGA, characterized in that: include: The image acquisition and caching module is used to control the image sensor to acquire image frames and cache the current frame image and the previous frame image data; The motion detection module is used to calculate the motion amplitude based on the current frame image and the previous frame image, and to determine the motion state of the current image. The cross-frame smoothing control module is used to confirm the status of motion discrimination results in multiple consecutive frames, and to control the frame rate and exposure time to be adjusted progressively within a preset number of frames when the motion status changes. The adaptive control module is used to adaptively generate adjustment commands including frame rate, exposure time and gain based on the confirmed motion state and image brightness measurement results, and output them to the image sensor. The image sensor acquires images according to the adjustment command, forming a closed-loop adjustment.

2. The FPGA-based medical endoscope image noise suppression system as described in claim 1, characterized in that: The motion discrimination module includes a coarse detection unit and a fine detection unit; The coarse detection unit is used to perform multi-scale downsampling on the current frame image and the previous frame image, calculate the inter-frame grayscale difference at each scale, compare it with the frame difference threshold corresponding to each scale, generate a multi-scale binary motion mask, and output a suspected motion judgment signal based on the comparison result of the number of moving pixels at each scale with the corresponding counting threshold. The fine detection unit is used to perform feature point detection and optical flow calculation on the candidate motion region after receiving the suspected motion determination signal, and output the final motion state based on the optical flow motion amplitude.

3. The FPGA-based medical endoscope image noise suppression system as described in claim 2, characterized in that: The multi-scale downsampling includes performing Gaussian filtering on the image and then downsampling every other row and column to generate at least three scale images with different resolutions; The scaled image is stored in the FPGA's internal block memory for reuse in coarse and fine detection.

4. The FPGA-based medical endoscope image noise suppression system as described in claim 3, characterized in that: In the coarse detection unit, the frame difference threshold corresponding to each scale is dynamically corrected based on the brightness perturbation reference amount of the current frame and the effective gain. The motion pixel count threshold is calculated based on the preset minimum effective motion area and the downsampling factor at each scale.

5. The FPGA-based medical endoscope image noise suppression system as described in claim 4, characterized in that: In the fine detection unit, the binary motion mask at each scale is upsampled and fused to determine the region of interest. Feature point detection is performed in the region of interest, and the number of detected feature points is limited. After the lower limit of the number of feature points is met, the multi-scale images stored in the coarse detection unit are reused to perform pyramid optical flow calculation, and the final motion state is determined based on the motion amplitude of each layer of optical flow.

6. The FPGA-based medical endoscope image noise suppression system as described in claim 5, characterized in that: The cross-frame smoothing control module includes a state buffer unit and a frame rate exposure gradient control unit; The state buffer unit is used to store the motion state of multiple consecutive frames, and confirms the final stable state when the same state is continuously in the same frame for a preset number of frames. The frame rate exposure gradient control unit is used to update the frame rate level frame by frame according to a preset gradient function when switching motion states, and to adjust the exposure time in conjunction with the frame rate until the target frame rate is reached.

7. The FPGA-based medical endoscope image noise suppression system as described in claim 6, characterized in that: The adaptive control module includes a brightness statistics unit and a parameter update unit; The brightness statistics unit is used to calculate the weighted average brightness of the central region of the image and the proportion of overexposed pixels. The parameter update unit is used to adjust the gain based on the deviation between the average brightness and the target brightness in a dynamic state, to prioritize reducing the frame rate and simultaneously extend the exposure time in a static state, and to perform gain back-off adjustment when the slight overexposure ratio exceeds the first threshold or the severe overexposure ratio exceeds the second threshold.

8. The FPGA-based medical endoscope image noise suppression system as described in claim 7, characterized in that: The adaptive control module also works in conjunction with the automatic parameter measurement unit of the image signal processing unit, receiving pixel brightness statistics output by the automatic parameter measurement unit as the brightness measurement result.

9. A method for suppressing noise in medical endoscope images based on FPGA, wherein the system for suppressing noise in medical endoscope images based on FPGA as described in any one of claims 1 to 8 is characterized in that: include: Control the image sensor to acquire image frames according to the current acquisition parameters, and buffer the current frame image and the previous frame image data; The motion amplitude is calculated based on the current frame image and the previous frame image to determine the motion state of the current image; The motion detection results of multiple consecutive frames are confirmed, and when the motion state changes, the frame rate and exposure time are adjusted in a step-by-step manner within a preset number of frames. Based on the confirmed motion state and image brightness measurement results, adaptively generate acquisition parameter adjustment instructions including frame rate, exposure time and gain, and output them to the image sensor; The image sensor acquires images according to the adjustment command and performs the next round of adjustment.

10. The FPGA-based method for suppressing noise in medical endoscope images as described in claim 9, characterized in that: The determination of the motion state of the current image includes: In the coarse detection stage, the current frame image and the previous frame image are downsampled at multiple scales, and the inter-frame gray level difference at each scale is calculated to generate a multi-scale binary motion mask. Based on the number of moving pixels at each scale, a suspected motion judgment signal is output. In the fine detection stage, after receiving the suspected motion determination signal, feature point detection is performed on the candidate motion region. The multi-scale image stored in the FPGA internal memory after downsampling in the coarse detection stage is reused to perform pyramid optical flow calculation, and the final motion state is output according to the optical flow motion amplitude.

Citation Information

Patent Citations

  • Frame rate switching method and related devices

    CN113630572B

  • Multi-mode camera frame sharing algorithm for cv features in xr headsets

    US20250063252A1