An image filter based on B frame compression
Through the image filter technology based on B frame compression, the problems of high B frame image delay and poor image quality are solved. Through contour marking, sliding scanning and gradient processing technology, the edge clarity and naturalness of the image are improved, achieving Better image quality improvements.
Patent Information
- Application Number
- CN202410278550.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-12
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-03-12
AI Technical Summary
In video encoding, the B-frame image needs to wait for the decoding of the previous and next frames, resulting in high delay and image quality affected by noise and artifacts. In addition, image filtering in the existing technology is difficult to effectively improve the naturalness of edge contours.
An image filter based on B-frame compression is used to mark the contour edge of the B-frame difference image through the acquisition and marking module. The sliding scanning module locks the contour curve segment with the preset scanning window size, and the calculation and processing module performs weighted average and radial gradient transition processing. , integrate the optimization module for linear gradient over-processing, and adjust the scanning window to ensure that the image proportion is within the standard range.
It improves the edge clarity and transition edge naturalness of the image, reduces the difference between the B-frame difference image and the background, makes the edge contour more smooth and natural, and enhances the overall quality of the image.
Smart Images

Figure CN118233632B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of compressed sensing, and in particular to an image filter based on B frame compression. Background Art
[0002] B frame compression refers to the use of B frames for compression in video encoding to reduce the size of video files and improve encoding efficiency. The bidirectional prediction ability of B frames is used to predict and encode video frames by referring to the difference between the previous and next key frames. During encoding, B frames can perform motion compensation and spatial prediction based on the difference between the previous and next frames to reduce redundant information. The pixel data in the B frame is described by motion vectors so that it can be accurately reconstructed during decoding. However, since it is necessary to wait for the previous and next frames to be decoded before decoding the B frame, the use of B frames will increase the delay of video decoding. Moreover, the decoding complexity of B frames is high, and more computing resources are required to ensure the clarity of B frame images. Since B frames contain more motion information, their image quality will be affected by noise, artifacts or other image quality problems. Therefore, in order to improve the image quality of B frames, the image can be filtered. Image filtering is the process of applying a filter to an image to change the image by smoothing or enhancing the brightness, contrast, color, sharpness and edges of the image. Image filters are used to improve and modify the image by changing the pixel values of the image or selectively enhancing or weakening certain frequency components in the image.
[0003] Chinese Patent Publication No.: CN110636307A discloses a deterministic image coding method based on Gabor filter. The technical point is that by compressing and imaging and reconstructing the millimeter wave image, the reconstruction time of the millimeter wave image can be effectively reduced and the reconstruction performance can be improved. It can be seen that in the existing compressed sensing technology, while generating the B frame, the image is also blurred, such as some jagged edges or loss of details. Therefore, there is an urgent need for an image filter that can quickly lock the adaptive position including the edge pixel points by selectively sliding the scanning window and selecting to adjust the size of the scanning window, and enhance the edge details by selectively changing the pixel data, reduce the image contour difference, and make the edge contour smoother and more natural as a whole, thereby improving the image clarity. Summary of the invention
[0004] To this end, the present invention provides an image filter based on B frame compression, so as to overcome the problem in the prior art that the B frame image is prone to have a large difference between the edge contour and the background, resulting in unclear images.
[0005] To achieve the above object, the present invention provides an image filter based on B frame compression, comprising:
[0006] The acquisition and marking module is used to obtain the decoded B frame image and the B frame difference image during compression, mark the contour edge in the B frame image according to the position coordinates of the edge pixel points of the picture area in the B frame difference image, form a number of marked contour pixels, divide the B frame image into an outer contour area and an inner contour area, and mark and number the line segments formed by the current contour pixels for a second time;
[0007] A sliding scanning module, which is connected to the acquisition and marking module, is used to extract the B frame image after the contour edge marking is completed, scan the marked contour pixels in the B frame image through the scanning window with a preset scanning window size, and during the scanning process, lock the marked contour pixels in the image area corresponding to the current scanning window, extract the contour curve segments, and determine the number of contour curve segments. When it is determined that the number of contour curve segments in the image area corresponding to the current scanning window is 1, the shape of the contour curve segments in the current scanning window and the corresponding image area is determined to determine the first sliding distance or the second sliding distance according to the position coordinates of the pixel points at both ends of the contour curve segment, and determine the real-time area image proportion according to the standard area image proportion range, and select the preset scanning window size to be corrected with the first correction side length or the second correction side length;
[0008] A calculation processing module connected to the sliding scanning module is used to obtain the image area corresponding to the current scanning window when the sliding scanning module determines that the real-time area image ratio is within the standard area image ratio range, form a to-be-processed image unit, and perform filtering processing on the to-be-processed image unit;
[0009] An integrated optimization module, which is connected to the calculation processing module and the sliding scanning module, and is used to perform filtering optimization processing on a plurality of contour curve segments that have completed filtering processing in the B frame image;
[0010] The filtering process includes performing weighted average processing on the brightness data of a number of pixel points of the image unit to be processed, and performing radial gradient transition processing on each gradient transition layer in the current scanning window;
[0011] The filtering optimization process includes, when it is determined that there is another contour curve segment connected to any end point and has completed secondary marking, performing linear gradient transition processing on the linear gradient transition curve segment.
[0012] Furthermore, an image scanning coefficient is provided in the sliding scanning module, and the sliding scanning module can obtain the total number of pixels of the B frame image, and calculate the preset scanning window size according to the image scanning coefficient and the total number of pixels. When the sliding scanning module scans the marked contour pixels in the B frame image with the preset scanning window size, it can lock the marked contour pixels in the image area corresponding to the current scanning window, extract the contour curve segments, and determine the number of the contour curve segments.
[0013] If the number of contour curve segments in the image region corresponding to the current scanning window is 1, the sliding scanning module will determine the shape of the contour curve segments in the current scanning window and the corresponding image region to determine whether the boundary of the contour curve segment and the current scanning window forms a closed state;
[0014] If the number of contour curve segments in the image area corresponding to the current scanning window is not 1, the sliding scanning module replaces the locked B frame image area through the sliding scanning window and continues to determine the number of contour curve segments;
[0015] Wherein, Sc=Nz×A, Sc represents the preset scanning window size for calculation, Nz represents the total number of pixels of the B frame image, and A represents the set image scanning coefficient.
[0016] Furthermore, when the sliding scanning module determines that the number of contour curve segments in the image region corresponding to the current scanning window is 1, the sliding scanning module determines the shape of the contour curve segments in the current scanning window and the corresponding image region.
[0017] If the current scanning window does not form a closed state with one end of the contour curve segment in the corresponding image area, but forms a closed state with the other end, the current scanning window will be slid in a straight line direction from the unclosed end to the closed end until the boundary of the current scanning window intersects with the unclosed end, or the contour curve segment does not form a closed state with the boundary of the current scanning window, then the sliding stops;
[0018] If the current scanning window and the two ends of the contour curve segment in the corresponding image area are not in a closed state, calculate the first sliding distance, connect the two end points to form a straight line, and slide the current scanning window to the first sliding distance in the direction of the perpendicular bisector of the straight line;
[0019] If the current scanning window intersects with the two ends of the contour curve segment in the corresponding image area, the real-time area image proportion will be determined according to the standard area image proportion range to determine whether to adjust the state of the current scanning window;
[0020] Among them, the first sliding distance is obtained by respectively obtaining the horizontal coordinates corresponding to the pixel points at both ends of the contour curve segment in the image area corresponding to the current scanning window, that is, X1 and X2, calculating the horizontal displacement difference ΔX= X1-X2 between the two horizontal coordinates, and taking the absolute value of the horizontal displacement difference |ΔX|=|X1-X2| as the first sliding distance.
[0021] Furthermore, a standard area image ratio range is set in the sliding scanning module. When the sliding scanning module determines that the current scanning window intersects with the two ends of the contour curve segment in the corresponding image area, the number of pixels in the inner contour area and the number of pixels in the outer contour area in the corresponding image area are obtained to calculate the real-time area image ratio, and the real-time area image ratio is determined according to the standard area image ratio range.
[0022] If the real-time regional image ratio is within the standard regional image ratio range, the calculation processing module will perform filtering processing on the image unit to be processed;
[0023] If the real-time area image ratio is not within the standard area image ratio range, the calculation processing module will obtain the positional relationship between the two intersection points of the contour curve segment in the image area corresponding to the current scanning window and the scanning window boundary and make a determination to determine a method for correcting the preset scanning window size;
[0024] The real-time area image ratio is equal to the ratio of the number of pixels in the inner contour area to the number of pixels in the outer contour area of the image area corresponding to the current scanning window.
[0025] Furthermore, when the sliding scanning module determines that the real-time area image ratio is not within the standard area image ratio range, the sliding scanning module obtains the position relationship between the two intersection points of the contour curve segment in the image area corresponding to the current scanning window and the boundary of the current scanning window and makes a determination.
[0026] If the two intersection points are located on opposite sides of the boundary of the current scanning window, the sliding scanning module compares the area of the inner contour region of the image area corresponding to the current scanning window with the area of the outer contour region, slides the current scanning window to a second sliding distance in the straight line direction from the starting point to the end point, obtains the area of the inner contour region of the image area corresponding to the current scanning window after sliding as the real-time region area, repeats the above calculation of the real-time region image ratio, determines the real-time region image ratio according to the standard region image ratio range, and slides the current scanning window until it is determined that the real-time region image ratio is within the standard region image ratio range, stops sliding the current scanning window, and the calculation processing module performs filtering processing on the image unit to be processed;
[0027] If the two intersection points are located at two adjacent sides of the current scanning window boundary or the two intersection points are located at the same side of the current scanning window boundary, the sliding scanning module compares the first area image ratio and the second area image ratio with the real-time area image ratio to determine a method for correcting the preset scanning window size;
[0028] The starting point is the centroid of the larger area of the two regions, and the end point is the centroid of the smaller area of the two regions;
[0029] Calculating the second sliding distance includes obtaining the maximum difference in the vertical coordinates of each pixel point in the inner area of the contour corresponding to the image area of the current scanning window as the real-time inner contour spacing, obtaining the maximum difference in the vertical coordinates of each pixel point in the outer area of the contour as the real-time outer contour spacing, and obtaining half of the difference between the real-time inner contour spacing and the real-time outer contour spacing as the second sliding distance.
[0030] Furthermore, when the sliding scanning module determines that the two intersection points are respectively located on two adjacent sides of the current scanning window boundary or the two intersection points are located on the same side of the current scanning window boundary, the first area image ratio, the second area image ratio and the calculated real-time area image ratio are obtained, and the first area image ratio and the second area image ratio are respectively compared with the real-time area image ratio.
[0031] If the image proportion of the real-time area is less than the image proportion of the first area, the sliding scanning module obtains the absolute value of the difference between the area of the inner contour and the area of the outer contour of the image area corresponding to the current scanning window as the corrected scanning window size, subtracts the preset scanning window size from the corrected scanning window size to obtain the first corrected window size, calculates the first corrected side length according to the first corrected window size, and corrects the preset scanning window size with the first corrected side length to the first corrected window size;
[0032] If the image proportion of the real-time area is greater than the image proportion of the second area, the sliding scanning module obtains the absolute value of the difference between the area of the inner contour and the area of the outer contour of the image area corresponding to the current scanning window as the corrected scanning window size, adds the preset scanning window size to the corrected scanning window size to obtain the second corrected window size, calculates the second corrected side length according to the second corrected window size, and corrects the preset scanning window size with the second corrected side length to the second corrected window size;
[0033] Until it is determined that the real-time area image ratio is within the standard area image ratio range, the sliding scanning module stops correcting the preset scanning window size, and the calculation processing module performs filtering processing on the image unit to be processed;
[0034] Wherein, the first correction window size = the first correction side length × the first correction side length, and the second correction window size = the second correction side length × the second correction side length;
[0035] The correction process includes obtaining the pixel point at the centroid position of the area within the contour of the image area corresponding to the current scanning window as the reference pixel point, and scaling the horizontal and vertical coordinates of the reference pixel point by the corresponding correction side length.
[0036] Furthermore, when the sliding scanning module determines that the real-time area image ratio is within the standard area image ratio range, the calculation processing module obtains the image area corresponding to the current scanning window to form an image unit to be processed, and performs weighted average processing on the brightness data of several pixel points of the image unit to be processed, that is, each initial brightness value of the image unit to be processed is adjusted to the corresponding corrected brightness value in turn;
[0037] Among them, the weighted average processing includes, respectively obtaining the brightness value of each pixel point in the inner area of the contour of the image unit to be processed as a number of initial brightness values, calculating the average foreground brightness according to each initial brightness value, obtaining the brightness value of each pixel in the outer area of the contour of the image unit to be processed to calculate the average background brightness, subtracting the average foreground brightness from the average background brightness to obtain a real-time brightness difference, and adding each initial brightness value to the real-time brightness difference in turn to obtain a corresponding corrected brightness value.
[0038] Furthermore, a preset brightness difference value is set in the calculation processing module, and after the calculation processing module performs weighted average processing on the brightness data of a plurality of pixel points of the image unit to be processed, the calculation processing module performs radial gradient transition processing on each gradient transition layer of the image unit to be processed;
[0039] Wherein, determining the number of radial gradient transition layers includes, in the image unit to be processed, obtaining a contour curve segment as an initial radial gradient transition layer, obtaining each pixel point constituting the contour curve segment as each edge center point, and calculating the brightness difference between the pixel points of the adjacent upper and lower layers and the edge center point in sequence from each edge center point, to obtain a number of real-time brightness difference values, if there is a real-time brightness difference value greater than a preset brightness difference value, then selecting the layer where the pixel point is located as the radial gradient transition layer, and accumulating the number of initial radial gradient transition layers;
[0040] The radial gradient transition process is to adjust the color brightness of each gradient transition layer through a superposition algorithm.
[0041] Furthermore, after the calculation processing module performs radial gradient transition processing on each gradient transition layer of the image unit to be processed, the contour edge mark in the image unit to be processed is deleted, the acquisition and marking module performs secondary marking on the contour curve segment in the image unit to be processed, and numbers the contour curve segment in the connection order of each endpoint, and the integration optimization module obtains the two endpoints of the contour curve segment for determination,
[0042] If there is another contour curve segment connected to any end point that has completed secondary marking, the integration optimization module will perform linear gradient transition processing on the linear gradient transition curve segment;
[0043] If the other two contour curve segments respectively connected to the two end points have not completed the secondary marking, the integration optimization module does not perform the linear gradient transition processing on the linear gradient transition curve segment.
[0044] Furthermore, a linear gradient transition coefficient is provided in the integration optimization module. When the integration optimization module determines that another contour curve segment connected to any endpoint has completed secondary marking, the number of gradient transition pixels is calculated, the current gradient transition line segment is determined, and another gradient transition curve segment connected to the endpoint is obtained to synthesize a linear gradient transition curve segment, and a linear gradient transition processing is performed on the linear gradient transition curve segment through a transparency blending algorithm;
[0045] Wherein, determining the gradual transition curve segment includes obtaining the total number of pixels of the current contour curve segment, multiplying the total number of pixels by the linear gradual transition coefficient to obtain the current gradual transition number, and selecting corresponding pixel points from the two end points with the current gradual transition number to form the current gradual transition curve segment;
[0046] The linear gradient transition process is to perform weighted blending of the transparency and color value of each pixel point constituting the linear gradient transition curve segment in sequence through a transparency blending algorithm.
[0047] Compared with the prior art, the beneficial effect of the present invention lies in that the contour edge of the B frame image is marked according to the B frame difference image by the acquisition and marking module, and the sliding scanning window is slid by the sliding scanning module until the real-time area image ratio is within the standard area image ratio range, so as to ensure that the image filtering processing is effectively carried out and improve the processing accuracy; the brightness data of each pixel point in the area within the contour of the image unit to be processed is processed by the calculation and processing module, which not only enhances the edge of the image, but also reduces the difference between the B frame difference image and the background image to make the transition edge smoother; the calculation and processing module performs radial gradient transition processing on each gradient transition layer of the image unit to be processed, so that the contour transition edge of the B frame difference image is more natural, that is, the B frame difference image is better integrated into the background image; the linear gradient transition processing is performed on the linear gradient transition line segment by the integration optimization module, so as to ensure that the edge contour processed by radial gradient is smoother and more natural as a whole.
[0048] Furthermore, by setting the image scanning coefficient to calculate the corresponding preset scanning window size according to the size of the image to be processed, the applicability of filtering the image is improved, and the number of contour curve segments in the current scanning window area is obtained to quickly lock the position where the number of contour curve segments in the current scanning window area is 1, and the shape of the contour curve segments in the current scanning area is judged, and the sliding scanning module slides the scanning window to an adaptive position to filter the contour curve segments.
[0049] In particular, when the number of contour curve segments in the image region corresponding to the current scanning window is determined to be 1 by the sliding scanning module, the shapes of the contour curve segments in the current scanning window and the corresponding image region are determined to determine the adjustment method of the current scanning window. If the sliding scanning module determines that the current scanning window and one end of the contour curve segment in the corresponding image region do not form a closed state, it means that part of the contour edge mark in the current scanning region has been deleted, because the radial gradient transition processing of each gradient transition layer has been completed, and the contour edge mark in the image has been deleted, then the sliding scanning module controls the scanning window to slide toward the other end of the contour edge. Window, quickly lock the target position, increase efficiency. Similarly, if the sliding scanning module determines that the current scanning window and the two ends of the contour curve segment in the corresponding image area have not formed a closed state, then the two end points are connected to form a straight line, and the current scanning window is slid to the first sliding distance in the direction of the perpendicular bisector of the straight line, so that the scanning window is closer to the contour curve segment that has not been processed. If the sliding scanning module determines that the current scanning window intersects with the two ends of the contour curve segment in the corresponding image area, indicating that the contour curve segment in the current scanning area has not been processed, the real-time area image ratio is determined according to the standard area image ratio range to determine whether to adjust the state of the current scanning window.
[0050] Furthermore, by setting a standard area image ratio range, the sliding scanning module determines the real-time area image ratio according to the standard area image ratio range to determine whether to lock the current scanning window for filtering processing. If the sliding scanning module determines that the real-time area image ratio is within the standard area image ratio range, it means that the ratio of the area inside the contour to the area outside the contour in the image area corresponding to the current scanning window is close to 1. The contour curve segment can be adjusted with reference to the pixel data on both sides of the contour curve segment to ensure that the contour edge is naturally and smoothly integrated into the background image. If the sliding scanning module determines that the real-time area image ratio is not within the standard area image ratio range, the positional relationship between the two intersection points of the contour curve segment in the image area corresponding to the current scanning window and the scanning window boundary is obtained and determined to determine the method for correcting the preset scanning window size. The operation is simple and effective.
[0051] Furthermore, by obtaining the positional relationship between the two intersection points of the contour curve segment in the current scanning window and the current scanning window boundary and making a judgment, a sliding scanning module is used to select a method for correcting the preset scanning window size. If the sliding scanning module determines that the two intersection points are respectively located on two opposite sides of the current scanning window boundary, the current scanning window is simply and directly translated and slid so that the area in the current scanning window satisfies that the real-time area image ratio is within the standard area image ratio range, thereby filtering the image in the current scanning area. If the sliding scanning module determines that the two intersection points are respectively located on two adjacent sides of the current scanning window boundary or the two intersection points are located on the same side of the current scanning window boundary, and the positional relationship is relatively complex, the first area image ratio and the second area image ratio are respectively compared with the real-time area image ratio to determine a method for correcting the preset scanning window size.
[0052] In particular, by conducting a specific analysis of the situation where the real-time area image ratio is not within the range of the standard area image ratio, the size of the scanning window is accurately adjusted to adapt to the actual situation. If the sliding processing module determines that the real-time area image ratio is less than the first area image ratio, the reference pixel point is selected, and the first corrected side length is calculated as the scaling factor to reduce the size of the scanning window. If the sliding processing module determines that the real-time area image ratio is greater than the second area image ratio, the reference pixel point is selected, and the second corrected side length is calculated as the scaling factor to enlarge the size of the scanning window. The method is simple and effective.
[0053] Furthermore, by performing weighted average calculation on the brightness values of the pixel points and accurately and reliably analyzing the data, the brightness values of the pixel points in the inner contour area of the image area corresponding to the current scanning window are balanced and adjusted to be close to the brightness values of the pixel points in the outer contour area of the corresponding image area, so that the contour curve segment, that is, the contour edge, is more obvious.
[0054] Furthermore, by setting a preset brightness difference value, the calculation and processing module selects a radial gradient transition layer according to the degree of brightness change, and calculates the brightness difference between the adjacent upper and lower layers of pixels and the edge center point in turn from the center point of each edge, to determine the brightness change around the contour curve segment. If the calculation and processing module determines that the real-time brightness difference is greater than the preset brightness difference value, indicating that the brightness values of the two pixel points located in the two adjacent layers have changed significantly, the color brightness needs to be adjusted to ensure a natural transition of the contour edge.
[0055] Furthermore, by performing secondary marking on the line segments formed by the current contour pixels, the contour curve segments are numbered according to the connection order of the intersection points, and the calculation processing module performs linear gradient processing on the connections of the contour curve segments under different scanning windows, so as to avoid obvious changes at the connection nodes due to different scanning windows or large differences in the pixel points themselves, resulting in unnatural and unsmooth overall edge contour segments.
[0056] Furthermore, by setting the linear gradient transition coefficient, the optimization module is integrated to select the length of the gradient transition line segment according to actual conditions to ensure the smoothness and naturalness of the processing effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A schematic diagram of an image filter based on B frame compression according to an embodiment of the present invention;
[0058] Figure 2 The figure is a schematic diagram of the segmentation process of a B frame image according to an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0060] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0061] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the drawings. This is merely for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.
[0062] In addition, it should be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0063] See also Figure 1 and Figure 2 As shown, Figure 1 is a schematic diagram of an image filter based on B frame compression according to an embodiment of the present invention, Figure 2 The present invention is a schematic diagram of the segmentation processing of a B frame image in an embodiment of the present invention. The present invention provides an image filter based on B frame compression, including an acquisition marking module, a sliding scanning module, a calculation processing module and an integration optimization module, wherein:
[0064] The acquisition and marking module is used to obtain the decoded B frame image and the B frame difference image during compression, mark the contour edge in the B frame image according to the position coordinates of the edge pixel points of the picture area in the B frame difference image, form a number of marked contour pixels, divide the B frame image into an outer contour area and an inner contour area, and mark and number the line segments formed by the current contour pixels for a second time;
[0065] A sliding scanning module, which is connected to the acquisition and marking module, is used to extract the B frame image after the contour edge marking is completed, scan the marked contour pixels in the B frame image through the scanning window with a preset scanning window size, and during the scanning process, lock the marked contour pixels in the image area corresponding to the current scanning window, extract the contour curve segments, and determine the number of contour curve segments. When it is determined that the number of contour curve segments in the image area corresponding to the current scanning window is 1, the shape of the contour curve segments in the current scanning window and the corresponding image area is determined to determine the first sliding distance or the second sliding distance according to the position coordinates of the pixel points at both ends of the contour curve segment, and determine the real-time area image proportion according to the standard area image proportion range, and select the preset scanning window size to be corrected with the first correction side length or the second correction side length;
[0066] A calculation processing module connected to the sliding scanning module is used to obtain the image area corresponding to the current scanning window when the sliding scanning module determines that the real-time area image ratio is within the standard area image ratio range, form a to-be-processed image unit, and perform filtering processing on the to-be-processed image unit;
[0067] An integrated optimization module, which is connected to the calculation processing module and the sliding scanning module, and is used to perform filtering optimization processing on a plurality of contour curve segments that have completed filtering processing in the B frame image;
[0068] The filtering process includes performing weighted average processing on the brightness data of a number of pixel points of the image unit to be processed, and performing radial gradient transition processing on each gradient transition layer in the current scanning window;
[0069] The filtering optimization process includes, when it is determined that there is another contour curve segment connected to any end point and has completed secondary marking, performing linear gradient transition processing on the linear gradient transition curve segment.
[0070] The B-frame image is marked with contour edges according to the B-frame difference image through the acquisition and marking module, and the sliding scanning window is slid by the sliding scanning module until the real-time area image ratio is within the standard area image ratio range, so as to ensure that the image filtering processing is effectively carried out and improve the processing accuracy. The brightness data of each pixel point in the area within the contour of the image unit to be processed is processed by the calculation and processing module, which not only enhances the edge of the image, but also reduces the difference between the B-frame difference image and the background image to make the transition edge smoother. The calculation and processing module performs radial gradient transition processing on each gradient transition layer of the image unit to be processed, so that the contour transition edge of the B-frame difference image is more natural, that is, the B-frame difference image is better integrated into the background image. The linear gradient transition processing is performed on the linear gradient transition line segment through the integration and optimization module, so as to ensure that the edge contour processed by radial gradient is smoother and more natural as a whole.
[0071] Specifically, the sliding scanning module is provided with an image scanning coefficient, the sliding scanning module can obtain the total number of pixels of the B frame image, and calculate the preset scanning window size according to the image scanning coefficient and the total number of pixels. When the sliding scanning module scans the marked contour pixels in the B frame image with the preset scanning window size, it can lock the marked contour pixels in the image area corresponding to the current scanning window, extract the contour curve segments, and determine the number of the contour curve segments.
[0072] If the number of contour curve segments in the image region corresponding to the current scanning window is 1, the sliding scanning module will determine the shape of the contour curve segments in the current scanning window and the corresponding image region to determine whether the boundary of the contour curve segment and the current scanning window forms a closed state;
[0073] If the number of contour curve segments in the image area corresponding to the current scanning window is not 1, the sliding scanning module replaces the locked B frame image area through the sliding scanning window and continues to determine the number of contour curve segments;
[0074] Wherein, Sc=Nz×A, Sc represents the preset scanning window size for calculation, Nz represents the total number of pixels of the B frame image, and A represents the set image scanning coefficient.
[0075] The image scanning coefficient represents a set decimal value, which is related to the size and quality requirements of the image to be processed. Generally, the set value is guaranteed to make the preset scanning window size the square of the integer value. Even if the preset scanning window size can be 3×3, it can be set between 0.01-0.1; the scanning window is a rectangle; locking means that in the B frame image, the current scanning area is simulated and closed according to the current scanning window, and the corresponding image area is accurately obtained for judgment to ensure smooth and effective judgment;
[0076] By setting the image scanning coefficient, the corresponding preset scanning window size is calculated according to the size of the image to be processed, so as to improve the applicability of the image filtering processing. By obtaining the number of contour curve segments in the current scanning window area, the position where the number of contour curve segments in the current scanning window area is 1 is quickly locked.
[0077] The shape of the contour curve segment in the current scanning area is determined, and the sliding scanning module slides the scanning window to an adaptive position to perform filtering processing on the contour curve segment.
[0078] Specifically, when the sliding scanning module determines that the number of contour curve segments in the image region corresponding to the current scanning window is 1, the sliding scanning module determines the shape of the contour curve segments in the current scanning window and the corresponding image region.
[0079] If the current scanning window does not form a closed state with one end of the contour curve segment in the corresponding image area, but forms a closed state with the other end, the current scanning window will be slid in a straight line direction from the unclosed end to the closed end until the boundary of the current scanning window intersects with the unclosed end, or the contour curve segment does not form a closed state with the boundary of the current scanning window, then the sliding stops;
[0080] If the current scanning window and the two ends of the contour curve segment in the corresponding image area are not in a closed state, calculate the first sliding distance, connect the two end points to form a straight line, and slide the current scanning window to the first sliding distance in the direction of the perpendicular bisector of the straight line;
[0081] If the current scanning window intersects with the two ends of the contour curve segment in the corresponding image area, the real-time area image proportion will be determined according to the standard area image proportion range to determine whether to adjust the state of the current scanning window;
[0082] Among them, the first sliding distance is obtained by respectively obtaining the horizontal coordinates corresponding to the pixel points at both ends of the contour curve segment in the image area corresponding to the current scanning window, that is, X1 and X2, calculating the horizontal displacement difference ΔX= X1-X2 between the two horizontal coordinates, and taking the absolute value of the horizontal displacement difference |ΔX|=|X1-X2| as the first sliding distance.
[0083] When the number of contour curve segments in the image area corresponding to the current scanning window is determined to be 1 by the sliding scanning module, the shape of the contour curve segments in the current scanning window and the corresponding image area is determined to determine the adjustment method of the current scanning window. If the sliding scanning module determines that the current scanning window and one end of the contour curve segment in the corresponding image area do not form a closed state, it means that part of the contour edge mark in the current scanning area has been deleted, because the radial gradient transition processing of each gradient transition layer has been completed, and the contour edge mark in the image has been deleted, the sliding scanning module controls the scanning window to translate the sliding scanning window toward the other end of the contour edge. , quickly lock the target position and increase efficiency. Similarly, if the sliding scanning module determines that the current scanning window and the two ends of the contour curve segment in the corresponding image area have not formed a closed state, the two end points are connected to form a straight line, and the current scanning window is slid to the first sliding distance in the direction of the perpendicular bisector of the straight line, so that the scanning window is closer to the contour curve segment that has not been processed. If the sliding scanning module determines that the current scanning window intersects with the two ends of the contour curve segment in the corresponding image area, indicating that the contour curve segment in the current scanning area has not been processed, the real-time area image proportion is determined according to the standard area image proportion range to determine whether to adjust the state of the current scanning window.
[0084] Specifically, a standard area image ratio range is set in the sliding scanning module. When the sliding scanning module determines that the current scanning window intersects with the two ends of the contour curve segment in the corresponding image area, the number of pixels in the inner contour area and the number of pixels in the outer contour area in the corresponding image area are obtained to calculate the real-time area image ratio, and the real-time area image ratio is determined according to the standard area image ratio range.
[0085] If the real-time regional image ratio is within the standard regional image ratio range, the calculation processing module will perform filtering processing on the image unit to be processed;
[0086] If the real-time area image ratio is not within the standard area image ratio range, the calculation processing module will obtain the positional relationship between the two intersection points of the contour curve segment in the image area corresponding to the current scanning window and the scanning window boundary and make a determination to determine a method for correcting the preset scanning window size;
[0087] The real-time area image ratio is equal to the ratio of the number of pixels in the inner contour area to the number of pixels in the outer contour area of the image area corresponding to the current scanning window.
[0088] The standard area image ratio range indicates the standard value of the set image that can be filtered, which is generally set to 40%-60%, so as to ensure that the pixel points that constitute the contour curve segment are effectively processed;
[0089] By setting the standard area image proportion range, the sliding scanning module determines the real-time area image proportion according to the standard area image proportion range to determine whether to lock the current scanning window for filtering processing. If the sliding scanning module determines that the real-time area image proportion is within the standard area image proportion range, it means that the ratio of the area of the inner contour region to the area of the outer contour region in the image area corresponding to the current scanning window is close to 1, and the contour curve segment can be adjusted with reference to the pixel data on both sides of the contour curve segment to ensure that the contour edge is naturally and smoothly integrated into the background image. If the sliding scanning module determines that the real-time area image proportion is not within the standard area image proportion range, the positional relationship between the two intersection points of the contour curve segment in the image area corresponding to the current scanning window and the scanning window boundary is obtained and determined to determine the method for correcting the preset scanning window size. The operation is simple and effective.
[0090] Specifically, when the sliding scanning module determines that the real-time area image ratio is not within the standard area image ratio range, it obtains the position relationship between the two intersection points of the contour curve segment in the image area corresponding to the current scanning window and the boundary of the current scanning window and makes a determination.
[0091] If the two intersection points are located on opposite sides of the boundary of the current scanning window, the sliding scanning module compares the area of the inner contour region of the image area corresponding to the current scanning window with the area of the outer contour region, slides the current scanning window to a second sliding distance in the straight line direction from the starting point to the end point, obtains the area of the inner contour region of the image area corresponding to the current scanning window after sliding as the real-time region area, repeats the above calculation of the real-time region image ratio, determines the real-time region image ratio according to the standard region image ratio range, and slides the current scanning window until it is determined that the real-time region image ratio is within the standard region image ratio range, stops sliding the current scanning window, and the calculation processing module performs filtering processing on the image unit to be processed;
[0092] If the two intersection points are located at two adjacent sides of the current scanning window boundary or the two intersection points are located at the same side of the current scanning window boundary, the sliding scanning module compares the first area image ratio and the second area image ratio with the real-time area image ratio to determine a method for correcting the preset scanning window size;
[0093] The starting point is the centroid of the larger area of the two regions, and the end point is the centroid of the smaller area of the two regions;
[0094] Calculating the second sliding distance includes obtaining the maximum difference in the vertical coordinates of each pixel point in the inner area of the contour corresponding to the image area of the current scanning window as the real-time inner contour spacing, obtaining the maximum difference in the vertical coordinates of each pixel point in the outer area of the contour as the real-time outer contour spacing, and obtaining half of the difference between the real-time inner contour spacing and the real-time outer contour spacing as the second sliding distance.
[0095] By obtaining the positional relationship between the two intersection points of the contour curve segment in the current scanning window and the current scanning window boundary and making a judgment, a sliding scanning module is used to select a method for correcting the preset scanning window size. If the sliding scanning module determines that the two intersection points are respectively located on two opposite sides of the current scanning window boundary, the current scanning window is simply and directly translated and slid so that the area in the current scanning window satisfies that the real-time area image ratio is within the standard area image ratio range, thereby filtering the image in the current scanning area. If the sliding scanning module determines that the two intersection points are respectively located on two adjacent sides of the current scanning window boundary or the two intersection points are located on the same side of the current scanning window boundary, and the positional relationship is relatively complex, the image ratio of the first area and the image ratio of the second area are respectively compared with the real-time area image ratio to determine a method for correcting the preset scanning window size.
[0096] Specifically, when the sliding scanning module determines that the two intersection points are located at two adjacent sides of the current scanning window boundary or the two intersection points are located at the same side of the current scanning window boundary, the first area image ratio, the second area image ratio and the calculated real-time area image ratio are obtained, and the first area image ratio and the second area image ratio are compared with the real-time area image ratio respectively.
[0097] If the image proportion of the real-time area is less than the image proportion of the first area, the sliding scanning module obtains the absolute value of the difference between the area of the inner contour and the area of the outer contour of the image area corresponding to the current scanning window as the corrected scanning window size, subtracts the preset scanning window size from the corrected scanning window size to obtain the first corrected window size, calculates the first corrected side length according to the first corrected window size, and corrects the preset scanning window size with the first corrected side length to the first corrected window size;
[0098] If the image proportion of the real-time area is greater than the image proportion of the second area, the sliding scanning module obtains the absolute value of the difference between the area of the inner contour and the area of the outer contour of the image area corresponding to the current scanning window as the corrected scanning window size, adds the preset scanning window size to the corrected scanning window size to obtain the second corrected window size, calculates the second corrected side length according to the second corrected window size, and corrects the preset scanning window size with the second corrected side length to the second corrected window size;
[0099] Until it is determined that the real-time area image ratio is within the standard area image ratio range, the sliding scanning module stops correcting the preset scanning window size, and the calculation processing module performs filtering processing on the image unit to be processed;
[0100] Wherein, the first correction window size = the first correction side length × the first correction side length, and the second correction window size = the second correction side length × the second correction side length;
[0101] The correction process includes obtaining the pixel point at the centroid position of the area within the contour of the image area corresponding to the current scanning window as the reference pixel point, and scaling the horizontal and vertical coordinates of the reference pixel point by the corresponding correction side length.
[0102] The first area image proportion and the second area image proportion constitute a standard area image proportion range. By specifically analyzing the situation where the real-time area image proportion is not within the standard area image proportion range, the size of the scanning window is accurately adjusted to adapt to the actual situation. If the sliding processing module determines that the real-time area image proportion is less than the first area image proportion, the reference pixel point is selected, and the first corrected side length is calculated as the scaling factor to reduce the size of the scanning window. If the sliding processing module determines that the real-time area image proportion is greater than the second area image proportion, the reference pixel point is selected, and the second corrected side length is calculated as the scaling factor to enlarge the size of the scanning window. The method is simple and effective.
[0103] Specifically, when the sliding scanning module determines that the real-time area image ratio is within the standard area image ratio range, the calculation processing module obtains the image area corresponding to the current scanning window to form an image unit to be processed, and performs weighted average processing on the brightness data of several pixel points of the image unit to be processed, that is, each initial brightness value of the image unit to be processed is adjusted to the corresponding corrected brightness value in turn;
[0104] Among them, the weighted average processing includes, respectively obtaining the brightness value of each pixel point in the inner area of the contour of the image unit to be processed as a number of initial brightness values, calculating the average foreground brightness according to each initial brightness value, obtaining the brightness value of each pixel in the outer area of the contour of the image unit to be processed to calculate the average background brightness, subtracting the average foreground brightness from the average background brightness to obtain a real-time brightness difference, and adding each initial brightness value to the real-time brightness difference in turn to obtain a corresponding corrected brightness value.
[0105] By performing weighted average calculation on the brightness values of the pixels and accurately and reliably analyzing the data, the brightness values of the pixels in the inner contour area of the image area corresponding to the current scanning window are balanced and adjusted to be close to the brightness values of the pixels in the outer contour area of the corresponding image area, so that the contour curve segment, that is, the contour edge, is more obvious.
[0106] Specifically, a preset brightness difference value is set in the calculation processing module, and after the calculation processing module performs weighted average processing on the brightness data of a plurality of pixel points of the image unit to be processed, the calculation processing module performs radial gradient transition processing on each gradient transition layer of the image unit to be processed;
[0107] Wherein, determining the number of radial gradient transition layers includes, in the image unit to be processed, obtaining a contour curve segment as an initial radial gradient transition layer, obtaining each pixel point constituting the contour curve segment as each edge center point, and calculating the brightness difference between the pixel points of the adjacent upper and lower layers and the edge center point in sequence from each edge center point, to obtain a number of real-time brightness difference values, if there is a real-time brightness difference value greater than a preset brightness difference value, then selecting the layer where the pixel point is located as the radial gradient transition layer, and accumulating the number of initial radial gradient transition layers;
[0108] The radial gradient transition process is to adjust the color brightness of each gradient transition layer through a superposition algorithm.
[0109] The overlay algorithm in this embodiment adopts an overlay blending mode algorithm to adjust the color of the previous layer according to the color brightness of one layer. That is, if the color brightness of the current layer is less than 0.5, the color of the previous layer is multiplied by 2 to brighten the color of the upper layer. If the color brightness of the current layer is greater than or equal to 0.5, the color of the upper layer is multiplied by the sum of the brightness of the two and the product of the brightness of the two, so that the color of the upper layer becomes darker. The calculation is performed layer by layer to achieve a gradient effect.
[0110] By setting a preset brightness difference, the calculation and processing module selects the radial gradient transition layer according to the degree of brightness change. By calculating the brightness difference between the adjacent upper and lower layers of pixels and the edge center point respectively from the center point of each edge, the brightness change around the contour curve segment is determined. If the calculation and processing module determines that the real-time brightness difference is greater than the preset brightness difference, it means that the brightness values of the two pixel points located in the two adjacent layers have changed significantly, then the color brightness needs to be adjusted to ensure a natural transition of the contour edge.
[0111] Specifically, after the calculation processing module performs radial gradient transition processing on each gradient transition layer of the image unit to be processed, the contour edge mark in the image unit to be processed is deleted, the acquisition and marking module performs secondary marking on the contour curve segment in the image unit to be processed, and numbers the contour curve segment in the connection order of each endpoint, and the integration optimization module obtains the two endpoints of the contour curve segment for determination.
[0112] If there is another contour curve segment connected to any end point that has completed secondary marking, the integration optimization module will perform linear gradient transition processing on the linear gradient transition curve segment;
[0113] If the other two contour curve segments respectively connected to the two end points have not completed the secondary marking, the integration optimization module does not perform the linear gradient transition processing on the linear gradient transition curve segment.
[0114] The line segments formed by the current contour pixels are marked twice, the contour curve segments are numbered according to the connection order of the intersection points, and the calculation processing module performs linear gradient processing on the connection points of the contour curve segments under different scanning windows to avoid obvious changes at the connection nodes due to different scanning windows or large differences in the pixel points themselves, resulting in unnatural and unsmooth overall edge contour segments.
[0115] Specifically, a linear gradient transition coefficient is set in the integration optimization module. When the integration optimization module determines that there is another contour curve segment connected to any endpoint that has completed secondary marking, the number of gradient transition pixels is calculated, the current gradient transition line segment is determined, and another gradient transition curve segment connected to the endpoint is obtained to synthesize a linear gradient transition curve segment, and a linear gradient transition processing is performed on the linear gradient transition curve segment through a transparency blending algorithm;
[0116] Wherein, determining the gradual transition curve segment includes obtaining the total number of pixels of the current contour curve segment, multiplying the total number of pixels by the linear gradual transition coefficient to obtain the current gradual transition number, and selecting corresponding pixel points from the two end points with the current gradual transition number to form the current gradual transition curve segment;
[0117] The linear gradient transition process is to perform weighted blending of the transparency and color value of each pixel point constituting the linear gradient transition curve segment in sequence through a transparency blending algorithm.
[0118] The transparency blending algorithm in this embodiment uses an RGB color model to convert the transparency values of the two colors into decimals between 0 and 1 for two pixel points. For example, a color with a transparency of 50% can be converted to 0.5; weighted blending is performed based on their transparency and color values, and the blended color value is calculated using the following formula:
[0119] The mixed red value = (Transparency1 × Red Value1 + Transparency2 × Red Value2) / (Transparency1 + Transparency2);
[0120] The green value after blending = (Transparency1 × Green Value1 + Transparency2 × Green Value2) / (Transparency1 + Transparency2);
[0121] The mixed blue value = (Transparency 1 × Blue Value 1 + Transparency 2 × Blue Value 2) / (Transparency 1 + Transparency 2);
[0122] Among them, the calculation results are rounded to the nearest integer;
[0123] The linear gradient transition coefficient represents a set decimal value, which can be set between 0.05-0.1 according to the size of the image to be processed and the size of the scanning window;
[0124] By setting the linear gradient transition coefficient, the optimization module is integrated to select the length of the gradient transition line segment according to actual conditions to ensure the smoothness and naturalness of the processing effect.
[0125] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
[0126] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An image filter based on B frame compression, characterized in that: include, The acquisition and marking module is used to obtain the decoded B frame image and the B frame difference image during compression, mark the contour edge in the B frame image according to the position coordinates of the edge pixel points of the picture area in the B frame difference image, form a number of marked contour pixels, divide the B frame image into an outer contour area and an inner contour area, and mark and number the line segments formed by the current contour pixels for a second time; A sliding scanning module, which is connected to the acquisition and marking module, is used to extract the B frame image after the contour edge marking is completed, scan the marked contour pixels in the B frame image through the scanning window with a preset scanning window size, and during the scanning process, lock the marked contour pixels in the image area corresponding to the current scanning window, extract the contour curve segments, and determine the number of contour curve segments. When it is determined that the number of contour curve segments in the image area corresponding to the current scanning window is 1, the shape of the contour curve segments in the current scanning window and the corresponding image area is determined to determine the first sliding distance or the second sliding distance according to the position coordinates of the pixel points at both ends of the contour curve segment, and determine the real-time area image proportion according to the standard area image proportion range, and select the preset scanning window size to be corrected with the first correction side length or the second correction side length; A calculation processing module connected to the sliding scanning module is used to obtain the image area corresponding to the current scanning window when the sliding scanning module determines that the real-time area image ratio is within the standard area image ratio range, form a to-be-processed image unit, and perform filtering processing on the to-be-processed image unit; An integrated optimization module, which is connected to the calculation processing module and the sliding scanning module, and is used to perform filtering optimization processing on a plurality of contour curve segments that have completed filtering processing in the B frame image; The filtering process includes performing weighted average processing on the brightness data of a number of pixel points of the image unit to be processed, and performing radial gradient transition processing on each gradient transition layer in the current scanning window; The filtering optimization process includes, when it is determined that there is another contour curve segment connected to any end point and has completed secondary marking, performing linear gradient transition processing on the linear gradient transition curve segment.
2. The image filter based on B frame compression according to claim 1, characterized in that: The sliding scanning module is provided with an image scanning coefficient, and the sliding scanning module can obtain the total number of pixels of the B frame image, and calculate the preset scanning window size according to the image scanning coefficient and the total number of pixels. When the sliding scanning module scans the marked contour pixels in the B frame image with the preset scanning window size, it can lock the marked contour pixels in the image area corresponding to the current scanning window, extract the contour curve segments, and determine the number of the contour curve segments. If the number of contour curve segments in the image region corresponding to the current scanning window is 1, the sliding scanning module will determine the shape of the contour curve segments in the current scanning window and the corresponding image region to determine whether the boundary of the contour curve segment and the current scanning window forms a closed state; If the number of contour curve segments in the image area corresponding to the current scanning window is not 1, the sliding scanning module replaces the locked B frame image area through the sliding scanning window and continues to determine the number of contour curve segments; Wherein, Sc=Nz×A, Sc represents the preset scanning window size for calculation, Nz represents the total number of pixels of the B frame image, and A represents the set image scanning coefficient.
3. The image filter based on B frame compression according to claim 2, characterized in that: When the sliding scanning module determines that the number of contour curve segments in the image area corresponding to the current scanning window is 1, the sliding scanning module determines the shape of the contour curve segments in the current scanning window and the corresponding image area. If the current scanning window does not form a closed state with one end of the contour curve segment in the corresponding image area, but forms a closed state with the other end, the current scanning window will be slid in a straight line direction from the unclosed end to the closed end until the boundary of the current scanning window intersects with the unclosed end, or the contour curve segment does not form a closed state with the boundary of the current scanning window, then the sliding stops; If the current scanning window and the two ends of the contour curve segment in the corresponding image area are not in a closed state, calculate the first sliding distance, connect the two end points to form a straight line, and slide the current scanning window to the first sliding distance in the direction of the perpendicular bisector of the straight line; If the current scanning window intersects with the two ends of the contour curve segment in the corresponding image area, the real-time area image proportion will be determined according to the standard area image proportion range to determine whether to adjust the state of the current scanning window; Among them, the first sliding distance is obtained by respectively obtaining the horizontal coordinates corresponding to the pixel points at both ends of the contour curve segment in the image area corresponding to the current scanning window, that is, X1 and X2, calculating the horizontal displacement difference ΔX= X1-X2 between the two horizontal coordinates, and taking the absolute value of the horizontal displacement difference |ΔX|=|X1-X2| as the first sliding distance.
4. The image filter based on B frame compression according to claim 3, characterized in that: The sliding scanning module is provided with a standard area image proportion range. When the sliding scanning module determines that the current scanning window intersects with the two ends of the contour curve segment in the corresponding image area, the number of pixels in the inner contour area and the number of pixels in the outer contour area in the corresponding image area are obtained to calculate the real-time area image proportion, and the real-time area image proportion is determined according to the standard area image proportion range. If the real-time regional image ratio is within the standard regional image ratio range, the calculation processing module will perform filtering processing on the image unit to be processed; If the real-time area image ratio is not within the standard area image ratio range, the calculation processing module will obtain the positional relationship between the two intersection points of the contour curve segment in the image area corresponding to the current scanning window and the scanning window boundary and make a determination to determine a method for correcting the preset scanning window size; The real-time area image ratio is equal to the ratio of the number of pixels in the area inside the contour to the number of pixels outside the contour of the image area corresponding to the current scanning window.
5. The image filter based on B frame compression according to claim 4, characterized in that: When the sliding scanning module determines that the real-time area image ratio is not within the standard area image ratio range, the sliding scanning module obtains the position relationship between the two intersection points of the contour curve segment in the image area corresponding to the current scanning window and the boundary of the current scanning window and makes a determination. If the two intersection points are located on opposite sides of the boundary of the current scanning window, the sliding scanning module compares the area of the inner contour region of the image area corresponding to the current scanning window with the area of the outer contour region, slides the current scanning window to a second sliding distance in the straight line direction from the starting point to the end point, obtains the area of the inner contour region of the image area corresponding to the current scanning window after sliding as the real-time region area, repeats the above calculation of the real-time region image ratio, determines the real-time region image ratio according to the standard region image ratio range, and slides the current scanning window until it is determined that the real-time region image ratio is within the standard region image ratio range, stops sliding the current scanning window, and the calculation processing module performs filtering processing on the image unit to be processed; If the two intersection points are located at two adjacent sides of the current scanning window boundary or the two intersection points are located at the same side of the current scanning window boundary, the sliding scanning module compares the first area image ratio and the second area image ratio with the real-time area image ratio to determine a method for correcting the preset scanning window size; The starting point is the centroid of the larger area of the two regions, and the end point is the centroid of the smaller area of the two regions; Calculating the second sliding distance includes obtaining the maximum difference in the vertical coordinates of each pixel point in the inner area of the contour corresponding to the image area of the current scanning window as the real-time inner contour spacing, obtaining the maximum difference in the vertical coordinates of each pixel point in the outer area of the contour as the real-time outer contour spacing, and obtaining half of the difference between the real-time inner contour spacing and the real-time outer contour spacing as the second sliding distance.
6. The image filter based on B frame compression according to claim 5, characterized in that: When the sliding scanning module determines that the two intersection points are located at two adjacent sides of the current scanning window boundary or the two intersection points are located at the same side of the current scanning window boundary, the first area image ratio, the second area image ratio and the calculated real-time area image ratio are obtained, and the first area image ratio and the second area image ratio are respectively compared with the real-time area image ratio. If the image proportion of the real-time area is less than the image proportion of the first area, the sliding scanning module obtains the absolute value of the difference between the area of the inner contour and the area of the outer contour of the image area corresponding to the current scanning window as the corrected scanning window size, subtracts the preset scanning window size from the corrected scanning window size to obtain the first corrected window size, calculates the first corrected side length according to the first corrected window size, and corrects the preset scanning window size with the first corrected side length to the first corrected window size; If the image proportion of the real-time area is greater than the image proportion of the second area, the sliding scanning module obtains the absolute value of the difference between the area of the inner contour and the area of the outer contour of the image area corresponding to the current scanning window as the corrected scanning window size, adds the preset scanning window size to the corrected scanning window size to obtain the second corrected window size, calculates the second corrected side length according to the second corrected window size, and corrects the preset scanning window size with the second corrected side length to the second corrected window size; Until it is determined that the real-time area image ratio is within the standard area image ratio range, the sliding scanning module stops correcting the preset scanning window size, and the calculation processing module performs filtering processing on the image unit to be processed; Wherein, the first correction window size = the first correction side length × the first correction side length, and the second correction window size = the second correction side length × the second correction side length; The correction process includes obtaining the pixel point at the centroid position of the area within the contour of the image area corresponding to the current scanning window as the reference pixel point, and scaling the horizontal and vertical coordinates of the reference pixel point by the corresponding correction side length.
7. The image filter based on B frame compression according to claim 6, characterized in that: When the sliding scanning module determines that the real-time area image ratio is within the standard area image ratio range, the calculation processing module obtains the image area corresponding to the current scanning window to form an image unit to be processed, and performs weighted average processing on the brightness data of several pixel points of the image unit to be processed, that is, adjusts each initial brightness value of the image unit to be processed to the corresponding corrected brightness value in turn; Among them, the weighted average processing includes, respectively obtaining the brightness value of each pixel point in the inner area of the contour of the image unit to be processed as a number of initial brightness values, calculating the average foreground brightness according to each initial brightness value, obtaining the brightness value of each pixel in the outer area of the contour of the image unit to be processed to calculate the average background brightness, subtracting the average foreground brightness from the average background brightness to obtain a real-time brightness difference, and adding each initial brightness value to the real-time brightness difference in turn to obtain a corresponding corrected brightness value.
8. The image filter based on B frame compression according to claim 7, characterized in that: The calculation processing module is provided with a preset brightness difference value, and after the calculation processing module performs weighted average processing on the brightness data of a plurality of pixel points of the image unit to be processed, performs radial gradient transition processing on each gradient transition layer of the image unit to be processed; Wherein, determining the number of radial gradient transition layers includes, in the image unit to be processed, obtaining a contour curve segment as an initial radial gradient transition layer, obtaining each pixel point constituting the contour curve segment as each edge center point, and calculating the brightness difference between the pixel points of the adjacent upper and lower layers and the edge center point in sequence from each edge center point, to obtain a number of real-time brightness difference values, if there is a real-time brightness difference value greater than a preset brightness difference value, then selecting the layer where the pixel point is located as the radial gradient transition layer, and accumulating the number of initial radial gradient transition layers; The radial gradient transition process is to adjust the color brightness of each gradient transition layer through a superposition algorithm.
9. The image filter based on B frame compression according to claim 8, characterized in that: After the calculation processing module performs radial gradient transition processing on each gradient transition layer of the image unit to be processed, the contour edge mark in the image unit to be processed is deleted. The acquisition and marking module performs secondary marking on the contour curve segment in the image unit to be processed, and numbers the contour curve segment in the connection order of each endpoint. The integration optimization module obtains the two endpoints of the contour curve segment for determination. If there is another contour curve segment connected to any end point that has completed secondary marking, the integration optimization module will perform linear gradient transition processing on the linear gradient transition curve segment; If the other two contour curve segments respectively connected to the two end points have not completed the secondary marking, the integration optimization module does not perform the linear gradient transition processing on the linear gradient transition curve segment.
10. The image filter based on B frame compression according to claim 9, characterized in that: The integration optimization module is provided with a linear gradient transition coefficient. When the integration optimization module determines that another contour curve segment connected to any endpoint has completed secondary marking, the number of gradient transition pixels is calculated, the current gradient transition line segment is determined, and another gradient transition curve segment connected to the endpoint is obtained to synthesize a linear gradient transition curve segment, and a linear gradient transition process is performed on the linear gradient transition curve segment through a transparency blending algorithm; Wherein, determining the gradual transition curve segment includes obtaining the total number of pixels of the current contour curve segment, multiplying the total number of pixels by the linear gradual transition coefficient to obtain the current gradual transition number, and selecting corresponding pixel points from the two end points with the current gradual transition number to form the current gradual transition curve segment; The linear gradient transition process is to perform weighted blending of the transparency and color value of each pixel point constituting the linear gradient transition curve segment in sequence through a transparency blending algorithm.
Citation Information
Patent Citations
Deterministic image coding method based on Gabor filter
CN110636307A
Image processing apparatus, image processing system, image processing method
CN103259959A
Intelligent pavement disease extraction method based on deep learning and image processing method
CN111310558A
