Image edge enhancement methods, image sensors, and computer-readable storage media

Adaptive edge enhancement is achieved by calculating edge strength and difference within a preset neighborhood of the image, which solves the problem of false edge enhancement in the prior art, improves image quality and saves SRAM resources.

CN119090791BActive Publication Date: 2026-11-10BYD SEMICON CO LTD
3 Cites 0 Cited by

Patent Information

Application Number
CN202310633338.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2026-11-10
Estimated Expiration
2043-05-31

Smart Images

  • Figure CN119090791B_ABST
    Figure CN119090791B_ABST
Patent Text Reader

Abstract

This invention discloses an image edge enhancement method, an image sensor, and a computer-readable storage medium. The image edge enhancement method includes: acquiring a target image; calculating the edge intensity of an edge in the target edge direction within a preset neighborhood around a center pixel of the target image; obtaining the edge difference of the edges in the target edge direction within the preset neighborhood; and performing edge enhancement on the pixel value of the center pixel based on the edge intensity and the edge difference of the corresponding edge direction. The image edge enhancement method and image sensor of this invention can adaptively adjust the edge enhancement intensity, avoiding false edge enhancement caused by using the same edge intensity, reducing noise, improving image quality, and saving SRAM resources by eliminating the need for additional color space conversion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image edge enhancement method, an image sensor, and a computer-readable storage medium. Background Technology

[0002] In existing technologies, most image edge enhancement methods use high-pass filter templates similar to the Laplacian operator. For example, when performing edge enhancement in the YUV domain, only the high-pass filter template is used for calculation, and the calculated high-frequency information is then superimposed on the original Y component information. As another example, when performing edge enhancement in the RAW domain, directly applying the high-pass filter template will enhance all pixels with the same intensity. However, using only the high-pass filter template for edge enhancement results in all pixels being enhanced with the same edge intensity, causing false edges to appear more obvious due to noise enhancement, thus reducing image quality. Summary of the Invention

[0003] This invention aims to at least solve one of the technical problems existing in the prior art. To this end, one object of this invention is to propose an image edge enhancement method that can adaptively adjust the intensity of edge enhancement based on weights, effectively reducing the influence of false edges caused by noise, improving image quality, and, moreover, this method does not require additional color space conversion, saving SRAM resources.

[0004] The second objective of this invention is to provide an image sensor.

[0005] A third objective of this invention is to provide a computer-readable storage medium.

[0006] To achieve the above objectives, an image edge enhancement method according to a first aspect of the present invention includes: acquiring a target image; calculating the edge intensity of an edge in a target edge direction within a preset neighborhood around a center pixel of the target image; obtaining an edge difference of the edge in the target edge direction; and performing edge enhancement on the pixel value of the center pixel based on the edge intensity and the edge difference of the edge in the corresponding edge direction.

[0007] According to the image edge enhancement method of the present invention, the edge difference value of the target image in the target edge direction within a preset neighborhood is obtained. The edge difference value is equivalent to the weight value of the edge intensity in the target edge direction. That is, the target image is enhanced according to the edge intensity and the corresponding edge difference value. This is equivalent to adaptive edge enhancement according to the weight value and edge intensity of each target edge direction. This can avoid false edge enhancement caused by using the same edge intensity, reduce noise, improve image quality, and save SRAM resources without additional color space conversion.

[0008] In some embodiments, obtaining the edge difference of the edge in the target edge direction includes: obtaining the pixel values ​​of the target pixel channels corresponding to all pixels in the preset neighborhood; and obtaining the edge difference of the edge in the target edge direction based on the pixel values ​​of the target pixel channels corresponding to all pixels in the preset neighborhood.

[0009] In some embodiments, obtaining the pixel values ​​of all pixels in the preset neighborhood corresponding to the target pixel channel includes: obtaining the pixel value of the center pixel corresponding to the target pixel channel; and obtaining the pixel values ​​of neighboring pixels in the preset neighborhood corresponding to the target pixel channel.

[0010] In some embodiments, obtaining the pixel value of the target pixel channel corresponding to the center pixel includes: if the center pixel is the target pixel corresponding to the target pixel channel, then the pixel value of the center pixel is used as the pixel value of the target pixel channel corresponding to the center pixel.

[0011] In some embodiments, obtaining the pixel value of the target pixel channel corresponding to a neighboring pixel within the preset neighborhood includes: if the neighboring pixel is a target pixel corresponding to the target pixel channel, then the pixel value of the neighboring pixel is used as the pixel value of the target pixel channel corresponding to the neighboring pixel; if the neighboring pixel is a pixel other than the target pixel, then the pixel value of the neighboring pixel is interpolated for the target pixel channel to obtain the pixel value of the target pixel channel corresponding to the neighboring pixel.

[0012] In some embodiments, interpolation calculation of the target pixel channel is performed on the pixel values ​​of the neighboring pixels to obtain the pixel values ​​of the neighboring pixels corresponding to the target pixel channel, including: determining the pixels of two adjacent target pixel channels of the neighboring pixels in the direction of the target edge; obtaining the pixel values ​​of the pixels of the two adjacent target pixel channels, and calculating the average of the pixel values ​​as the pixel value of the neighboring pixels corresponding to the target pixel channel.

[0013] In some embodiments, calculating the edge strength of the edge in the target edge direction within a preset neighborhood around the center pixel of the target image includes: obtaining a first edge strength of the target image in the horizontal edge direction within the preset neighborhood; obtaining a second edge strength of the target image in the vertical edge direction within the preset neighborhood; obtaining a third edge strength of the target image in the 45-degree angle edge direction within the preset neighborhood; and obtaining a fourth edge strength of the target image in the 135-degree angle edge direction within the preset neighborhood.

[0014] In some embodiments, obtaining a first edge intensity of the target image in the horizontal edge direction within the preset neighborhood includes: obtaining the upper pixel value of the pixel adjacent to the center pixel above the center pixel and obtaining the lower pixel value of the pixel adjacent to the center pixel below the center pixel within the preset neighborhood; calculating the difference between the upper pixel value and the lower pixel value and obtaining a first absolute value of the difference calculation as the first edge intensity.

[0015] In some embodiments, obtaining the second edge intensity of the target image in the vertical edge direction within the preset neighborhood includes: obtaining the left pixel value of the left-column adjacent pixel of the center pixel and the right pixel value of the right-column adjacent pixel of the center pixel within the preset neighborhood; calculating the difference between the left pixel value and the right pixel value and obtaining the second absolute value of the difference calculation as the second edge intensity.

[0016] In some embodiments, obtaining the third edge intensity of the target image in the 45-degree angle edge direction within the preset neighborhood includes: obtaining the upper right pixel value of the pixel point to the upper right of the center pixel point in the 45-degree angle direction, and obtaining the lower left pixel value of the pixel point to the lower left of the center pixel point in the 45-degree angle direction; calculating the difference between the upper right pixel value and the lower left pixel value and obtaining the third absolute value of the difference calculation, which is used as the third edge intensity.

[0017] In some embodiments, obtaining the fourth edge intensity of the target image in the 135-degree angle edge direction within the preset neighborhood includes: obtaining the upper-left pixel value of the pixel at the upper left of the center pixel in the 135-degree angle direction, and obtaining the lower-right pixel value of the pixel at the lower right of the center pixel in the 135-degree angle direction; calculating the difference between the upper-left pixel value and the lower-right pixel value and obtaining the fourth absolute value of the difference calculation, which is used as the fourth edge intensity.

[0018] In some embodiments, obtaining the pixel value of the target pixel channel corresponding to the center pixel includes: if the center pixel is a pixel other than the target pixel corresponding to the target pixel channel, determining the target edge direction where the center pixel is located; and performing interpolation calculation of the target pixel channel on the pixel value of the center pixel according to the target edge direction where the center pixel is located, so as to obtain the pixel value of the target pixel channel corresponding to the center pixel.

[0019] In some embodiments, determining the target edge direction of the center pixel includes: obtaining the minimum edge intensity of the first edge intensity and the second edge intensity, and obtaining the edge intensity difference between the first edge intensity and the second edge intensity; if the minimum edge intensity is less than an edge threshold and the absolute value of the edge intensity difference is greater than the edge threshold, then the center pixel is determined to be on a horizontal edge or a vertical edge.

[0020] In some embodiments, after determining that the center pixel is in the horizontal edge direction or the vertical edge direction, the image edge enhancement method further includes: if the first edge intensity is greater than the second edge intensity, then determining that the center pixel is in the horizontal edge; if the second edge intensity is greater than the first edge intensity, then determining that the center pixel is in the vertical edge.

[0021] In some embodiments, determining the target edge direction where the center pixel is located further includes: determining that the smallest edge intensity is greater than or equal to an edge threshold, or determining that the absolute value of the edge intensity difference is less than or equal to the edge threshold, then determining that the center pixel is in a flat region.

[0022] In some embodiments, interpolating the pixel value of the center pixel point according to the target edge direction where the center pixel point is located to obtain the pixel value of the center pixel point corresponding to the target pixel channel includes: if the center pixel point is located at the horizontal edge, obtaining the pixel values ​​of the two adjacent pixels of the center pixel point in the horizontal edge direction and obtaining a first average of the pixel values; obtaining a first double value of the pixel value of the center pixel point; calculating a first difference between the first double value and the pixel values ​​of the next two adjacent pixels of the center pixel point in the horizontal edge direction; and obtaining the pixel value of the center pixel point corresponding to the target pixel channel based on the first average and the first difference.

[0023] In some embodiments, interpolating the pixel value of the center pixel point according to the target edge direction where the center pixel is located to obtain the pixel value of the center pixel point corresponding to the target pixel channel includes: if the center pixel point is located on the vertical edge, obtaining a second average value of the pixel values ​​of the two adjacent pixels of the center pixel point in the vertical edge direction; obtaining a second double value of the pixel value of the center pixel point; calculating a second difference between the second double value and the pixel values ​​of the next two adjacent pixels of the center pixel point in the vertical edge direction; and obtaining the pixel value of the center pixel point corresponding to the target pixel channel based on the second average value and the second difference.

[0024] In some embodiments, interpolation calculation of the target pixel channel is performed on the pixel value of the center pixel according to the target edge direction where the center pixel is located to obtain the pixel value of the target pixel channel corresponding to the center pixel, including: if the center pixel is in the flat area, obtaining the first horizontal pixel value of two adjacent pixels of the center pixel in the horizontal edge direction, obtaining the first vertical pixel value of two adjacent pixels of the center pixel in the vertical edge direction; calculating the average value of the first horizontal pixel value and the first vertical pixel value as the pixel value of the target pixel channel corresponding to the center pixel.

[0025] In some embodiments, obtaining the pixel value of the target pixel channel corresponding to a neighboring pixel within the preset neighborhood includes: if the neighboring pixel is a target pixel corresponding to the target pixel channel, then the pixel value of the neighboring pixel is used as the pixel value of the target pixel channel corresponding to the neighboring pixel; if the neighboring pixel is a pixel other than the target pixel, then the pixel value of the neighboring pixel is interpolated for the target pixel channel to obtain the pixel value of the target pixel channel corresponding to the neighboring pixel.

[0026] In some embodiments, interpolation calculation of the target pixel channel is performed on the pixel value of the neighboring pixel to obtain the pixel value of the target pixel channel corresponding to the neighboring pixel, including: obtaining the second horizontal pixel value of two adjacent target pixel channels of the neighboring pixel in the horizontal edge direction; obtaining the second vertical pixel value of two adjacent target pixel channels of the neighboring pixel in the vertical edge direction; calculating the average value of the second horizontal pixel value and the second vertical pixel value as the pixel value of the target channel pixel corresponding to the neighboring pixel.

[0027] In some embodiments, obtaining the edge difference value of the edge in the target edge direction based on the pixel values ​​of all pixels in the preset neighborhood corresponding to the target pixel channel includes: obtaining a third double value of the pixel value of the center pixel corresponding to the target pixel channel; obtaining the adjacent pixel values ​​of the two adjacent pixels of the center pixel in the target edge direction corresponding to the target pixel channel; and calculating the difference between the third double value and the adjacent pixel values ​​as the edge difference value of the edge in the target edge direction.

[0028] In some embodiments, edge enhancement of the pixel value of the center pixel is performed based on the edge intensity and the edge difference of the corresponding edge direction, including: obtaining the product of the edge intensity and the corresponding edge difference of the target image in each target edge direction within the preset neighborhood; obtaining a first summation of the corresponding product values ​​in all target edge directions; obtaining a second summation of the edge intensity in all target edge directions; performing a division operation based on the first summation and the second summation to obtain an edge enhancement value; and superimposing the edge enhancement value with the interpolated pixel value of the center pixel.

[0029] In some embodiments, obtaining a target image includes: traversing the original image using a preset pixel array as a template to obtain a plurality of target images.

[0030] To achieve the above objectives, an image sensor according to a second aspect of the present invention includes: a pixel array and a filter array, wherein the filter array is configured correspondingly to the pixel array; and a control unit connected to the pixel array, configured to perform edge enhancement processing on the output image of the pixel array according to the image edge enhancement method described in the above embodiment.

[0031] According to the image sensor of the present invention, by employing the image edge enhancement method of the above embodiment, the target image can be edge enhanced according to the edge difference and edge intensity of each target edge direction. The edge difference can be used as a weight value of the edge intensity in the target edge direction to achieve adaptive adjustment of the edge enhancement intensity, avoid false edge enhancement caused by using the same edge intensity, reduce noise, improve image quality, and save SRAM resources without the need for additional color space conversion.

[0032] To achieve the above objectives, a computer-readable storage medium according to a third aspect of the present invention stores a computer program thereon, which, when executed, implements the image edge enhancement method described in the above embodiments.

[0033] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0034] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a flowchart of an image edge enhancement method according to an embodiment of the present invention; Figure 2This is a schematic diagram of a Bayer array image according to an embodiment of the present invention; Figure 3 This is a schematic diagram of a central pixel being a G-channel pixel and its horizontally adjacent channel pixels being B-channel pixels, according to an embodiment of the present invention. Figure 4 This is a schematic diagram of a central pixel being a G-channel pixel and its horizontally adjacent channel pixels being R-channel pixels, according to an embodiment of the present invention. Figure 5 This is a schematic diagram of a B-channel pixel as the center pixel according to an embodiment of the present invention; Figure 6 This is a schematic diagram of a pixel with the R channel as the center pixel according to an embodiment of the present invention; Figure 7 This is a flowchart of an image edge enhancement method according to an embodiment of the present invention; Figure 8 This is a block diagram of an image sensor according to an embodiment of the present invention.

[0035] Figure label: Image sensor 100; Pixel array 1; Filter array 2; Control unit 3; Detailed Implementation The embodiments of the present invention are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. The embodiments of the present invention are described in detail below.

[0036] The following is for reference. Figures 1-7 An image edge enhancement method according to an embodiment of the present invention is described.

[0037] Figure 1 This is a flowchart of an image edge enhancement method according to an embodiment of the present invention, such as... Figure 1 As shown, the image edge enhancement method of this embodiment includes at least the following steps S1-S4.

[0038] S1, acquire the target image.

[0039] The target image refers to the original image to be subjected to edge enhancement processing. The target image can be acquired from digital image acquisition devices (such as cameras, scanners, etc.) or selected from an existing image library. The target image can be a grayscale image or a color image.

[0040] In some embodiments, the target image is obtained by segmenting the entire original image into a preset pixel array. Specifically, the original image can be divided according to a set step size and region size to obtain multiple small regions of the same size, each of which is a target image. All target images can be obtained by traversing the entire original image using a sliding window. In embodiments of the present invention, the target image can be a 5x5 pixel array image, and the preset pixel array can be a 3x3 pixel matrix.

[0041] S2, calculate the edge strength of the edge in the direction of the target edge within a preset neighborhood around the center pixel of the target image.

[0042] Edge strength refers to the intensity of grayscale changes between adjacent pixels in an image, used to represent features such as edges or textures in the image. In edge enhancement processing, the calculation of edge strength can be determined according to the specific algorithm implementation, such as the Laplacian operator, Sobel operator, Canny operator, difference algorithm, or filtering algorithm.

[0043] In some embodiments of the present invention, a differential algorithm can be used to calculate edge strength, which determines edge strength by calculating the gradient values ​​around a pixel.

[0044] Specifically, the target edge direction is determined based on the position of the center pixel of the target image and a preset neighborhood size centered on the center pixel, and then the edge intensity in this direction is calculated. In some embodiments, the target edge direction may include, but is not limited to, a horizontal edge direction, a vertical edge direction, a 45-degree angle edge direction, and a 135-degree angle edge direction. For example, the edge intensity around the center pixel of the target image is calculated. 3. Edge strength in the horizontal, vertical, 45-degree, and 135-degree angle directions within the neighborhood.

[0045] S3, obtain the edge difference of the edge in the target edge direction within the preset neighborhood.

[0046] S4, perform edge enhancement on the pixel value of the center pixel based on the edge strength and the edge difference of the corresponding edge direction.

[0047] According to the image edge enhancement method of the present invention, the edge difference value of the target image in the target edge direction within a preset neighborhood is obtained. The edge difference value is equivalent to the weight value of the edge intensity in the target edge direction. That is, the target image is enhanced according to the edge intensity and the corresponding edge difference value. This is equivalent to adaptive edge enhancement according to the weight value and edge intensity of each target edge direction. This can avoid false edge enhancement caused by using the same edge intensity, reduce noise, improve image quality, and save SRAM resources without additional color space conversion.

[0048] Furthermore, when obtaining the edge difference, the pixel values ​​of all pixels in the preset neighborhood corresponding to the target pixel channel are obtained. The edge difference of the target image in the target edge direction within the preset neighborhood is obtained based on the pixel values ​​of all pixels in the preset neighborhood corresponding to the target channel pixels.

[0049] Specifically, in some embodiments, any channel from the R / G / B channels of a color image can be selected as the target channel, where B represents the blue component, G represents the green component, and R represents the red component. In a Bayer array image, the number of G channels is twice the number of R or B channels, containing richer information; moreover, compared to R and B channels, G channels have a higher signal-to-noise ratio. Therefore, in some embodiments of the present invention, edge enhancement processing can be performed on the image based on the G channels, using a Bayer array image as an example.

[0050] Then, the pixel values ​​of all pixels within a preset neighborhood of the center pixel of the target image on that channel are obtained for subsequent calculations and processing. During this process, pixel loss may occur, such as at the edges of the neighborhood or in pixel gaps, making it impossible to directly obtain the pixel value of the target channel. In such cases, interpolation algorithms can be used to calculate the values ​​of missing pixels. Depending on the specific application scenario and requirements, different interpolation algorithms are selected to calculate the values ​​of missing pixels to achieve better results.

[0051] Specifically, when performing edge enhancement processing, the target edge direction needs to be determined first, such as a horizontal edge direction, a vertical edge direction, a 45-degree angle edge direction, or a 135-degree angle edge direction. Then, all pixels adjacent to the target edge direction are selected within a preset neighborhood, and their pixel values ​​in the target channel are obtained to calculate the edge difference of the target image in the target edge direction within the preset neighborhood. The edge difference can be obtained by methods such as difference calculation or gradient calculation.

[0052] Furthermore, edge enhancement is performed on the pixel value of the center pixel of the target image based on the edge strength and corresponding edge difference in the target edge direction within the preset neighborhood.

[0053] In some embodiments, edge enhancement can be achieved by increasing or decreasing the brightness value, or by adjusting the color value. The specific enhancement method can be selected according to specific needs. Edge enhancement of the target image is performed using the edge intensity and corresponding edge difference values ​​obtained in the preset neighborhood of the target edge direction through the above steps. The edge difference value of each target edge direction is relative to the intensity weight of the corresponding edge direction; that is, edge enhancement is performed based on the weight value and edge intensity of each edge. This makes the edges in the image more obvious and clear, makes the target in the image more prominent, reduces the significant enhancement of false edges caused by noise, and improves image quality.

[0054] By enhancing the edges in an image, the human eye can more quickly identify and understand the content within it, which also benefits subsequent image processing and analysis. Edge enhancement is widely used in image processing, computer vision, robot vision, medical image processing, remote sensing image processing, and other fields.

[0055] In some embodiments, the image edge enhancement method proposed in this invention can be applied to image data of various formats, including Bayer array images. A Bayer array is a common color filter array that acquires color information by arranging filters of different colors at different positions.

[0056] Figure 2 This is a schematic diagram of a Bayer array image according to an embodiment of the present invention, such as... Figure 2 As shown, the data representation of a Bayer image is arranged by BG / GR channel pixels, with each channel pixel displaying only one of the three primary color components: B for blue, G for green, and R for red. The number of G channel pixels is twice that of either the R or B channels, and compared to R and B channels, G channel pixels have a higher signal-to-noise ratio and contain richer information. Therefore, this invention uses G channel pixels as the target channel pixels for image edge enhancement processing.

[0057] Specifically, edge enhancement processing is achieved by acquiring the pixel values ​​of all G-channel pixels within a preset neighborhood. These pixel values ​​include the pixel value of the G-channel pixel corresponding to the center pixel of the target image, as well as the pixel values ​​of the G-channel pixels corresponding to the neighboring pixels (excluding the center pixel) within the preset neighborhood surrounding the center pixel of the target image.

[0058] The pixel value of the G-channel pixel corresponding to the center pixel of the target image can be explained in two cases: one where the center pixel of the target image is a G-channel pixel, and the other where the center pixel of the target image is a pixel other than the G-channel pixel. Similarly, the pixel values ​​of the G-channel pixels corresponding to the neighboring pixels within the preset neighborhood of the center pixel of the target image can also be explained in two cases: one where the neighboring pixels are G-channel pixels, and the other where the neighboring pixels are pixels other than the target channel pixel.

[0059] In this embodiment, if the center pixel of the target image is a target pixel of the target pixel channel, such as a G channel pixel, then the pixel value of the center pixel is used as the pixel value of the corresponding G channel pixel. Similarly, if a neighboring pixel is a G channel pixel, then the pixel value of the neighboring pixel is used as the pixel value of the corresponding G channel pixel.

[0060] In an embodiment, if a neighboring pixel is a pixel other than a target pixel of a target pixel channel, such as a G-channel pixel, then the pixel value of the neighboring pixel is interpolated using the target pixel channel to obtain the pixel value of the target pixel channel corresponding to the neighboring pixel. Specifically, this may include: determining the pixels of two adjacent target pixel channels of the neighboring pixel in the target edge direction; obtaining the pixel values ​​of the two adjacent target pixel channels; and calculating the average of the pixel values ​​as the pixel value of the target pixel channel corresponding to the neighboring pixel. For example, the average of the pixel values ​​of two adjacent G-channel pixels in the target edge direction of the neighboring pixel is obtained as the pixel value of the G-channel corresponding to the neighboring pixel.

[0061] In an embodiment, within a preset neighborhood around the center pixel of the target image, the edge strength of the edge in the target edge direction is calculated, including: obtaining a first edge strength of the target image in the horizontal edge direction within the preset neighborhood; obtaining a second edge strength of the target image in the vertical edge direction within the preset neighborhood; obtaining a third edge strength of the target image in the 45-degree angle edge direction within the preset neighborhood; and obtaining a fourth edge strength of the target image in the 135-degree angle edge direction within the preset neighborhood.

[0062] Specifically, obtaining the first edge intensity of the target image in the horizontal edge direction within a preset neighborhood includes: obtaining the upper pixel value of the pixel adjacent to the center pixel above the center pixel and obtaining the lower pixel value of the pixel adjacent to the center pixel below the center pixel within the preset neighborhood; calculating the difference between the upper pixel value and the lower pixel value and obtaining the first absolute value of the difference calculation as the first edge intensity.

[0063] In an embodiment, obtaining the second edge intensity of the target image in the vertical edge direction within a preset neighborhood includes: obtaining the left pixel value of the left-column adjacent pixels of the center pixel within the preset neighborhood, and obtaining the right pixel value of the right-column adjacent pixels of the center pixel; calculating the difference between the left pixel value and the right pixel value and obtaining the second absolute value of the difference calculation as the second edge intensity.

[0064] In some embodiments, obtaining the third edge intensity of the target image in the 45-degree angle edge direction within a preset neighborhood includes: obtaining the upper right pixel value of the pixel with the center pixel in the upper right direction at a 45-degree angle, and obtaining the lower left pixel value of the pixel with the center pixel in the lower left direction at a 45-degree angle; calculating the difference between the upper right pixel value and the lower left pixel value and obtaining the third absolute value of the difference calculation as the third edge intensity.

[0065] In some embodiments, obtaining the fourth edge intensity of the target image in the 135-degree angle edge direction within a preset neighborhood includes: obtaining the upper left pixel value of the pixel with the center pixel in the upper left direction in the 135-degree angle direction, and obtaining the lower right pixel value of the pixel with the center pixel in the lower right direction in the 135-degree angle direction; calculating the difference between the upper left pixel value and the lower right pixel value and obtaining the fourth absolute value of the difference calculation, which is used as the fourth edge intensity.

[0066] like Figure 3 As shown, the center pixel of the 5x5 matrix is ​​G33, and its 3x3 neighborhood contains pixels G22, R23, G24, B32, G33, B34, G42, R43, and G44. When calculating edge strength within the 3x3 neighborhood, edge strength is calculated in the horizontal, vertical, 45-degree angle, and 135-degree angle directions, denoted by H, V, X, and Y respectively. Here, H represents the edge strength in the horizontal direction, V represents the edge strength in the vertical direction, X represents the edge strength in the 45-degree angle direction, and Y represents the edge strength in the 135-degree angle direction. The specific calculation formula is as follows: H=|(G22+2 R23+G24)-(G42+2 R43+G44)| V=|(G22+2 B32+G42)-(G24+2 B34+G44)| X=|(R²³+2) G24+B34)-(R43+2 G42+B32)| Y=|(R²³+2) G22+B32)-(R43+2 G44+B34)| The formula for calculating the edge intensity H in the horizontal direction is to sum the weighted pixel values ​​of G22, R23, G24 and G42, G43, B24 within a 3x3 neighborhood and take the absolute value. The formula for calculating the edge intensity V in the vertical direction is to sum the weighted pixel values ​​of G22, B32, G42 and G24, B34, G44 within a 3x3 neighborhood and take the absolute value. The formula for calculating the edge intensity X in the 45-degree angle direction is to sum the weighted pixel values ​​of R23, G24, B34 and R43, G42, B32 within a 3x3 neighborhood and take the absolute value. The formula for calculating the edge intensity Y in the 135-degree angle direction is to sum the weighted pixel values ​​of R23, G22, B32 and R43, G44, B34 within a 3x3 neighborhood and take the absolute value. The calculated edge strength values ​​can be used to adaptively adjust the edge enhancement parameters to achieve more accurate edge enhancement results.

[0067] like Figure 3 and Figure 4 As shown, Figure 3 and Figure 4 These are schematic diagrams showing a central pixel that is a G-channel pixel and its horizontally adjacent pixel is a B-channel pixel, and a central pixel that is a G-channel pixel and its horizontally adjacent pixel is an R-channel pixel.

[0068] Specifically, with Figure 3 For example, in a 3x3 neighborhood centered on pixel G33, four edge-direction G-channel pixels are needed to provide edge information. Specifically, the G-channel pixels at the 45-degree angle are G22 and G44; at the 135-degree angle are G24 and G42; and the pixels at the horizontal edge are B32 and B34. Since these two pixels are located in the B-channel position, their corresponding G-channel pixels are missing. To obtain the G-channel pixel values ​​for these pixels, interpolation can be performed using two neighboring G-channel pixels. Specifically, the value of G32 is calculated by averaging the values ​​of its left-side neighboring pixel G31 and the center pixel G33, and the value of G34 is calculated by averaging the values ​​of its right-side neighboring pixel G35 and the center pixel G33. This can be expressed by the formulas G32 = (G31 + G33) / 2 and G34 = (G33 + G35) / 2.

[0069] Similarly, the pixels along the vertical edge are R23 and R43. Because these two pixels are located in the R channel, they lack corresponding G channel pixels. To obtain the G channel pixel values ​​for these pixels, interpolation can be performed using two neighboring G channel pixels. Specifically, the value of G23 is calculated by averaging the values ​​of its upper neighboring pixel G13 and the center pixel G33, and the value of G43 is calculated by averaging the values ​​of its lower neighboring pixel G53 and the center pixel G33. This can be expressed by the formulas G23 = (G13 + G33) / 2 and G43 = (G33 + G53) / 2.

[0070] Furthermore, after calculating the pixel information of all G channels in the 3x3 neighborhood around the center pixel, the edge difference of the target edge direction in the preset neighborhood around the center pixel of the target image can be calculated.

[0071] Specifically, obtain twice the pixel value of the target pixel channel corresponding to the center pixel point, for example, as a third double value; obtain the pixel values ​​of the adjacent pixels of the target pixel channel corresponding to the two adjacent pixels of the center pixel point in the target edge direction; calculate the difference between the third double value and the adjacent pixel values, as the edge difference value of the edge in the target edge direction.

[0072] In one embodiment, edge enhancement of the pixel value of the center pixel is performed based on the edge intensity and the edge difference of the corresponding edge direction, including: obtaining the product of the edge intensity and the corresponding edge difference of the target image in each target edge direction within the preset neighborhood; obtaining a first summation of the corresponding product values ​​in all target edge directions; obtaining a second summation of the edge intensity in all target edge directions; performing a division operation based on the first summation and the second summation to obtain an edge enhancement value; and superimposing the edge enhancement value with the interpolated pixel value of the center pixel.

[0073] For example, taking a 3x3 neighborhood as an example, such as Figure 3 As shown in Figure 4, after calculating the pixel information of all G-channels in the 3x3 neighborhood around the center pixel, the edge difference in each direction is calculated, as shown in the following formula: DifH=2 G33-G32-G34 DifV=2 G33-G23-G43 DifX=2 G33-G22-G44 DifY=2 G33-G24-G42 Where DifH, DifV, DifX, and DifY represent the edge differences in the horizontal, vertical, 45-degree angle, and 135-degree angle directions, respectively. Calculate Dif = (DifH... H+DifV V+DifX X+DifY The final edge enhancement value is obtained by calculating (Y) / (H+V+X+Y). The calculated edge enhancement value Dif is then superimposed with the corresponding interpolated pixel. Let the interpolated pixel be R1, G1, and B1. Then, R=R1+Dif, G=G1+Dif, and B=B1+Dif, resulting in the edge enhancement values ​​R, G, and B, thus completing the edge enhancement of the 5x5 matrix.

[0074] In other embodiments, if the center pixel of the target image is a pixel other than the target pixel corresponding to the G channel, the target edge direction of the center pixel needs to be determined first. Then, the pixel value of the center pixel is interpolated according to the target edge direction of the center pixel to obtain the pixel value of the target pixel channel corresponding to the center pixel.

[0075] Specifically, the first edge intensity of the target image in the horizontal edge direction within the preset neighborhood is obtained; the second edge intensity of the target image in the vertical edge direction within the preset neighborhood is obtained. The minimum edge intensity between the first and second edge intensities is obtained, and the edge intensity difference between the first and second edge intensities is obtained. If the minimum edge intensity is less than an edge threshold and the absolute value of the edge intensity difference is greater than the edge threshold, then the center pixel is determined to be located on either a horizontal or vertical edge.

[0076] Furthermore, after determining whether the center pixel is in the horizontal or vertical edge direction, the image edge enhancement method further includes: if the first edge intensity is greater than the second edge intensity, then the center pixel is determined to be in the horizontal edge; if the second edge intensity is greater than the first edge intensity, then the center pixel is determined to be in the vertical edge.

[0077] Furthermore, determining the target edge direction where the center pixel is located also includes: determining that the smallest edge intensity is greater than or equal to the edge threshold, or determining that the absolute value of the edge intensity difference is less than or equal to the edge threshold, in which case the center pixel is determined to be in a flat region.

[0078] For example, such as Figure 5 and Figure 6 As shown, Figure 5 and Figure 6 These are schematic diagrams centered on the B channel pixel and the R channel pixel, respectively.

[0079] Specifically, with Figure 5 For example, the center pixel of the target image is B33, and its 3x3 neighborhood contains pixels R22, G23, R24, G32, B33, G34, R42, G43, and R44. When calculating edge intensity within this 3x3 neighborhood, the edge intensity is calculated in the horizontal, vertical, 45-degree angle, and 135-degree angle directions, denoted by H, V, X, and Y respectively. The specific calculation formulas are as follows: H=|(R22+2 G23+R24)-(R42+2 G43+R44)| V=|(R²²+2) G32+R42)-(R24+2 G34+R44)| X=|(G23+2 R24+G34)-(G43+2 R42+G32)| Y=|(G23+2 R22+G32)-(G43+2 R44+G34)| Where H represents the edge intensity in the horizontal direction, V represents the edge intensity in the vertical direction, X represents the edge intensity in the 45-degree angle direction, and Y represents the edge intensity in the 135-degree angle direction. In a 3x3 neighborhood matrix centered at pixel B33, the G-channel pixels of the center pixel and the G-channel pixels in the four directions are needed to provide edge information in the same channel.

[0080] In this embodiment, the interpolation operation of the G-pixel channel is performed on the pixel value of the center pixel. First, it is necessary to determine the edge direction of the center pixel B33. An edge threshold TH can be used to determine whether the center pixel is on an edge. If the minimum value of the first edge intensity in the horizontal edge direction and the second edge intensity in the vertical edge direction within a preset neighborhood around the center pixel is less than the edge threshold TH, and the absolute value of the difference between the first and second edge intensities is greater than the edge threshold TH, i.e., min(H,V)...<TH&&|H-V|> TH determines whether the center pixel is located at a horizontal or vertical edge.

[0081] After determining whether the center pixel B33 is on a horizontal or vertical edge, its edge direction needs to be determined based on the edge strength in either direction. If the first edge strength H in the horizontal direction is greater than the second edge strength V in the vertical direction (H>V), then the center pixel B33 is considered to be on a horizontal edge. If the second edge strength V in the vertical direction is greater than the first edge strength H in the horizontal direction (V>H), then the center pixel B33 is considered to be on a vertical edge.

[0082] Furthermore, if the minimum value of the first edge intensity in the horizontal edge direction and the second edge intensity in the vertical edge direction within the preset neighborhood around the center pixel B33 is greater than or equal to the edge threshold TH, or if the absolute value of the difference between the first edge intensity and the second edge intensity is less than the edge threshold TH, i.e., min(H,V)>TH|||HV| TH indicates that the center pixel is located in a flat region.

[0083] In this embodiment, different interpolation methods can be used to calculate the G-channel pixel value of the center pixel for different edge directions. If the center pixel is located on the horizontal edge, the pixel values ​​of the two pixels adjacent to the center pixel in the horizontal edge direction are obtained, and a first average of these pixel values ​​is obtained; twice the pixel value of the center pixel is obtained as a first double value; a first difference is calculated between the first double value and the pixel values ​​of the next two pixels adjacent to the center pixel in the horizontal edge direction; the pixel value of the target pixel channel corresponding to the center pixel is obtained based on the first average and the first difference. Figure 5 For example, the specific calculation formula is as follows: G33=(G32+G34) / 2+(2B33-B31-B35) / 4 In an embodiment, if the center pixel is located at the vertical edge, a second average value of the pixel values ​​of the two pixels adjacent to the center pixel in the direction of the vertical edge is obtained; twice the pixel value of the center pixel is obtained as a second double value; a second difference is calculated between the second double value and the pixel values ​​of the two pixels next to the center pixel in the direction of the vertical edge; and the pixel value of the center pixel corresponding to the target pixel channel is obtained based on the second average value and the second difference. Figure 5 For example, the specific calculation formula is as follows: G33=(G23+G43) / 2+(2B33-B13-B53) / 4 In an embodiment, if the center pixel is located in the flat region, the first horizontal pixel value of the two adjacent pixels of the center pixel in the horizontal edge direction is obtained, and the first vertical pixel value of the two adjacent pixels of the center pixel in the vertical edge direction is obtained; the average of the first horizontal pixel value and the first vertical pixel value is calculated as the pixel value of the center pixel corresponding to the target pixel channel. Figure 5 For example, the specific calculation formula is as follows: G33 = (G23 + G32 + G34 + G43) / 4 In some embodiments, obtaining the pixel value of the target pixel channel corresponding to a neighboring pixel within a preset neighborhood includes: if the neighboring pixel is the target pixel corresponding to the target pixel channel, then the pixel value of the neighboring pixel is used as the pixel value of the target pixel channel corresponding to the neighboring pixel; if the neighboring pixel is a pixel other than the target pixel, then the pixel value of the neighboring pixel is interpolated for the target pixel channel to obtain the pixel value of the target pixel channel corresponding to the neighboring pixel.

[0084] Further, interpolation calculations are performed on the pixel values ​​of the neighboring pixels to obtain the pixel values ​​of the target pixel channels corresponding to the neighboring pixels. This includes: obtaining the second horizontal pixel values ​​of two adjacent target pixel channels in the horizontal edge direction and obtaining the second vertical pixel values ​​of two adjacent target pixel channels in the vertical edge direction; calculating the average of the second horizontal pixel values ​​and the second vertical pixel values ​​as the pixel values ​​of the target channel pixels corresponding to the neighboring pixels.

[0085] Specifically, in order to calculate the pixel value of the G channel pixel corresponding to the neighboring pixel, it is necessary to first calculate the average of the pixel values ​​of the two adjacent G channel pixels in the horizontal edge direction and the pixel values ​​of the two adjacent G channel pixels in the vertical edge direction of the neighboring pixel, and then use it as the pixel value of the G channel pixel corresponding to the neighboring pixel.

[0086] For example, such as Figure 5 As shown, in the 3x3 neighborhood centered at pixel B33, the pixels along the horizontal edge are G32 and G34, the pixels along the vertical edge are G23 and G43, and the pixels along the 45-degree angle edge are R22 and R44. Since there are no G-channel pixels, the G-channel pixel values ​​at R22 and R44 can be obtained by averaging the neighboring G-channel pixels around R22 and R44. The specific calculation formula is as follows: G22=(G12+G23+G21+G32) / 4 G44 = (G34 + G45 + G43 + G54) / 4 The pixels at the 135-degree edge are R24 and R42, which lack G channel pixels. The G channel pixel values ​​at R24 and R42 can be obtained by averaging the neighboring G channel pixels around R24 and R42. The specific calculation formula is as follows: G24 = (G14 + G23 + G25 + G34) / 4 G42 = (G32 + G41 + G43 + G52) / 4 In this embodiment, after calculating the pixel information of all G-channels in the 3x3 neighborhood surrounding the center pixel, the edge difference of the target image in the target edge direction within the 3x3 neighborhood can be calculated. The edge difference of the target edge direction is obtained based on the pixel values ​​of all pixels in the preset neighborhood corresponding to the target pixel channel, including: obtaining twice the pixel value of the target pixel channel corresponding to the center pixel as a third double value; obtaining the pixel values ​​of the adjacent pixels of the target pixel channel corresponding to the two adjacent pixels of the center pixel in the target edge direction; and calculating the difference between the third double value and the adjacent pixel values ​​as the edge difference of the target edge direction.

[0087] Specifically, the edge difference of the center pixel in the horizontal direction is defined as DifH; the edge difference of the center pixel in the vertical direction is defined as DifV; the edge difference of the center pixel in the 45-degree angle direction is defined as DifX; and the edge difference of the center pixel in the 135-degree angle direction is defined as DifY. Figure 3 For example, the calculations of DifH, DifV, DifX, and DifY are as follows: DifH=2 G33-G32-G34 DifV=2 G33-G23-G43 DifX=2 G33-G22-G44 DifY=2 G33-G24-G42 Further, in an embodiment, edge enhancement of the pixel value of the center pixel based on the edge intensity and the edge difference of the corresponding edge direction includes: obtaining the product of the edge intensity and the corresponding edge difference of the target image in each target edge direction within the preset neighborhood; obtaining a first summation of the corresponding product values ​​in all target edge directions; obtaining a second summation of the edge intensity in all target edge directions; performing a division operation based on the first summation and the second summation to obtain an edge enhancement value; and superimposing the edge enhancement value with the interpolated pixel value of the center pixel to achieve edge enhancement of the pixel value of the center pixel.

[0088] Specifically, after calculating the edge intensity and edge difference of the target image in the target edge direction within a preset neighborhood around the center pixel of the target image, the edge differences DifH, DifV, DifX, and DifY are multiplied by the corresponding edge intensities H, V, X, and Y. Then, a first summation of the products in all target edge directions is calculated. Next, the edge intensities in all target edge directions are added together, i.e., H + V + X + Y, to obtain a second summation of the edge intensities in all target edge directions. Finally, a division operation is performed based on the first and second summations to obtain the edge enhancement value. The specific calculation formula is as follows: Dif=(DifH H+DifV V+DifX X+DifY Y) / (H+V+X+Y) After calculating the edge enhancement value Dif, the edge enhancement value Dif is superimposed with the corresponding interpolated pixel. Let the interpolated pixel be R1, G1, and B1, then R = R1 + Dif, G = G1 + Dif, and B = B1 + Dif, thus obtaining the edge enhancement results R, G, and B. This achieves adaptive adjustment of the edge enhancement intensity of the target image, effectively reduces the influence of false edges caused by noise, and improves image quality.

[0089] In some embodiments, the original image is traversed using a preset pixel array, such as a 5x5 matrix, to obtain multiple target images. The pixel values ​​of the center pixel of each target image can be edge-enhanced according to the edge enhancement process described above. When the entire original image has been traversed, the edge enhancement of the entire original image is achieved.

[0090] The following is for reference. Figure 7 The calculation process of the image edge enhancement method according to an embodiment of the present invention is described.

[0091] Figure 7 This is a flowchart of an image edge enhancement method according to an embodiment of the present invention, such as... Figure 7 As shown, the image edge enhancement method of this embodiment includes at least the following steps S100-S105.

[0092] S100, acquires a single frame of raw Bayer array image.

[0093] S101 uses a 5x5 target pixel as a template to calculate the edge intensity in each direction.

[0094] S102, calculates the missing G channel pixel values ​​in the neighborhood of the center pixel.

[0095] S103 calculates the edge difference in each direction of the neighborhood of the center pixel.

[0096] S104: Calculate the edge enhancement value of the center pixel based on the edge difference and edge intensity, and perform edge enhancement on the center pixel.

[0097] S105: The 5x5 target pixel template is traversed throughout the entire original image to complete the image edge enhancement.

[0098] In summary, by obtaining the pixel values ​​of all pixels in the target image corresponding to the target channel pixels within a preset neighborhood, and based on these pixel values, the edge difference of the target image in the target edge direction within the preset neighborhood is obtained. This edge difference is equivalent to the weight value of the edge intensity in the target edge direction. That is, the target image is enhanced according to the edge intensity and the corresponding edge difference. This is equivalent to adaptive edge enhancement according to the weight value and edge intensity of each target edge direction, which can avoid false edge enhancement caused by using the same edge intensity, reduce noise, improve image quality, and save SRAM resources without additional color space conversion.

[0099] A second aspect of this invention also proposes an image sensor, which is an electronic device that converts light signals into electrical signals and is commonly used in digital devices such as digital cameras and mobile phone cameras. Its working principle utilizes the photoelectric effect, focusing light through a lens onto a photosensitive element to generate electrons, thereby converting the light signal into an electrical signal. Image sensors can be divided into two categories: CCD (Charge Coupled Device) sensors and CMOS (Complementary Metal Oxide Semiconductor) sensors. CCD sensors use a charge-coupled device to read out charges line by line, offering advantages such as low noise, large dynamic range, and suitability for high-speed continuous imaging; while CMOS sensors integrate the signal converter into each pixel, offering advantages such as low power consumption, high integration, and ease of manufacturing.

[0100] Figure 8 This is a block diagram of an image sensor according to an embodiment of the present invention, such as... Figure 8 As shown, the image sensor 100 includes: a pixel array 1, a filter array 2, and a control unit 3.

[0101] In this context, pixel array 1 refers to a series of tiny photosensitive elements, also known as pixels, on the image sensor. Each pixel is responsible for capturing light and converting it into electrical signals, which ultimately form the entire image. Pixel array 1 typically consists of millions of pixels arranged in a two-dimensional matrix, which can be read and processed by control unit 3.

[0102] The filter array 2 is configured correspondingly to the pixel array 1, and is used to filter different colors of light in the image sensor so that each pixel receives only light of a specific color. In an embodiment of the present invention, the filter array 2 is used to process the original Bayer array image after image acquisition and extract edge information therein.

[0103] The control unit 3 is connected to the pixel array 1 and is used to perform edge enhancement processing on the output image of the pixel array 1 according to the image edge enhancement method described in the above embodiment.

[0104] According to an embodiment of the image sensor 100 of the present invention, when light enters the image sensor 100, the pixel array 1 converts it into an electrical signal and outputs the signal to the filter array 2 for processing. The filter array 2 enhances and reduces noise in the signal through filtering, and then outputs the processed signal back to the pixel array 1. Finally, the control unit 3 performs edge enhancement processing on the output image of the pixel array 1 according to the image edge enhancement method described in the above embodiment, thereby realizing weight-based adaptive adjustment of the edge enhancement intensity, effectively reducing the influence of false edges caused by noise, and improving image quality. Furthermore, this method does not require additional color space conversion, saving SRAM resources.

[0105] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the image edge enhancement method described in the above embodiments.

[0106] In embodiments, the computer-readable storage medium may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM), etc.

[0107] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example.

[0108] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims

1. An image edge enhancement method, characterized in that, include: Acquire the target image; Within a preset neighborhood around the center pixel of the target image, calculate the edge strength of the edge in the target edge direction; Obtain the edge difference value of the edge in the target edge direction within the preset neighborhood; The pixel value of the center pixel is enhanced based on the edge intensity and the edge difference of the corresponding edge direction. The process of enhancing the pixel value of the center pixel based on the edge intensity and the edge difference between the corresponding edge directions includes: Obtain the product of the edge intensity and the corresponding edge difference of the target image in each of the target edge directions within the preset neighborhood; Obtain the first summation of the product values ​​corresponding to all the target edge directions; Obtain a second summation of the edge intensities in all the target edge directions; The edge enhancement value is obtained by performing a division operation based on the first summation value and the second summation value; The edge enhancement value is superimposed on the interpolated pixel value of the center pixel.

2. The image edge enhancement method according to claim 1, characterized in that, Obtaining the edge difference value of the edge in the direction of the target edge includes: Obtain the pixel values ​​of the target pixel channels corresponding to all pixels within the preset neighborhood; The edge difference of the edge in the target edge direction is obtained based on the pixel values ​​of the target pixel channels corresponding to all pixels in the preset neighborhood.

3. The image edge enhancement method according to claim 2, characterized in that, Obtaining the pixel values ​​of the target pixel channels corresponding to all pixels within the preset neighborhood includes: Obtain the pixel value of the target pixel channel corresponding to the center pixel; and, Obtain the pixel value of the target pixel channel corresponding to the neighboring pixels within the preset neighborhood.

4. The image edge enhancement method according to claim 3, characterized in that, Obtaining the pixel value of the target pixel channel corresponding to the center pixel includes: If the center pixel is the target pixel corresponding to the target pixel channel, then the pixel value of the center pixel is used as the pixel value of the target pixel channel corresponding to the center pixel.

5. The image edge enhancement method according to claim 4, characterized in that, Obtaining the pixel value of the target pixel channel corresponding to the neighboring pixels within the preset neighborhood includes: If the neighboring pixel is the target pixel corresponding to the target pixel channel, then the pixel value of the neighboring pixel is used as the pixel value of the target pixel channel corresponding to the neighboring pixel. If the neighboring pixel is a pixel other than the target pixel, then the pixel value of the neighboring pixel is interpolated by the target pixel channel to obtain the pixel value of the neighboring pixel corresponding to the target pixel channel.

6. The image edge enhancement method according to claim 5, characterized in that, Interpolation calculation of the target pixel channel is performed on the pixel values ​​of the neighboring pixels to obtain the pixel values ​​of the target pixel channel corresponding to the neighboring pixels, including: Determine the pixels of two adjacent target pixel channels of the neighboring pixel in the direction of the target edge; Obtain the pixel values ​​of the pixels in the two adjacent target pixel channels, and calculate the average of the pixel values ​​to use as the pixel value of the neighboring pixel corresponding to the target pixel channel.

7. The image edge enhancement method according to claim 3, characterized in that, Within a preset neighborhood around the center pixel of the target image, the edge strength of the edge in the target edge direction is calculated, including: Obtain the first edge intensity of the target image in the horizontal edge direction within the preset neighborhood; Obtain the second edge intensity of the target image in the vertical edge direction within the preset neighborhood; Obtain the third edge intensity of the target image in the 45-degree angle edge direction within the preset neighborhood; and Obtain the fourth edge intensity of the target image in the 135-degree edge direction within the preset neighborhood.

8. The image edge enhancement method according to claim 7, characterized in that, Obtaining the first edge intensity of the target image in the horizontal edge direction within the preset neighborhood includes: Within the preset neighborhood, the upper pixel value of the pixel adjacent to the center pixel above is obtained, and the lower pixel value of the pixel adjacent to the center pixel below is obtained. The difference between the upper pixel value and the lower pixel value is calculated to obtain the first absolute value of the difference, which is used as the first edge intensity.

9. The image edge enhancement method according to claim 7, characterized in that, Obtaining the second edge intensity of the target image in the vertical edge direction within the preset neighborhood includes: Within the preset neighborhood, the left pixel value of the pixel adjacent to the left column of the center pixel is obtained, and the right pixel value of the pixel adjacent to the right column of the center pixel is obtained. The difference between the left pixel value and the right pixel value is calculated to obtain the second absolute value of the difference, which is used as the second edge intensity.

10. The image edge enhancement method according to claim 7, characterized in that, Obtaining the third edge intensity of the target image in the 45-degree angle edge direction within the preset neighborhood includes: Within the preset neighborhood, the upper right pixel value of the pixel to the upper right of the center pixel in the 45-degree direction is obtained, and the lower left pixel value of the pixel to the lower left of the center pixel in the 45-degree direction is obtained. The difference between the upper right pixel value and the lower left pixel value is calculated to obtain the third absolute value of the difference, which is used as the third edge intensity.

11. The image edge intensity method according to claim 7, characterized in that, Obtaining the fourth edge intensity of the target image within the preset neighborhood at a 135-degree angle edge direction includes: Within the preset neighborhood, the top-left pixel value of the pixel at the top left of the center pixel in the 135-degree direction is obtained, and the bottom-right pixel value of the pixel at the bottom right of the center pixel in the 135-degree direction is obtained. The difference between the top-left pixel value and the bottom-right pixel value is calculated to obtain the fourth absolute value of the difference, which is used as the fourth edge intensity.

12. The image edge enhancement method according to claim 7, characterized in that, Obtaining the pixel value of the target pixel channel corresponding to the center pixel includes: If the center pixel is a pixel other than the target pixel corresponding to the target pixel channel, determine the target edge direction where the center pixel is located; Based on the target edge direction where the center pixel is located, the pixel value of the center pixel is interpolated to the target pixel channel to obtain the pixel value of the center pixel corresponding to the target pixel channel.

13. The image edge enhancement method according to claim 12, characterized in that, Determining the target edge direction where the center pixel is located includes: Obtain the minimum edge strength between the first edge strength and the second edge strength, and obtain the edge strength difference between the first edge strength and the second edge strength; If the minimum edge strength is less than the edge threshold and the absolute value of the edge strength difference is greater than the edge threshold, then the center pixel is determined to be on a horizontal or vertical edge.

14. The image edge enhancement method according to claim 13, characterized in that, After determining whether the center pixel is in the horizontal or vertical edge direction, the image edge enhancement method further includes: If the first edge intensity is greater than the second edge intensity, then the center pixel is determined to be at a horizontal edge; If the second edge strength is greater than the first edge strength, then the center pixel is determined to be on a vertical edge.

15. The image edge enhancement method according to claim 13, characterized in that, Determining the target edge direction where the center pixel is located further includes: If the minimum edge intensity is determined to be greater than or equal to an edge threshold, or if the absolute value of the edge intensity difference is determined to be less than or equal to the edge threshold, then the center pixel is determined to be in a flat region.

16. The image edge enhancement method according to claim 14, characterized in that, Based on the target edge direction where the center pixel is located, the pixel value of the center pixel is interpolated according to the target pixel channel to obtain the pixel value of the center pixel corresponding to the target pixel channel, including: If the center pixel is located at the horizontal edge, obtain the pixel values ​​of the two adjacent pixels of the center pixel in the direction of the horizontal edge and obtain the first average value of the pixel values; Obtain the first double value of the pixel value of the center pixel; Calculate the first difference between the first double value and the pixel values ​​of the two next adjacent pixels of the center pixel in the horizontal edge direction; The pixel value of the target pixel channel corresponding to the center pixel is obtained based on the first mean and the first difference.

17. The image edge enhancement method according to claim 14, characterized in that, Based on the target edge direction where the center pixel is located, the pixel value of the center pixel is interpolated according to the target pixel channel to obtain the pixel value of the center pixel corresponding to the target pixel channel, including: If the center pixel is located at the vertical edge, obtain the second average value of the pixel values ​​of the two adjacent pixels of the center pixel in the direction of the vertical edge; Obtain a second value that is twice the pixel value of the center pixel; Calculate the second difference between the second double value and the pixel values ​​of the two next adjacent pixels of the center pixel in the vertical edge direction; The pixel value of the target pixel channel corresponding to the center pixel is obtained based on the second mean and the second difference.

18. The image edge enhancement method according to claim 15, characterized in that, Based on the target edge direction where the center pixel is located, interpolation calculation of the target pixel channel is performed on the center pixel to obtain the pixel value of the target pixel channel corresponding to the center pixel, including: If the center pixel is located in the flat area, obtain the first horizontal pixel value of the two adjacent pixels of the center pixel in the horizontal edge direction, and obtain the first vertical pixel value of the two adjacent pixels of the center pixel in the vertical edge direction. Calculate the average of the first horizontal pixel value and the first vertical pixel value to use as the pixel value of the target pixel channel corresponding to the center pixel point.

19. The image edge enhancement method according to claim 12, characterized in that, Obtaining the pixel value of the target pixel channel corresponding to the neighboring pixels within the preset neighborhood includes: If the neighboring pixel is the target pixel corresponding to the target pixel channel, then the pixel value of the neighboring pixel is used as the pixel value of the target pixel channel corresponding to the neighboring pixel. If the neighboring pixel is a pixel other than the target pixel, then the pixel value of the neighboring pixel is interpolated by the target pixel channel to obtain the pixel value of the neighboring pixel corresponding to the target pixel channel.

20. The image edge enhancement method according to claim 19, characterized in that, Interpolation calculation of the target pixel channel is performed on the pixel values ​​of the neighboring pixels to obtain the pixel values ​​of the target pixel channel corresponding to the neighboring pixels, including: Obtain the second horizontal pixel value of the two adjacent target pixel channels of the neighboring pixel in the horizontal edge direction, and obtain the second vertical pixel value of the two adjacent target pixel channels of the neighboring pixel in the vertical edge direction; Calculate the average of the second horizontal pixel value and the second vertical pixel value to use as the pixel value of the target pixel channel corresponding to the neighboring pixel.

21. The image edge enhancement method according to claim 2, characterized in that, The edge difference value of the edge in the target edge direction is obtained based on the pixel values ​​of the target pixel channels corresponding to all pixels in the preset neighborhood, including: Obtain the third value twice the pixel value of the target pixel channel corresponding to the center pixel point; Obtain the pixel values ​​of adjacent pixels of the target pixel channel corresponding to two adjacent pixels of the center pixel in the direction of the target edge; The difference between the third double value and the pixel value of the adjacent pixel is calculated and used as the edge difference value of the edge in the target edge direction.

22. The image edge enhancement method according to claim 1, characterized in that, Acquiring the target image includes: The original image is traversed using a preset pixel array as a template to obtain multiple target images.

23. An image sensor, characterized in that, include: A pixel array and a filter array, wherein the filter array is configured correspondingly to the pixel array; A control unit, connected to the pixel array, is used to perform edge enhancement processing on the output image of the pixel array according to any one of claims 1-22.

24. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the image edge enhancement method according to any one of claims 1-22.

Citation Information

Patent Citations

  • Image processing apparatus and image processing program

    CN101036161A

  • Image zooming method and device, computer equipment and storage medium

    CN109903224A

  • Image filtering method and device, electronic equipment and storage medium

    CN110956594A