Image processing method and device and electronic equipment
By using two edge detection operators to detect the image in low illumination scenarios and generating target edge feature maps, the problem that Sobel operator is difficult to distinguish noise and edge texture at low illumination is solved, and more accurate edge detection is achieved.
Patent Information
- Application Number
- CN202412000045.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-18
AI Technical Summary
In low-illumination scenarios, the Sobel operator is difficult to accurately distinguish noise from edge texture, resulting in poor accuracy of edge detection results.
Two different edge detection operators are used to edge detection on the YUV image to be processed to obtain the first and second edge feature maps. By comparing these two edge feature maps, target edge feature maps for the image to be processed are generated to improve the accuracy of edge detection.
By fusing the advantages of the two edge detection operators, the generated target edge feature map can more accurately identify edge information in the image, reduce noise characteristics, and improve the signal-to-noise ratio of edge detection.
Smart Images

Figure CN119850664A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision, and in particular to an image processing method, device and electronic device. Background Art
[0002] Image edge detection technology is a basic technology in the field of computer vision. It identifies the boundaries and contours of objects in an image by detecting changes in pixel intensity in the image. It has wide application value in image analysis, object segmentation and positioning.
[0003] In practical applications, the Sobel operator (an edge detection operator based on first-order derivatives) is usually used to detect edges in images by calculating the gradient values in the horizontal and vertical directions of the image. However, for images in low-light scenes, it is difficult for the Sobel operator to accurately distinguish between noise and edge textures, resulting in poor accuracy of edge detection results, which is difficult to meet the requirements of subsequent image processing tasks. Summary of the invention
[0004] In view of the above problems, this application provides the following solutions:
[0005] The first aspect of the present application provides an image processing method, the method comprising:
[0006] Get the YUV image of the image to be processed;
[0007] Performing edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and performing edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map;
[0008] Processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed, so as to perform an image processing task on the image to be processed;
[0009] Among them, the signal-to-noise ratio of the first edge feature map is greater than the signal-to-noise ratio of the second edge feature map, and the number of edge texture features of the YUV image contained in the first edge feature map is less than the number of edge texture features of the YUV image contained in the second edge feature map.
[0010] Optionally, performing edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and performing edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map, includes:
[0011] Performing line-by-line edge detection on the YUV image using a detection window includes:
[0012] Utilizing the detection area to extract pixel features row by row in each detection window, obtaining a first edge texture feature value of a central pixel of the corresponding detection window from the absolute value of the sum of pixel feature deviations of each pixel point in each detection area, and obtaining a second edge texture feature value of a central pixel point of the corresponding detection window from the sum of the absolute values of the pixel feature deviations of each pixel point in each detection area;
[0013] Obtaining the first edge feature map according to the first edge texture feature value of each pixel point in the YUV image, and obtaining the second edge feature map according to the second edge texture feature value of each pixel point in the YUV image;
[0014] Wherein, the first size of the detection window is smaller than the second size of the detection area.
[0015] Optionally, obtaining the first edge texture feature value of the central pixel of the corresponding detection window by the absolute value of the sum of the pixel feature deviations of each pixel in each detection area, and obtaining the second edge texture feature value of the central pixel of the corresponding detection window by the sum of the absolute values of the pixel feature deviations of each pixel in each detection area, includes:
[0016] Obtaining the mean value of pixel features of each pixel point in the current detection window;
[0017] Obtaining a pixel feature deviation of each pixel point in the corresponding detection area according to the pixel feature mean and the pixel feature value of each pixel point in the detection area;
[0018] The first characteristic difference degree of the central pixel of the corresponding detection area is obtained by the absolute value of the sum of the pixel characteristic deviations of each pixel in the same detection area, and the second characteristic difference degree of the central pixel of the corresponding detection area is obtained by the sum of the absolute values of the pixel characteristic deviations of each pixel in the same detection area;
[0019] The first edge texture feature value of the central pixel of the detection window is obtained by the degree of difference of the first feature corresponding to each pixel in the current detection window, and the second edge texture feature value of the central pixel of the detection window is obtained by the degree of difference of the second feature corresponding to each pixel in the current detection window.
[0020] Optionally, the processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed includes:
[0021] The second edge feature map is compared with the first edge feature map, and a target edge texture feature value of a corresponding pixel point is obtained from an absolute value of an edge texture feature difference of the same pixel point in the YUV image;
[0022] A target edge feature map for the image to be processed is obtained based on the target edge texture feature value corresponding to each pixel point of the YUV image.
[0023] Optionally, performing an image processing task on the image to be processed includes:
[0024] Based on the different target edge texture feature values of each pixel point in the target edge feature map, the image to be processed is subjected to denoising processing according to different pre-matched denoising parameters to obtain a denoised target image.
[0025] Optionally, the performing denoising on the image to be processed according to different target edge texture feature values of each pixel point in the target edge feature map and different pre-matched denoising parameters to obtain a denoised target image includes any of the following:
[0026] Based on different target edge texture feature values of each pixel in the target edge feature map, using different first denoising operators with corresponding different denoising strengths, processing corresponding pixel points in the image to be processed to obtain a denoised target image;
[0027] Based on different target edge texture feature values of each pixel in the target edge feature map, adjusting the same second denoising operator to different denoising strengths, processing corresponding pixel points in the image to be processed, and obtaining a denoised target image;
[0028] The pixel point with a larger target edge texture feature value has a smaller noise reduction intensity.
[0029] Optionally, the performing denoising on the image to be processed according to different target edge texture feature values of each pixel point in the target edge feature map and different pre-matched denoising parameters to obtain a denoised target image includes:
[0030] Obtaining the corresponding relationship between different preset noise parameters and different edge texture feature values of pixel points;
[0031] Determine the target denoising parameters of the corresponding pixel points in the image to be processed based on the corresponding relationship and the different target edge texture feature values of each pixel point in the target edge feature map;
[0032] A third denoising operator having the target denoising parameters is used to perform denoising processing on corresponding pixel points in the image to be processed to obtain a denoised target image.
[0033] Optionally, the correspondence between the different noise parameters and the different edge texture feature values of the pixel points includes:
[0034] The first denoising parameters corresponding to the edge texture feature values within the first edge texture feature range are the same;
[0035] The second noise reduction parameter corresponding to each edge texture feature value within the second edge texture feature range is linearly related to the change of the edge texture feature value;
[0036] The third denoising parameters corresponding to the edge texture feature values within the third edge texture feature range are the same;
[0037] Wherein, the second edge texture feature range is larger than the first edge texture feature range and smaller than the third edge texture feature range;
[0038] If the noise reduction parameter is noise reduction intensity, the second noise reduction parameter is less than the first noise reduction parameter and greater than the third noise reduction parameter;
[0039] If the noise reduction parameter is a gain, the second noise reduction parameter is greater than the first noise reduction parameter and less than the third noise reduction parameter.
[0040] A second aspect of the present application provides an image processing device, the device comprising:
[0041] An acquisition module, used for acquiring a YUV image of an image to be processed;
[0042] An edge detection module, configured to perform edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and perform edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map;
[0043] A processing module, used for processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed, so as to perform an image processing task on the image to be processed;
[0044] Among them, the signal-to-noise ratio of the first edge feature map is greater than the signal-to-noise ratio of the second edge feature map, and the number of edge texture features of the YUV image contained in the first edge feature map is less than the number of edge texture features of the YUV image contained in the second edge feature map.
[0045] A third aspect of the present application provides an electronic device, the electronic device comprising: at least one communication element, at least one memory and at least one processor, wherein:
[0046] The communication element is used to receive the image to be processed;
[0047] The memory is used to store a plurality of computer instructions;
[0048] The processor is used to execute the multiple computer instructions to implement the following steps:
[0049] Obtaining a YUV image of the image to be processed;
[0050] Performing edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and performing edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map;
[0051] Processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed, so as to perform an image processing task on the image to be processed;
[0052] Among them, the signal-to-noise ratio of the first edge feature map is greater than the signal-to-noise ratio of the second edge feature map, and the number of edge texture features of the YUV image contained in the first edge feature map is less than the number of edge texture features of the YUV image contained in the second edge feature map. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0054] Figure 1 This is a flowchart of the image processing method proposed in Example 1 of the present application;
[0055] Figure 2 A schematic diagram of a process for obtaining a target edge feature map in an image processing method proposed in an embodiment of the present application;
[0056] Figure 3 This is a flowchart of the image processing method proposed in Embodiment 2 of the present application;
[0057] Figure 4 A schematic diagram of an improvement of a target edge feature map in the image processing method proposed in an embodiment of the present application;
[0058] Figure 5 This is a flowchart of the image processing method proposed in Embodiment 3 of the present application;
[0059] Figure 6 A schematic diagram of obtaining a second edge feature by using a first edge detection operator in the image processing method proposed in an embodiment of the present application;
[0060] Figure 7 A schematic diagram of obtaining a second edge feature by using a second edge detection operator in the image processing method proposed in an embodiment of the present application;
[0061] Figure 8 A schematic diagram of an improvement of the second edge feature map in the image processing method proposed in an embodiment of the present application;
[0062] Fig. 9 This is a flowchart of the image processing method proposed in Embodiment 4 of the present application;
[0063] Fig.10 This is a flowchart of the image processing method proposed in Embodiment 5 of the present application;
[0064] Fig.11 A schematic diagram of a corresponding relationship between different noise parameters and different edge texture feature values of pixel points in the image processing method proposed in an embodiment of the present application;
[0065] Fig.12 A schematic diagram of another correspondence relationship between different noise parameters and different edge texture feature values of pixel points in the image processing method proposed in an embodiment of the present application;
[0066] Fig.13 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application;
[0067] Fig.14 The figure is a schematic diagram of the hardware structure of an electronic device suitable for the image processing method proposed in this application. DETAILED DESCRIPTION
[0068] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation mode of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application. The embodiments of the present application are described below in conjunction with the drawings. It is known to those of ordinary skill in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0069] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0070] In order to solve the above problems, the embodiment of the present application provides an image processing method, which can be applied to various image processing tasks in any application field such as industrial automation, medical image analysis, security monitoring, art design and cultural relics protection, such as image denoising, target recognition, image segmentation and feature extraction, etc. One or more combined tasks. The image processing method of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0071] Reference Figure 1 , is a flowchart of the image processing method proposed in the first embodiment of the present application. The method can be applied to an electronic device, which can be a server or a terminal device with image processing capabilities, or a server in conjunction with a terminal device. The product form of the electronic device can be determined according to actual needs. Figure 1 As shown, the image processing method proposed in this embodiment may include:
[0072] Step S11, obtaining a YUV image of an image to be processed;
[0073] In the actual application of the present application, when an electronic device is used to perform a corresponding image processing task in any of the application fields listed above, after obtaining the image to be processed (such as a production line image, medical image, surveillance image or cultural relic image, etc.) used to implement its image processing task in the application field, an edge feature map of the image to be processed can be obtained first, that is, a two-dimensional image representing the edge information in the image to be processed, so that the electronic device can identify important structures in the image to be processed, so as to reliably and accurately implement the image processing task of the image to be processed.
[0074] In the process of edge detection of the image to be processed, considering the influence of different lighting conditions on the accuracy and reliability of edge detection, this application processes the image to be processed into a YUV image, and then performs edge detection on the Y component (i.e., brightness feature) of each pixel in the YUV image. Among them, the YUV image is obtained by processing the image to be processed using the YUV color encoding method, Y represents brightness (i.e., brightness value), U and V represent chromaticity, and this application does not elaborate on the implementation process of step S11. It should be understood that for the images to be processed obtained under different lighting conditions, even if the image content of the images to be processed is the same, the YUV images used for edge detection are different, and their Y component images can reflect the actual brightness characteristics of each pixel under different lighting conditions.
[0075] In a possible implementation, the above-mentioned image to be processed can be any image stored locally in the electronic device, or an image stored in other storage devices connected to the electronic device. In this way, when it is necessary to perform a certain image processing task on the image, the image to be processed for implementing the image processing task can be obtained in response to the image processing task. After obtaining the target edge feature map of the image to be processed according to the image processing method proposed in this application, the requested image processing task is performed on the image to be processed based on the target edge feature map. The implementation process can refer to but is not limited to the noise reduction task below. It may also be that the image processing software in other application fields listed above (such as professional image processing applications installed in medical imaging equipment or cultural relics detection equipment or product defect monitoring equipment) performs image processing tasks in corresponding application fields (such as medical image anomaly recognition, cultural relics recognition or product defect detection, etc.). The image processing software responds to the image processing request, obtains the requested processing image, that is, the image to be processed, and can execute the method proposed in this application to achieve its image processing requirements. The implementation process is not described in detail by examples one by one in this application.
[0076] In a possible implementation, the above-mentioned image to be processed may also be an image acquisition device integrated in an electronic device, or an original image directly acquired by an external independent image acquisition device, which is processed by the electronic device to form an image finally presented to the user and stored. For example, a user uses a camera of an electronic device to capture an image. If the captured image does not meet the task requirements, or if it is necessary to perform specific task processing on the captured image, the captured image can be determined as the image to be processed to execute the image processing method proposed in this application, and the target edge feature map obtained is used to perform the corresponding task processing on the image to be processed. Of course, the present application can also store the target edge feature map, and when waiting for the subsequent execution of the image processing task, the stored image to be processed and its target edge feature map can be read to realize the processing of the image to be processed, etc. The present application does not limit the source of the image to be processed and its application scenario, which can be determined according to actual needs.
[0077] Step S12, performing edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and performing edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map;
[0078] Step S13, processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed, so as to perform an image processing task on the image to be processed; the signal-to-noise ratio of the first edge feature map is greater than the signal-to-noise ratio of the second edge feature map, and the number of edge texture features of the YUV image contained in the first edge feature map is less than the number of edge texture features of the YUV image contained in the second edge feature map.
[0079] In order to ensure that edge information in the image to be processed can be accurately identified even in low-light environments, the present application proposes to use two different edge detection operators to perform edge detection on the image to be processed respectively, so as to utilize the edge detection advantages of the two edge detection operators respectively, and fuse the edge feature maps obtained respectively to obtain a target edge feature map that can accurately and reliably indicate the edge texture features of objects in the image to be processed. The present application does not elaborate on the image processing principles of the two edge detection operators.
[0080] Among them, compared with the first edge detection operator, the second edge detection operator can more accurately identify and retain the structural information between pixels in the YUV image (indicating the pixel points at the edge position). During the edge detection process, it is more conducive to retaining the edge texture features in the YUV image, that is, the degree of retention of the edge texture features is higher, so that the number of edge texture features of the YUV image contained in the second edge feature map is greater than the number of edge texture features of the YUV image contained in the first edge feature map.
[0081] However, while the second edge detection operator has the above-mentioned advantages over the first edge detection operator, it retains more edge texture features of the YUV image while also retaining more noise features (i.e., interference features that are confused with the edge texture features of the object and reduce the detection accuracy and reliability of the edge texture features), resulting in its poor noise suppression ability (i.e., anti-noise performance), so that the signal-to-noise ratio of the second edge feature map is lower than that of the first edge feature map. In other words, the second edge feature map has more noise features than the first edge feature map, and the edge information indicated by the first edge feature map is more accurate.
[0082] It can be seen that the first edge detection operator has better anti-noise performance, and the second edge detection operator is more conducive to retaining the edge texture features of the YUV image, so that the noise features in the first edge feature map are less and the edge texture features in the second edge feature map are more. Figure 2As shown, the present application can perform edge detection on the same YUV image for each of the two edge detection operators, and in the process of fusing the two corresponding edge feature maps, fully consider the advantages of each of the two edge feature maps in edge detection, and obtain a target edge feature map containing fewer noise features and more edge texture features, so that it can more accurately and reliably indicate the edge information and texture of each object in the image to be processed, and can more efficiently and accurately perform image processing tasks on the image to be processed, meeting image processing requirements.
[0083] Based on this, in a possible implementation, the first edge detection operator can be a Canny operator, which can smooth the image and suppress noise through a Gaussian filter, and then apply gradient calculation to detect edges. Next, it uses non-maximum suppression and dual threshold detection to determine the real and potential edges, which allows it to maintain good edge continuity while suppressing noise, thereby improving edge detection accuracy. The LoG (Laplacian of Gaussian) operator can also be used, that is, by first performing Gaussian filtering on the image to smooth the noise, and then applying the Laplace operator to detect the edge to improve the robustness of the operator to noise and discrete points. An edge detection method based on deep learning can also be used to achieve efficient and accurate edge detection by training a deep convolutional neural network, achieve strong anti-noise performance, etc. This application can comprehensively select a first edge detection operator with better anti-noise performance according to actual conditions, including but not limited to the first edge detection operator types listed above. In one possible implementation, the second edge detection operator may be a Sobel operator, which can detect edges by calculating the gradient between each pixel and its surrounding pixels. It is a method based on first-order derivatives, which combines Gaussian smoothing and differential derivation, has a smoothing effect on noise, and provides more accurate edge direction information, so it performs better in retaining edge texture features. The Sobel operator adds the concept of weights on the basis of the Prewitt operator, and believes that the distance between adjacent points has different effects on the current pixel point. The closer the distance, the greater the influence of the pixel point on the current pixel, thereby achieving image sharpening and highlighting the edge contour, further improving the accuracy of edge detection. The implementation process is not described in detail in this application.
[0084] Optionally, the second edge detection operator can also be an improved Canny operator based on texture features, by calculating the texture point pair retention rate and the average texture point pair reduction rate, and finding the importance of the texture point pair based on these ratios, thereby reflecting the change in texture features and the possibility that the texture is an edge line. The distribution and importance of the pixel points of the image to be processed are used to set the regional adaptive dual threshold to retain edge information to the greatest extent and improve the edge detection effect. Of course, the present application can also use other edge detection operators that retain the edge texture features of the YUV image. The present application does not give detailed examples one by one here, and can be comprehensively selected based on actual conditions.
[0085] Combined with the characteristics of the two edge feature maps obtained by different edge detection operators above, the pixel features of the same pixel point between the first edge feature map and the second edge feature map can be differenced to obtain a target edge feature map that can fuse the advantages of the two edge feature maps, so that it can retain the edge texture features of the YUV image while reducing the noise features, laying a reliable foundation for subsequent image processing tasks. Optionally, the present application can also use the Difference of Gaussians (DoG) method to achieve the fusion processing of the first edge feature map and the second edge feature map, that is, filter the image using two Gaussian filters with different standard deviations, and then subtract them to obtain the target feature map. It should be noted that the present application does not limit how to achieve the fusion processing method of the first edge feature map and the second edge feature map for the same YUV image, and can adopt any one or more implementation methods that can achieve the technical effect of suppressing noise features while retaining more edge texture features to improve the performance of subsequent image processing tasks.
[0086] Reference Figure 3 , is a flowchart of the image processing method proposed in the second embodiment of the present application. This embodiment can describe an optional refinement process of how to use two edge detection algorithms in the image processing method proposed above to perform edge detection on a YUV image and obtain a corresponding edge feature map. Based on this, Figure 3 As shown, the implementation process of step S12 in the above embodiment may include but is not limited to the following steps:
[0087] Step S31, obtaining a YUV image of an image to be processed;
[0088] Step S32, using the detection window to perform line-by-line edge detection on the YUV image;
[0089] In an embodiment of the present application, during edge detection of a YUV image, the YUV image can be scanned line by line based on a detection window, so as to determine the position of the edge by analyzing the pixel feature difference (such as brightness feature difference) between the central pixel of the detection window and other pixels at each detection window position. The detection window can be a fixed-size area used to compare the neighboring pixel features (such as the brightness value of the pixel) around the pixel during edge detection, such as a 7×7-sized detection window, etc. The first size of the detection window (which indicates the size and formation, such as a 7×7-sized detection window, which can be a square area of 7×7 (in pixels)) affects the effect and amount of calculation of edge detection. The present application can comprehensively determine the value of the first size based on factors such as the computing resources of the electronic device and the requirements for the edge detection effect, and is not limited to the 7×7 size of the example.
[0090] In the process of scanning the YUV image line by line through the detection window, the detection window is gradually moved with a single pixel as the scanning movement step, so as to achieve the edge detection result at each detection window position according to the method described below. However, it is not limited to this movement step, and can be determined according to the actual detection efficiency and accuracy requirements.
[0091] Step S33, using the detection area to perform row-by-row pixel feature extraction in each detection window, obtaining a first edge texture feature value of the central pixel of the corresponding detection window from the absolute value of the sum of the pixel feature deviations of each pixel point in each detection area, and obtaining a second edge texture feature value of the central pixel point of the corresponding detection window from the sum of the absolute values of the pixel feature deviations of each pixel point in each detection area;
[0092] Following the above analysis, in order to be applicable to edge detection under different lighting conditions, the accuracy and reliability of edge detection can be reduced or even avoided to be affected by brightness changes in YUV images. Especially in low-light scenes, the difference in pixel features between edge positions and non-edge positions is not obvious, which can easily cause false edge detection and increase noise features in edge feature maps. The embodiment of the present application proposes to use two image processing operators based on local area blocks, namely a first edge detection algorithm and a second edge detection operator, to perform edge detection on pixels in each detection window in the same YUV image, which improves the accuracy of edge detection compared to directly calculating the difference in pixel features between the center pixel in the detection window and the surrounding pixels in the detection window.
[0093] Based on this, in the process of performing row-by-row and pixel-by-pixel edge detection on the YUV image using a fixed detection window, for the edge detection of the YUV image at each detection window position, a smaller detection window (referred to as the detection area, whose second size is smaller than the first size) can be used, and the YUV image in the detection window at this position (the local image block in the detection window) is subjected to pixel-by-pixel edge detection to determine the pixel feature difference between the central pixel point and the surrounding pixels in the detection area, that is, to determine the pixel feature deviation of the local image block relative to the detection window, and then use the pixel feature deviation corresponding to the detection area at each position in the detection window at this position, that is, consider the pixel feature deviation of different brightness areas in the detection window, to accurately determine the pixel feature deviation between the central pixel point of the detection window and the surrounding pixels, and obtain the edge texture feature value of the central pixel point, thereby indicating that the central pixel point refers to the edge position pixel point.
[0094] It can be seen that the above-mentioned edge detection method takes into account the brightness difference of each detection area in the detection window (that is, the pixel feature deviation), and determines it as the brightness difference of the central pixel of the corresponding detection area, that is, the brightness difference of each pixel in the detection window, which represents the brightness difference between the central pixel and the surrounding pixels in the detection window. Compared with directly calculating the brightness difference between the central pixel and the surrounding pixels in the detection window, the present application can more accurately capture the edge position with large brightness changes in the YUV image in the detection window through the brightness difference between different detection windows, thereby improving the accuracy of edge detection and making the calculated edge texture feature value of the central pixel of the detection window more accurate and reliable.
[0095] Among them, in the process of performing row-by-row edge detection on each detection window in the detection area, the detection area slides within the detection window according to the step size of a single pixel, so that the pixel features (such as brightness values) of pixels at different positions in the detection window participate in the calculation at different times. For example, the detection window is 7×7 in size and the detection area is 3×3 in size. The times that each pixel in the same row in the detection window participates in the calculation are 1, 2, 3, 3, 3, 2, 1, respectively. This is for the calculation of the edge texture feature value of the central pixel of the detection window, and a Gaussian weight is added for each pixel in the detection window to enhance the pixel features of the pixel points at the corresponding position in the detection window, and the difference with the pixel features of the central pixel point, that is, the Gaussian weight in the spatial domain is considered to suppress noise and retain the edge texture features. Compared with the pixel features of each pixel in the detection window participating in the calculation only once, this edge detection algorithm proposed in this embodiment improves the accuracy of edge detection.
[0096] Combined with the above analysis of the respective advantages of the first edge detection algorithm and the second edge detection operator, when using the first edge detection algorithm, in the process of calculating the edge texture feature value of the central pixel point of each detection window position, in order to suppress more noise features and reduce the adverse effects of noise features on image processing tasks, the pixel feature deviations of each pixel point in each detection window position can be accumulated and summed. Since the pixel feature deviations of different pixels may be positive (the brightness value of the corresponding pixel point is greater than the average brightness of the surrounding pixels) or negative (the brightness value of the corresponding pixel point is less than the average brightness of the surrounding pixels), the pixel feature deviations of each pixel point in the same detection area are directly summed to obtain the actual difference between the pixel feature values of different pixels, which is beneficial to improving the anti-noise performance of the edge detection operator.
[0097] Similarly, when using the second edge detection operator, in the process of calculating the edge texture feature value of the central pixel point of each detection window position, in order to retain more edge texture features in the YUV image, the absolute value (positive number) of the pixel feature deviation of each pixel point in each detection area position is summed, that is, the pixel feature amplitude is accumulated to obtain the absolute difference between the pixel feature values, so as to enhance the pixel feature deviation value of the corresponding detection area, so as to be more conducive to detecting the edge texture feature of the central pixel point of the detection window. Regarding these two edge detection operators, the detailed implementation process of calculating the edge texture feature value of the central pixel point of each detection window position is not described in detail in this application, and this application does not limit the execution order of these two edge detection operators, such as being able to be executed sequentially or simultaneously.
[0098] It should be noted that in actual applications, the sizes of the detection window and the detection area may need to be adjusted according to the characteristics of the image and application requirements to achieve the best edge detection effect, and are not limited to the sizes in the above examples.
[0099] Step S34, obtaining a first edge feature map from the first edge texture feature value of each pixel point in the YUV image, and obtaining a second edge feature map from the second edge texture feature value of each pixel point in the YUV image;
[0100] Combined with the above analysis, the signal-to-noise ratio of the first edge feature map obtained by performing edge detection on the same YUV image through the above two edge detection operators is greater than the signal-to-noise ratio of the second edge feature map, that is, the first edge feature map has fewer noise features than the second edge feature map, that is, the anti-noise performance is better, but at the same time, the texture features lost are also more, so that the first edge feature map retains the edge texture features in the YUV image less than the second edge feature map, that is, the second edge feature map contains more edge texture features. Among them, the degree of retention of edge texture features refers to the ratio or percentage between the edge texture features in the corresponding edge feature map and the edge texture features in the YUV image. The greater the degree of retention, the more edge texture features are obtained in the edge feature map when the corresponding edge detection operator is used to perform edge detection on the YUV image.
[0101] In the embodiment of the present application, according to the method described above, a detection window of a fixed size is used to scan the YUV image step by step, and the edge texture feature value of the central pixel point of the detection window at the corresponding position can be calculated. By advancing the calculation in this way, the edge texture feature value of each pixel point in the YUV image can be obtained to form a corresponding edge feature map. It should be understood that in the scanning process using the detection window, the position of the detection window is required not to exceed the boundary position of the YUV image, which may cause several rows of pixel points close to the YUV boundary position to be unable to obtain the corresponding edge texture feature value according to the method described above, but this does not affect the edge detection accuracy and reliability of the entire edge feature map, which can be ignored.
[0102] Step S35, comparing the second edge feature map with the first edge feature map, and obtaining the target edge texture feature value of the corresponding pixel point from the absolute value of the edge texture feature difference of the same pixel point in the YUV image;
[0103] Step S36, obtaining a target edge feature map for the image to be processed based on the target edge texture feature value corresponding to each pixel point of the YUV image.
[0104] Following the above-described correlation analysis of the respective advantages of the first edge feature map and the second edge feature map, as Figure 4 The first edge feature map shown in (b), and Figure 4 In the second edge feature map shown in Figure (a), since the Gaussian weights in the spatial domain are considered in the edge detection process of the same YUV image using the first edge detection operator and the second edge detection operator, there are fewer noise features in the first edge feature map, and the edge texture features in the second edge feature map are more highly retained, making it clearer and more accurate to indicate the texture features of the structural position in the YUV image, and the brightness difference between the pixel at the structural position and the pixel at other positions is greater.
[0105] The present application can perform a difference operation on the edge texture feature value of the same pixel point in the second edge feature map and the first edge feature map, and determine the target edge texture feature value of the corresponding pixel point by the absolute value of the obtained difference, so as to form a target edge feature map for the image to be processed, such as Figure 4 As shown in Figure (c). It can be seen that relative to Figure 4 The second edge eigenvalue shown in (a) and the first edge eigenvalue shown in (b), Figure 4 The brightness difference between the edge position and the non-edge area of the target edge feature map shown in the middle (c) figure is greater, the edge information is clearer and more accurate, and it is more conducive to reliable and accurate execution of subsequent image processing tasks.
[0106] In summary, in the embodiment of the present application, in the process of edge detection of the same YUV image using the first edge detection operator and the second edge detection operator, that is, using a fixed-size detection window to scan the YUV image line by line, when edge detection is performed on each pixel point within each detection window position, a smaller-sized detection window will be used, and the edge area with a large pixel feature change in the detection window is determined by analyzing the pixel feature difference of different detection areas (i.e., local image blocks) within the detection window. Since the pixel feature difference analyzed by the second edge detection operator is the absolute value of the pixel feature deviation (i.e., the difference size, excluding the sign), the robustness of the edge texture feature detection is improved and is not affected by the direction of the pixel feature difference between adjacent detection areas. Even if there are differences in the edge feature values of different brightness areas in the YUV image, the edge texture features can be accurately identified and are not affected by brightness changes, especially in low illumination scenes, such as Figure 4 As shown in FIG. 1 , the accuracy and reliability of the obtained edge feature map are significantly improved. The absolute value of the difference between the first edge feature map with better noise resistance obtained by the first edge detection operator is used to further highlight the structural edge information in the target edge feature map.
[0107] Reference Figure 5 , is a flowchart of the image processing method proposed in the third embodiment of the present application. This embodiment can describe in detail an optional refinement implementation process of the first edge feature map and the second edge feature map in the image processing method proposed above. For other processing steps of the image processing method, please refer to the description of the corresponding part of the context embodiment, which will not be described in detail in this embodiment. Based on this, Figure 5 As shown, the process of acquiring the first edge feature map may include but is not limited to the following steps:
[0108] Step S51, in the process of performing line-by-line edge detection on the YUV image using the detection window, obtaining the pixel feature mean of each pixel point in the current detection window;
[0109] Step S52, obtaining the pixel feature deviation of each pixel point in the corresponding detection area according to the pixel feature mean value and the pixel feature value of each pixel point in the detection area;
[0110] In practical applications, a detection window of a fixed size scans the YUV image line by line. After determining the position of each detection window, the edge detection process of the YUV image within the detection window is similar and will not be repeated in this application.
[0111] Based on this, after determining the position of the detection window, the average value (i.e., pixel feature mean) of the pixel feature values (such as brightness value) of each pixel point in the detection window can be used as the basis for measuring the pixel feature deviation between the pixel points in the detection window and the surrounding pixel points. In this way, when a small-sized detection area is used to scan line by line in the detection window to obtain the pixel feature deviation between the central pixel point and the surrounding pixel points in each detection area position, the pixel feature value of each pixel point in the detection area and the pixel feature mean value in the detection window can be subtracted to obtain the pixel feature deviation of the corresponding pixel point to measure the pixel feature change in the detection area. If the pixel feature deviation in the detection area is large, it indicates that there may be an edge in the detection area. Different types of texture features can also be identified through different pixel feature deviations.
[0112] Step S53, obtaining a first characteristic difference degree of a central pixel of a corresponding detection area from the absolute value of the sum of the pixel characteristic deviations of each pixel in the same detection area, and obtaining a second characteristic difference degree of a central pixel of a corresponding detection area from the sum of the absolute values of the pixel characteristic deviations of each pixel in the same detection area;
[0113] Step S54, obtaining a first edge texture feature value of a central pixel of the detection window from the first feature difference degree corresponding to each pixel in the current detection window, and obtaining a second edge texture feature value of a central pixel of the detection window from the second feature difference degree corresponding to each pixel in the current detection window;
[0114] Step S55, obtaining a first edge feature map from the first edge texture feature value of each pixel point in the YUV image, and obtaining a second edge feature map from the second edge texture feature value of each pixel point in the YUV image.
[0115] According to the above description of the first edge detection operator and the second edge detection operator, the first edge detection operator can be a BVSD (Block Variance Sum of Difference) operator, and the second edge detection operator can be a BVSAD (Block Variance Sum of Absolute Difference) operator. In the case where the first size of the detection window is 7×7 and the second size of the detection area can be 3×3, refer to Figure 6 and Figure 7 The detection window (i.e., the entire pixel array) and the detection area (i.e., the dotted box in the figure) shown in the figure can refer to the first edge detection operator (BVSD) expressed by the following formula (1) to obtain the first edge feature map, and refer to the second edge detection operator (BVSAD) expressed by the following formula (2) to obtain the second edge feature map:
[0116] ; (1)
[0117] ; (2)
[0118] In the above formula, the center pixel of the detection window is taken as the origin of the coordinate system, and the following is constructed: Figure 6 and Figure 7 In the coordinate system shown, (x, y) represents the coordinate position of each pixel point, m x,y Represents the average value of the pixel feature values of each pixel in the detection window, that is, the pixel feature mean. x+i+m,y+j+n Represents the pixel feature value of each pixel in the detection window. In this embodiment, it refers to the Y component value in the YUV image, that is, the brightness value of the pixel. m and n constitute the boundary value of the pixel position range contained in the detection area. The center pixel of the detection area is taken as the origin, and one pixel is added to the right, left, top and bottom respectively to determine the size of the detection area (i.e. 3×3) and the pixel positions contained therein. Figure 6 and Figure 7 As shown in the figure, m and n represent the value range of the detection area, both of which are [-1,1]. Similarly, i and j constitute the boundary value of the pixel position range that can detect edge texture features contained in the detection window. The center pixel of the detection window is taken as the origin, and several pixels are added to the right, left, top and bottom respectively to determine the size of the pixel area that can detect edges in the detection window and the pixel positions included. Figure 6 and Figure 7As shown in the figure, a 7×7 detection window is used, and the outermost pixels cannot be detected. The remaining 5×5 pixel area can add 2 pixels to the right, left, top and bottom respectively starting from its central pixel, so the value range of i and j is [-2,2]); abs() means taking absolute value operation.
[0119] Based on this, It can be expressed as the sum of the calculation results obtained by the calculation method in () for each pixel in the detection area. Similarly, It means that the calculation results of each pixel point in the remaining 5×5 area except the outermost pixel point in the detection window are summed according to the calculation method in ().
[0120] The operation method of the first edge detection operator represented by formula (1) is as follows: Figure 6 In the schematic diagram of a detection window shown in the figure, the absolute value of the sum of the pixel feature deviations at each detection area position can be calculated first, and then summed to obtain the first edge texture feature value of the central pixel of the detection window. The absolute value of the sum of the pixel feature deviations at each detection area position can be used to measure the total intensity of the brightness change of the detection area, which is recorded as the first feature difference degree of the central pixel of the detection area, that is, the degree of pixel feature discreteness between the central pixel and other pixels in the detection area.
[0121] Similarly, according to the operation method of the second edge detection operator expressed in formula (2), refer to Figure 7 The schematic diagram of a detection window shown in the figure can first calculate the sum of the absolute values of the pixel feature deviations at each detection area position, and use it as the second feature difference degree of the central pixel of the detection area, that is, an absolute difference, to measure the intensity of the brightness change of each pixel in the detection area, and then sum the second feature difference degrees corresponding to each detection area to obtain the second edge texture feature value of the central pixel of the detection window, which more accurately measures the degree of discreteness of the pixel features of the central pixel in the detection window and the pixel in the detection window, so as to accurately determine whether the corresponding pixel is located at the edge position. Compared with directly calculating the absolute value of the sum of the pixel feature deviations of each pixel in the detection window to obtain the second edge texture feature value of the central pixel of the detection window, the edge feature map (such as Figure 8 The implementation method of (b) is as shown in FIG. Figure 8 The edge texture features of the second edge feature map obtained by the second edge detection operator of the present application shown in Figure (a) are clearer.
[0122] It can be seen that the present application proposes to implement two edge detection operators based on the edge detection method of local image blocks (detection areas), so that in the process of edge detection of YUV images, the brightness difference in different inspection areas in the same inspection window is taken into account, and the texture features of dark areas can be accurately and reliably detected by taking the absolute value and then summing it, that is, the implementation method of the second edge detection operator, so as to improve the accuracy and reliability of the edge feature map. In other words, under different lighting conditions, according to the edge detection method based on local image blocks (detection areas) proposed in the present application, noise features can be effectively suppressed, edge texture features can be accurately and reliably identified, and the edge information in the obtained target edge feature map can be ensured to be clear, and the reliable detection of edge texture features of pixel points at structural positions in the image can be reliably realized.
[0123] In some embodiments proposed in the present application, combined with the above description of the first edge detection operator and the second edge detection operator, the present application uses a detection window to perform row-by-row edge detection on a YUV image. A convolution method can be used to extract pixel features of each pixel in the detection window, and the edge information of the corresponding pixel, such as edge strength and edge direction, is calculated based on this to obtain a corresponding edge feature map.
[0124] Based on the image edge detection implementation process described in the above embodiments, the present application performs edge detection on the YUV image according to the first edge detection operator to obtain a first edge feature map, and performs edge detection on the YUV image according to the second edge detection operator to obtain a second edge feature map. After feature fusion is performed on these two edge feature maps to obtain a target feature map, it can be used to implement image processing tasks for the image to be processed. The image denoising task is used as an example for explanation below. For other types of image processing tasks, they can be executed after obtaining the denoised target image, or they can be directly based on the target edge feature map to perform target recognition or image segmentation and other processing on the image to be processed. The implementation process can be determined according to the working principle of the corresponding image processing task, and the present application will not give detailed examples one by one.
[0125] Reference Fig. 9 , is a flow chart of the image processing method proposed in the fourth embodiment of the present application, such as Fig. 9 As shown, the method may include but is not limited to the following steps:
[0126] Step S91, obtaining a YUV image of an image to be processed;
[0127] Step S92, performing edge detection on the YUV image according to the first edge detection operator to obtain a first edge feature map, and performing edge detection on the YUV image according to the second edge detection operator to obtain a second edge feature map;
[0128] Step S93, processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed;
[0129] Regarding the implementation process of step S91 to step S93, the image processing method described in the above embodiment may be used, and this embodiment will not elaborate on it.
[0130] Step S94, based on different target edge texture feature values of each pixel point in the target edge feature map, denoising is performed on the image to be processed according to different pre-matched denoising parameters to obtain a denoised target image.
[0131] Combined with the above description of the characteristics of the two edge detection operators and the advantages of the edge feature maps obtained by each, for the pixel points with larger target edge texture eigenvalues in the target edge feature map, they are usually the pixel points with more texture structures in the image. The edge texture features of the image in this area are more retained, and the noise features are relatively small. The pixel points with smaller target edge texture eigenvalues in the target edge feature map retain more noise features. Therefore, the embodiment of the present application proposes that for the pixel points corresponding to different target edge texture eigenvalues, different noise reduction parameters can be pre-configured. According to this, after the pixel points at the corresponding position in the processed image are denoised, the edge texture features of the pixel points with more texture structures can be retained. For the pixel points in the non-structural area, that is, the target edge feature map Pixels with more noise features can be denoised by denoising the pixels at the corresponding positions in the image to be processed, which can filter out more noise data without losing too much texture features. Compared with using the same denoising parameters to denoise each pixel of the image to be processed, the present application is based on the difference in target edge texture feature values of different pixels in the target edge feature map, and can adaptively select denoising parameters that match the target edge texture feature values of the pixels, so that pixels with different target edge texture feature values are configured with different denoising parameters, and denoise the pixels at the corresponding positions in the image to be processed, which greatly improves the denoising effect and ensures that the target image retains more edge texture features of the structural area to better meet the needs of subsequent other image processing tasks.
[0132] In some embodiments, the present application can process the corresponding pixel points in the image to be processed based on the different target edge texture feature values of each pixel point in the target edge feature map, using different first denoising operators with corresponding different denoising strengths to obtain the denoised target image. This embodiment does not limit the types of different first denoising operators with different denoising strengths, such as Gaussian filtering, mean filtering, median filtering, bilateral filtering, wavelet transform denoising or total variation regularization model (a denoising method based on image gradient, which maintains the sharpness of the image edge by minimizing the total variation of the image gradient while reducing noise), etc., which can be flexibly configured according to actual conditions. It can be understood that the greater the denoising intensity of the pixel points of the image to be processed, the more noise data is filtered, and the more texture features are lost. The denoising intensity corresponding to the pixel points with different target edge texture feature values can be flexibly selected according to actual conditions, and the present application does not limit this.
[0133] For each denoising operator listed above, different denoising intensities can be achieved by adjusting its parameters. Therefore, for step S94, the same denoising operator (which can be recorded as the second denoising operator) can also be used to implement it. In this case, based on the different target edge texture feature values of each pixel point in the target edge feature map, the same second denoising operator can be adjusted to different denoising intensities, and the corresponding pixel points in the processed image can be processed to obtain the denoised target image. The second denoising operator may include but is not limited to any of the denoising operators listed above. The present application can determine how to adjust the parameters of the second denoising operator to achieve different denoising intensities based on the denoising principle of the second denoising operator. The pixel point with a larger target edge texture feature value has a smaller corresponding denoising intensity. The present application does not limit the change relationship between the two and the value of the denoising intensity.
[0134] For example, the denoising operators of the filter types listed above can be configured with filtering thresholds corresponding to different denoising operators. For the pixel points corresponding to different target edge texture feature values in the target edge feature map, the second denoising operator can use the corresponding filtering threshold to filter the pixel points at the corresponding position in the processed image to obtain the target image, but it is not limited to this implementation method. Optionally, for the adjustment of different denoising intensities of the second denoising operator, that is, in the process of controlling the second denoising operator to denoise each pixel point of the processed image, the rules or corresponding relationships between the pixel points representing different target edge texture feature values and the different denoising intensities can be used to dynamically adjust the parameters of the second denoising operator so that it reaches the corresponding denoising intensity and completes the denoising processing of the pixel points with the target edge texture feature value, but it is not limited to the implementation method described in this embodiment.
[0135] In a possible implementation, in the implementation process of the above step S94, since in the target edge feature map, except for the edge position pixel points, the difference in the target edge texture feature values of adjacent pixel points in other areas is often relatively small, in order to improve the noise reduction efficiency, the image to be processed can be divided into regions according to the different target edge texture feature values of each pixel point in the target edge feature map, so that the adjacent pixel points with smaller differences in target edge texture feature values are determined as an image region, such as performing a difference operation on the target edge texture feature values of adjacent pixel points, and forming an image region with a difference change amount less than a threshold. After that, the same noise reduction parameter is used for each pixel point in the same image region to achieve noise reduction processing of the image region. It should be noted that the sizes of each image region determined by this method in the present application may be the same or different, depending on the situation. Different image regions use different noise reduction parameters, that is, different noise reduction intensities are used to achieve noise reduction processing of different image regions of the image to be processed. Among them, the noise reduction parameter can be the noise reduction strength. The noise reduction processing of different image areas can be achieved by using different noise reduction parameters of the same noise reduction operator, or by using different noise reduction operators with different noise reduction strengths. The implementation process is similar and will not be described in detail in this application.
[0136] In a possible implementation, the present application can predetermine the correspondence between different noise parameters and different edge texture feature values of pixel points through a large number of experiments or based on machine learning, that is, for pixel points with different edge texture feature values, what noise reduction parameters are used to reduce the noise of the pixel points to meet the noise reduction requirements. The present application does not limit the method of obtaining the correspondence and the method of expressing it. Afterwards, based on the correspondence, the appropriate noise reduction parameters for each pixel point can be obtained to achieve adaptive noise reduction processing of the image to be processed.
[0137] Based on this, refer to Fig.10 , is a flowchart of the image processing method proposed in Embodiment 5 of the present application. The noise reduction implementation process of the above step S94 may include:
[0138] Step S101, obtaining the corresponding relationship between different preset noise parameters and different edge texture feature values of pixel points;
[0139] Step S102, determining a target denoising parameter of a corresponding pixel in the image to be processed based on the corresponding relationship and different target edge texture feature values of each pixel in the target edge feature map;
[0140] Step S103: using a third denoising operator with target denoising parameters, perform denoising processing on corresponding pixels in the image to be processed to obtain a denoised target image.
[0141] In one possible implementation, Fig.11 The curve showing the noise reduction strength as the edge texture feature value (i.e., the brightness difference of the pixel points) changes, or Fig.12 The curves shown in FIG. 1 and 2 show how the gain changes with the change of the edge texture feature value (i.e., the brightness difference of the pixel points), but are not limited to these two curve relationships. The expression of these two corresponding relationships is also not limited to Fig.11 and Fig.12 The broken line curve shown may also be other types of curves that change adaptively. The noise reduction process is similar, and this application will not give detailed examples one by one.
[0142] Among them, Fig.11 and Fig.12 The corresponding relationship between the different noise parameters and the different edge texture eigenvalues of the pixel points can be expressed as follows: the first noise reduction parameters corresponding to the edge texture eigenvalues within the first edge texture feature range are the same; the second noise reduction parameters corresponding to the edge texture eigenvalues within the second edge texture feature range are linearly related to the change of the edge texture eigenvalue (such as Fig.11 and Fig.12 The third denoising parameter corresponding to each edge texture feature value within the third edge texture feature range is the same. The second edge texture feature range is larger than the first edge texture feature range and smaller than the third edge texture feature range. That is, Fig.11 and Fig.12 In the figure, the ranges divided by the dotted lines from left to right on the horizontal axis are represented as: the first edge texture feature range, the second edge texture feature range, and the third edge texture feature range. It should be noted that if the noise reduction parameter is the noise reduction intensity, the second noise reduction parameter is less than the first noise reduction parameter and greater than the third noise reduction parameter; if the noise reduction parameter is the gain, the second noise reduction parameter is greater than the first noise reduction parameter and less than the third noise reduction parameter.
[0143] Based on this, after determining the different target edge texture feature values of each pixel point in the target edge feature map, the corresponding relationship can be queried to determine the corresponding target noise reduction parameters to control the third noise reduction operator with the target noise reduction parameters to perform noise reduction on the pixel points at the corresponding position in the processed image. In this implementation process, as described above, the same third noise reduction operator or different third noise reduction operators with corresponding target noise reduction parameters can also be used for implementation, and this application does not limit this.
[0144] It can be seen that the present application proposes to perform denoising on the pixels at the corresponding positions in the image to be processed based on the different target edge texture feature values of each pixel point in the target edge feature map through adaptive denoising parameters. Compared with the direct use of denoising methods such as non-local mean filtering (NLM) or three-dimensional block matching (Block Matching and 3D collaborative filtering, BM3D), the present application greatly reduces the amount of calculation and reduces the image denoising processing time to be too long, thus avoiding the impact on subsequent services. And because the present application proposes to obtain the target edge feature value to retain the structural information in the image to be processed (i.e., the image area with a large target edge texture feature value), the distortion of the target image after denoising is avoided, and the denoising effect is improved.
[0145] An image processing method provided by an embodiment of the present application is introduced above, and a device for executing the above image processing method will be introduced below.
[0146] See also Fig.13 , is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. Fig.13 As shown, the image processing device may include:
[0147] An acquisition module 131 is used to acquire a YUV image of an image to be processed;
[0148] An edge detection module 132 is used to perform edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and to perform edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map;
[0149] A processing module 133 is used to process the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed, so as to perform an image processing task on the image to be processed;
[0150] Among them, the signal-to-noise ratio of the first edge feature map is greater than the signal-to-noise ratio of the second edge feature map, and the number of edge texture features of the YUV image contained in the first edge feature map is less than the number of edge texture features of the YUV image contained in the second edge feature map.
[0151] Optionally, the edge detection module 132 may include:
[0152] The edge detection unit is used to perform line-by-line edge detection on the YUV image using a detection window, comprising:
[0153] The edge texture feature obtaining unit is used to extract pixel features row by row in each detection window using the detection area, obtain the first edge texture feature of the central pixel of the corresponding detection window by the absolute value of the sum of the pixel feature deviations of each pixel point in each detection area, and obtain the second edge texture feature of the central pixel point of the corresponding detection window by the sum of the absolute values of the pixel feature deviations of each pixel point in each detection area;
[0154] an edge feature map obtaining unit, configured to obtain the first edge feature map from the first edge texture features of each pixel point in the YUV image, and to obtain the second edge feature map from the second edge texture features of each pixel point in the YUV image;
[0155] Wherein, the first size of the detection window is smaller than the second size of the detection area.
[0156] Optionally, the edge texture feature obtaining unit may include:
[0157] A pixel feature mean value acquisition subunit is used to acquire the pixel feature mean value of each pixel point in the current detection window;
[0158] A pixel feature deviation obtaining subunit is used to obtain a pixel feature deviation of each pixel point in the corresponding detection area according to the pixel feature mean value and the pixel feature value of each pixel point in the detection area;
[0159] The feature difference degree obtaining subunit is used to obtain the first feature difference degree of the central pixel of the corresponding detection area by the absolute value of the sum of the pixel feature deviations of each pixel in the same detection area, and to obtain the second feature difference degree of the central pixel of the corresponding detection area by the sum of the absolute values of the pixel feature deviations of each pixel in the same detection area;
[0160] The edge texture feature value obtaining subunit is used to obtain the first edge texture feature value of the central pixel point of the detection window according to the first feature difference degree corresponding to each pixel point in the current detection window, and to obtain the second edge texture feature value of the central pixel point of the detection window according to the second feature difference degree corresponding to each pixel point in the current detection window.
[0161] Optionally, the processing module 133 may include:
[0162] a target edge texture feature value obtaining unit, used for comparing the second edge feature map with the first edge feature map, and obtaining a target edge texture feature value of a corresponding pixel point from an absolute value of an edge texture feature difference of the same pixel point in the YUV image;
[0163] The target edge feature map obtaining unit is used to obtain the target edge feature map for the image to be processed based on the target edge texture feature value corresponding to each pixel point of the YUV image.
[0164] Based on the above analysis, the image processing module for performing the image processing task on the image to be processed may include:
[0165] The denoising unit is used to perform denoising on the image to be processed based on different target edge texture feature values of each pixel point in the target edge feature map according to different pre-matched denoising parameters to obtain a denoised target image.
[0166] Optionally, the noise reduction unit may include any of the following units:
[0167] A first denoising processing unit is configured to process corresponding pixel points in the image to be processed using different first denoising operators with corresponding different denoising strengths based on different target edge texture feature values of each pixel point in the target edge feature map to obtain a denoised target image;
[0168] A second denoising processing unit is used to adjust the same second denoising operator to different denoising strengths based on different target edge texture feature values of each pixel point in the target edge feature map, process the corresponding pixel points in the image to be processed, and obtain a denoised target image;
[0169] The pixel point with a larger target edge texture feature value has a smaller noise reduction intensity.
[0170] Optionally, the noise reduction unit may include:
[0171] A correspondence acquisition unit, used to acquire the correspondence between different preset noise parameters and different edge texture feature values of pixel points;
[0172] A target noise reduction parameter determination unit, configured to determine a target noise reduction parameter of a corresponding pixel point in the image to be processed based on the corresponding relationship and different target edge texture feature values of each pixel point in the target edge feature map;
[0173] The third denoising processing unit is used to perform denoising processing on corresponding pixel points in the image to be processed by using a third denoising operator having the target denoising parameters to obtain a denoised target image.
[0174] Among them, the correspondence between different noise parameters and different edge texture eigenvalues of pixel points may include: the first noise reduction parameter corresponding to each edge texture eigenvalue within the first edge texture feature range is the same; the second noise reduction parameter corresponding to each edge texture eigenvalue within the second edge texture feature range is linearly related to the change of the edge texture eigenvalue; the third noise reduction parameter corresponding to each edge texture eigenvalue within the third edge texture feature range is the same.
[0175] Among them, the second edge texture feature range is larger than the first edge texture feature range and smaller than the third edge texture feature range; if the noise reduction parameter is the noise reduction intensity, the second noise reduction parameter is smaller than the first noise reduction parameter and larger than the third noise reduction parameter; if the noise reduction parameter is the gain, the second noise reduction parameter is larger than the first noise reduction parameter and smaller than the third noise reduction parameter.
[0176] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any image processing method provided in the embodiment of the present application.
[0177] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any image processing method provided in the embodiment of the present application.
[0178] Reference Fig.14 , is a hardware structure diagram of an electronic device applicable to the image processing method proposed in this application, the electronic device may include but is not limited to mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptops, netbooks, robots or business terminals and other terminal devices, and may also be configured with a server to implement the image processing method proposed in this application. Fig.14 As shown, the electronic device may include but is not limited to: at least one communication element 141, at least one memory 142 and at least one processor 143, wherein:
[0179] At least one communication element 141, at least one memory 142 and at least one processor 143 can communicate with each other via a bus. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.14 Only one bidirectional line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0180] The communication element 141 can be used to receive the image to be processed, such as receiving the image to be processed sent by the image acquisition device, or reading the image to be processed from the database, etc. The present application does not limit the source of the image to be processed. It can also be used to realize data or instruction transmission between internal components of the electronic device.
[0181] Based on this, in the embodiment of the present application, the communication element 141 may include a communication element corresponding to wireless communication methods such as wifi, Bluetooth, 5G / 6G and other mobile communications, so that the electronic device can realize data transmission with other devices through the communication element, and may also include one or more interfaces supporting wired communication methods, such as general-purpose input / output (GPIO) interface, USB interface, universal asynchronous receiver / transmitter (UART) interface, etc., to realize data transmission between various components inside the electronic device. The present application does not limit the composition structure of the communication element 141 to realize this function and its corresponding communication transmission mechanism, which can be determined according to the circumstances.
[0182] The memory 142 can be used to store multiple computer instructions for implementing the image processing method proposed in the embodiment of the present application; the processor 143 can load and execute the multiple computer instructions stored in the memory 142 to implement the various steps of the image processing method proposed in the embodiment of the present application. The implementation process can refer to the description of the corresponding part of the method embodiment above.
[0183] In the embodiment of the present application, the memory 142 may include storage media such as a floppy disk, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk. The processor 141 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), a digital signal processor (DSP), an application specific integrated circuit (ASIC) or a field-programmable gate array (FPGA).
[0184] It should be understood that Fig.14 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiment of the present application. In practical applications, the electronic device may include Fig.14 More or fewer components as shown, or a combination of certain components, such as when the electronic device is a terminal device, may also include a microphone, a speaker, a display, various sensors, an antenna, a power module, a radio frequency component, an external port and other input / output components, etc., which can be determined according to the processing function requirements, and this application does not give detailed examples one by one.
[0185] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0186] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. In this specification, each embodiment is described in a progressive or parallel manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device, system, and electronic device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
Claims
1. An image processing method, the method comprising: Get the YUV image of the image to be processed; Performing edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and performing edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map; Processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed, so as to perform an image processing task on the image to be processed; Among them, the signal-to-noise ratio of the first edge feature map is greater than the signal-to-noise ratio of the second edge feature map, and the number of edge texture features of the YUV image contained in the first edge feature map is less than the number of edge texture features of the YUV image contained in the second edge feature map.
2. The method according to claim 1, wherein the step of performing edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and performing edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map, comprises: Performing line-by-line edge detection on the YUV image using a detection window includes: Utilizing the detection area to extract pixel features row by row in each detection window, obtaining a first edge texture feature value of a central pixel of the corresponding detection window from the absolute value of the sum of pixel feature deviations of each pixel point in each detection area, and obtaining a second edge texture feature value of a central pixel point of the corresponding detection window from the sum of the absolute values of the pixel feature deviations of each pixel point in each detection area; Obtaining the first edge feature map based on the first edge texture features of each pixel point in the YUV image, and obtaining the second edge feature map based on the second edge texture features of each pixel point in the YUV image; Wherein, the first size of the detection window is smaller than the second size of the detection area.
3. The method according to claim 2, wherein the first edge texture feature value of the central pixel of the corresponding detection window is obtained by the absolute value of the sum of the pixel feature deviations of each pixel point in each detection area, and the second edge texture feature value of the central pixel point of the corresponding detection window is obtained by the sum of the absolute values of the pixel feature deviations of each pixel point in each detection area, including: Obtaining the mean value of pixel features of each pixel point in the current detection window; Obtaining a pixel feature deviation of each pixel point in the corresponding detection area according to the pixel feature mean and the pixel feature value of each pixel point in the detection area; The first characteristic difference degree of the central pixel of the corresponding detection area is obtained by the absolute value of the sum of the pixel characteristic deviations of each pixel in the same detection area, and the second characteristic difference degree of the central pixel of the corresponding detection area is obtained by the sum of the absolute values of the pixel characteristic deviations of each pixel in the same detection area; The first edge texture feature value of the central pixel of the detection window is obtained by the degree of difference of the first feature corresponding to each pixel in the current detection window, and the second edge texture feature value of the central pixel of the detection window is obtained by the degree of difference of the second feature corresponding to each pixel in the current detection window.
4. The method according to claim 1, wherein the processing of the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed comprises: The second edge feature map is compared with the first edge feature map, and a target edge texture feature value of a corresponding pixel point is obtained from an absolute value of an edge texture feature difference of the same pixel point in the YUV image; A target edge feature map for the image to be processed is obtained based on the target edge texture feature value corresponding to each pixel point of the YUV image.
5. The method according to any one of claims 1 to 4, wherein performing an image processing task on the image to be processed comprises: Based on the different target edge texture feature values of each pixel point in the target edge feature map, the image to be processed is subjected to denoising processing according to different pre-matched denoising parameters to obtain a denoised target image.
6. The method according to claim 5, wherein the denoising process is performed on the image to be processed based on different target edge texture feature values of each pixel point in the target edge feature map according to different pre-matched denoising parameters to obtain a denoised target image, including any of the following: Based on different target edge texture feature values of each pixel point in the target edge feature map, using different first denoising operators with corresponding different denoising strengths, processing corresponding pixel points in the image to be processed to obtain a denoised target image; Based on different target edge texture feature values of each pixel in the target edge feature map, adjusting the same second denoising operator to different denoising strengths, processing corresponding pixel points in the image to be processed, and obtaining a denoised target image; in, The pixel point with a larger target edge texture feature value corresponds to a smaller noise reduction intensity.
7. The method according to claim 5, wherein the denoising process is performed on the image to be processed based on different target edge texture feature values of each pixel point in the target edge feature map according to different pre-matched denoising parameters to obtain a denoised target image, comprising: Obtaining the corresponding relationship between different preset noise parameters and different edge texture feature values of pixel points; Determine the target denoising parameters of the corresponding pixel points in the image to be processed based on the corresponding relationship and the different target edge texture feature values of each pixel point in the target edge feature map; A third denoising operator having the target denoising parameters is used to perform denoising processing on corresponding pixel points in the image to be processed to obtain a denoised target image.
8. According to the method of claim 7, the correspondence between the different noise parameters and the different edge texture feature values of the pixel points comprises: The first denoising parameters corresponding to the edge texture feature values within the first edge texture feature range are the same; The second noise reduction parameter corresponding to each edge texture feature value within the second edge texture feature range is linearly related to the change of the edge texture feature value; The third denoising parameters corresponding to the edge texture feature values within the third edge texture feature range are the same; Wherein, the second edge texture feature range is larger than the first edge texture feature range and smaller than the third edge texture feature range; If the noise reduction parameter is noise reduction intensity, the second noise reduction parameter is less than the first noise reduction parameter and greater than the third noise reduction parameter; If the noise reduction parameter is a gain, the second noise reduction parameter is greater than the first noise reduction parameter and less than the third noise reduction parameter.
9. An image processing device, comprising: An acquisition module, used for acquiring a YUV image of an image to be processed; An edge detection module, configured to perform edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and perform edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map; A processing module, used for processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed, so as to perform an image processing task on the image to be processed; Among them, the signal-to-noise ratio of the first edge feature map is greater than the signal-to-noise ratio of the second edge feature map, and the number of edge texture features of the YUV image contained in the first edge feature map is less than the number of edge texture features of the YUV image contained in the second edge feature map.
10. An electronic device, comprising: at least one communication element, at least one memory, and at least one processor, wherein: The communication element is used to receive the image to be processed; The memory is used to store a plurality of computer instructions; The processor is used to execute the multiple computer instructions to implement the following steps: Obtaining a YUV image of the image to be processed; Performing edge detection on the YUV image according to a first edge detection operator to obtain a first edge feature map, and performing edge detection on the YUV image according to a second edge detection operator to obtain a second edge feature map; Processing the first edge feature map and the second edge feature map to obtain a target edge feature map for the image to be processed, so as to perform an image processing task on the image to be processed; Among them, the signal-to-noise ratio of the first edge feature map is greater than the signal-to-noise ratio of the second edge feature map, and the number of edge texture features of the YUV image contained in the first edge feature map is less than the number of edge texture features of the YUV image contained in the second edge feature map.
Citation Information
Cited By
Image edge optimization processing method, device and equipment
CN120672789A