Image edge enhancement method, image sensor and computer readable storage medium
By calculating edge intensity and difference values within the preset neighborhood around the central pixel point of the image, adaptively adjusting the edge enhancement intensity, solving the problem of false edge enhancement in the prior art, improving image quality and saving resources.
Patent Information
- Application Number
- CN202310633338.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2043-05-31
AI Technical Summary
Existing image edge enhancement methods use high-pass filter templates to cause edge enhancement of all pixels at the same intensity, resulting in false edges appearing more pronounced and degrading image quality.
By calculating edge intensity and edge difference values in the edge direction within the preset neighborhood around the central pixel point of the image, adaptively adjust the intensity of edge enhancement based on these values, avoiding false edge enhancement caused by the same edge intensity without additional Color space conversion.
It effectively reduces the false edge impact caused by noise, improves image quality, and saves SRAM resources.
Smart Images

Figure CN119090791A_ABST
Abstract
Description
Technical Field
[0001] The present 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 Art
[0002] In the prior art, most image edge enhancement methods use a high-pass filter template similar to the Laplace operator. For example, when edge enhancement is performed in the YUV domain, only the high-pass filter template is used for calculation, and the high-frequency information is calculated and superimposed on the original Y component information. For another example, when edge enhancement is performed in the RAW domain, directly applying the high-pass filter template will enhance the edges of all pixels at the same intensity. However, only using the high-pass filter template for edge enhancement will enhance the edges of all pixels at the same edge intensity, causing the false edges to become more obvious due to noise enhancement, thereby reducing the image quality. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, one purpose of the present invention is to provide an image edge enhancement method, which can adaptively adjust the intensity of edge enhancement based on weights, effectively reduce the false edge effect caused by noise, improve image quality, and the method does not require additional color space conversion, saving SRAM resources.
[0004] A second objective of the present invention is to provide an image sensor.
[0005] A third object of the present invention is to provide a computer-readable storage medium.
[0006] In order to achieve the above-mentioned purpose, the image edge enhancement method of the first aspect of the embodiment of the present invention includes: acquiring a target image; calculating the edge strength of the edge in the target edge direction within a preset neighborhood around the central pixel point of the target image; obtaining the edge difference of the edge in the target edge direction; and performing edge enhancement on the pixel value of the central pixel point according to the edge strength and the edge difference of the edge in the corresponding edge direction.
[0007] According to the image edge enhancement method of the embodiment of the present invention, the edge difference of the edge of the target image in the target edge direction within a preset field is obtained, and the edge difference is equivalent to the weight value of the edge strength in the target edge direction, that is, the edge of the target image is enhanced according to the edge strength and the corresponding edge difference, which is equivalent to adaptive edge enhancement according to the weight value and edge strength of each target edge direction, thereby avoiding false edge enhancement caused by using the same edge strength, reducing noise, and improving image quality. In addition, the method does not require additional color space conversion, saving SRAM resources.
[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 channel corresponding to all pixels in the preset neighborhood; and obtaining the edge difference of the edge in the target edge direction according to the pixel values of the target pixel channel corresponding to all pixels in the preset neighborhood.
[0009] In some embodiments, obtaining pixel values of the target pixel channel corresponding to all pixel points in the preset neighborhood includes: obtaining the pixel value of the target pixel channel corresponding to the central pixel point; and obtaining the pixel values of the target pixel channel corresponding to the neighborhood pixel points in the preset neighborhood.
[0010] In some embodiments, obtaining the pixel value of the center pixel corresponding to the target pixel channel includes: if the center pixel is the target pixel corresponding to the target pixel channel, using the pixel value of the center pixel 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 the neighborhood pixel point within the preset neighborhood includes: if the neighborhood pixel point is the target pixel corresponding to the target pixel channel, then using the pixel value of the neighborhood pixel point as the pixel value of the target pixel channel corresponding to the neighborhood pixel point; if the neighborhood pixel point is a pixel other than the target pixel, then performing an interpolation calculation of the target pixel channel on the pixel value of the neighborhood pixel point to obtain the pixel value of the target pixel channel corresponding to the neighborhood pixel point.
[0012] In some embodiments, an interpolation calculation of a target pixel channel is performed on the pixel value of the neighborhood pixel point to obtain the pixel value of the target pixel channel corresponding to the neighborhood pixel point, including: determining the pixel points of two target pixel channels adjacent to the neighborhood pixel point in the target edge direction; obtaining the pixel values of the pixel points 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 neighborhood pixel point.
[0013] In some embodiments, the edge strength of the edge in the target edge direction is calculated within a preset neighborhood around the central pixel point of the target image, including: obtaining a first edge strength in the horizontal edge direction of the target image within the preset neighborhood; obtaining a second edge strength in the vertical edge direction of the target image within the preset neighborhood; obtaining a third edge strength in the 45-degree edge direction of the target image within the preset neighborhood; and obtaining a fourth edge strength in the 135-degree edge direction of the target image within the preset area.
[0014] In some embodiments, obtaining the first edge strength of the target image in the horizontal edge direction within the preset neighborhood includes: obtaining the upper pixel value of the pixel point adjacent to the central pixel point in the upper row, and obtaining the lower pixel value of the pixel point adjacent to the central pixel point in the lower row within the preset area; performing a difference calculation between the upper pixel value and the lower pixel value and obtaining a first difference calculation absolute value as the first edge strength.
[0015] In some embodiments, obtaining the second edge strength of the target image in the vertical edge direction within the preset neighborhood includes: obtaining the left pixel value of the pixel adjacent to the left column of the center pixel within the preset neighborhood, and obtaining the right pixel value of the pixel adjacent to the right column of the center pixel; performing a difference calculation between the left pixel value and the right pixel value and obtaining a second difference calculation absolute value as the second edge strength.
[0016] In some embodiments, obtaining the third edge strength 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 that is 45 degrees to the upper right of the center pixel point within the preset area, and obtaining the lower left pixel value of the pixel point that is 45 degrees to the lower left of the center pixel point; performing a difference calculation between the upper right pixel value and the lower left pixel value and obtaining a third difference calculation absolute value as the third edge strength.
[0017] In some embodiments, obtaining the fourth edge strength of the target image in the 135-degree angle edge direction within the preset area includes: obtaining, within the preset area, the upper left pixel value of the pixel point that is to the upper left of the center pixel point in the 135-degree angle direction, and obtaining the lower right pixel value of the pixel point that is to the lower right of the center pixel point in the 135-degree direction; performing a difference calculation between the upper left pixel value and the lower right pixel value and obtaining a fourth difference calculation absolute value as the fourth edge strength.
[0018] In some embodiments, obtaining the pixel value of the target pixel channel corresponding to the center pixel point includes: if the center pixel point is a pixel other than the target pixel corresponding to the target pixel channel, determining the target edge direction of the center pixel point; and performing an interpolation calculation of the target pixel channel on the pixel value of the center pixel point according to the target edge direction of the center pixel point to obtain the pixel value of the target pixel channel corresponding to the center pixel point.
[0019] In some embodiments, determining the target edge direction of the central pixel point includes: obtaining the smallest edge intensity between 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; determining that the smallest edge intensity is less than an edge threshold and the absolute value of the edge intensity difference is greater than the edge threshold, then determining that the central pixel point is at a horizontal edge or a vertical edge.
[0020] In some embodiments, after determining that the central pixel is in a horizontal edge direction or a vertical edge direction, the image edge enhancement method further includes: if the first edge strength is greater than the second edge strength, determining that the central pixel is in a horizontal edge; if the second edge strength is greater than the first edge strength, determining that the central pixel is in a vertical edge.
[0021] In some embodiments, determining the target edge direction where the central pixel is located further includes: determining that the minimum 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 central pixel is in a flat area.
[0022] In some embodiments, an interpolation calculation of the target pixel channel is performed on 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 target pixel channel corresponding to the center pixel point, including: if the center pixel point is at the horizontal edge, obtaining the pixel values of two pixel points adjacent to the center pixel point in the horizontal edge direction and obtaining a first mean 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 two pixel points next adjacent to the center pixel point in the horizontal edge direction; and obtaining the pixel value of the target pixel channel corresponding to the center pixel point according to the first mean and the first difference.
[0023] In some embodiments, the target pixel channel is interpolated based on the target edge direction where the center pixel is located to obtain the pixel value of the center pixel corresponding to the target pixel channel, including: if the center pixel is at the vertical edge, obtaining a second mean of the pixel values of two pixels adjacent to the center pixel in the vertical edge direction; obtaining a second twice the pixel value of the center pixel; calculating a second difference between the second twice the pixel value and the pixel values of two next adjacent pixels to the center pixel in the vertical edge direction; and obtaining the pixel value of the center pixel corresponding to the target pixel channel based on the second mean and the second difference.
[0024] In some embodiments, an interpolation calculation of the target pixel channel is performed on 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 target pixel channel corresponding to the center pixel point, including: if the center pixel point is in the flat area, obtaining the first horizontal pixel value of two pixel points adjacent to the center pixel point in the horizontal edge direction, and obtaining the first vertical pixel value of two pixel points adjacent to the center pixel point in the vertical edge direction; and calculating the average 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 point.
[0025] In some embodiments, the pixel value of the target pixel channel corresponding to the neighborhood pixel point within the preset area is obtained, including: if the neighborhood pixel point is the target pixel corresponding to the target pixel channel, the pixel value of the neighborhood pixel point is used as the pixel value of the target pixel channel corresponding to the neighborhood pixel point; if the neighborhood pixel point is a pixel other than the target pixel, the pixel value of the neighborhood pixel point is interpolated for the target pixel channel to obtain the pixel value of the target pixel channel corresponding to the neighborhood pixel point.
[0026] In some embodiments, an interpolation calculation of a target pixel channel is performed on the pixel values of the neighborhood pixel points to obtain the pixel values of the target pixel channel corresponding to the neighborhood pixel points, including: obtaining the second horizontal pixel values of two target pixel channels adjacent to the neighborhood pixel points in the horizontal edge direction; obtaining the second vertical pixel values of two target pixel channels adjacent to the neighborhood pixel points in the vertical edge direction; and 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 neighborhood pixel.
[0027] In some embodiments, an edge difference of an edge in the target edge direction is obtained based on the pixel values of the target pixel channel corresponding to all pixels in the preset neighborhood, including: obtaining a third twice value of the pixel value of the target pixel channel corresponding to the center pixel; obtaining the pixel values of adjacent pixels of the target pixel channel corresponding to two adjacent pixels of the center pixel in the target edge direction; and calculating the difference between the third twice value and the adjacent pixel values as the edge difference of the edge in the target edge direction.
[0028] In some embodiments, edge enhancement is performed on the pixel value of the central pixel point according to the edge strength and the edge difference of the edge in the corresponding edge direction, including: obtaining the product value of the edge strength of each target edge direction of the target image within the preset neighborhood and the corresponding edge difference; obtaining a first summation value of the corresponding product values in all the target edge directions; obtaining a second summation value of the edge strength in all the target edge directions; performing a division operation on the first summation value and the second summation value to obtain an edge enhancement value; and superimposing the edge enhancement value with the interpolated pixel value of the central pixel point.
[0029] In some embodiments, acquiring the target image includes: traversing the original image using a preset pixel array as a template to obtain a plurality of the target images.
[0030] In order to achieve the above-mentioned purpose, the image sensor of the second aspect embodiment of the present invention includes: a pixel array and a filter array, the filter array is arranged corresponding to the pixel array; a control unit, the control unit is connected to the pixel array, and is used 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] The image sensor according to the embodiment of the present invention adopts the image edge enhancement method of the above embodiment, and can perform edge enhancement on the target image according to the edge difference and edge strength of each target edge direction, wherein the edge difference can be used as a weight value of the edge strength in the target edge direction to achieve adaptive adjustment of the edge enhancement intensity, avoid false edge enhancement caused by using the same edge strength, reduce noise, and improve image quality. In addition, the method does not require additional color space conversion, saving SRAM resources.
[0032] In order to achieve the above-mentioned purpose, a computer-readable storage medium of an embodiment of the third aspect of the present invention stores a computer program thereon, and when the computer program is executed, the image edge enhancement method described in the above embodiment is implemented.
[0033] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0035] Figure 1 is a flow chart of an image edge enhancement method according to an embodiment of the present invention;
[0036] Figure 2 is a schematic diagram of a Bayer array image according to an embodiment of the present invention;
[0037] Figure 3 is a schematic diagram showing that a central pixel is a G channel pixel and its lateral adjacent channel pixels are B channel pixels according to an embodiment of the present invention;
[0038] Figure 4 is a schematic diagram showing that a central pixel is a G channel pixel and its lateral adjacent channel pixels are R channel pixels according to an embodiment of the present invention;
[0039] Figure 5 is a schematic diagram of a central pixel being a B channel pixel according to an embodiment of the present invention;
[0040] Figure 6 is a schematic diagram of a central pixel being an R channel pixel according to an embodiment of the present invention;
[0041] Figure 7 is a flow chart of an image edge enhancement method according to an embodiment of the present invention;
[0042] Figure 8 is a block diagram of an image sensor according to an embodiment of the present invention.
[0043] Reference numerals:
[0044] Image sensor 100;
[0045] Pixel array 1; filter array 2; control unit 3; DETAILED DESCRIPTION
[0046] Embodiments of the present invention are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. Embodiments of the present invention are described in detail below.
[0047] Reference below Figure 1-Figure 7 The image edge enhancement method according to an embodiment of the present invention is described.
[0048] Figure 1 is a flow chart of an image edge enhancement method according to an embodiment of the present invention. Figure 1 As shown, the image edge enhancement method of the embodiment of the present invention at least includes the following steps S1-S4.
[0049] S1, obtain the target image.
[0050] The target image refers to the original image to be processed for edge enhancement, and the target image can be obtained from a digital image acquisition device (such as a camera, a scanner, etc.), or can be selected from an existing image library. The target image can be a grayscale image or a color image.
[0051] In some embodiments, the target image is obtained by dividing the entire original image into a preset pixel array. Specifically, the original image can be divided according to the set step size and area size to obtain multiple small areas of the same size, and each small area is a target image. The entire original image can be traversed by a sliding window to obtain all target images. In an embodiment of the present invention, the size of the target image can be a 5x5 pixel array image, and the preset pixel array can be a 3x3 pixel matrix.
[0052] S2, calculating the edge strength of the edge in the target edge direction within a preset neighborhood around the central pixel point of the target image.
[0053] Among them, edge strength refers to the intensity of grayscale changes between adjacent pixels in an image, and is used to represent features such as edges or textures in an image. In edge enhancement processing, the calculation of edge strength can be determined according to a specific algorithm implementation method, such as Laplace operator, Sobel operator, Canny operator, difference algorithm or filtering algorithm.
[0054] In some embodiments of the present invention, a differential algorithm may be used to calculate edge strength, and the differential algorithm determines the edge strength by calculating the gradient value around the pixel point.
[0055] Specifically, the target edge direction is determined according to the central pixel position of the target image and the size of the preset area centered on the central pixel, and then the edge strength in this direction is calculated. In some embodiments, the target edge direction may include but is not limited to the horizontal edge direction, the vertical edge direction, the 45-degree edge direction, and the 135-degree edge direction. For example, the edge strength of the horizontal edge direction, the vertical edge direction, the 45-degree edge direction, and the 135-degree edge direction in the 3*3 neighborhood around the central pixel of the target image is calculated.
[0056] S3, obtaining the edge difference of the edge in the target edge direction within the preset area.
[0057] S4, performing edge enhancement on the pixel value of the central pixel point according to the edge intensity and the edge difference of the edge corresponding to the edge direction.
[0058] According to the image edge enhancement method of the embodiment of the present invention, the edge difference of the edge of the target image in the target edge direction within a preset field is obtained, and the edge difference is equivalent to the weight value of the edge strength in the target edge direction, that is, the edge of the target image is enhanced according to the edge strength and the corresponding edge difference, which is equivalent to adaptive edge enhancement according to the weight value and edge strength of each target edge direction, thereby avoiding false edge enhancement caused by using the same edge strength, reducing noise, and improving image quality. In addition, the method does not require additional color space conversion, saving SRAM resources.
[0059] Furthermore, when obtaining edge differences, pixel values of target pixel channels corresponding to all pixels in a preset neighborhood are obtained. The edge difference of the target image in the target edge direction in the preset neighborhood is obtained according to the pixel values of target channel pixels corresponding to all pixels in the preset neighborhood.
[0060] Specifically, in some embodiments, any channel of the R / G / B channels of the color image can be selected as the target channel, where B is the blue component, G is the green component, and R is the red component. In the Bayer array image, the number of G channels is twice the number of R channels or B channels, and contains richer information; and compared with the R channel and the B channel, the G channel has a higher signal-to-noise ratio. Therefore, in some embodiments of the present invention, the Bayer array image can be taken as an example, and the edge enhancement processing of the image can be performed based on the G channel.
[0061] Then, the pixel values corresponding to all pixels in the preset neighborhood around the central pixel of the target image on the channel are obtained for subsequent calculation and processing. In this process, there may be missing pixels. For example, at the edge of the neighborhood or at the pixel gap, the pixel value of the target channel cannot be directly obtained. In this case, the value of the missing pixel can be calculated by an interpolation algorithm. According to the specific application scenario and requirements, different interpolation algorithms are selected to calculate the value of the missing pixel to achieve better results.
[0062] Specifically, when performing edge enhancement processing, it is first necessary to determine the target edge direction, such as the horizontal edge direction, the vertical edge direction, the 45-degree angle edge direction, or the 135-degree angle edge direction. Then, all pixel points adjacent to the target edge direction are selected in a preset neighborhood, and their pixel values on the target channel are obtained to calculate the edge difference of the target image in the target edge direction in the preset neighborhood. The edge difference can be calculated by differentiating, gradient, etc.
[0063] Furthermore, edge enhancement is performed on the pixel value of the central pixel point of the target image according to the edge strength of the target edge direction in the preset neighborhood and the corresponding edge difference.
[0064] In some embodiments, the edge enhancement method can be to increase or decrease the brightness value, or to adjust the color value. The specific enhancement method can be selected according to specific needs. The edge strength of the target edge direction in the preset neighborhood obtained by the above steps and the corresponding edge difference are used to enhance the edge of the target image, wherein the edge difference of each target edge direction is relative to the intensity weight of the corresponding edge direction, that is, the edge enhancement is performed based on the weight value and edge strength of each edge, which can make the edges in the image more obvious and clear, make the target in the image more prominent, reduce the obvious enhancement of false edges caused by noise, and improve image quality.
[0065] By enhancing the edges in an image, it can help the human eye recognize and understand the content in the image more quickly, and it is also beneficial for 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.
[0066] In some embodiments, the image edge enhancement method proposed by the present invention can be applied to image data in various formats, including Bayer array images. The Bayer array is a common color filter array that collects color information by arranging filters of different colors at different positions.
[0067] Figure 2 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 of the Bayer image is arranged in BG\GR channel pixels, and each channel pixel only displays one color component of the three primary colors, B is the blue component, G is the green component, and R is the red component. Among them, the number of G channel pixels is twice the number of R channel pixels or B channel pixels, and compared with R channel pixels and B channel pixels, G channel pixels have a higher signal-to-noise ratio and contain richer information. Therefore, the present invention uses G channel pixels as target channel pixels to perform edge enhancement processing on the image.
[0068] Specifically, edge enhancement processing is achieved by acquiring pixel values of all G channel pixels in a preset neighborhood, including the pixel values of the G channel pixels corresponding to the central pixel of the target image, and the pixel values of the G channel pixels corresponding to the neighborhood pixels other than the central pixel in the preset neighborhood around the central pixel of the target image.
[0069] Among them, the pixel value of the G channel pixel corresponding to the central pixel of the target image can be divided into two cases for explanation, one is that the central pixel of the target image is the G channel pixel. The other is that the central pixel of the target image is a pixel other than the G channel pixel. The pixel value of the G channel pixel corresponding to the neighborhood pixels other than the central pixel in the preset neighborhood around the central pixel of the target image can also be divided into two cases for explanation, one is that the neighborhood pixel is the G channel pixel. The other is that the neighborhood pixel is a pixel other than the target channel pixel.
[0070] In an embodiment, if the central pixel of the target image is a target pixel of a target pixel channel, such as a G channel pixel, the pixel value of the central pixel is used as the pixel value of the G channel pixel corresponding to the central pixel. Similarly, if the neighborhood pixel is a G channel pixel, the pixel value of the neighborhood pixel is used as the pixel value of the G channel pixel corresponding to the neighborhood pixel.
[0071] In an embodiment, if a neighborhood pixel is a target pixel of a target pixel channel, for example, a pixel other than a G channel pixel, the pixel value of the neighborhood pixel is interpolated for the target pixel channel to obtain the pixel value of the target pixel channel corresponding to the neighborhood pixel. Specifically, it may include: determining the pixels of two target pixel channels adjacent to the neighborhood pixel in the target edge direction; 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 target pixel channel corresponding to the neighborhood pixel. For example, the average of the pixel values of two adjacent G channel pixels in the target edge direction of the neighborhood pixel is obtained as the pixel value of the G pixel channel corresponding to the neighborhood pixel.
[0072] In an embodiment, within a preset neighborhood around a central pixel point of a target image, the edge strength of an edge in a target edge direction is calculated, including: obtaining a first edge strength of a target image in a horizontal edge direction within a preset neighborhood; obtaining a second edge strength of a target image in a vertical edge direction within a preset neighborhood; obtaining a third edge strength of a target image in a 45-degree angle edge direction within a preset neighborhood; and obtaining a fourth edge strength of a target image in a 135-degree angle edge direction within a preset area.
[0073] Specifically, obtaining a first edge strength of a target image in a horizontal edge direction within a preset neighborhood includes: obtaining, within the preset area, an upper pixel value of a pixel point adjacent to an upper row of a central pixel point, and obtaining a lower pixel value of a pixel point adjacent to a lower row of the central pixel point; performing a difference calculation between the upper pixel value and the lower pixel value and obtaining a first difference calculation absolute value as the first edge strength.
[0074] In an embodiment, obtaining a second edge strength of a target image in a vertical edge direction within a preset neighborhood includes: obtaining, within the preset neighborhood, a left pixel value of a pixel adjacent to a left column of a center pixel, and obtaining a right pixel value of a pixel adjacent to a right column of a center pixel; performing a difference calculation between the left pixel value and the right pixel value and obtaining a second difference calculation absolute value as the second edge strength.
[0075] In some embodiments, obtaining a third edge strength of a target image in a 45-degree angle edge direction within a preset neighborhood includes: obtaining, within the preset area, an upper-right pixel value of a pixel point that is 45 degrees to the upper right of a center pixel point, and obtaining a lower-left pixel value of a pixel point that is 45 degrees to the lower left of the center pixel point; performing a difference calculation between the upper-right pixel value and the lower-left pixel value and obtaining a third difference calculation absolute value as the third edge strength.
[0076] In some embodiments, obtaining a fourth edge strength of a target image in a 135-degree angle edge direction within a preset range includes: obtaining, within the preset range, an upper-left pixel value of a pixel point that is upper left of a center pixel point in a 135-degree angle direction, and obtaining a lower-right pixel value of a pixel point that is lower right of a center pixel point in a 135-degree direction; performing a difference calculation between the upper-left pixel value and the lower-right pixel value and obtaining a fourth difference calculation absolute value as a fourth edge strength.
[0077] like Figure 3 As shown, the central pixel of the 5x5 matrix is G33, and the pixels in its 3x3 neighborhood are G22, R23, G24, B32, G33, B34, G42, R43, and G44. When calculating edge strength within the 3x3 neighborhood, the edge strength is calculated in the horizontal, vertical, 45-degree and 135-degree directions, respectively, and is represented by H, V, X and Y, respectively, where H represents the edge strength in the horizontal edge direction, V represents the edge strength in the vertical edge direction, X represents the edge strength in the 45-degree direction, and Y represents the edge strength in the 135-degree direction. The specific calculation formula is as follows:
[0078] H=|(G22+2*R23+G24)-(G42+2*R43+G44)|
[0079] V=|(G22+2*B32+G42)-(G24+2*B34+G44)|
[0080] X=|(R23+2*G24+B34)-(R43+2*G42+B32)|
[0081] Y=|(R23+2*G22+B32)-(R43+2*G44+B34)|
[0082] Among them, the calculation formula of the edge strength H in the horizontal edge direction is to weight the sum of the pixel values of G22, R23, G24 and G42, G43, B24 in the 3x3 neighborhood, and take the absolute value. The calculation formula of the edge strength V in the vertical edge direction is to weight the sum of the pixel values of G22, B32, G42 and G24, B34, G44 in the 3x3 neighborhood, and take the absolute value. The calculation formula of the edge strength X in the 45-degree angle direction is to weight the sum of the pixel values of R23, G24, B34 and R43, G42, B32 in the 3x3 neighborhood, and take the absolute value. The calculation formula of the edge strength Y in the 135-degree angle direction is to weight the sum of the pixel values of R23, G22, B32 and R43, G44, B34 in the 3x3 neighborhood, and take the absolute value. These calculated edge strength values can be used to adaptively adjust edge enhancement parameters to achieve a more accurate edge enhancement effect.
[0083] like Figure 3 and Figure 4 As shown, Figure 3 and Figure 4 They are schematic diagrams in which the central pixel is a G channel pixel and its lateral adjacent channel pixels are B channel pixels, and the central pixel is a G channel pixel and its lateral adjacent channel pixels are R channel pixels.
[0084] Specifically, Figure 3 For example, in the 3x3 neighborhood with G33 as the center pixel, four G pixel channels in the edge direction are required to provide the same channel edge information, among which the G channel pixels in the 45-degree angle direction are G22 and G44; the G channel pixels in the 135-degree angle direction are G24 and G42; the pixels in the horizontal edge direction are B32 and B34, because these two pixels are in the position of the B channel, so there is a lack of corresponding G channel pixels. In order to obtain the G channel pixel values corresponding to these pixels, two adjacent G channel pixels can be used for interpolation calculation. Specifically, the value of G32 is calculated by the average value of its left adjacent pixel G31 and the center pixel G33, and the value of G34 is calculated by the average value of its right adjacent pixel G35 and the center pixel G33. It can be expressed as G32 = (G31 + G33) / 2, G34 = (G33 + G35) / 2.
[0085] Similarly, the pixels in the vertical edge direction are R23 and R43. Because these two pixels are located in the R channel, the corresponding G channel pixels are missing. In order to obtain the G channel pixel values corresponding to these pixels, two adjacent G channel pixels can also be used for interpolation calculation. Specifically, the value of G23 is calculated by the average value of the adjacent pixel G13 above it and the center pixel G33, and the value of G43 is calculated by the average value of the adjacent pixel G53 below it and the center pixel G33. It can be expressed as G23 = (G13 + G33) / 2, G43 = (G33 + G53) / 2.
[0086] Furthermore, after calculating all G channel pixel information in a 3x3 neighborhood around the central pixel, the edge difference in the target edge direction in a preset neighborhood around the central pixel of the target image can be calculated.
[0087] Specifically, twice the value of the pixel value of the target pixel channel corresponding to the center pixel point is obtained, for example, as a third twice value; adjacent pixel values of the target pixel channel corresponding to two adjacent pixel points of the center pixel point in the target edge direction are obtained; and the difference between the third twice value and the adjacent pixel values is calculated as the edge difference of the edge in the target edge direction.
[0088] Among them, in an embodiment, edge enhancement is performed on the pixel value of the central pixel point according to the edge strength and the edge difference of the edge in the corresponding edge direction, including: obtaining the product value of the edge strength of each target edge direction of the target image within the preset neighborhood and the corresponding edge difference; obtaining a first summation value of the corresponding product values in all the target edge directions; obtaining a second summation value of the edge strength in all the target edge directions; performing a division operation on the first summation value and the second summation value to obtain an edge enhancement value; and superimposing the edge enhancement value with the interpolated pixel value of the central pixel point.
[0089] For example, taking a 3x3 neighborhood as an example, Figure 3 Or as shown in 4, after calculating all the G channel pixel information of the 3x3 neighborhood around the central pixel, the edge difference of the edges in each direction is calculated. The formula is as follows:
[0090] DifH=2*G33-G32-G34
[0091] DifV=2*G33-G23-G43
[0092] DifX=2*G33-G22-G44
[0093] DifY=2*G33-G24-G42
[0094] Among them, 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*Y) / (H+V+X+Y) to get the final edge enhancement value. Superimpose the calculated edge enhancement value Dif with the corresponding pixel points after interpolation. Suppose the interpolated pixel points are R1, G1, and B1, then R = R1+Dif, G = G1+Dif, B = B1+Dif, and get the edge enhancement results R, G, and B, completing the edge enhancement of the 5x5 matrix.
[0095] In other embodiments, if the central pixel of the target image is a pixel other than the target pixel corresponding to the target pixel channel, such as the G channel pixel, it is first necessary to determine the target edge direction where the central pixel is located. Then, the pixel value of the central pixel is interpolated in the target pixel channel according to the target edge direction where the central pixel is located, so as to obtain the pixel value of the target pixel channel corresponding to the central pixel.
[0096] Specifically, the first edge strength of the target image in the horizontal edge direction in the preset neighborhood is obtained; the second edge strength of the target image in the vertical edge direction in the preset neighborhood is obtained. The minimum edge strength of the first edge strength and the second edge strength is obtained, and the edge strength difference between the first edge strength and the second edge strength is obtained; if the minimum edge strength is determined to be less than the edge threshold and the absolute value of the edge strength difference is greater than the edge threshold, it is determined that the central pixel is at a horizontal edge or a vertical edge.
[0097] Furthermore, after determining that the central pixel is in the horizontal edge direction or the vertical edge direction, the image edge enhancement method also includes: if the first edge strength is greater than the second edge strength, determining that the central pixel is in the horizontal edge; if the second edge strength is greater than the first edge strength, determining that the central pixel is in the vertical edge.
[0098] Furthermore, determining the target edge direction where the central pixel is located further includes: determining that the minimum 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, and then determining that the central pixel is in a flat area.
[0099] For example, Figure 5 and Figure 6 As shown, Figure 5 and Figure 6 They are schematic diagrams with the B channel pixel as the center pixel and the R channel pixel as the center pixel respectively.
[0100] Specifically, Figure 5For example, the central pixel of the target image is B33, and the pixels in its 3x3 neighborhood are R22, G23, R24, G32, B33, G34, R42, G43, and R44. When the following edge strength calculation is performed within the 3x3 neighborhood, the edge strength is calculated in the horizontal, vertical, 45-degree and 135-degree directions, respectively, and is represented by H, V, X and Y. The specific calculation formula is as follows:
[0101] H=|(R22+2*G23+R24)-(R42+2*G43+R44)|
[0102] V=|(R22+2*G32+R42)-(R24+2*G34+R44)|
[0103] X=|(G23+2*R24+G34)-(G43+2*R42+G32)|
[0104] Y=|(G23+2*R22+G32)-(G43+2*R44+G34)|
[0105] Among them, H represents the edge strength in the horizontal edge direction, V represents the edge strength in the vertical edge direction, X represents the edge strength in the 45-degree angle direction, and Y represents the edge strength in the 135-degree angle direction. In the 3x3 neighborhood matrix with B33 as the center pixel, the G channel pixels of the center pixel and the G channel pixels in the four directions are required to provide the same-channel edge information.
[0106] In the embodiment, the pixel value of the central pixel is interpolated by the G pixel channel. First, it is necessary to determine the edge direction of the central pixel B33. Here, an edge threshold TH can be used to determine whether the central pixel is at the edge. If the minimum value of the first edge strength in the horizontal edge direction and the second edge strength in the vertical edge direction in the preset neighborhood around the central pixel is less than the edge threshold TH, and the absolute value of the difference between the first edge strength and the second edge strength is greater than the edge threshold TH, that is, min(H,V)<TH&&|H-V|> TH, it is determined whether the central pixel is at a horizontal edge or a vertical edge.
[0107] After determining that the central pixel B33 is at a horizontal edge or a vertical edge, it is necessary to determine the edge direction according to the edge strength in the horizontal edge direction or the vertical edge direction. If the first edge strength H in the horizontal edge direction is greater than the second edge strength V in the vertical edge direction, that is, H>V, the central pixel B33 is considered to be at a horizontal edge. If the second edge strength V in the vertical edge direction is greater than the first edge strength H in the horizontal edge direction, that is, V>H, the central pixel B33 is considered to be at a vertical edge.
[0108] In addition, if the minimum value of the first edge intensity in the horizontal edge direction and the second edge intensity in the vertical edge direction in a preset neighborhood around the central pixel B33 is greater than or equal to the edge threshold TH, or the absolute value of the difference between the first edge intensity and the second edge intensity is less than the edge threshold TH, that is, min(H,V)>TH|||HV|≤TH, then it is determined that the central pixel is in a flat area.
[0109] In an embodiment, for different edge directions, different interpolation methods can be used to calculate the G channel pixel value of the center pixel. If the center pixel point is at the horizontal edge, obtain the pixel values of the two pixel points adjacent to the center pixel point in the horizontal edge direction and obtain a first mean of the pixel values; obtain twice the value of the pixel value of the center pixel point as a first twice value; calculate the first difference between the first twice value and the pixel values of the two pixel points next adjacent to the center pixel point in the horizontal edge direction; obtain the pixel value of the center pixel point corresponding to the target pixel channel based on the first mean and the first difference. Figure 5 For example, the specific calculation formula is as follows:
[0110] G33=(G32+G34) / 2+(2B33-B31-B35) / 4
[0111] In an embodiment, if the central pixel is at the vertical edge, obtain the second mean of the pixel values of the two pixels adjacent to the central pixel in the vertical edge direction; obtain twice the pixel value of the central pixel as the second twice value; calculate the second difference between the second twice value and the pixel values of the two pixels next adjacent to the central pixel in the vertical edge direction; and obtain the pixel value of the central pixel corresponding to the target pixel channel according to the second mean and the second difference. Figure 5 For example, the specific calculation formula is as follows:
[0112] G33=(G23+G43) / 2+(2B33-B13-B53) / 4
[0113] In an embodiment, if the central pixel point is in the flat area, the first horizontal pixel value of two pixels adjacent to the central pixel point in the horizontal edge direction is obtained, and the first vertical pixel value of two pixels adjacent to the central pixel point in the vertical edge direction is obtained; the average value of the first horizontal pixel value and the first vertical pixel value is calculated as the pixel value of the target pixel channel corresponding to the central pixel point. Figure 5 For example, the specific calculation formula is as follows:
[0114] G33=(G23+G32+G34+G43) / 4
[0115] In some embodiments, the pixel value of the target pixel channel corresponding to the neighborhood pixel point within a preset area is obtained, including: if the neighborhood pixel point is the target pixel corresponding to the target pixel channel, the pixel value of the neighborhood pixel point is used as the pixel value of the target pixel channel corresponding to the neighborhood pixel point; if the neighborhood pixel point is a pixel other than the target pixel, the pixel value of the neighborhood pixel point is interpolated by the target pixel channel to obtain the pixel value of the target pixel channel corresponding to the neighborhood pixel point.
[0116] Furthermore, the pixel values of the neighborhood pixels are interpolated in the target pixel channel to obtain the pixel values of the target pixel channels corresponding to the neighborhood pixels, including: obtaining the second horizontal pixel values of two target pixel channels adjacent to the neighborhood pixels in the horizontal edge direction; obtaining the second vertical pixel values of two target pixel channels adjacent to the neighborhood pixels in the vertical edge direction; and 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 neighborhood pixel.
[0117] Specifically, in order to calculate the pixel value of the G channel pixel corresponding to the neighborhood pixel, it is necessary to first calculate the average value of the pixel values of the two G channel pixels adjacent to the neighborhood pixel in the horizontal edge direction and the average value of the pixel values of the two G channel pixels adjacent to the neighborhood pixel in the vertical edge direction, and then use it as the pixel value of the G channel pixel corresponding to the neighborhood pixel.
[0118] For example, Figure 5 As shown, in the 3x3 neighborhood with B33 as the center pixel, the pixels in the horizontal edge direction are G32 and G34, the pixels in the vertical edge direction are G23 and G43, and the pixels in the 45-degree edge direction are R22 and R44. The G channel pixels are missing, and the G channel pixel values at R22 and R44 can be obtained by taking the average of the adjacent G channel pixels around R22 and R44. The specific calculation formula is as follows:
[0119] G22=(G12+G23+G21+G32) / 4
[0120] G44=(G34+G45+G43+G54) / 4
[0121] The pixels at the 135-degree edge are R24 and R42. There are no G channel pixels. The G channel pixel values at R24 and R42 can be obtained by taking the average of the adjacent G channel pixels around R24 and R42. The specific calculation formula is as follows:
[0122] G24=(G14+G23+G25+G34) / 4
[0123] G42=(G32+G41+G43+G52) / 4
[0124] In an embodiment, after calculating all G channel pixel information of a 3x3 neighborhood around a central pixel, the edge difference of the target image in the target edge direction within the 3x3 neighborhood can be calculated, and the edge difference of the edge in the target edge direction is obtained according to the pixel values of the target pixel channel corresponding to all pixels in a preset neighborhood, including: obtaining twice the pixel value of the target pixel channel corresponding to the central pixel as a third twice value; obtaining the pixel values of adjacent pixels corresponding to the target pixel channel of two adjacent pixels of the central pixel in the target edge direction; and calculating the difference between the third twice value and the adjacent pixel values as the edge difference of the edge in the target edge direction.
[0125] 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 direction is defined as DifX; and the edge difference of the center pixel in the 135-degree direction is defined as DifY. Figure 3 For example, the calculation of DifH, DifV, DifX, and DifY is as follows:
[0126] DifH=2*G33-G32-G34
[0127] DifV=2*G33-G23-G43
[0128] DifX=2*G33-G22-G44
[0129] DifY=2*G33-G24-G42
[0130] Further, in an embodiment, edge enhancement is performed on the pixel value of the central pixel point according to the edge strength and the edge difference of the edge in the corresponding edge direction, including: obtaining the product value of the edge strength of each target edge direction of the target image within the preset neighborhood and the corresponding edge difference; obtaining a first summation value of the corresponding product values in all the target edge directions; obtaining a second summation value of the edge strengths in all the target edge directions; performing a division operation on the first summation value and the second summation value to obtain an edge enhancement value; and superimposing the edge enhancement value with the interpolated pixel value of the central pixel point to achieve edge enhancement of the pixel value of the central pixel point.
[0131] Specifically, after calculating the edge strength of the target edge direction in a preset neighborhood around the central pixel of the target image and the edge difference of the edge of the target image in the preset neighborhood in the target edge direction, the edge difference DifH, DifV, DifX and DifY are multiplied by the corresponding edge strengths H, V, X and Y, and then the first summation value of the corresponding product values in all target edge directions is calculated. Next, the edge strengths in all target edge directions are added, that is, H+V+X+Y, so as to obtain the second summation value of the edge strengths in all target edge directions. Finally, a division operation is performed based on the first summation value and the second summation value to obtain the edge enhancement value. The specific calculation formula is as follows:
[0132] Dif=(DifH*H+DifV*V+DifX*X+DifY*Y) / (H+V+X+Y)
[0133] After calculating the edge enhancement value Dif, the edge enhancement value Dif is superimposed on the corresponding pixel point after interpolation. Assuming the interpolated pixel points are R1, G1, and B1, then R=R1+Dif, G=G1+Dif, and B=B1+Dif, thereby obtaining the edge enhancement results R, G, and B, and realizing the adaptive adjustment of the edge enhancement intensity of the target image, effectively reducing the influence of false edges caused by noise, and improving image quality.
[0134] In some embodiments, the original image is traversed using a preset pixel array, such as a 5x 5 matrix, as a template to obtain multiple target images. The pixel values of the central pixel points of each target image can be edge enhanced according to the above-mentioned edge enhancement process. When the traversal of the entire original image is completed, the edge enhancement of the entire original image is achieved.
[0135] Reference below Figure 7 The calculation process of the image edge enhancement method according to an embodiment of the present invention is described.
[0136] Figure 7 is a flow chart of an image edge enhancement method according to an embodiment of the present invention. Figure 7 As shown, the image edge enhancement method of the embodiment of the present invention at least includes the following steps S100-S105.
[0137] S100, collecting a frame of original Bayer array image.
[0138] S101, using the 5x5 target pixel as a template, calculate the edge strength in each direction.
[0139] S102, calculating the missing G channel pixel values in the neighborhood of the central pixel.
[0140] S103, calculating edge differences in all directions of the neighborhood of the central pixel.
[0141] S104, calculating the edge enhancement value of the central pixel according to the edge difference and the edge strength, and performing edge enhancement on the central pixel.
[0142] S105, traverse the entire original image with a 5x5 target pixel template to complete image edge enhancement.
[0143] In summary, by obtaining the pixel values of the target channel pixels corresponding to all pixels of the target image in a preset field, the edge difference of the edge of the target image in the target edge direction in the preset field is obtained based on the pixel value, and the edge difference is equivalent to the weight value of the edge strength in the target edge direction, that is, the edge of the target image is enhanced according to the edge strength and the corresponding edge difference, which is equivalent to adaptive edge enhancement according to the weight value and edge strength of each target edge direction, thereby avoiding false edge enhancement caused by using the same edge strength, reducing noise, and improving image quality. In addition, this method does not require additional color space conversion, saving SRAM resources.
[0144] The second aspect of the present 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 is to use the photoelectric effect to focus light through a lens onto a photosensitive element to generate electrons, thereby converting light signals into electrical signals. Image sensors can be divided into two categories: CCD (Charge coupled Device) sensors and CMOS (Complementary Metal Oxide Semiconductor) sensors. CCD sensors use charge coupled devices to read out charges line by line. Its advantages are low noise, large dynamic range, and suitability for high-speed continuous imaging. CMOS sensors integrate signal converters in each pixel. Its advantages are low power consumption, high integration, and easy manufacturing.
[0145] Figure 8 is a block diagram of an image sensor according to an embodiment of the present invention, Figure 8 As shown, the image sensor 100 includes: a pixel array 1 , a filter array 2 and a control unit 3 .
[0146] The pixel array 1 refers to a series of tiny photosensitive elements on the image sensor, also known as pixels. Each pixel is responsible for capturing light and converting it into electrical signals, which ultimately form the entire image. The pixel array 1 is usually composed of millions of pixels, which are arranged in a two-dimensional matrix and can be read and processed by the control unit 3.
[0147] The filter array 2 is arranged corresponding to the pixel array 1, and is used to filter light of different colors 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 the image is acquired, and to extract edge information therein.
[0148] 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.
[0149] According to the image sensor 100 of the embodiment 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 on the signal through filtering, and then outputs the processed signal to the pixel array 1 again. 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, so that the intensity of edge enhancement can be adaptively adjusted based on weights, effectively reducing the false edge effect caused by noise and improving image quality. In addition, this method does not require additional color space conversion, saving SRAM resources.
[0150] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed, the image edge enhancement method described in the above embodiment is implemented.
[0151] In an embodiment, the computer readable storage medium may include at least one of a non-volatile and a volatile memory. The non-volatile memory may include a read-only memory (ROM), a magnetic tape, a floppy disk, a flash memory, or an optical memory. The volatile memory may include a random access memory (RAM) or an external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM).
[0152] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.
[0153] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A method for image edge enhancement, It is characterized in that include: Get the target image; Calculating the edge strength of the edge in the target edge direction within a preset neighborhood around the central pixel point of the target image; Obtaining an edge difference of an edge in the target edge direction within the preset area; Edge enhancement is performed on the pixel value of the central pixel point according to the edge intensity and the edge difference of the edge corresponding to the edge direction.
2. The image edge enhancement method according to claim 1, It is characterized in that Obtaining the edge difference of the edge in the target edge direction includes: Obtaining pixel values of target pixel channels corresponding to all pixel points in the preset neighborhood; The edge difference of the edge in the target edge direction is obtained according to the pixel values of the target pixel channel corresponding to all the pixel points in the preset neighborhood.
3. The image edge enhancement method according to claim 2, It is characterized in that Obtaining pixel values of target pixel channels corresponding to all pixel points in the preset neighborhood includes: Obtaining the pixel value of the target pixel channel corresponding to the central pixel; and, Obtain pixel values of neighborhood pixels within the preset neighborhood corresponding to the target pixel channel.
4. The image edge enhancement method according to claim 3, It is characterized in that Obtaining the pixel value of the target pixel channel corresponding to the central pixel point includes: If the central pixel is the target pixel corresponding to the target pixel channel, the pixel value of the central pixel is used as the pixel value of the target pixel channel corresponding to the central pixel.
5. The image edge enhancement method according to claim 4, It is characterized in that Obtaining the pixel value of the target pixel channel corresponding to the neighborhood pixel point in the preset neighborhood includes: If the neighborhood pixel point is the target pixel corresponding to the target pixel channel, the pixel value of the neighborhood pixel point is used as the pixel value of the target pixel channel corresponding to the neighborhood pixel point; If the neighborhood pixel point is a pixel other than the target pixel, an interpolation calculation of the target pixel channel is performed on the pixel value of the neighborhood pixel point to obtain the pixel value of the neighborhood pixel point corresponding to the target pixel channel.
6. The image edge enhancement method according to claim 5, It is characterized in that Performing interpolation calculation of a target pixel channel on the pixel value of the neighborhood pixel point to obtain the pixel value of the neighborhood pixel point corresponding to the target pixel channel includes: Determine pixel points of two target pixel channels adjacent to the neighborhood pixel point in the target edge direction; The pixel values of the pixel points of the two adjacent target pixel channels are obtained, and the average of the pixel values is calculated to serve as the pixel value of the neighborhood pixel point corresponding to the target pixel channel.
7. The image edge enhancement method according to claim 3, It is characterized in that Calculating the edge strength of the edge in the target edge direction in a preset neighborhood around the central pixel point of the target image, including: Obtaining a first edge strength of the target image in a horizontal edge direction within the preset neighborhood; Obtaining a second edge strength of the target image in a vertical edge direction within the preset neighborhood; Obtaining a third edge strength of the target image in a 45-degree angle edge direction within the preset neighborhood; and The fourth edge strength of the target image in the 135-degree angle edge direction within the preset area is obtained.
8. The image edge enhancement method according to claim 7, It is characterized in that Obtaining a first edge strength of the target image in a horizontal edge direction within the preset neighborhood includes: In the preset area, an upper pixel value of a pixel point that is adjacent to the central pixel point in an upper row is obtained, and a lower pixel value of a pixel point that is adjacent to the central pixel point in a lower row is obtained; A difference calculation is performed between the upper pixel value and the lower pixel value to obtain a first difference calculation absolute value as the first edge strength.
9. The image edge enhancement method according to claim 7, It is characterized in that Obtaining a second edge strength of the target image in the vertical edge direction within the preset neighborhood includes: In the preset neighborhood, obtain the left pixel value of the pixel point adjacent to the left column of the central pixel point, and obtain the right pixel value of the pixel point adjacent to the right column of the central pixel point; The left pixel value and the right pixel value are subtracted to obtain a second subtracted absolute value as the second edge strength.
10. The image edge enhancement method according to claim 7, It is characterized in that Obtaining a third edge strength of the target image in a 45-degree angle edge direction within the preset neighborhood includes: In the preset area, the upper right pixel value of the pixel point to the upper right of the central pixel point at a 45-degree angle direction is obtained, and the lower left pixel value of the pixel point to the lower left of the central pixel point at the 45-degree angle direction is obtained; The upper right pixel value and the lower left pixel value are subtracted and a third subtraction absolute value is obtained as the third edge strength.
11. The image edge strength method according to claim 7, It is characterized in that Obtaining a fourth edge strength of the target image in a 135-degree angle edge direction within the preset area includes: In the preset area, obtain the upper left pixel value of the pixel point at the upper left of the central pixel point at an angle of 135 degrees, and obtain the lower right pixel value of the pixel point at the lower right of the central pixel point at the angle of 135 degrees; The upper left pixel value and the lower right pixel value are subtracted to obtain a fourth subtraction absolute value as the fourth edge strength.
12. The image edge enhancement method according to claim 7, It is characterized in that Obtaining the pixel value of the target pixel channel corresponding to the central pixel point includes: If the central pixel is a pixel other than the target pixel corresponding to the target pixel channel, determine the target edge direction where the central pixel is located; An interpolation calculation of a target pixel channel is performed on the pixel value of the central pixel point according to the target edge direction where the central pixel point is located, so as to obtain the pixel value of the central pixel point corresponding to the target pixel channel.
13. The image edge enhancement method according to claim 12, It is characterized in that Determining the target edge direction where the central pixel is located includes: Obtaining a minimum edge strength between the first edge strength and the second edge strength, and obtaining an edge strength difference between the first edge strength and the second edge strength; It is determined that 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, and then it is determined that the central pixel is at a horizontal edge or a vertical edge.
14. The image edge enhancement method according to claim 13, It is characterized in that After determining that the central pixel is in a horizontal edge direction or a vertical edge direction, the image edge enhancement method further includes: If the first edge strength is greater than the second edge strength, determining that the central pixel is at a horizontal edge; If the second edge strength is greater than the first edge strength, it is determined that the central pixel is at a vertical edge.
15. The image edge enhancement method according to claim 13, It is characterized in that Determining the target edge direction where the central pixel is located further includes: It is determined that the minimum edge intensity is greater than or equal to an edge threshold, or that the absolute value of the edge intensity difference is less than or equal to the edge threshold, and then it is determined that the central pixel is in a flat area.
16. The image edge enhancement method according to claim 14, It is characterized in that The method further comprises: performing interpolation calculation of the target pixel channel on the pixel value of the central pixel point according to the target edge direction where the central pixel point is located, so as to obtain the pixel value of the central pixel point corresponding to the target pixel channel, including: If the central pixel is at the horizontal edge, obtaining pixel values of two pixel points adjacent to the central pixel 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 central pixel; Calculate a first difference between the first double value and the pixel values of two pixel points next adjacent to the central pixel point in the horizontal edge direction; The pixel value of the central pixel corresponding to the target pixel channel is obtained according to the first mean value and the first difference value.
17. The image edge enhancement method according to claim 14, It is characterized in that The method further comprises: performing interpolation calculation of the target pixel channel on the pixel value of the central pixel point according to the target edge direction where the central pixel is located, so as to obtain the pixel value of the central pixel point corresponding to the target pixel channel, including: If the central pixel point is located at the vertical edge, obtaining a second average value of pixel values of two pixels adjacent to the central pixel point in the direction of the vertical edge; Obtaining a second double value of the pixel value of the central pixel; Calculate a second difference between the second double value and the pixel values of two pixel points next adjacent to the central pixel in the vertical edge direction; The pixel value of the central pixel corresponding to the target pixel channel is obtained according to the second mean value and the second difference value.
18. The image edge enhancement method according to claim 15, It is characterized in that Performing an interpolation calculation of the target pixel channel on the central pixel point according to the target edge direction where the central pixel point is located to obtain a pixel value of the central pixel point corresponding to the target pixel channel, including: If the central pixel point is in the flat area, obtain the first horizontal pixel value of two pixel points adjacent to the central pixel point in the horizontal edge direction, and obtain the first vertical pixel value of two pixel points adjacent to the central pixel point in the vertical edge direction; An average value of the first horizontal pixel value and the first vertical pixel value is calculated to serve as a pixel value of the target pixel channel corresponding to the central pixel point.
19. The image edge enhancement method according to claim 12, It is characterized in that Obtaining the pixel value of the target pixel channel corresponding to the neighborhood pixel point in the preset area includes: If the neighborhood pixel point is the target pixel corresponding to the target pixel channel, the pixel value of the neighborhood pixel point is used as the pixel value of the target pixel channel corresponding to the neighborhood pixel point; If the neighborhood pixel point is a pixel other than the target pixel, an interpolation calculation of the target pixel channel is performed on the pixel value of the neighborhood pixel point to obtain the pixel value of the neighborhood pixel point corresponding to the target pixel channel.
20. The image edge enhancement method according to claim 19, It is characterized in that Performing interpolation calculation of a target pixel channel on the pixel value of the neighborhood pixel point to obtain the pixel value of the neighborhood pixel point corresponding to the target pixel channel includes: Obtaining second horizontal pixel values of two target pixel channels adjacent to the neighborhood pixel point in the horizontal edge direction, and obtaining second vertical pixel values of two target pixel channels adjacent to the neighborhood pixel point in the vertical edge direction; An average value of the second horizontal pixel value and the second vertical pixel value is calculated to serve as the pixel value of the target channel pixel corresponding to the neighborhood pixel point.
21. The image edge enhancement method according to claim 2, It is characterized in that Obtaining the edge difference of the edge in the target edge direction according to the pixel values of the target pixel channel corresponding to all the pixels in the preset neighborhood includes: Obtaining a third double value of the pixel value of the target pixel channel corresponding to the central pixel point; Obtain pixel values of adjacent pixels of two adjacent pixels of the central pixel corresponding to the target pixel channel in the target edge direction; The difference between the third double value and the pixel value of the adjacent pixel is calculated as the edge difference of the edge in the target edge direction.
22. The image edge enhancement method according to claim 1, It is characterized in that Performing edge enhancement on the pixel value of the central pixel point according to the edge strength and the edge difference of the edge corresponding to the edge direction, comprising: Obtain a product value of the edge strength of each target edge direction of the target image within the preset neighborhood and the corresponding edge difference; Obtaining a first sum value of the product values corresponding to all the target edge directions; Obtain a second sum value of the edge strengths in all target edge directions; Performing a division operation on the first sum value and the second sum value to obtain an edge enhancement value; The edge enhancement value is superimposed with the interpolated pixel value of the central pixel point.
23. The image edge enhancement method according to claim 1, It is characterized in that Acquiring the target image includes: The original image is traversed using a preset pixel array as a template to obtain a plurality of target images.
24. An image sensor, It is characterized in that include: A pixel array and a filter array, wherein the filter array is arranged corresponding to the pixel array; A control unit, the control unit is connected to the pixel array, and is used to perform edge enhancement processing on the output image of the pixel array according to the image edge enhancement method according to any one of claims 1 to 23.
25. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed, the image edge enhancement method according to any one of claims 1 to 23 is implemented.
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
System and method for promoting marginal definition of video image
CN1545328A
Image signal processing apparatus, image signal processing method, and program
JP2017108314A
