A method and apparatus for video disocclusion
By introducing block matching and block computation into video de-line technology, and using motion vectors and pixel difference quantization for filtering, the problem of video dynamic smoothness caused by ignoring inter-frame correlation in existing technologies is solved, thereby improving the temporal and motion smoothness of the video.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING QIYI CENTURY SCI & TECH CO LTD
- Filing Date
- 2025-10-21
- Publication Date
- 2026-05-29
AI Technical Summary
Existing video de-line technology ignores the motion correlation and temporal continuity between video frames, resulting in problems such as frame jumps, broken motion trajectories, or dynamic blurring in the output video, which cannot guarantee the dynamic smoothness of the video.
By acquiring the reference image frame that has been processed in the previous frame, the odd field reconstruction frame and the even field reconstruction frame are divided into multiple non-overlapping image blocks, block matching and block calculation are performed, temporal correlation is established using motion vectors, and the optimal reconstruction frame is determined by pixel difference quantization, thus forming a precise and coherent block-level good field selection mechanism.
It effectively improves the dynamic smoothness of the video after field line removal, avoids inter-frame image jumps and motion artifacts, and ensures the temporal and motion continuity of the video.
Smart Images

Figure CN122120402A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video processing technology, and in particular to a method and apparatus for removing field lines from a video. Background Technology
[0002] De-fielding technology is a fundamental and crucial step in video processing, widely supporting core scenarios such as broadcast television signal transmission, DVD playback, video surveillance recording analysis, and digital restoration of historical video data. In these scenarios, there are numerous video sources based on interlaced scanning technology. Its core principle is to split a complete image frame into two half-frames, one with odd-numbered fields and one with even-numbered fields, reducing data volume and adapting to traditional hardware performance through staged transmission or recording. However, with the development of display technology, modern terminal devices (such as LCD TVs, computer monitors, and smartphone screens) all use progressive scanning, requiring the display of the complete image's pixels line by line. The difference in display logic between the two makes the conversion from interlaced to progressive scanning a necessary step. This conversion process is called de-fielding, serving as a technological bridge connecting traditional video sources and modern display terminals.
[0003] In the implementation of defielding technology, the selection of odd-field reconstruction frames and even-field reconstruction frames is the core issue that determines the final video quality. Currently, the industry mainly has two types of solutions.
[0004] The first category consists of fixed rules or simple evaluation strategies. For example, always choosing the odd-field reconstruction result, or judging based on some simple image statistics (such as the average gradient of the entire image). These methods are too simplistic and cannot adapt to complex and varied video content; the selected result is often suboptimal.
[0005] The second category is evaluation methods based on single-frame image features, which is currently the mainstream direction in deinterlacing technology research. Compared with the first category, it improves the accuracy of static image quality assessment. Its technical logic is as follows: for two candidate reconstructed frames generated by deinterlacing algorithms for odd and even fields respectively, static image quality analysis is performed independently, such as quantitative evaluation of edge sharpness, texture restoration, and noise suppression effect. A preset scoring model is used to calculate the static quality scores of the two frames, and the frame with the higher score is selected as the final output. For example, Figure 1 The original image, the de-lined frame for odd field, and the de-lined frame for even field are displayed respectively. The frame with the higher score can be selected as the final output.
[0006] Existing technologies have key limitations, namely treating continuous video streams as a series of unrelated static images and processing them independently, completely ignoring the motion correlation and temporal continuity between video frames. This can easily lead to problems such as frame jumps, broken motion trajectories, or dynamic blurring in the output video, and cannot fundamentally guarantee the dynamic smoothness of the video. Summary of the Invention
[0007] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this application provides a method and apparatus for video de-fielding.
[0008] In a first aspect, this application provides a method for removing field lines from a video, the method comprising: Obtain the reference image frame that has been processed in the previous frame, as well as the odd field reconstruction frame and even field reconstruction frame corresponding to the current frame; The odd-field reconstructed frame and the even-field reconstructed frame are divided into multiple non-overlapping image blocks according to the same position; The image blocks at the same position in the odd field reconstruction frame and the even field reconstruction frame are respectively matched and calculated with the reference image frame to determine the reconstruction frame to which the image block with the best performance at the same position belongs, and the count of the reconstruction frame is incremented by one. The reconstruction frame to which the image block with the best performance belongs conforms to the motion law of objects in the video and has no motion artifacts. After matching and calculating all image blocks, the reconstructed frame with the highest count is taken as the processing completion frame of the current frame and used as the reference image frame required for the next frame in the video de-fielding process.
[0009] Optionally, block matching and block calculation are performed on image blocks at the same location in the odd-field reconstructed frame and the even-field reconstructed frame, respectively, with the reference image frame to determine the reconstructed frame to which the image block with the best performance at the same location belongs, including: The image blocks at the same position in the odd-field reconstructed frame and the even-field reconstructed frame are respectively matched with the reference image frame to obtain the motion vector of each image block at the same position relative to the reference image frame, wherein the motion vector is used to indicate the inter-frame position offset of the image block; Based on the motion vector, determine the same prediction block corresponding to each image block at the same position in the reference image frame, and calculate the pixel difference between the image block and the prediction block in the odd field reconstruction frame and the pixel difference between the image block and the prediction block in the even field reconstruction frame, respectively. For image blocks at the same location in the odd-field reconstruction frame and the even-field reconstruction frame, determine the reconstruction frame to which the image block with the smallest pixel difference belongs.
[0010] Optionally, image blocks at the same location in the odd-field reconstructed frame and the even-field reconstructed frame are respectively matched with the reference image frame to obtain the motion vectors of each image block at the same location relative to the reference image frame, including: A block matching motion estimation algorithm is used to match the image block at the target position in the odd field reconstructed frame with the image block at the corresponding position in the reference image frame to obtain the odd field motion vector of the image block at the target position in the odd field reconstructed frame relative to the reference image frame. A block matching motion estimation algorithm is used to match the image block at the target position in the even-field reconstructed frame with the image block at the corresponding position in the reference image frame to obtain the even-field motion vector of the image block at the target position in the even-field reconstructed frame relative to the reference image frame.
[0011] Optionally, based on the motion vector, the same prediction block corresponding to each image block at the same location in the reference image frame is determined, and the pixel difference between the image block in the odd-field reconstructed frame and the prediction block, and the pixel difference between the image block in the even-field reconstructed frame and the prediction block are calculated respectively, including: Based on the relationship between the magnitude of the motion vector of the image block and a preset threshold, the image block is determined to be a moving region or a stationary region in the current frame. The pixel changes in the moving region are dominated by motion and are prone to artifacts, while the pixels in the stationary region are stable and prone to flickering. If the image block is a moving region, then motion compensation is performed on the corresponding image block in the reference image frame according to the motion vector to obtain the first prediction block after motion compensation. The first prediction block is used to match motion patterns and reduce artifact misjudgment. The pixel differences between the image block of the odd-field reconstructed frame and the first prediction block, and the pixel differences between the image block of the even-field reconstructed frame and the first prediction block are calculated respectively.
[0012] Optionally, after determining that the image patch is a moving or stationary region in the current frame, the method further includes: If the image block is a stationary region, then the image block corresponding to the image block in the reference image frame is used as the second prediction block, wherein the second prediction block is used to reduce the risk of flicker by utilizing the stability of the stationary region; The pixel differences between the image block of the odd-field reconstructed frame and the second prediction block, and the pixel differences between the image block of the even-field reconstructed frame and the second prediction block are calculated respectively.
[0013] Optionally, determining whether an image patch is a moving or stationary region in the current frame based on the relationship between the magnitude of the motion vector of the image patch and a preset threshold includes: If the amplitude of the odd-field motion vector is greater than the preset threshold or the amplitude of the even-field motion vector is greater than the preset threshold, then the image block is determined to be a motion region in the current frame. If the amplitude of the odd-field motion vector is less than or equal to the preset threshold, or the amplitude of the even-field motion vector is less than or equal to the preset threshold, then the image block is determined to be a stationary region in the current frame.
[0014] Optionally, obtaining the odd-field reconstructed frame and even-field reconstructed frame corresponding to the current frame includes: Obtain the odd-numbered field image and the even-numbered field image corresponding to the current frame; The odd-field image is processed using a deinterlacing algorithm to obtain an odd-field reconstructed frame that fills in the missing even-field image. The even-field image is processed using a deinterlacing algorithm to obtain an even-field reconstructed frame that completes the missing odd-field.
[0015] Secondly, this application provides an apparatus for video field removal, the method comprising: The acquisition module is used to acquire the reference image frame that has been processed in the previous frame, as well as the odd field reconstruction frame and even field reconstruction frame corresponding to the current frame. The partitioning module is used to divide the odd-field reconstructed frame and the even-field reconstructed frame into multiple non-overlapping image blocks according to the same position; The matching and calculation module is used to perform block matching and block calculation on the image blocks at the same position in the odd field reconstruction frame and the even field reconstruction frame respectively with the reference image frame, determine the reconstruction frame to which the image block with the best performance at the same position belongs, and increment the count of the reconstruction frame by one. The reconstruction frame to which the image block with the best performance belongs conforms to the motion law of objects in the video and has no motion artifacts. The counting module is used to select the reconstructed frame with the highest count as the current frame after matching and calculating all image blocks, and to use it as the reference image frame required for the next frame in the video de-fielding process.
[0016] Thirdly, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements any of the steps of the video de-line method described above.
[0017] Fourthly, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when executed by a processor, the computer program implements any of the video field removal method steps described above.
[0018] The technical solutions provided in this application have the following advantages compared with the prior art: The method provided in this application establishes a precise and coherent block-level good field screening mechanism by establishing temporal correlation through motion vectors, providing a comparison benchmark through prediction blocks, and quantifying pixel differences. On the one hand, motion vectors build a temporal bridge between the current frame and the reference image frame, so that subsequent judgments are no longer isolated to a single frame, thus fundamentally avoiding the defects of existing single-frame feature methods that misjudge bad field artifacts. On the other hand, through pixel difference quantization comparison, it can objectively reflect whether the image block conforms to the motion law, avoid the bias of subjective feature evaluation, and ensure the accurate screening of high-quality blocks at the same position. At the same time, this process is carried out on a block-by-block basis, which can adapt to the motion differences of different regions within the frame, prevent local artifacts from being masked by the whole frame statistics, and ultimately provide reliable block-level data support for global optimization, helping the output frame to have both artifact-free characteristics and inter-frame motion coherence, effectively improving the dynamic smoothness of the video after field line removal. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram illustrating the result of using odd and even fields to remove field lines from a video in the existing technology. Figure 2 A schematic diagram of the hardware environment for a video field removal method provided in this application embodiment; Figure 3 A flowchart illustrating a video field removal method provided in this application embodiment; Figure 4 A schematic diagram illustrating the data initialization and acquisition process provided in this application embodiment; Figure 5 This is a data flow diagram provided for an embodiment of this application; Figure 6 A schematic diagram of a device structure for removing video field lines is provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of 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, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustration and has no specific meaning in itself. Therefore, "module" and "part" may be used interchangeably.
[0024] To address the problems mentioned in the background art, according to one aspect of the embodiments of this application, an embodiment of a method for removing field lines from a video is provided.
[0025] Optionally, in the embodiments of this application, the above-described video delineation method can be applied to, for example... Figure 2 The hardware environment shown consists of terminal 201 and server 203. Figure 1 As shown, server 203 is connected to terminal 201 via a network. Terminal 201 uploads video to the server, and the server performs video de-line processing. Database 205 can be set up on the server or independently of the server to provide data storage services for server 203. The aforementioned network includes, but is not limited to, wide area network, metropolitan area network or local area network. Terminal 201 includes, but is not limited to, PC, mobile phone, tablet computer, etc.
[0026] The following will describe in detail a method for removing video field lines provided in this application embodiment, with the server acting as the execution entity, in conjunction with specific implementation methods. Figure 3 As shown, the specific steps are as follows: Step 301: Obtain the reference image frame that has been processed in the previous frame, as well as the odd field reconstruction frame and even field reconstruction frame corresponding to the current frame; Step 302: Divide the odd-field reconstruction frame and the even-field reconstruction frame into multiple non-overlapping image blocks according to the same position; Step 303: Perform block matching and block calculation on the image blocks at the same position in the odd field reconstruction frame and the even field reconstruction frame respectively with the reference image frame to determine the reconstruction frame to which the best performing image block at the same position belongs, and increment the count of the reconstruction frame by one. The reconstruction frame to which the best performing image block belongs conforms to the motion law of objects in the video and has no motion artifacts. Step 304: After completing the matching and calculation of all image blocks, the reconstructed frame with the highest count is taken as the processing completion frame of the current frame and as the reference image frame required for the next frame in the video de-fielding process.
[0027] In step 301, the server obtains the final processed frame of the previous interlaced video after the complete delineation process, which is the reference image frame. This frame is a high-quality progressive scan frame that conforms to the motion rules and has no artifacts. Its function is to serve as the temporal reference for the analysis of the current frame. By comparing with this frame, it can be determined whether the motion trend of the current frame image block is continuous, thus avoiding the jump between frames.
[0028] The server also obtains the odd-field image (containing only half-frame data of odd-numbered rows of pixels) and the even-field image (containing only half-frame data of even-numbered rows of pixels) corresponding to the current video frame. Then, it uses a deinterlacing algorithm to complete the missing pixels of the odd-field image, obtaining a complete odd-field reconstructed frame line by line. It also uses a deinterlacing algorithm to complete the missing pixels of the even-field image, obtaining a complete even-field reconstructed frame line by line.
[0029] In step 302, the server splits the odd-field reconstruction frame and the even-field reconstruction frame row by row and column by column according to the same position and set size. For example, the reconstruction frame is split into multiple non-overlapping image blocks according to 16×16 pixels. The image blocks can be marked by position index, such as using row number and column number to identify the position of the image block. Subsequently, the image blocks at the same position in the odd-field reconstruction frame and the even-field reconstruction frame can be compared based on the same position index.
[0030] In step 303, during the video deinterlacing process, a good field refers to a frame that, after being completed using a deinterlacing algorithm, has clear edges, no comb artifacts or ghosting, and whose content strictly follows the motion patterns of objects in the video (such as displacement trajectories and posture changes). Its inter-frame information has temporal continuity and can be accurately predicted based on the motion state of the previous frame. A bad field, on the other hand, is prone to producing unnatural visual defects after completion due to rapid movement of objects or sudden scene changes within the odd-even field acquisition interval. Furthermore, its artifact signals belong to the category of temporal anomalies and cannot be derived from normal motion models. Existing evaluation methods based on single-frame static features are prone to misjudging high-frequency signals contained in bad field artifacts as detailed information, leading to the selection of inferior frames. On the other hand, because no inter-frame temporal correlation is established, even small changes in the content of the next frame may cause frame selection bias, resulting in obvious inter-frame flickering in the output video and severely insufficient temporal stability.
[0031] This application introduces a reference image frame to construct a temporal correlation link between the current frame and the previous frame. Specifically, the server first extracts image blocks at the same coordinate position in both the odd-field and even-field reconstructed frames of the current frame, and performs block matching and block calculation operations with the reference image frame respectively. The block matching step searches for the region in the reference image frame that is most similar to the current image block to obtain motion correlation information such as inter-frame position offset and motion trajectory, thus achieving temporal connection between the current frame and the previous frame. The block calculation step verifies the consistency between the current image block and the corresponding image block in the reference image frame based on this motion correlation information. If the image block conforms to the true motion law of the object and has no artifacts, its reconstructed frame is a good field, and the content of such image blocks can be accurately predicted through the reference image frame and motion model. If the image block has deviations that violate the motion law or contains comb artifacts or ghosting, its reconstructed frame is a bad field, and its artifacts cannot be derived from normal motion laws, resulting in low consistency with the reference image frame. After completing the judgment of a single image block, the server accumulates the count of the reconstructed frames belonging to good fields, realizing block-level quality screening and voting.
[0032] This application abandons the traditional evaluation logic of static features of a single frame. It establishes a dual mechanism of temporal correlation and motion law verification through reference frames, accurately capturing the continuity of good frames and the anomalies of bad frames from the time dimension. This effectively avoids the interference of bad frame artifacts on the frame selection results and ensures the accurate identification of high-quality frames.
[0033] In step 304, after the server completes the matching and calculation of all image blocks, it first counts the odd-field reconstructed frames and even-field reconstructed frames to obtain the final counts of the two types of reconstructed frames. Then, based on the highest count, the corresponding reconstructed frame is determined as the processed frame after the current interlaced video frame has undergone delineation processing. At the same time, the processed frame is stored as the reference image frame required for the next frame in the subsequent video delineation processing. This achieves the delineation output target of the current frame and realizes the temporal coherence of the processing reference for the next frame, ultimately forming a closed-loop logic for inter-frame processing.
[0034] The image patch matching and calculation supports two modes: sequential execution and parallel execution. In sequential execution, the server first completes the matching and calculation of odd-field and even-field image patches at a certain position, determines the image patch with the best performance at that position, and increments the count of its corresponding reconstructed frame by one. Then, the same matching, calculation, and counting operations are performed on the image patches at the next position in sequence. In parallel execution, the server performs matching and calculation of odd-field and even-field image patches at all positions simultaneously. After all image patches at all positions have been processed, the count results of odd-field reconstructed frames and even-field reconstructed frames are counted uniformly.
[0035] In this application, during video de-line processing, the first step is to obtain the reference image frame from the previous frame as the selected high-quality good field. Then, the odd-field reconstructed frames and even-field reconstructed frames of the current frame are obtained. These two types of reconstructed frames are then split into non-overlapping image blocks at the same position, transforming frame-level judgment into block-level fine analysis. This prevents local artifacts from being masked by frame-wide statistics, ensuring that the motion state of each frame region can be accurately evaluated and avoiding local frame selection bias from affecting overall dynamic smoothness. Next, motion correlation between the current block and the reference image frame is established through block matching. Block calculation is used to verify whether it conforms to motion patterns, accurately selecting and counting good field blocks. This avoids misselection caused by bad field artifacts and ensures that the selection of good fields closely matches the actual motion state, reducing the interference of frame selection bias on smoothness. Finally, the optimal reconstructed frame is selected as the processed frame and updated as the reference frame for the next frame. This ensures that the current frame is high-quality and artifact-free, and forms a closed loop through inter-frame reference iteration, avoiding inter-frame selection jumps, ultimately achieving dynamic smoothness in video during de-line processing.
[0036] As an optional implementation, in step 303, image blocks at the same location in the odd-field reconstruction frame and the even-field reconstruction frame are matched and calculated with the reference image frame to determine the reconstruction frame to which the best-performing image block at the same location belongs, including the following: Step S11: Perform block matching between the image blocks at the same position in the odd field reconstruction frame and the even field reconstruction frame and the reference image frame to obtain the motion vector of each image block at the same position relative to the reference image frame. The motion vector is used to indicate the inter-frame position offset of the image block. Step S12: Determine the same prediction block in the reference image frame for each image block at the same location based on the motion vector, and calculate the pixel difference between the image block and the prediction block in the odd field reconstruction frame and the pixel difference between the image block and the prediction block in the even field reconstruction frame respectively. Step S13: For image blocks at the same location in odd-field reconstruction frames and even-field reconstruction frames, determine the reconstruction frame to which the image block with the smallest pixel difference belongs.
[0037] In step S11, the server first performs block matching operations with the reference image frame processed in the previous frame for image blocks at the same coordinate position in both the odd-field and even-field reconstruction frames, for example, blocks corresponding to the (16,16)-(31,31) pixel region within the frame. Specifically, a block matching motion estimation algorithm is used (a diamond search or hexagonal search algorithm can be used to balance efficiency and accuracy). Within a preset search range of the reference image frame, the region with the highest pixel similarity to the current image block is found, and then the inter-frame position offset of the current image block relative to the corresponding image block in the reference image frame is calculated, i.e., the motion vector. This motion vector contains direction and magnitude information, and its function is to accurately indicate the position offset of the current image block in the reference image frame. Since there are two reconstruction frames, namely the odd-field reconstruction frame and the even-field reconstruction frame, the calculated motion vector also includes the odd-field motion vector of the odd-field reconstruction frame and the even-field motion vector of the even-field reconstruction frame.
[0038] In step S12, based on the motion vectors of image blocks at the same location, the server locates the region in the reference image frame that has a motion correlation with the current image block. The image block in this region is identified as the prediction block, which is the block in the reference image frame that, after offset by the motion vector, should theoretically maintain motion continuity with the current image block. Specifically, image blocks at the same location in the odd-field reconstruction frame and the even-field reconstruction frame correspond to the same prediction block. Subsequently, the server calculates the pixel differences between the image block in the odd-field reconstruction frame and the prediction block, and the pixel differences between the image block in the even-field reconstruction frame and the prediction block, respectively. Common calculation methods include sum of absolute differences and mean square error. This pixel difference quantification reflects the consistency of content between the current image block and the prediction block in the reference frame: the smaller the difference, the more the content of the current image block conforms to the motion rules derived from the previous frame, and the higher the probability of no artifacts; the larger the difference, the more likely the current image block contains artifacts that violate motion rules, such as comb-like patterns or ghosting.
[0039] In step S13, after calculating the pixel difference, the server compares the pixel difference values of image blocks at the same location in the odd-field reconstructed frame and the even-field reconstructed frame with the predicted blocks. Image blocks with smaller pixel differences are identified as high-quality image blocks that conform to motion patterns and are free of artifacts. The reconstructed frame to which this high-quality image block belongs is then determined. If the difference between image blocks in the odd-field frame is smaller, the corresponding reconstructed frame is an odd-field reconstructed frame; if the difference between image blocks in the even-field frame is smaller, the corresponding reconstructed frame is an even-field reconstructed frame. This step, through quantitative difference comparison, achieves accurate preliminary screening of good and bad fields, avoiding the problem of misjudging bad field artifacts as high-quality details based on traditional single-frame static features (such as high-frequency information).
[0040] This application establishes a precise and coherent block-level good field screening mechanism through a logical chain of motion vectors to establish temporal correlation, prediction blocks to provide a comparison benchmark, and pixel difference quantification screening. On the one hand, motion vectors build a temporal bridge between the current frame and the reference image frame, so that subsequent judgments are no longer isolated to a single frame, fundamentally avoiding the defects of existing single-frame feature methods that misjudge bad field artifacts. On the other hand, through pixel difference quantification comparison, it can objectively reflect whether the image block conforms to the motion law, avoid the bias of subjective feature evaluation, and ensure the accurate screening of high-quality blocks at the same position. At the same time, this process is carried out on a block-by-block basis, which can adapt to the motion differences of different regions within the frame, prevent local artifacts from being masked by whole-frame statistics, and ultimately provide reliable block-level data support for global optimization, helping the output frame to have both artifact-free characteristics and inter-frame motion coherence, effectively improving the dynamic smoothness of the video after field line removal.
[0041] As an optional implementation, in step S11, image blocks at the same location in the odd-field reconstruction frame and the even-field reconstruction frame are respectively matched with the reference image frame to obtain the motion vectors of each image block at the same location relative to the reference image frame, including: Step S111: Using the block matching motion estimation algorithm, the image block at the target position in the odd field reconstruction frame is matched with the image block at the corresponding position in the reference image frame to obtain the odd field motion vector of the image block at the target position in the odd field reconstruction frame relative to the reference image frame. Step S112: Using the block matching motion estimation algorithm, the image block at the target position in the even field reconstructed frame is matched with the image block at the corresponding position in the reference image frame to obtain the even field motion vector of the image block at the target position in the even field reconstructed frame relative to the reference image frame.
[0042] The server first determines the target location in the odd-field reconstruction frame. The target location corresponds to a pre-divided image block in the odd-field reconstruction frame. For example, after being divided into 16×16 pixel blocks, the block indexed as row 2-column 3 has coordinates ranging from (32,48) to (47,63). Then, the server employs a block matching motion estimation algorithm. Using the image block at the target location in the odd-field reconstruction frame as the block to be matched, and centering on the region in the reference image frame whose coordinates match the target location, a preset search range is set. Within this search range, the pixel similarity between the block to be matched and each candidate block in the reference image frame is compared point by point. When the candidate block with the highest similarity is found, the server calculates the coordinate offset between this candidate block and the block to be matched in the reference image frame and the odd-field reconstruction frame, obtaining an odd-field motion vector containing direction (e.g., horizontal to the right, vertical down) and magnitude (e.g., 3 pixels, 5 pixels). This vector precisely indicates the motion trajectory of the image block at the target location in the odd-field reconstruction frame relative to the previous reference image frame.
[0043] The server uses the coordinate range of the target location as a reference to locate image blocks within the same coordinate range in the even-field reconstructed frame, specifically the block between (32,48) and (47,63) in the even-field reconstructed frame, which corresponds to the same frame area in the original video frame as the target block in the odd-field reconstructed frame. Then, using the same block matching motion estimation algorithm, this even-field image block is selected as the block to be matched. Within a preset search range centered on the area in the reference image frame that matches the target location coordinates, the pixel similarity between the block to be matched and each candidate block in the reference frame is compared. After finding the optimal candidate block, its coordinate offset from the even-field block to be matched is calculated, generating the even-field motion vector. Because the even-field reconstructed frame is generated by filling in the odd rows with the even fields of the current interlaced frame, its pixel composition and edge details differ from those of the odd-field reconstructed frame. For example, the pixel distribution at the object edges may differ, and the corresponding motion states may have subtle differences. Therefore, calculating a dedicated motion vector for the even-field block avoids misjudgment of motion patterns caused by directly reusing the odd-field motion vector, ensuring the accuracy of the even-field block motion analysis.
[0044] As an optional implementation, in step S12, the same prediction block corresponding to each image block at the same location in the reference image frame is determined based on the motion vector, and the pixel differences between the image block and the prediction block in the odd-field reconstruction frame and the pixel differences between the image block and the prediction block in the even-field reconstruction frame are calculated respectively, including: Step S121: Based on the relationship between the magnitude of the motion vector of the image block and the preset threshold, determine whether the image block is a moving region or a stationary region in the current frame. Among them, the pixel changes in the moving region are dominated by motion and are prone to artifacts, while the pixels in the stationary region are stable and prone to flickering. Step S122: If the image block is a moving region, then perform motion compensation on the corresponding image block in the reference image frame according to the motion vector to obtain the first prediction block after motion compensation. The first prediction block is used to match the motion pattern and reduce artifact misjudgment. Calculate the pixel difference between the image block of the odd field reconstructed frame and the first prediction block, and the pixel difference between the image block of the even field reconstructed frame and the first prediction block, respectively. Step S123: If the image block is a stationary region, the image block corresponding to the image block in the reference image frame is taken as the second prediction block. The second prediction block is used to reduce the risk of flicker by utilizing the stability of the stationary region. The pixel difference between the image block of the odd field reconstruction frame and the second prediction block, and the pixel difference between the image block of the even field reconstruction frame and the second prediction block are calculated respectively.
[0045] In step S121, the server first determines the magnitude of the motion vector of the image block. The magnitude of the motion vector is the size of the motion vector, ignoring the direction, and only reflects the distance of the inter-frame positional offset of the image block, such as 2 pixels or 5 pixels. Then, a preset threshold is determined. The preset threshold needs to be dynamically adjusted in combination with the characteristics of the video scene (such as surveillance video, movie video) and the frame rate. For example, the preset threshold is set to 3 pixels. This value is based on the statistics of the movement speed of common objects. For example, the inter-frame offset of pedestrians walking or vehicles moving slowly usually does not exceed 3 pixels, while the offset of fast-moving objects exceeds the threshold, ensuring that the stationary area with a small offset and the moving area with a significant offset can be effectively distinguished.
[0046] If the amplitude of the odd field motion vector of the image patch is detected to be greater than a preset threshold, or the amplitude of its even field motion vector is greater than a preset threshold (either of the two conditions must be met), then the image patch can be determined to be a moving region in the current frame. This is because as long as the image patch exhibits a motion intensity exceeding the critical value in either the odd or even field dimension, it means that there is a significant positional change or dynamic feature in the time dimension of the current frame, which does not meet the core attribute of low motion intensity in static regions. The pixel changes in moving regions are dominated by the actual movement of objects, such as cars driving or people walking in the picture. When interlacing to line-by-line completion, comb artifacts and ghosting are easily generated due to motion misalignment within the odd and even field acquisition interval.
[0047] If the amplitude of the odd-field motion vector of an image patch is less than or equal to a preset threshold, and the amplitude of its even-field motion vector is also less than or equal to a preset threshold (both conditions must be met simultaneously), then the image patch is determined to be a stationary region in the current frame. This is because the key characteristic of a stationary region is that the motion intensity of the image patch is at an extremely low level in all field dimensions (odd and even fields). Only when the amplitudes of the odd and even fields motion vectors do not exceed the preset threshold can it be ensured that the image patch has not undergone significant displacement within the current frame, thus conforming to the definition of a stationary region. Pixels in stationary regions are basically stable, such as background walls and fixed furniture in the image. Although there is no risk of motion artifacts, if the wrong reconstructed frame is selected between frames, slight pixel differences can easily cause screen flickering, such as fluctuating background brightness. Through this step, the server achieves the premise of targeted processing by region, avoiding processing deviations caused by using a uniform strategy for moving and stationary regions.
[0048] In step S122, when an image block is determined to be a moving region, the server uses a motion compensation strategy to generate a first prediction block that adapts to the motion pattern and performs pixel difference calculation. The specific process is as follows: The server first locates a reference block in the reference image frame that is consistent with the initial position of the current image block. For example, if the initial position of the current image block is (100,100)-(115,115), the corresponding reference block in the reference image frame is at the same position. Then, based on the motion vector of the current image block (including direction and magnitude, such as 5 pixels to the right horizontally), the reference block in the reference image frame is shifted by the corresponding magnitude according to the vector direction to obtain the first prediction block after motion compensation. That is, the reference block is shifted from (100,100)-(115,115) to (105,100)-(120,115). This process essentially simulates the real motion trajectory of the current moving region block, making the first prediction block highly consistent with the motion state of the current block.
[0049] Since motion regions are prone to artifacts due to motion misalignment, and the first prediction block is an ideal artifact-free block derived from the motion patterns of the previous frame, the difference can be calculated based on it. This can accurately distinguish between good field blocks (small difference, no artifacts) that conform to the motion patterns and bad field blocks (large difference, containing artifacts) that violate the motion patterns, effectively reducing artifact misjudgment, such as avoiding misjudging motion artifacts of bad fields as details.
[0050] The server extracts motion region image blocks from odd-field reconstructed frames and motion region image blocks at the same position from even-field reconstructed frames, and performs pixel-level quantization calculations with the first prediction block. Quantization calculations commonly use indicators such as absolute difference sum and mean square error to obtain the pixel differences between the image blocks of odd-field reconstructed frames and the first prediction block, and the pixel differences between the image blocks of even-field reconstructed frames and the first prediction block.
[0051] In step S122, when an image block is determined to be a stationary region, the server directly selects the corresponding block of the reference image frame as the second prediction block based on the pixel stability characteristics of the stationary region, and performs pixel difference calculation. The specific process is as follows: Since the motion vector amplitude of the stationary region is extremely small, it indicates that the position of the region between frames is basically without offset. The reference block in the reference image frame that is completely consistent with the position of the current image block is the second prediction block. Its pixel content is highly consistent with the ideal state of the current block and no additional motion compensation is required. The block can be directly reused as the reference.
[0052] The core risk of static regions is inter-frame flicker (e.g., selecting an odd-field static block in the previous frame and an even-field static block in the next frame, causing the background to flicker due to slight pixel differences). The second prediction block comes from a high-quality reference frame that has been verified in the previous frame. The difference is calculated based on this frame, which can filter out the current block that is closest to the static block of the previous frame (with small differences), ensuring the continuity of pixels in the static region between frames and reducing the risk of flicker from the root.
[0053] The server also extracts the still region image blocks of the odd field reconstructed frame and the still region image blocks of the same position of the even field reconstructed frame, and then calculates the pixel difference between them and the second prediction block. The same quantization index as the moving region is used to ensure the fairness of the comparison. Finally, the pixel difference between the image block of the odd field reconstructed frame and the second prediction block, and the pixel difference between the image block of the even field reconstructed frame and the second prediction block are obtained.
[0054] In this application, to address the issue of artifacts easily generated in moving regions, a first prediction block is generated through motion compensation, ensuring that the difference calculation closely follows the motion pattern and avoiding misjudgment of artifacts. To address the issue of flicker easily generated in stationary regions, a second prediction block is generated by reusing the corresponding block of the reference frame, ensuring pixel continuity between frames and avoiding flicker at its source, thus achieving the dual goals of motion artifact removal and stationary flicker prevention. Furthermore, both types of prediction blocks are generated based on the reference image frame of the previous frame and are highly adapted to the region type; for example, a compensated frame is used for moving blocks, and the original frame block is used for stationary blocks. This avoids using incorrect references to calculate differences, such as quantization deviations caused by using the original frame block as a reference for moving blocks. It also makes the difference comparison between odd-field and even-field blocks more objective, providing a reliable quantization basis for subsequent selection of good field blocks and reducing the probability of inferior frames being selected. Finally, both the first prediction block in the moving region and the second prediction block in the stationary region are based on the reference image frame. Essentially, they strongly correlate the block-level quality judgment of the current frame with the state of the previous frame. This temporal connection design ensures that the good field blocks selected in the current frame are consistent with the content of the previous frame, avoids frame selection jumps between frames, and lays a key foundation for the dynamic smoothness of the video after field line removal.
[0055] The core logic of this application is as follows: In de-field processing, good fields (reconstructed frames without artifacts and conforming to motion patterns) possess temporal continuity and predictability, and can be deduced from the state and motion patterns of the previous frame; bad fields (reconstructed frames containing defects such as comb artifacts and ghosting) are abrupt and violate motion patterns because artifacts are temporal anomalous signals. By quantifying temporal inconsistencies, bad fields are accurately identified, and ultimately, global good fields are selected. This application includes the following steps.
[0056] 1. Basic Frame Data Acquisition: The server first acquires two types of core frame data. The first is the reference image frame output after the previous interlaced video frame has been processed by deinterlacing (it has been verified to be a high-quality good field without artifacts and conforming to the motion law, and is used as a temporal reference); the second is the odd-numbered field image and even-numbered field image corresponding to the current interlaced video frame. The missing pixels of even-numbered and odd-numbered lines are filled in by the deinterlacing algorithm to generate odd-numbered field reconstruction frames and even-numbered field reconstruction frames (both are complete frames line by line, which are used as good / bad field candidates to be screened).
[0057] 2. Inter-frame motion vector calculation: The server splits the odd-field reconstructed frame and the even-field reconstructed frame into multiple non-overlapping image blocks at the same position. The block matching motion estimation algorithm is used to process the image blocks of the two types of reconstructed frames respectively. The target position image block of the odd-field reconstructed frame is matched with the corresponding position image block of the reference image frame to obtain the odd-field motion vector of the image block. Similarly, the target position image block of the even-field reconstructed frame is matched with the corresponding position image block of the reference image frame to obtain the even-field motion vector.
[0058] 3. Block-level processing of odd field reconstructed frames: The server first extracts the odd field motion vector corresponding to the target position image block in the odd field reconstructed frame, obtains the amplitude of the motion vector and compares it with a preset threshold.
[0059] If the amplitude is greater than the preset threshold: the image block is determined to be a moving region. The image block at the corresponding position in the reference image frame is motion compensated using the odd field motion vector (the position is adjusted according to the vector direction and amplitude) to generate a first prediction block that fits the moving region block. The pixel difference between the moving region image block and the first prediction block in the odd field reconstruction frame is calculated and denoted as Residual_Odd. Its conformity with the motion law is quantified.
[0060] If the amplitude is less than or equal to the preset threshold: the image block is determined to be a stationary region, and the image block in the reference image frame corresponding to the target position is directly used as the second prediction block; the pixel difference between the stationary region image block and the second prediction block in the odd field reconstruction frame is calculated and denoted as Diff_Odd, and its stability with the stationary region of the previous frame is quantified.
[0061] 4. Block-level processing of even-field reconstructed frames: The server extracts the even-field motion vectors corresponding to the image blocks at the same target position in the even-field reconstructed frames and compares their amplitudes with preset thresholds.
[0062] If the amplitude is greater than the preset threshold, it is determined to be a motion region. Motion compensation is performed on the corresponding block of the reference image frame using the even-field motion vector to generate the first prediction block of the even-field motion region block. The pixel difference between the motion region image block and the first prediction block in the even-field reconstructed frame is calculated and denoted as Residual_Even.
[0063] If the amplitude is less than or equal to the preset threshold, it is determined to be a stationary region. The corresponding block in the reference image frame is used as the second prediction block. The pixel difference between the stationary region image block and the second prediction block in the even-field reconstruction frame is calculated and denoted as Diff_Even.
[0064] 5. Reconstructed Frame Determination: In odd-field and even-field reconstructed frames, image blocks at the same target location theoretically correspond to the same area of the original interlaced video frame. Their actual motion state (moving / stationary) should be consistent because the movement of objects in that area is an objective fact and will not change due to odd / even field splitting. Therefore, for image blocks at the same target location, their motion state is consistent in odd-field and even-field reconstructed frames, so the comparison is between moving or stationary regions.
[0065] If it is a moving region: Comparing Residual_Odd and Residual_Even, the one with smaller pixel differences indicates that its moving region block is more in line with the motion pattern and has no artifacts, and the reconstructed frame to which it belongs is the winner for that region.
[0066] For static areas: Comparing Diff_Odd and Diff_Even, the one with smaller pixel differences indicates that it can better maintain the temporal stability of static areas and avoid flickering, and the reconstructed frame of that area is the winner.
[0067] 6. Global Fusion Decision and Reference Frame Update: The server calculates the regional winners for all image blocks and uses a majority voting principle. If the odd-field reconstructed frame has more winning regions, it is designated as the processed complete frame (i.e., globally good field); if the even-field reconstructed frame has more winning regions, it is designated as the processed complete frame. Finally, the server stores this processed complete frame as the reference image frame for the next frame's interlaced video delineation processing, forming an inter-frame temporal correlation closed loop to ensure the continuity of subsequent processing and complete a single delineation process.
[0068] This application provides an example for illustration, including the following.
[0069] Step 1: Data initialization and acquisition.
[0070] Prepare the basic input for processing the current frame, including odd-field images. Even field images and reference image frames .
[0071] At the current time t=0, the even-numbered field image is set as the default initial image: .
[0072] Figure 4 A flowchart illustrating the data initialization and acquisition process.
[0073] Step 2: Generation of reconstructed frames (candidate frames).
[0074] The input odd and even field images are completed using a basic deinterlacing reconstruction algorithm (such as Weave), generating two types of reconstructed frames, which serve as input for subsequent temporal analysis and voting.
[0075] Odd Field Reconstruction Frame: .
[0076] Even field reconstruction frames: .
[0077] Step 3: Inter-frame motion analysis.
[0078] The purpose of this step is to... and Accurate motion models are established for subsequent motion compensation consistency calculations.
[0079] Will and The image is divided into M×N non-overlapping image blocks (macroblocks), for example, a macroblock of size 16×16 pixels. , where i is the index of the macroblock.
[0080] The information obtained in step 1 Using the reference frame, a block matching motion estimation algorithm (e.g., a diamond search or hexagonal search algorithm can be used to balance efficiency and accuracy) is employed to calculate the motion vector (MV) for each macroblock.
[0081] for Each macroblock in ,exist Within a preset search window, the image patch that best matches it is found, and the positional offset between the two is the singularity motion vector. .
[0082] for Each macroblock in Calculate its corresponding even-field motion vector: .
[0083] After this step is completed, two independent motion vector fields are obtained: .
[0084] Step 4: Compare temporal consistency across different regions.
[0085] Based on the motion vector in step 3, the motion state of the region is determined, and the pixel difference between the image block of the odd and even field reconstruction result and the corresponding image block of the reference image frame is compared in each region. The winner gets a vote.
[0086] Initialize two voting counters: .
[0087] Set motion detection threshold: .
[0088] For each macroblock Follow the steps below.
[0089] 1) If satisfied If it is a moving region, then it is considered a stationary region; otherwise, it is considered a static region.
[0090] 2) If it is a movement area, The first prediction block in is or , This represents the prediction block corresponding to the i-th macroblock in the odd-field candidate frame. This represents the prediction block corresponding to the i-th macroblock in the even-field candidate frame. In other words, the motion region may have already shifted, so we cannot simply use the content at the same position in the previous frame as a reference; we must perform displacement prediction based on the motion vector.
[0091] If it is a static region: the reference block is the macroblock at the same position in the previous frame: A stationary area indicates that the content of the image in that area has hardly changed, so the same position in the previous frame can be used directly as a reference without needing motion vectors or prediction. In other words, when the area is stationary, the simplest and most reliable approach is to directly refer to the content at the corresponding position in the previous frame.
[0092] 3) Calculate pixel differences.
[0093] Pixel differences in odd-field reconstructed frames: .
[0094] Pixel differences in even-field reconstructed frames: .
[0095] 4) Compare and vote.
[0096] like ,but ,otherwise .
[0097] Step 5: Global voting and final decision.
[0098] After the loop ends, a global decision is made based on the final voting results, by comparing the total number of votes. and .
[0099] like The final decision is to select the odd field reconstruction frame as the current frame and output... .
[0100] like The final decision is to select the even-field reconstructed frame as the current frame and output... .
[0101] Figure 5This is a schematic diagram of the data flow of this application, including steps 2 to 5.
[0102] Step 6: Status update.
[0103] The final selection and output from step 5 Stored in the buffer. This frame will serve as the reference frame acquired in step 1 when processing the video data at the next time point t+1. This forms a continuous, closed-loop processing flow.
[0104] Based on the same technical concept, this application also provides a device for video delineation, such as... Figure 6 As shown, the method includes: The acquisition module 601 is used to acquire the reference image frame that has been processed in the previous frame, as well as the odd field reconstruction frame and even field reconstruction frame corresponding to the current frame. The partitioning module 602 is used to divide the odd-field reconstruction frame and the even-field reconstruction frame into multiple non-overlapping image blocks according to the same position; The matching and calculation module 603 is used to perform block matching and block calculation on the image blocks at the same position in the odd field reconstruction frame and the even field reconstruction frame respectively with the reference image frame, determine the reconstruction frame to which the best performing image block at the same position belongs, and increment the count of the reconstruction frame by one. The reconstruction frame to which the best performing image block belongs conforms to the motion law of objects in the video and has no motion artifacts. The counting module 604 is used to, after completing the matching and calculation of all image blocks, take the reconstructed frame with the highest count as the processing completion frame of the current frame, and use it as the reference image frame required for the next frame in the video de-fielding process.
[0105] Optionally, the matching and calculation module 603 is used for: The image blocks at the same position in the odd field reconstruction frame and the even field reconstruction frame are respectively matched with the reference image frame to obtain the motion vector of each image block at the same position relative to the reference image frame. The motion vector is used to indicate the inter-frame position offset of the image block. Based on the motion vector, determine the same prediction block in the reference image frame for each image block at the same location, and calculate the pixel difference between the image block and the prediction block in the odd field reconstructed frame and the pixel difference between the image block and the prediction block in the even field reconstructed frame respectively. For image blocks at the same location in odd-field and even-field reconstruction frames, determine the reconstruction frame to which the image block with the smallest pixel difference belongs.
[0106] Optionally, the matching and calculation module 603 is specifically used for: The block matching motion estimation algorithm is adopted to match the image block at the target position in the odd field reconstruction frame with the image block at the corresponding position in the reference image frame to obtain the odd field motion vector of the image block at the target position in the odd field reconstruction frame relative to the reference image frame. The block matching motion estimation algorithm is adopted to match the image block at the target position in the even field reconstructed frame with the image block at the corresponding position in the reference image frame to obtain the even field motion vector of the image block at the target position in the even field reconstructed frame relative to the reference image frame.
[0107] Optionally, the matching and calculation module 603 is specifically used for: Based on the relationship between the magnitude of the motion vector of the image block and the preset threshold, the image block is determined to be a moving region or a stationary region in the current frame. Among them, the pixel changes in the moving region are dominated by motion and are prone to artifacts, while the pixels in the stationary region are stable and prone to flickering. If the image block is a moving region, motion compensation is performed on the corresponding image block in the reference image frame according to the motion vector to obtain the first predicted block after motion compensation. The first predicted block is used to match the motion pattern and reduce false artifacts. Calculate the pixel difference between the image block of the odd-field reconstructed frame and the first prediction block, and the pixel difference between the image block of the even-field reconstructed frame and the first prediction block, respectively.
[0108] Optionally, the device is also used for: If the image patch is a stationary region, the image patch corresponding to the image patch in the reference image frame is used as the second prediction block. The second prediction block is used to reduce the risk of flicker by utilizing the stability of the stationary region. Calculate the pixel difference between the image block of the odd-field reconstructed frame and the second prediction block, and the pixel difference between the image block of the even-field reconstructed frame and the second prediction block, respectively.
[0109] Optionally, the matching and calculation module 603 is specifically used for: If the amplitude of the odd-field motion vector is greater than a preset threshold or the amplitude of the even-field motion vector is greater than a preset threshold, then the image block is determined to be the motion region in the current frame. If the amplitude of the odd-field motion vector is less than or equal to a preset threshold, or the amplitude of the even-field motion vector is less than or equal to a preset threshold, then the image block is determined to be a stationary region in the current frame.
[0110] Optionally, the acquisition module 601 is used for: Obtain the odd-numbered field image and the even-numbered field image corresponding to the current frame; The odd-field image is processed using a deinterlacing algorithm to obtain a reconstructed frame of the odd field that fills in the missing even field. The even-field image is processed using a deinterlacing algorithm to obtain an even-field reconstructed frame that completes the missing odd-field.
[0111] Based on the same technical concept, embodiments of the present invention also provide an electronic device, such as... Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703, and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704. Memory 703 is used to store computer programs; The processor 701 performs the above steps when executing the program stored in the memory 703.
[0112] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0113] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0114] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0115] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0116] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above methods.
[0117] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the methods described above.
[0118] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0119] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0120] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for removing field lines from a video, characterized in that, The method includes: Obtain the reference image frame that has been processed in the previous frame, as well as the odd field reconstruction frame and even field reconstruction frame corresponding to the current frame; The odd-field reconstructed frame and the even-field reconstructed frame are divided into multiple non-overlapping image blocks according to the same position; The image blocks at the same position in the odd field reconstruction frame and the even field reconstruction frame are respectively matched and calculated with the reference image frame to determine the reconstruction frame to which the image block with the best performance at the same position belongs, and the count of the reconstruction frame is incremented by one. The reconstruction frame to which the image block with the best performance belongs conforms to the motion law of objects in the video and has no motion artifacts. After matching and calculating all image blocks, the reconstructed frame with the highest count is taken as the processing completion frame of the current frame and used as the reference image frame required for the next frame in the video de-fielding process.
2. The method according to claim 1, characterized in that, By performing block matching and block calculation on image blocks at the same location in the odd-field reconstructed frame and the even-field reconstructed frame respectively with the reference image frame, the reconstructed frame to which the best-performing image block at the same location belongs is determined as follows: The image blocks at the same position in the odd-field reconstructed frame and the even-field reconstructed frame are respectively matched with the reference image frame to obtain the motion vector of each image block at the same position relative to the reference image frame, wherein the motion vector is used to indicate the inter-frame position offset of the image block; Based on the motion vector, determine the same prediction block corresponding to each image block at the same position in the reference image frame, and calculate the pixel difference between the image block and the prediction block in the odd field reconstruction frame and the pixel difference between the image block and the prediction block in the even field reconstruction frame, respectively. For image blocks at the same location in the odd-field reconstruction frame and the even-field reconstruction frame, determine the reconstruction frame to which the image block with the smallest pixel difference belongs.
3. The method according to claim 2, characterized in that, By performing block matching on image blocks at the same location in both the odd-field and even-field reconstructed frames with the reference image frame, the motion vectors of each image block at the same location relative to the reference image frame are obtained, including: A block matching motion estimation algorithm is used to match the image block at the target position in the odd field reconstructed frame with the image block at the corresponding position in the reference image frame to obtain the odd field motion vector of the image block at the target position in the odd field reconstructed frame relative to the reference image frame. A block matching motion estimation algorithm is used to match the image block at the target position in the even-field reconstructed frame with the image block at the corresponding position in the reference image frame to obtain the even-field motion vector of the image block at the target position in the even-field reconstructed frame relative to the reference image frame.
4. The method according to claim 3, characterized in that, Based on the motion vector, the same image block at the same location is determined to correspond to the same prediction block in the reference image frame. The pixel differences between the image block in the odd-field reconstructed frame and the prediction block, and the pixel differences between the image block in the even-field reconstructed frame and the prediction block are calculated respectively, including: Based on the relationship between the magnitude of the motion vector of the image block and a preset threshold, the image block is determined to be a moving region or a stationary region in the current frame. The pixel changes in the moving region are dominated by motion and are prone to artifacts, while the pixels in the stationary region are stable and prone to flickering. If the image block is a moving region, then motion compensation is performed on the corresponding image block in the reference image frame according to the motion vector to obtain the first prediction block after motion compensation. The first prediction block is used to match motion patterns and reduce artifact misjudgment. The pixel differences between the image block of the odd-field reconstructed frame and the first prediction block, and the pixel differences between the image block of the even-field reconstructed frame and the first prediction block are calculated respectively.
5. The method according to claim 4, characterized in that, After determining that the image patch is a moving or stationary region in the current frame, the method further includes: If the image block is a stationary region, then the image block corresponding to the image block in the reference image frame is used as the second prediction block, wherein the second prediction block is used to reduce the risk of flicker by utilizing the stability of the stationary region; The pixel differences between the image block of the odd-field reconstructed frame and the second prediction block, and the pixel differences between the image block of the even-field reconstructed frame and the second prediction block are calculated respectively.
6. The method according to claim 4, characterized in that, Determining whether an image block is a moving or stationary region in the current frame based on the relationship between the magnitude of the motion vector of the image block and a preset threshold includes: If the amplitude of the odd-field motion vector is greater than the preset threshold or the amplitude of the even-field motion vector is greater than the preset threshold, then the image block is determined to be a motion region in the current frame. If the amplitude of the odd-field motion vector is less than or equal to the preset threshold, or the amplitude of the even-field motion vector is less than or equal to the preset threshold, then the image block is determined to be a stationary region in the current frame.
7. The method according to claim 1, characterized in that, Obtaining the odd-field reconstructed frame and even-field reconstructed frame corresponding to the current frame includes: Obtain the odd-numbered field image and the even-numbered field image corresponding to the current frame; The odd-field image is processed using a deinterlacing algorithm to obtain an odd-field reconstructed frame that fills in the missing even-field image. The even-field image is processed using a deinterlacing algorithm to obtain an even-field reconstructed frame that completes the missing odd-field.
8. A device for removing field lines from a video, characterized in that, The method includes: The acquisition module is used to acquire the reference image frame that has been processed in the previous frame, as well as the odd field reconstruction frame and even field reconstruction frame corresponding to the current frame. The partitioning module is used to divide the odd-field reconstructed frame and the even-field reconstructed frame into multiple non-overlapping image blocks according to the same position; The matching and calculation module is used to perform block matching and block calculation on the image blocks at the same position in the odd field reconstruction frame and the even field reconstruction frame respectively with the reference image frame, determine the reconstruction frame to which the image block with the best performance at the same position belongs, and increment the count of the reconstruction frame by one. The reconstruction frame to which the image block with the best performance belongs conforms to the motion law of objects in the video and has no motion artifacts. The counting module is used to select the reconstructed frame with the highest count as the current frame after matching and calculating all image blocks, and to use it as the reference image frame required for the next frame in the video de-fielding process.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-7.