Image motion-static discrimination method and apparatus
By extracting and fusing multiple feature maps in image signal processing to generate a dynamic judgment threshold, the problem of traditional 3DNR algorithms being unable to distinguish between moving and stationary areas during high-speed motion is solved, achieving high-accuracy motion-static differentiation and real-time video processing with low computational overhead.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- MALANSHAN AUDIO & VIDEO LABORATORY
- Filing Date
- 2026-03-25
- Publication Date
- 2026-06-23
Smart Images

Figure CN122265341A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method and apparatus for distinguishing between still and moving images. Background Technology
[0002] In the field of image signal processing, especially for embedded dynamic shooting devices such as action cameras, dashcams, and surveillance cameras, 3D digital noise reduction (3DNR) is a key technology for improving image quality in low-light scenes. 3DNR suppresses random noise through inter-frame temporal fusion, and its performance is highly dependent on the accurate differentiation between moving and stationary areas in the image. However, in scenarios such as cycling and extreme sports, due to the low computational accuracy of traditional 3DNR algorithms, when the camera or subject is moving at high speed, it is impossible to accurately distinguish between moving and stationary areas. Forcing temporal fusion in this case will blur the motion trajectory into a blurring effect, resulting in ghosting, edge tearing, and other phenomena in the image. Summary of the Invention
[0003] In view of this, embodiments of this application provide an image motion-static differentiation method and system, which can effectively solve the technical problem of being unable to accurately distinguish between moving and stationary areas when the camera or subject is moving at high speed.
[0004] In a first aspect, embodiments of this application provide a method for distinguishing between still and moving images, the method comprising: Acquire multiple consecutive image frames, and for each current image frame in the multiple consecutive image frames, determine the previous image frame for the current image frame; For each of the temporal change dimension, spatial structure dimension, and motion dimension, feature extraction is performed on at least one of the current image frame and the previous image frame to obtain a local edge gradient feature map, an inter-frame difference feature map, and a direction vector feature map. The local edge gradient feature map, inter-frame difference feature map, and direction vector feature map are fused to obtain a collaborative feature map including multiple collaborative feature values; Based on the collaborative feature map, a dynamic judgment threshold is generated, and multiple collaborative feature values are compared with the dynamic judgment threshold to obtain a ternary mask map containing the motion region, the static region, and the transition region.
[0005] Secondly, embodiments of this application provide an image motion / static differentiation device, the device comprising: The image acquisition module is used to acquire multiple consecutive image frames, and for each current image frame in the multiple consecutive image frames, determine the previous image frame for the current image frame. The parallel extraction module is used to extract features from at least one of the current image frame and the previous image frame, respectively, based on the temporal change dimension, spatial structure dimension, and motion dimension, to obtain local edge gradient feature maps, inter-frame difference feature maps, and direction vector feature maps. The fusion module is used to fuse the local edge gradient feature map, the inter-frame difference feature map, and the direction vector feature map to obtain a collaborative feature map including multiple collaborative feature values. The motion / static differentiation module is used to generate a dynamic determination threshold based on the collaborative feature map, and compare multiple collaborative feature values with the dynamic determination threshold to obtain a ternary mask map containing motion regions, static regions and transition regions.
[0006] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps: Acquire multiple consecutive image frames, and for each current image frame in the multiple consecutive image frames, determine the previous image frame for the current image frame; For each of the temporal change dimension, spatial structure dimension, and motion dimension, feature extraction is performed on at least one of the current image frame and the previous image frame to obtain a local edge gradient feature map, an inter-frame difference feature map, and a direction vector feature map. The local edge gradient feature map, inter-frame difference feature map, and direction vector feature map are fused to obtain a collaborative feature map including multiple collaborative feature values; Based on the collaborative feature map, a dynamic judgment threshold is generated, and multiple collaborative feature values are compared with the dynamic judgment threshold to obtain a ternary mask map containing the motion region, the static region, and the transition region.
[0007] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps: Acquire multiple consecutive image frames, and for each current image frame in the multiple consecutive image frames, determine the previous image frame for the current image frame; For each of the temporal change dimension, spatial structure dimension, and motion dimension, feature extraction is performed on at least one of the current image frame and the previous image frame to obtain a local edge gradient feature map, an inter-frame difference feature map, and a direction vector feature map. The local edge gradient feature map, inter-frame difference feature map, and direction vector feature map are fused to obtain a collaborative feature map including multiple collaborative feature values; Based on the collaborative feature map, a dynamic judgment threshold is generated, and multiple collaborative feature values are compared with the dynamic judgment threshold to obtain a ternary mask map containing the motion region, the static region, and the transition region.
[0008] The embodiments of this application have the following beneficial effects: First, by jointly modeling three types of physically interpretable features—temporal changes, spatial structure, and motion vectors—and dynamically generating judgment thresholds based on their collaborative responses, a precise three-value division of moving regions, stationary regions, and transitional regions with motion trends in image sequences is achieved.
[0009] Secondly, compared with existing technologies, it significantly improves the accuracy of distinguishing between motion and stillness and spatiotemporal consistency in complex lighting, low signal-to-noise ratio, camera shake and slight motion scenarios, while maintaining low computational overhead and having good applicability for embedded deployment and real-time video processing. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This illustration shows a framework / application scenario diagram of an image motion-static differentiation device according to an embodiment of this application; Figure 2 This paper presents an overall flowchart of an image motion-static differentiation method according to an embodiment of the present application; Figure 3 This paper illustrates a preprocessing flowchart of an image motion-static differentiation method according to an embodiment of this application; Figure 4 This invention illustrates a flowchart of an embodiment of the present application for generating a local edge gradient feature map; Figure 5 This paper illustrates a flowchart of an embodiment of the present application for generating inter-frame differential feature maps; Figure 6 This paper presents a flowchart illustrating one method for generating a direction vector feature map according to an embodiment of the present application. Figure 7 An adaptive threshold flowchart of an image motion-static differentiation method according to an embodiment of this application is shown; Figure 8 A frame structure diagram of an image motion-static differentiation device according to an embodiment of this application is shown. Detailed Implementation
[0012] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0013] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0014] In the following text, the terms "comprising," "having," and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more combinations thereof. Furthermore, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0015] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0016] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0017] The following describes the method and apparatus for distinguishing between static and dynamic images using specific embodiments.
[0018] Figure 1 This illustration shows a framework / application scenario diagram of an image motion / static differentiation device according to an embodiment of this application. Exemplarily, the device includes: Lens module 102 is responsible for collecting light signals.
[0019] The image sensor module 104 is responsible for converting light signals into electrical signals (analog signals), then performing analog-to-digital conversion, and outputting digital signals (continuous image frames).
[0020] The SoC (controller chip) 106 integrates various image processing algorithms to process digital signals and perform operations such as noise reduction, sharpening, and color correction.
[0021] The display module 108 is responsible for receiving the processed images and playing them on a display device, such as an LED screen or an LCD screen.
[0022] Storage module 110 is responsible for receiving the processed images and storing them in a storage medium, such as a hard drive or memory card.
[0023] Figure 2 An overall flowchart of an image motion-static differentiation method according to an embodiment of this application is shown. Exemplarily, the image motion-static differentiation method includes the following steps: Step S202: Acquire multiple consecutive image frames, and for each current image frame in the multiple consecutive image frames, determine the previous image frame for the current image frame.
[0024] Among them, continuous image frames refer to multiple frames of original digital images that are continuously acquired by an image sensor in chronological order and have a fixed temporal relationship, and are obtained after a series of preprocessing steps on the multiple frames of original digital images.
[0025] The current image frame refers to the latest frame in time that is to be processed for motion / static judgment, and serves as the main reference frame (i.e., frame t) for feature extraction and fusion operations.
[0026] The previous image frame refers to the image frame that is immediately before the current image frame in time (i.e., frame t-1). Together with the current frame, they form an inter-frame analysis pair, which is used to calculate temporal correlation features such as inter-frame difference and optical flow shift.
[0027] Specifically, refer to Figure 3 The system preprocesses the raw image data of consecutive frames acquired by the image sensor. It adopts a 3x3 median filtering algorithm, which takes the gray values of 9 pixels in its 3×3 neighborhood for each pixel in the raw image data. For the pixels at the image boundary, a boundary expansion strategy (repeated boundary) is adopted to ensure that the window can completely cover them. Then, the 5th median value is taken as the filtered gray value of the current pixel after sorting them from smallest to largest. This effectively removes salt-and-pepper noise and impulse noise and avoids noise interference to subsequent feature extraction.
[0028] In one example, the raw image data of consecutive frames is preprocessed using the following formula: g(x,y)=Med{f(x+i,y+j)∣i,j∈{-1,0,1}}; Where f(x, y) is the pixel grayscale value matrix of the original image data, g(x, y) is the output pixel grayscale value for each pixel, and Med{} represents the operation of taking the median, where (x+i, y+j) represents the coordinates of 9 pixels in a 3×3 neighborhood centered on the target pixel (x, y); optionally, the median is determined by sorting the gray values of the 9 pixels in descending order and taking the 5th value in the sorted sequence (i.e., the value in the middle position).
[0029] Step S204 involves extracting features from at least one of the current image frame and the previous image frame for the time-series change dimension, spatial structure dimension, and motion dimension, respectively, to obtain a local edge gradient feature map, an inter-frame difference feature map, and a direction vector feature map.
[0030] Among them, the temporal variation dimension refers to the dynamic characteristics that reflect the evolution of image content over time. It is characterized by the differential change trend of pixel grayscale between consecutive frames and is used to quantify the brightness / chromaticity jump caused by motion.
[0031] Spatial structure dimension refers to the inherent geometric texture and edge topology of an image within a single frame. It is characterized by the contours, boundaries, and structural saliency reflected by the local pixel gradient distribution and is used to identify the shape contours of moving objects and the structural stability of static backgrounds.
[0032] Motion dimension refers to the directional and consistent physical properties of pixel-level motion, characterized by the spatial orientation of the motion vector and its directional clustering in the local neighborhood. It is used to verify whether inter-frame changes originate from real rigid / non-deformation motion.
[0033] Local edge gradient feature map refers to a two-dimensional feature map obtained by applying a simplified Sobel operator (horizontal / vertical convolution kernel) to the current image frame to calculate the gradient magnitude of each pixel and normalizing it to the gray range of [0, 255].
[0034] Inter-frame difference feature map refers to a two-dimensional feature map obtained by calculating the absolute difference in grayscale values of corresponding pixels between the current image frame and the previous image frame, and then performing binarization and normalization processing with a preset threshold; the grayscale value (0 or 255) indicates whether the pixel has undergone a significant brightness change, reflecting the temporal change dimension information.
[0035] The orientation vector feature map refers to a two-dimensional feature map obtained by filtering high-confidence corner points based on corner point detection, solving the displacement vector of the high-confidence corner points, and then supplementing the orientation information of the whole map through bilinear interpolation, and normalizing the vector magnitude or orientation consistency index to [0, 255]. The gray value represents the reliability and consistency of the motion direction to which the pixel belongs, and reflects the motion dimension information.
[0036] Specifically, the edge gradient magnitude of the current image frame is calculated using an edge detection operator, and a local edge gradient feature map is generated based on the edge gradient magnitude; the absolute difference in pixel grayscale is calculated based on the current image frame and the previous image frame, and an inter-frame difference feature map is generated based on the absolute difference in pixel grayscale; corner detection is performed on the current image frame to determine high-confidence corners, and a direction vector feature map is generated based on the pixels of high-confidence corners and non-high-confidence corners.
[0037] The edge detection operator refers to a discrete differential operator used to identify locations in an image where brightness / grayscale changes significantly (i.e., edges). In this application, it specifically refers to the simplified Sobel operator, which consists of two 3×3 integer convolution kernels, including a horizontal kernel (for detecting vertical edges) and a vertical kernel (for vertical directions). Understandably, this edge detection operator efficiently obtains pixel gradient information through convolution operations, without involving floating-point operations or higher-order derivatives, meeting the requirements of embedded real-time processing, and sharing gradient results with subsequent direction vector calculations (avoiding redundant calculations).
[0038] Edge gradient magnitude refers to the combined intensity of the horizontal and vertical gradient values calculated by the edge detection operator for each pixel in the current image frame; its physical meaning is the degree of local significance of structural changes within the 3×3 neighborhood of that pixel, and it is the core quantitative indicator of spatial structure dimension.
[0039] The absolute difference of pixel grayscale refers to the absolute value of the difference between the grayscale values of the current image frame and the previous image frame at the same spatial coordinates (x, y). It can be understood that the absolute difference of pixel grayscale directly reflects the amount of brightness change of the pixel position between the two frames. It is the most basic and robust motion representation of the temporal change dimension. After thresholding and binarization, it forms an inter-frame difference feature map.
[0040] High-confidence corner points refer to pixels that meet preset conditions and are selected through corner detection algorithms. Understandably, high-confidence corner points possess strong texture contrast and stable grayscale distribution, serving as reliable anchor points for motion dimension verification.
[0041] Step S206: The local edge gradient feature map, the inter-frame difference feature map, and the direction vector feature map are fused to obtain a collaborative feature map including multiple collaborative feature values.
[0042] Among them, the collaborative feature value refers to the scalar result obtained by weighting and summing the local edge gradient value, inter-frame difference value, and direction vector value at the same pixel position according to a fixed weight, which reflects the comprehensive motion criterion strength after the three-dimensional features are combined in parallel.
[0043] A collaborative feature map is a two-dimensional grayscale image with the same resolution as the original image, composed of the collaborative feature values of all pixels. It serves as the unified quantization basis for motion and stillness determination and provides input for subsequent adaptive threshold determination.
[0044] Specifically, after obtaining the local edge gradient feature map, inter-frame difference feature map, and orientation vector feature map, the final pixel-level collaborative feature value is calculated using the following fixed-weight weighted fusion formula: F = G × Wg + M × Wm + d × Wd; Where G, M, and d are normalized local edge gradient feature maps, inter-frame difference feature maps, and orientation vector feature maps, respectively.
[0045] For example, the edge gradient feature weight Wg = 0.35 (responsible for motion contour recognition); the inter-frame difference feature weight Wm = 0.35 (responsible for motion change quantization); and the direction vector feature weight Wd = 0.3 (responsible for motion validity verification).
[0046] Step S208: Based on the collaborative feature map, a dynamic judgment threshold is generated, and multiple collaborative feature values are compared with the dynamic judgment threshold to obtain a three-value mask map containing the motion region, the stationary region, and the transition region.
[0047] Among them, the dynamic judgment threshold refers to the local judgment threshold dynamically generated for each pixel in the collaborative feature map based on the gray-level variance in the 3×3 neighborhood of each pixel. This achieves pixel-level adaptation, where a higher threshold is applied when the noise is strong (to prevent false judgment) and a lower threshold is applied when the noise is weak (to prevent false judgment), thus breaking through the limitation of a globally fixed threshold.
[0048] The motion region refers to the set of pixels whose collaborative feature value is greater than the dynamic determination threshold. It is marked as 255 (white) in the initial mask and corresponds to the image region that needs to be avoided in temporal fusion to prevent motion blur.
[0049] A static region refers to a set of pixels whose co-feature value is less than or equal to the dynamic determination threshold. It is marked as 0 (black) in the initial mask and corresponds to an image region where multi-frame temporal fusion can be safely enabled to suppress noise.
[0050] The transition region refers to the buffer zone formed by pixels that were originally in the moving region but whose 3×3 neighborhood has a static pixel ratio of greater than or equal to 50% after edge transition optimization. It is marked as 128 (gray) in the final mask and is used to drive the 3DNR module to implement gradient weight fusion to ensure that the visual boundary between moving and static areas is natural and free of artifacts.
[0051] In one embodiment, convolution operations are performed on the current image frame using horizontal and vertical convolution kernels respectively to obtain the horizontal and vertical gradient values of each pixel in the current image frame; the edge gradient magnitude is determined based on the horizontal and vertical gradient values; and a local edge gradient feature map is generated by normalizing the edge gradient magnitude corresponding to each pixel in the current image frame.
[0052] The horizontal convolution kernel refers to a 3×3 discrete convolution template used to detect vertical edges (i.e., structures that change drastically along the y-axis) in an image, with the following numerical configuration: ; The vertical convolution kernel refers to a 3×3 discrete convolution template used to detect horizontal edges (i.e., structures that change drastically along the x-axis) in an image, with the following numerical configuration: ; The horizontal gradient value refers to the scalar output value obtained after a pixel in an image is convolved by a horizontal convolution kernel. It represents the intensity and polarity of the local gray-level change of the pixel in the horizontal (x) direction (positive / negative indicates the direction of change) and is one of the key components constituting the edge gradient magnitude and direction angle.
[0053] The vertical gradient value is the scalar output value obtained after a pixel in an image is convolved by a vertical convolution kernel. It represents the intensity and polarity of the local gray-level change of the pixel in the vertical (y) direction. Together with the horizontal gradient value, it is used to synthesize the gradient magnitude (motion contour intensity) and gradient direction angle (edge direction).
[0054] Specifically, refer to Figure 4 Edge gradients are calculated using an edge detection operator. For the preprocessed current image frame and the previous image frame, convolution operations are performed using convolution kernels in two directions (x-axis / horizontal, y-axis / vertical). During convolution, a zero-padding strategy (zero padding values) is employed to ensure the output feature map matches the input image size, obtaining the horizontal and vertical edge gradient magnitudes of individual pixels. These edge gradient magnitudes are then numerically normalized to obtain the edge gradient feature map.
[0055] In one example, let the original image pixel grayscale value be f(x, y). After convolving a 3×3 neighborhood centered at (x, y) with Gx and Gy, we get: Horizontal gradient value: Ix = Gx f(x, y) (This represents a convolution operation); vertical gradient value: Iy = Gy f(x, y).
[0056] The edge gradient magnitude (representing the edge strength) of pixel (x, y) is obtained by combining the gradient values in both directions using the following formula: or ; Through the above embodiments, the ability to distinguish between real moving edges (such as the outline of a rapidly moving arm or wheel) and pseudo-motion noise (such as false differences caused by low light noise) is significantly improved in identifying the contour boundaries and structural edges of moving areas, or in low-light, weak texture, or slightly jittery scenes. This suppresses the ghosting or noise residue caused by edge misjudgment and provides strong criteria support for the spatial structure dimension of moving and static areas.
[0057] In one embodiment, for each pixel at the same position in the current image frame and the previous image frame, the absolute difference in pixel grayscale is calculated; based on the motion-static distinction threshold, the absolute difference in pixel grayscale is thresholded to generate a binarized inter-frame difference feature map, which includes motion feature points and static feature points.
[0058] Among them, the motion-static distinction threshold refers to the empirical intensity threshold used to binarize and filter the absolute difference of pixel gray levels. Its function is to initially separate pixels that change significantly (which may be motion) from pixels with small fluctuations (mostly noise or jitter) in the original difference result.
[0059] Motion feature points refer to pixels marked as "255" (i.e., bright / white) after being filtered by the motion / static distinction threshold in the inter-frame difference feature map. This indicates that the grayscale change between two consecutive frames exceeds the threshold, and they are initially judged as candidate pixels with the possibility of motion.
[0060] Static feature points refer to pixels marked as "0" (i.e., black) after being filtered by the motion-static distinction threshold in the inter-frame difference feature map. This indicates that their grayscale changes are weak (less than or equal to the threshold) between two consecutive frames, and they are initially judged as stable pixels without significant motion, forming the basic candidate set of static regions.
[0061] Specifically, refer to Figure 5 By calculating the pixel grayscale difference between the current image frame and the previous image frame, the motion region features in the image are extracted. The absolute difference of pixel grayscale is thresholded and normalized to obtain the inter-frame difference feature map, ensuring that the grayscale range is consistent with the edge gradient feature map.
[0062] In one example, the absolute difference between pixel gray levels is calculated using the following formula: ; Let two consecutive frames be... (frame t) and (frame t-1), where (x, y) are pixel coordinates, | | indicates taking the absolute value, eliminating the positive or negative influence of the difference; understandably, The larger the value, the more significant the change in that pixel between two frames, indicating it belongs to a moving region; conversely, the larger the value, the more significant the change. The closer a value is to 0, the less change the pixel indicates; it is considered a static area.
[0063] In another example, to highlight the motion region, the difference results (absolute difference in pixel grayscale) are thresholded using the following formula to obtain a binarized motion feature map Mt(x, y): ; Where T is the threshold for distinguishing between motion and static pixels, which can be adjusted according to the specific application scenario; Mt(x,y)=255 represents moving pixels (feature points), and Mt(x,y)=0 represents static pixels.
[0064] Through the above embodiments, the intensity of grayscale changes of each pixel in the image over time can be directly and quickly quantified, providing evidence of the existence of motion and coarse-grained spatial localization. It maintains sensitivity to global displacement and local deformation in high-speed motion scenes, and effectively suppresses high-frequency noise interference through threshold pre-screening, providing reliable and low-latency temporal change dimension input for three-feature collaborative judgment.
[0065] In one embodiment, corner detection is performed on the current image frame to determine high-confidence corners, including the following steps: Based on the horizontal and vertical gradient values, the autocorrelation matrix of each pixel in the current image frame is determined; the minimum eigenvalue of the autocorrelation matrix of each pixel is used as the corner response value of each pixel; and high-confidence corners are determined based on the preset corner threshold and the corner response value of each pixel.
[0066] The autocorrelation matrix refers to a 2×2 symmetric matrix constructed for each pixel in the current image frame using the horizontal and vertical gradient values of all pixels in the 3×3 neighborhood of each pixel.
[0067] The minimum eigenvalue refers to the smaller of the two eigenvalues obtained after performing eigenvalue decomposition on the autocorrelation matrix mentioned above. Physically, it represents the energy intensity of the neighborhood gradient in the direction of the weakest change. The larger the minimum eigenvalue, the more significant the gradient is in any direction, and the more it conforms to the corner characteristics.
[0068] The corner response value refers to the minimum eigenvalue of the autocorrelation matrix of each pixel as its corner response value. The larger the corner response value, the more likely the pixel is to be a high-confidence corner point with stable structural information (such as edge intersections or densely textured areas), providing a reliable anchor point for subsequent optical flow calculations.
[0069] The preset corner threshold is an empirical intensity threshold used to screen high-confidence corners. Only when the corner response value of a pixel is this threshold is it initially determined to be a candidate corner. This preset corner threshold is used to suppress false corners (such as noise spots) in low signal-to-noise ratio areas to ensure the reliability of subsequent optical flow estimation.
[0070] Specifically, the Lucas-Kanade optical flow method (a differential optical flow estimation method applied in the field of computer vision) is first used to extract the pixel displacement direction vector, and a corner detection algorithm is used to screen high-confidence corners.
[0071] In one example, the autocorrelation matrix M of each pixel is calculated for the previous image frame and the current image frame using the following formula: ; Where S xx =∑I X 2 S yy =∑I Y 2 Sxy=∑I X I Y ;I X It is the gradient value in the horizontal direction, I y It is the gradient value in the vertical direction.
[0072] In another example, the corner response value R (the minimum of the two eigenvalues of matrix M) is calculated using the following formula: ; Then comes threshold filtering: if a pixel has R > K (K is the preset corner threshold), it is determined to be a corner. Optionally, through non-maximum suppression, a 3×3 pixel neighborhood window is allocated to each selected corner. The pixels in the window must satisfy the assumption of constant gray level (the gray level change between two frames can be ignored). Only the pixel with the largest R value is retained to avoid corner clusters.
[0073] Through the above embodiments, without relying on external sensors, high-confidence local feature points with stable structures and significant gray-scale changes in the image are autonomously and efficiently screened out, providing high-quality motion estimation anchor points for subsequent optical flow methods. Thus, under embedded resource constraints, the effectiveness of the true motion direction can be verified, significantly reducing the motion misjudgment rate caused by noise, low light or global jitter.
[0074] In one embodiment, convolution operations are performed on the previous image frame using horizontal and vertical convolution kernels respectively to obtain the horizontal and vertical gradient values of each pixel in the previous image frame. Based on the horizontal and vertical gradient values and the absolute difference in pixel grayscale of each pixel in the previous image frame, a displacement direction vector is determined. A preset neighborhood range for each high-confidence corner point in the previous image frame is determined, and the proportion of high-confidence corner points within each preset neighborhood range is determined. The high-confidence corner points in the previous image frame are the same as those in the current image frame. If the proportion exceeds a first proportion threshold, the displacement direction vector is converted into a first direction vector feature value. If the proportion does not exceed the first proportion threshold, the first direction vector feature value is determined to be zero. For each pixel of a non-high-confidence corner point, non-maximum suppression processing is performed to obtain a second direction vector feature value, and a direction vector feature map is generated based on the first and second direction vector feature values.
[0075] The displacement direction vector refers to the two-dimensional pixel-level displacement (u, v) obtained by solving the optical flow constraint equation for each high-confidence corner point, where u is the horizontal (x-axis) displacement component and v is the vertical (y-axis) displacement component; the magnitude represents the motion amplitude and the direction angle represents the motion direction.
[0076] The preset neighborhood range refers to a 3×3 pixel area centered on a certain high-confidence corner point; this neighborhood is used to statistically analyze the distribution density of the surrounding corner points and serves as a spatial reference for determining whether the movement direction of the corner point has local consistency.
[0077] The percentage of high-confidence corner points within a preset neighborhood (e.g., 0°±30°) is the percentage of all corner points in that neighborhood.
[0078] The first proportion threshold is an empirical proportion threshold used to determine whether the direction of motion of a corner point has local consistency (only when the proportion of the number is greater than or equal to this threshold is the displacement direction of the corner point considered to have spatial continuity and can be converted into an effective direction vector feature; otherwise, it is regarded as noise interference and assigned a value of 0).
[0079] The first direction vector eigenvalue refers to the scalar value generated after direction consistency verification, which characterizes the effective motion direction and intensity of a high-confidence corner point.
[0080] The second directional vector feature value refers to the normalized value of the directional vector magnitude calculated by weighting the displacement vectors of the effective corner points (first directional vector feature value ≠ 0) in the 3×3 neighborhood of the non-corner pixel using bilinear interpolation. If the number of effective corner points in the neighborhood is less than 2, the value is assigned to 0. This ensures that all pixels in the image have directional vector features and there are no holes.
[0081] Specifically, each selected high-confidence corner point is first assigned a 3×3 pixel neighborhood window. The pixels within this window must satisfy the assumption of constant grayscale, which is the core premise of optical flow calculation. The horizontal and vertical gradients of each pixel within the window are calculated using the edge detection operator (optional, the operator is shared with the edge gradient extraction to reduce redundant calculations).
[0082] Secondly, the temporal gradient is calculated using the difference in grayscale values between corresponding pixels in the current image frame and the previous image frame. Based on the optical flow constraint equation, the horizontal and vertical displacements are solved to obtain the direction vectors of the corner points, i.e., the displacement direction vectors. For ordinary pixels not selected as corner points, bilinear interpolation is used to supplement the direction vector values, ensuring that all pixels in the image have complete direction vector feature data. The direction vector feature values of all pixels are normalized to the [0, 255] interval to generate a direction vector feature map. Optionally, the generated direction vector feature map has the same size and grayscale range as the other two feature maps.
[0083] Specifically, refer to Figure 6 First, the horizontal gradient I of each pixel within the window is calculated using the edge detection operator. X Vertical gradient I y (Optional, share operators with edge gradient extraction to reduce redundant calculations).
[0084] Secondly, the temporal gradient Dt(x, y) is calculated using the absolute difference in pixel grayscale values between the two frames (optional, sharing the operator with the inter-frame difference to reduce redundant calculations).
[0085] Next, construct the following matrices and vectors: matrix ; vector ; The optical flow vectors (U, V) (horizontal displacement U and vertical displacement V) can be solved using the following formulas: or (3×3 neighborhood expansion); The next step is to calculate the displacement direction vector, including: taking a 3×3 extended window of the current high-confidence corner point (covering 9 corner points centered on the current corner point, excluding corner points that exceed the image boundary), and statistically analyzing the direction interval distribution of all high-confidence corner points within the window; if the proportion of high-confidence corner points in the interval to which the current high-confidence corner point belongs is >60%, then the direction is considered valid, and the first direction vector feature value is calculated: If the percentage is ≤60%, it is judged as noise interference and assigned the value d=0.
[0086] For ordinary pixels that are not selected as corner points (each pixel that is not a high-confidence corner point), take a 3×3 window of ordinary pixels and find all valid corner points within the window (d≠0); if the number of valid corner points is ≥2, calculate the U and V values of the pixel using the bilinear interpolation formula, and then further process it through non-maximum suppression to obtain the second direction vector feature value; if the number of valid corner points is <2, assign d=0; ensure that all pixels in the image have complete direction vector feature data.
[0087] The above embodiments provide evidence of the consistency of motion direction. Without increasing hardware costs and computing power (based only on the basic image gradient and interpolation), the motion candidate regions identified by inter-frame difference are further verified to distinguish between real object displacement and pseudo-motion such as camera shake and noise disturbance. This significantly improves the physical rationality and robustness of motion judgment and fundamentally suppresses motion blur and ghosting caused by motion misjudgment.
[0088] In one embodiment, the step of generating a dynamic determination threshold based on the collaborative feature map includes: Obtain the maximum and minimum decision thresholds for preventing false negatives; determine the preset neighborhood range of each pixel in the collaborative feature map, as well as the mean of the collaborative feature values within the preset neighborhood range, and calculate the gray-level variance within the preset neighborhood range based on the mean of the collaborative feature values; use the product of the squared value of the gray-level variance and the preset constant coefficient as the intermediate decision threshold.
[0089] The maximum judgment threshold is the upper limit set during the dynamic threshold generation process. This prevents the dynamic threshold from being excessively raised when the local noise intensity is abnormally high, which could lead to missed detection of moving areas (such as being wrongly judged as stationary when it should be moving), thus ensuring motion sensitivity.
[0090] The minimum judgment threshold is a lower limit set during the dynamic threshold generation process to prevent the threshold from being too low in low noise, high signal-to-noise ratio areas (such as indoor static scenes), which may misjudge minor disturbances as motion and cause false motion blur or transition zone expansion.
[0091] The preset neighborhood range refers to a 3×3 pixel neighborhood window (i.e., a 9-pixel area centered on the target pixel), which is used for local statistical calculations.
[0092] The mean of collaborative feature values refers to the arithmetic mean of the collaborative feature values F(x, y) of 9 pixels within a 3×3 preset neighborhood.
[0093] Gray-level variance refers to the average of the squared deviations of the co-feature values F(x, y) of each pixel in a 3×3 neighborhood from their mean μ. Intuitively, gray-level variance characterizes the dispersion of noise / perturbation intensity in a local area. A larger variance indicates a more unstable image in that area (e.g., strong low-light noise, blurring during rapid motion), requiring a higher threshold; conversely, a smaller variance requires a lower threshold.
[0094] The preset constant coefficient refers to the scaling factor that linearly maps the local noise intensity (variance) to the judgment threshold.
[0095] Specifically, refer to Figure 7 To avoid edge artifacts caused by rigid segmentation of dynamic and static areas, the threshold is dynamically adjusted based on pixel-level local noise intensity to ensure accurate adaptation of judgment criteria for different areas. First, the local noise intensity is calculated, and then the dynamic judgment threshold is dynamically estimated.
[0096] In one example, the local noise intensity is calculated using the following formula: ; Among them, F avg The variance is the mean of the collaborative feature values of the 9 pixels within the window. The larger the variance, the stronger the local noise.
[0097] In another example, the dynamic decision threshold is calculated using the following formula. : ; The intermediate decision threshold T = σ² × 1.5 is set, and the maximum decision threshold T is set to avoid missed detections due to excessively high thresholds in extreme noise regions. max =50; To avoid false judgments due to excessively low thresholds in low-noise areas, a minimum judgment threshold T is set. min =3.
[0098] Through the above embodiments, the rigid limitations of global / scene-level thresholds are broken, and differentiated judgment criteria are generated in real time based on pixel-level local noise intensity. Without increasing hardware costs and computing power burden, the two major contradictions of low-light misjudgment ghosting and static misjudgment noise are solved simultaneously, significantly improving the visual fidelity and cross-scene robustness of 3DNR noise reduction.
[0099] In one embodiment, the step of comparing multiple collaborative feature values with a dynamic determination threshold to obtain a ternary mask image containing a moving region, a stationary region, and a transition region includes: For each pixel in the collaborative feature map, the collaborative feature value of the pixel is compared with a dynamic judgment threshold. If the collaborative feature value of the pixel is greater than the dynamic judgment threshold, the pixel is marked as a moving pixel. If the collaborative feature value of the pixel is less than or equal to the dynamic judgment threshold, the pixel is marked as a stationary pixel. In the initial dynamic-static mask map composed of stationary and moving pixels, for each moving pixel, a preset neighborhood range corresponding to the moving pixel is determined. If the proportion of stationary pixels in the preset neighborhood range corresponding to the moving pixel is greater than a second proportion threshold, the moving pixel is modified into a transition pixel. A ternary mask map is generated based on the stationary pixels, transition pixels, and moving pixels.
[0100] Among them, the dynamic judgment threshold refers to the judgment standard T(x, y) generated pixel by pixel and adaptively changing with the local noise intensity.
[0101] The initial dynamic-static mask image refers to the binary intermediate result image generated by comparing the cooperating feature value F(x,y) with the dynamic decision threshold T(x,y) pixel by pixel. Understandably, this initial dynamic-static mask image does not yet contain the transition region and is the input basis for subsequent edge optimization.
[0102] The second percentage threshold is used to determine whether moving pixels are in the transition zone between moving and static areas, preventing artifact spread.
[0103] Specifically, the dynamic / static judgment result is output by comparing the collaborative feature value with the final threshold pixel by pixel: If F(x,y)> If F(x,y) ≤ 0, then the pixel is determined to be a moving pixel and marked as 255 (white) in the initial motion mask image; if F(x,y) ≤ 0. If a pixel is identified as a stationary pixel, it is marked as 0 (black); an initial motion mask image is generated.
[0104] For each pixel marked 255 (moving) in the initial motion mask image, take its 3×3 neighborhood window and count the percentage R of pixels marked 0 (stationary) in the window. If R > 50%, change the pixel's mark value to 128 (gray) and determine it as a transition pixel; if R ≤ 50%, retain the mark value 255.
[0105] In one embodiment, the step of generating a ternary mask image based on stationary pixels, transitional pixels, and moving pixels includes: Among them, stationary pixels refer to pixels marked as 0 in the initial dynamic-static mask image, which means that their collaborative feature value does not exceed the dynamic judgment threshold and are judged as regions in the image that have no significant temporal changes, stable structure, and invalid motion.
[0106] Transition pixels refer to pixels that have been modified from the original moving pixels (255) to 128 after edge transition optimization; the physical meaning is: located at the edge of the moving area, the proportion of stationary pixels in the neighborhood exceeds 50%, belonging to the dynamic and static mixed buffer zone, and a gradient blending strategy is required.
[0107] Motion pixels refer to pixels marked as 255 in the initial static and dynamic mask image. This indicates that their collaborative feature value exceeds the dynamic judgment threshold and is judged to have real motion (including contour displacement, grayscale abrupt change, and direction consistency). Temporal fusion should be avoided to prevent ghosting.
[0108] A ternary mask image refers to the final output single-channel image containing three values (0 / 128 / 255), which precisely identify: static regions (0), transition regions (128), and moving regions (255). This directly drives the image enhancement module to execute a differentiated noise reduction strategy.
[0109] By using multi-frame temporal fusion, the static region where the stationary pixel is located is processed; by using spatial fusion, the moving region where the moving pixel is located is processed; and by using gradient weight fusion, the transition region where the transition pixel is located is processed, thus obtaining a ternary mask image.
[0110] Specifically, the results of the motion and stillness region judgment are passed to the image enhancement module. The stillness region adopts multi-frame temporal fusion noise reduction to make full use of multi-frame information to suppress noise. The motion region adopts spatial fusion to reduce the superposition of inter-frame information and avoid motion blur. The transition region adopts a gradual weight fusion strategy. From the motion region side to the still region side, the number of fusion frames gradually increases from 0 frames, and the weight ratio changes synchronously to ensure a natural transition between motion and stillness edges.
[0111] Figure 8 A frame structure diagram of an image motion-static differentiation device according to an embodiment of this application is shown. Exemplarily, the image motion-static differentiation device 800 includes: The image acquisition module 802 is used to acquire multiple consecutive image frames, and for each current image frame in the multiple consecutive image frames, determine the previous image frame for the current image frame. The parallel extraction module 804 is used to extract features from at least one of the current image frame and the previous image frame for the time-series change dimension, spatial structure dimension, and motion dimension respectively to obtain local edge gradient feature map, inter-frame difference feature map, and direction vector feature map. The fusion module 806 is used to fuse the local edge gradient feature map, the inter-frame difference feature map, and the orientation vector feature map to obtain a collaborative feature map including multiple collaborative feature values. The motion / static differentiation module 808 is used to generate a dynamic judgment threshold based on the collaborative feature map, and compare multiple collaborative feature values with the dynamic judgment threshold to obtain a three-value mask map containing the motion region, static region and transition region.
[0112] It is understood that the device in this embodiment corresponds to the image motion-static differentiation method in the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described again here.
[0113] This application also provides a terminal device, exemplary of which includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to enable the terminal device to perform the functions of the various modules in the above-described image motion-static differentiation method or the above-described image motion-static differentiation device.
[0114] The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0115] Memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), and Electrically Erasable Programmable Read-Only Memory (EEPROM). Memory is used to store computer programs, and the processor can execute these programs upon receiving execution instructions.
[0116] This application also provides a computer-readable storage medium for storing the computer program used in the aforementioned terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0117] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0118] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0119] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0120] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for distinguishing between still and moving images, characterized in that, include: Acquire multiple consecutive image frames, and for each current image frame in the multiple consecutive image frames, determine the previous image frame for the current image frame; For each of the temporal change dimension, spatial structure dimension, and motion dimension, feature extraction is performed on at least one of the current image frame and the previous image frame to obtain a local edge gradient feature map, an inter-frame difference feature map, and a direction vector feature map. The local edge gradient feature map, inter-frame difference feature map, and direction vector feature map are fused to obtain a collaborative feature map including multiple collaborative feature values; Based on the collaborative feature map, a dynamic judgment threshold is generated, and multiple collaborative feature values are compared with the dynamic judgment threshold to obtain a ternary mask map containing the motion region, the static region, and the transition region.
2. The method according to claim 1, characterized in that, The step involves extracting features from at least one of the current image frame and the previous image frame, respectively, based on temporal variation, spatial structure, and motion dimensions, to obtain local edge gradient feature maps, inter-frame difference feature maps, and direction vector feature maps. This includes: The edge gradient magnitude of the current image frame is calculated using an edge detection operator, and a local edge gradient feature map is generated based on the edge gradient magnitude. Based on the current image frame and the previous image frame, calculate the absolute difference in pixel gray levels, and generate an inter-frame difference feature map based on the absolute difference in pixel gray levels. Corner detection is performed on the current image frame to determine high-confidence corners, and a direction vector feature map is generated based on the pixels of the high-confidence corners and non-high-confidence corners.
3. The method according to claim 2, characterized in that, The step of calculating the edge gradient magnitude of the current image frame using an edge detection operator and generating a local edge gradient feature map based on the edge gradient magnitude includes: The current image frame is convolved using horizontal and vertical convolution kernels respectively to obtain the horizontal and vertical gradient values of each pixel in the current image frame. The edge gradient magnitude is determined based on the horizontal gradient value and the vertical gradient value. A local edge gradient feature map is generated by normalizing the edge gradient magnitude corresponding to each pixel in the current image frame.
4. The method according to claim 3, characterized in that, The step of calculating the absolute difference in pixel gray levels based on the current image frame and the previous image frame, and generating an inter-frame difference feature map based on the absolute difference in pixel gray levels, includes: For each pixel at the same position in the current image frame and the previous image frame, calculate the absolute difference in pixel grayscale for the corresponding pixel at the same position. Based on the motion / static distinction threshold, the absolute difference in pixel grayscale is thresholded to generate a binarized inter-frame difference feature map, which includes motion feature points and static feature points.
5. The method according to claim 4, characterized in that, The step of performing corner detection on the current image frame and determining high-confidence corners includes: Based on the horizontal gradient value and the vertical gradient value, determine the autocorrelation matrix of each pixel in the current image frame; The minimum eigenvalue of the autocorrelation matrix of each pixel is used as the corner response value of each pixel; High-confidence corners are determined based on a preset corner threshold and the corner response value of each pixel.
6. The method according to claim 4, characterized in that, The process of generating a direction vector feature map based on pixels that are not high-confidence corner points includes: The previous image frame is convolved using the horizontal convolution kernel and the vertical convolution kernel respectively to obtain the horizontal gradient value and the vertical gradient value of each pixel in the previous image frame. Based on the horizontal gradient value, vertical gradient value and absolute difference of pixel gray level of each pixel in the previous image frame, the displacement direction vector is determined. Determine the preset neighborhood range of each high-confidence corner point in the previous image frame, and determine the proportion of high-confidence corner points within each preset neighborhood range. The high-confidence corner points in the previous image frame are the same as the high-confidence corner points in the current image frame. If the quantity ratio exceeds the first ratio threshold, the displacement direction vector is converted into a first direction vector feature value; if the quantity ratio does not exceed the first ratio threshold, the first direction vector feature value is determined to be zero. For each pixel that is not a high-confidence corner point, non-maximum suppression processing is performed to obtain a second direction vector feature value, and a direction vector feature map is generated based on the first direction vector feature value and the second direction vector feature value.
7. The method according to claim 1, characterized in that, The dynamic judgment threshold includes a maximum judgment threshold, a minimum judgment threshold, and an intermediate judgment threshold; The step of generating a dynamic judgment threshold based on the collaborative feature map includes: Obtain the maximum decision threshold for preventing missed detections and the minimum decision threshold for preventing missed judgments; Determine the preset neighborhood range of each pixel in the collaborative feature map, and the mean value of the collaborative feature within the preset neighborhood range, and calculate the gray-level variance within the preset neighborhood range based on the mean value of the collaborative feature. The product of the squared value of the gray-level variance and the preset constant coefficient is used as the intermediate judgment threshold.
8. The method according to claim 1, characterized in that, The step of comparing multiple collaborative feature values with the dynamic determination threshold to obtain a ternary mask image containing the motion region, the stationary region, and the transition region includes: For each pixel in the collaborative feature map, the collaborative feature value of the target pixel is compared with the dynamic determination threshold; If the collaborative feature value of the target pixel is greater than the dynamic determination threshold, the target pixel is marked as a moving pixel; if the collaborative feature value of the target pixel is less than or equal to the dynamic determination threshold, the target pixel is marked as a stationary pixel. In the initial static and dynamic mask image composed of the static pixels and the moving pixels, for each moving pixel, a preset neighborhood range corresponding to the moving pixel is determined. If the proportion of stationary pixels in the preset neighborhood range corresponding to the targeted moving pixel is greater than the second proportion threshold, the targeted moving pixel will be modified into a transition pixel. A ternary mask image is generated based on the stationary pixels, the transition pixels, and the moving pixels.
9. The method according to claim 8, characterized in that, The step of generating a ternary mask image based on the stationary pixels, the transition pixels, and the moving pixels includes: The static region where the static pixel is located is processed by multi-frame temporal fusion; Spatial fusion is used to process the motion region where the moving pixels are located; By using gradient weight fusion, the transition region where the transition pixel is located is processed to obtain a ternary mask image.
10. An image motion / static differentiation device, characterized in that, include: The image acquisition module is used to acquire multiple consecutive image frames, and for each current image frame in the multiple consecutive image frames, determine the previous image frame for the current image frame. The parallel extraction module is used to extract features from at least one of the current image frame and the previous image frame, respectively, based on the temporal change dimension, spatial structure dimension, and motion dimension, to obtain local edge gradient feature maps, inter-frame difference feature maps, and direction vector feature maps. The fusion module is used to fuse the local edge gradient feature map, the inter-frame difference feature map, and the direction vector feature map to obtain a collaborative feature map including multiple collaborative feature values. The motion / static differentiation module is used to generate a dynamic determination threshold based on the collaborative feature map, and compare multiple collaborative feature values with the dynamic determination threshold to obtain a ternary mask map containing motion regions, static regions and transition regions.