Edge detection method and readable storage medium

The edge detection method for Quad Bayer Raw images directly processes the image through convolution and gradient calculations, addressing the loss and distortion issues of existing methods, resulting in improved accuracy and simplified calculations.

CN113989309BActive Publication Date: 2024-12-03HOWAY TECH (WUHAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111189000.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-12
Publication Date
2024-12-03
Estimated Expiration
2041-10-12

AI Technical Summary

Technical Problem

Existing methods for edge detection on the Quad Bayer image format fail to effectively utilize the edge detection on the Quad Bayer Raw image, leading to loss of original information and reduced accuracy due to conversion processes and separate channel detection.

Method used

An edge detection method that directly processes the Quad Bayer Raw image by performing convolution calculations on 2*2 pixel groups, calculating gradients, and determining edge pixels based on these gradients, using specific detection operators and thresholds.

Benefits of technology

This method maintains the original image information and achieves high accuracy by simplifying the calculation process and avoiding information loss, providing clearer and more accurate edge detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113989309B_ABST
    Figure CN113989309B_ABST
Patent Text Reader

Abstract

The present invention provides an edge detection method and a readable storage medium. The edge detection method comprises: performing convolution calculation based on a 2*2 pixel group as the center to obtain the convolution of convolution pixels, wherein the color channels of the original pixels in each of the 2*2 pixel groups are the same, and each of the convolution pixels corresponds to a 2*2 pixel group; calculating the gradient of the convolution pixel based on the convolution of the convolution pixel; judging whether the current convolution pixel is an edge pixel based on the gradient of the convolution pixel. Such a configuration solves the problem in the prior art of lacking a method for directly performing edge detection on the original information contained in the Quad Bayer Raw image. At the same time, the above method also has the beneficial effects of a simple calculation process and high accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image signal processing, and in particular to an edge detection method and a readable storage medium. Background Art

[0002] Quad Bayer is a "four-pixel-in-one" technology that uses the same color channel for four adjacent pixels to meet the needs of high resolution and high sensitivity, and supports high dynamic range photography. Currently, many image sensors use the Quad Bayer structure.

[0003] The Raw image generated based on the Quad Bayer structure is as follows Figure 1a As shown. Figure 1a In the image, the color channels of the adjacent four pixels are the same. For the convenience of description, the four adjacent pixels with the same color channels are called a 2*2 pixel group. The Raw image itself contains the most accurate original information of the image. However, in the prior art, when edge detection is performed on the Quad Bayer Raw image, it is necessary to first convert it into a traditional Bayer array image (such as Figure 1b ), or an RGB image (as Figure 1c As shown), and then it is calculated with some common edge detection algorithms.

[0004] The following are two common edge detection methods for Quad Bayer Raw images.

[0005] Method 1: Convert the QuadBayer Raw image into an RGB image through the remosaic (an algorithm for converting Quad Bayer Raw image into a traditional Bayer array image) algorithm and the demosaic (a method for converting a traditional Bayer array image into an RGB image) algorithm, and then perform edge detection based on the RGB image. The drawback of the above scheme is that the amount of calculation is large and it depends on the accuracy of the remosaic algorithm and the demosaic algorithm. The conversion process causes the original information of the image to be lost, and the edge detection accuracy is impaired.

[0006] Method 2: First, the Quad Bayer Raw image is converted into a traditional Bayer array image through the remosaic algorithm, and then the pixels are grouped according to the color channel (where the G channel is divided into the Gr channel and the Gb channel, a total of four channels: B, Gb, Gr, and R), and edge detection is performed on each channel. The results of the edge detection are then combined for judgment. Since the noise levels of different color channels are different, the thresholds for edge detection need to be set separately, which increases the complexity of detection; the detection results of the four channels may also affect the overall consistency of edge detection. In addition, there is still the problem of loss of original image information and loss of edge detection accuracy.

[0007] In summary, the prior art lacks a method for directly performing edge detection on the original information contained in the Quad Bayer Raw image. Summary of the invention

[0008] The object of the present invention is to provide an edge detection method and a readable storage medium to solve the problem in the prior art that there is a lack of a method for directly performing edge detection on the original information contained in a Quad Bayer Raw image.

[0009] In order to solve the above technical problems, the present invention provides an edge detection method applied to a Quad BayerRaw image, the edge detection method comprising:

[0010] Performing convolution calculation based on a 2*2 pixel group as the center to obtain a convolution of convolution pixels, wherein the color channels of the original pixels in each of the 2*2 pixel groups are the same, and each of the convolution pixels corresponds to one of the 2*2 pixel groups;

[0011] Calculating a gradient of the convolved pixel based on the convolution of the convolved pixel;

[0012] Whether the current convolution pixel is an edge pixel is determined based on the gradient of the convolution pixel.

[0013] Optionally, the step of determining whether the current convolution pixel is the edge pixel based on the gradient of the convolution pixel includes:

[0014] It is determined whether the gradient of the convolution pixel is greater than a first threshold value. If yes, it is determined that the current convolution pixel is the edge pixel.

[0015] Optionally, if it is determined that the gradient of the convolution pixel is less than or equal to the first threshold, the step of determining whether the current convolution pixel is the edge pixel based on the gradient of the convolution pixel further includes:

[0016] If the gradient of the convolution pixel is less than a second threshold, it is determined that the current convolution pixel is not the edge pixel;

[0017] If the gradient of the convolution pixel is greater than or equal to the second threshold and at least one of the remaining convolution pixels in the nine-square grid centered on the convolution pixel is the edge pixel, then it is determined that the current convolution pixel is the edge pixel;

[0018] If the gradient of the convolution pixel is greater than or equal to the second threshold and the remaining convolution pixels in the nine-square grid centered on the convolution pixel are not the edge pixels, it is determined that the current convolution pixel is not the edge pixel.

[0019] Optionally, the step of performing convolution calculation based on the 2*2 pixel group as the center to obtain the convolution pixel includes: performing convolution calculation with at least two detection operators respectively with the 2*2 pixel group as the center to obtain at least two convolutions of the convolution pixel.

[0020] The step of calculating the gradient of the convolution pixel based on the convolution of the convolution pixel includes: performing absolute value calculation, normalization operation and summation operation on the convolution pixel to obtain the gradient of the convolution pixel.

[0021] Optionally, the normalization operation step includes: dividing by the number of subtraction factors in the detection operator.

[0022] Optionally, the detection operator includes a horizontal detection operator, and when the color channel of the 2*2 pixel group is B or R, the horizontal detection operator is:

[0023]

[0024] When the color channel of the 2*2 pixel group is G, the horizontal detection operator is:

[0025]

[0026] Optionally, the detection operator includes a vertical detection operator, and when the color channel of the 2*2 pixel group is B or R, the vertical detection operator is:

[0027]

[0028] When the color channel of the 2*2 pixel group is G, the vertical detection operator is:

[0029]

[0030] Optionally, the detection operator includes a first 45° detection operator, a second 45° detection operator, and a third 45° detection operator. When the color channel of the 2*2 pixel group is B or R, the first 45° detection operator, the second 45° detection operator, and the third 45° detection operator are respectively:

[0031] and

[0032] When the color channel of the 2*2 pixel group is G, the first 45° detection operator, the second 45° detection operator and the third 45° detection operator are respectively:

[0033] and

[0034] Optionally, the detection operator includes a first 135° detection operator, a second 135° detection operator, and a third 135° detection operator. When the color channel of the 2*2 pixel group is B or R, the first 135° detection operator, the second 135° detection operator, and the third 135° detection operator are respectively:

[0035] and

[0036] When the color channel of the 2*2 pixel group is G, the first 135° detection operator, the second 135° detection operator and the third 135° detection operator are respectively:

[0037] and

[0038] In order to solve the above technical problem, the present invention further provides a readable storage medium, on which a program is stored, and when the program is run, the above edge detection method is executed.

[0039] Compared with the prior art, the present invention provides an edge detection method and a readable storage medium, wherein the edge detection method includes: performing convolution calculation based on a 2*2 pixel group as the center to obtain the convolution of convolution pixels, wherein the color channels of the original pixels in each of the 2*2 pixel groups are the same, and each of the convolution pixels corresponds to a 2*2 pixel group; calculating the gradient of the convolution pixel based on the convolution of the convolution pixel; judging whether the current convolution pixel is an edge pixel based on the gradient of the convolution pixel. Such a configuration solves the problem in the prior art of lacking a method for directly performing edge detection on the original information contained in the Quad Bayer Raw image. At the same time, the above method also has the beneficial effects of a simple calculation process and high accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Those skilled in the art will appreciate that the accompanying drawings are provided for a better understanding of the present invention and do not constitute any limitation on the scope of the present invention.

[0041] Figure 1a It is a schematic diagram of the pixel distribution of the Quad Bayer Raw image;

[0042] Figure 1b It is a schematic diagram of pixel distribution of a traditional Bayer array image;

[0043] Figure 1c It is a schematic diagram of an RGB image;

[0044] Figure 2 is a schematic flow chart of an edge detection method according to an embodiment of the present invention;

[0045] Figure 3a This is the first Quad Bayer Raw image used for testing;

[0046] Figure 3b The edge detection method of an embodiment of the present invention is Figure 3a The running results of the image shown;

[0047] Figure 3c It is a method in the prior art. Figure 3a The running results of the image shown;

[0048] Figure 3d It is a method in the prior art. Figure 3a The running results of the image shown;

[0049] Figure 4a This is the second Quad Bayer Raw image used for testing;

[0050] Figure 4b The edge detection method of an embodiment of the present invention is Figure 4a The running results of the image shown;

[0051] Figure 4c It is a method in the prior art. Figure 4a The running results of the image shown;

[0052] Figure 4d It is a method in the prior art. Figure 4a The running results of the image shown;

[0053] Figure 5a It is the third Quad Bayer Raw image used for testing;

[0054] Figure 5b The edge detection method of an embodiment of the present invention is Figure 5a The running results of the image shown;

[0055] Figure 5c It is a method in the prior art. Figure 5a The running results of the image shown;

[0056] Figure 5d It is a method in the prior art. Figure 5a The running results of the image shown;

[0057] Figure 6a It is the Quad Bayer Raw image that distinguishes the present invention from the prior art;

[0058] Figure 6b The edge detection method of an embodiment of the present invention is Figure 6a The running results of the image shown;

[0059] Figure 6c It is a method in the prior art. Figure 6a The running results of the image shown;

[0060] Figure 6d It is a method in the prior art. Figure 6a The image shown is the result of the operation. DETAILED DESCRIPTION

[0061] In order to make the purpose, advantages and features of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the drawings are all in a very simplified form and are not drawn to scale, and are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention. In addition, the structure shown in the drawings is often a part of the actual structure. In particular, the emphasis of each drawing is different, and sometimes different scales are used.

[0062] As used in the present invention, the singular forms "one", "an" and "the" include plural objects, the term "or" is generally used to include the meaning of "and / or", the term "several" is generally used to include the meaning of "at least one", and the term "at least two" is generally used to include the meaning of "two or more". In addition, the terms "first", "second" and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first", "second" and "third" may explicitly or implicitly include one or at least two of the features, "one end" and "the other end" and "the proximal end" and "the distal end" generally refer to two corresponding parts, which include not only the endpoints, and the terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral body; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. In addition, as used in the present invention, an element disposed on another element generally only indicates that there is a connection, coupling, cooperation or transmission relationship between the two elements, and the connection, coupling, cooperation or transmission between the two elements may be direct or indirect through an intermediate element, and cannot be understood as indicating or implying the spatial position relationship between the two elements, that is, one element may be in any orientation such as inside, outside, above, below or on one side of another element, unless otherwise clearly indicated in the content. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0063] The core idea of ​​the present invention is to provide an edge detection method and a readable storage medium to solve the problem in the prior art that there is a lack of a method for directly performing edge detection on the original information contained in the Quad Bayer Raw image.

[0064] The following description is given with reference to the accompanying drawings.

[0065] Please refer to Figures 1a to 6b ,in, Figure 1a It is a schematic diagram of the pixel distribution of the Quad Bayer Raw image; Figure 1b It is a schematic diagram of pixel distribution of a traditional Bayer array image; Figure 1c It is a schematic diagram of an RGB image; Figure 2 is a schematic flow chart of an edge detection method according to an embodiment of the present invention; Figure 3a This is the first Quad Bayer Raw image used for testing; Figure 3b The edge detection method of an embodiment of the present invention is Figure 3a The running results of the image shown; Figure 3cIt is a method in the prior art. Figure 3a The running results of the image shown; Figure 3d It is a method in the prior art. Figure 3a The running results of the image shown; Figure 4a This is the second Quad Bayer Raw image used for testing; Figure 4b The edge detection method of an embodiment of the present invention is Figure 4a The running results of the image shown; Figure 4c It is a method in the prior art. Figure 4a The running results of the image shown; Figure 4d It is a method in the prior art. Figure 4a The running results of the image shown; Figure 5a It is the third Quad Bayer Raw image used for testing; Figure 5b The edge detection method of an embodiment of the present invention is Figure 5a The running results of the image shown; Figure 5c It is a method in the prior art. Figure 5a The running results of the image shown; Figure 5d It is a method in the prior art. Figure 5a The running results of the image shown; Figure 6a It is the Quad Bayer Raw image that distinguishes the present invention from the prior art; Figure 6b The edge detection method of an embodiment of the present invention is Figure 6a The running results of the image shown; Figure 6c It is a method in the prior art. Figure 6a The running results of the image shown; Figure 6d It is a method in the prior art. Figure 6a The image shown is the result of the operation.

[0066] The background technology introduces the existing edge detection algorithms for Quad Bayer Raw images, wherein the idea of ​​method one is to perform edge recognition based on images in RGB format. Since the conversion of Quad Bayer Raw images to RGB images currently requires two conversion processes, the original information is lost seriously, and it is necessary to convert them into traditional Bayer array images first. The idea of ​​method two is to perform edge recognition based on traditional Bayer array images, so part of the original information is also lost. In addition, the technical bias of method two is that each color channel needs to be detected independently. Based on the above analysis, the understanding of those skilled in the art is that: "the step of converting the Quad Bayer Raw image into the traditional Bayer array image must appear in the edge detection process" and "the individual color channels need to be detected independently". The inventor of the present application has studied the specific data features of the Quad Bayer Raw image and proposed an edge detection method in combination with experimental data to overcome the above technical bias. The specific details of the method are described below.

[0067] like Figure 2 As shown, this embodiment provides an edge detection method applied to a Quad Bayer Raw image, and the edge detection method includes:

[0068] S10 performs convolution calculation based on the 2*2 pixel group as the center to obtain the convolution of the convolution pixels, wherein the color channels of the original pixels in each of the 2*2 pixel groups are the same, and each of the convolution pixels corresponds to one of the 2*2 pixel groups;

[0069] S20 calculates the gradient of the convolution pixel based on the convolution of the convolution pixel;

[0070] S30 determines whether the current convolution pixel is an edge pixel based on the gradient of the convolution pixel.

[0071] Quad Bayer is a special term in this field, which can be roughly understood as a four-in-one pixel structure. However, the Chinese description of "four-in-one pixel structure" is not exactly the same as the content referred to by "Quad Bayer". Therefore, the description of "Quad Bayer" is retained throughout this application, and those skilled in the art can understand the pixel structure described by "QuadBayer" and the internal structure of the image sensor that collects the pixel structure without any doubt. Raw image refers to the unprocessed original image obtained by the image sensor. However, the Chinese description of "raw image" is not exactly the same as the content referred to by "Raw". Therefore, the description of "Raw" is retained throughout this application, and those skilled in the art can understand the format and source of the image data described by "Raw" without any doubt.

[0072] Among them, the specific steps of convolution calculation and the specific steps of gradient calculation can be set by those skilled in the art according to common knowledge, and will not be described in detail here. In the image processing process, some of the 2*2 pixel groups are located at the edge position of the Quad Bayer Raw image. At this time, the pixel data required for the convolution calculation is incomplete. For such data, the existing processing methods in the field such as the mirror method and the copy method can be used for processing, or other logic can be used to directly perform amplitude calculation on the pixels at the above special positions. The specific processing measures are not limited here. In the above description, the concept of edge refers to the outer contour line of the image itself, and the meaning of the edge appearing in this application refers to the natural edge of the object captured in the image.

[0073] After being processed in step S10, the length and width of the original Quad Bayer Raw image are reduced to half of the original, because each of the 2*2 pixel groups is converted into one of the convolution pixels.

[0074] With such configuration, the edge detection method provided in this embodiment can directly process the original Quad BayerRaw image, thereby avoiding the loss and distortion of information during the image format conversion process in the prior art and simplifying the calculation steps.

[0075] Please refer to Figure 2 In one embodiment, the step S30 of determining whether the current convolution pixel is the edge pixel based on the gradient of the convolution pixel comprises:

[0076] S31 determines whether the gradient of the convolution pixel is greater than a first threshold value. If the result is yes, it is determined that the current convolution pixel is the edge pixel.

[0077] Need to understand, although Figure 2 In the disclosed embodiment, if the gradient of the convolution pixel is less than the first threshold, a more complex logic will be used for subsequent judgment. However, in some embodiments, step S30 may also include only step S31 and step S40, where step S40 is:

[0078] S40: If the gradient of the convolution pixel is less than the first threshold, it is determined that the current convolution pixel is not the edge pixel.

[0079] Although the judgment accuracy of the above embodiment is better than Figure 2 The described embodiment is low, but it can simplify the judgment steps and shorten the judgment time when the result accuracy requirement is not high, and should also be regarded as the protection scope of the technical solution of the present invention.

[0080] Please continue to refer to Figure 2 In a preferred embodiment, if it is determined that the gradient of the convolution pixel is less than or equal to the first threshold, the step of determining whether the current convolution pixel is the edge pixel based on the gradient of the convolution pixel further includes:

[0081] S32: if the gradient of the convolution pixel is less than a second threshold, determining that the current convolution pixel is not the edge pixel;

[0082] S33: if the gradient of the convolution pixel is greater than or equal to the second threshold and at least one of the remaining convolution pixels in the nine-square grid with the convolution pixel as the center is the edge pixel, then determine that the current convolution pixel is the edge pixel;

[0083] S34: If the gradient of the convolution pixel is greater than or equal to the second threshold and the remaining convolution pixels in the nine-square grid centered on the convolution pixel are not edge pixels, it is determined that the current convolution pixel is not the edge pixel.

[0084] It should be understood that when the convolution pixel is not at the edge position, the remaining convolution pixels in the nine-square grid are the eight convolution pixels in the eight directions of the top, bottom, left, right, upper left, lower left, upper right and lower right of the current convolution pixel. When the convolution pixel is at the edge position, the number of the remaining convolution pixels in the nine-square grid is less than eight, which is three (at the four vertices) or five (not at the four vertices). In the subsequent content of this specification, under the premise that there is no ambiguity, "the surrounding convolution pixels" will be used instead of "the remaining convolution pixels in the nine-square grid centered on the convolution pixel"

[0085] When it is necessary to determine whether the remaining convolution pixels are edge pixels, there may be an interlocking situation. For example, there are adjacent convolution pixels, numbered 1 and 2 respectively. When 1 determines whether the surrounding convolution pixels are edge pixels, 2 has not yet been determined. If 2 needs to be determined, it is necessary to first determine whether 1 is the edge pixel. In order to reduce the occurrence of this situation, the first round of judgment can be performed on all pixels, and all pixels whose results can be confirmed can be confirmed first. For example, pixels greater than the first threshold and pixels less than the second threshold, and pixels with at least one confirmed state and edge pixels around. Then the remaining interlocking conditions are processed. For example, any one of the following logics can be adopted: all the convolution pixels that have not yet had a judgment result are regarded as "not the edge pixel", the convolution pixels with a number less than their own number and have not yet had a judgment result are regarded as "not the edge pixel", and other logics are used to temporarily assign values ​​to the convolution pixels that have not yet had a judgment result. It should be understood that the above logic is only a way to handle the interlocking state, and other logics can also be used for processing in other embodiments.

[0086] It should be understood that if normalization is not performed during gradient calculation, different color channels correspond to different first thresholds, and different color channels correspond to different second thresholds; the color channel with a larger gain value has a larger threshold. The G channel carries the most information, and is used as the main source of edge detection. The gain value of this channel is used as an indicator for threshold selection.

[0087] In order to ensure the effectiveness of detection, in a preferred embodiment, the step of performing convolution calculation based on the 2*2 pixel group as the center to obtain the convolution pixel includes: S11 performing convolution calculation with at least two detection operators respectively with the 2*2 pixel group as the center to obtain at least two convolutions of the convolution pixel;

[0088] The step of calculating the gradient of the convolution pixel based on the convolution of the convolution pixel includes: S21 performing absolute value calculation, normalization operation and summation operation on the convolution pixel to obtain the gradient of the convolution pixel. It should be understood that the order of the above three can be swapped under the premise of ensuring the correctness of the result. For example, in the order of absolute value calculation, normalization operation and summation operation; in the order of normalization operation, absolute value calculation and summation operation; or in the order of absolute value calculation, summation operation and normalization operation.

[0089] The step of the normalization operation includes: dividing by the number of subtraction factors in the detection operator. The operator of the normalization operation is determined by the number of subtraction factors (-1) in the detection operator. In one embodiment, the number of subtraction operations in the detection operator (the number of -1 in the detection operator) is 8, and the normalization operation process is to divide by 8. The specific form of the detection operator can be understood by referring to the subsequent content of this specification.

[0090] In an exemplary embodiment, the detection operator used in the convolution calculation is a 6*6 operator.

[0091] The detection operator includes a horizontal detection operator. When the color channel of the 2*2 pixel group is B or R, the horizontal detection operator is:

[0092]

[0093] When the color channel of the 2*2 pixel group is G, the horizontal detection operator is:

[0094]

[0095] The detection operator includes a vertical detection operator. When the color channel of the 2*2 pixel group is B or R, the vertical detection operator is:

[0096]

[0097] When the color channel of the 2*2 pixel group is G, the vertical detection operator is:

[0098]

[0099] The detection operator includes a first 45° detection operator, a second 45° detection operator and a third 45° detection operator. When the color channel of the 2*2 pixel group is B or R, the first 45° detection operator, the second 45° detection operator and the third 45° detection operator are respectively:

[0100] and

[0101] When the color channel of the 2*2 pixel group is G, the first 45° detection operator, the second 45° detection operator and the third 45° detection operator are respectively:

[0102] and

[0103] The detection operator includes a first 135° detection operator, a second 135° detection operator and a third 135° detection operator. When the color channel of the 2*2 pixel group is B or R, the first 135° detection operator, the second 135° detection operator and the third 135° detection operator are respectively:

[0104] and

[0105] When the color channel of the 2*2 pixel group is G, the first 135° detection operator, the second 135° detection operator and the third 135° detection operator are respectively:

[0106] and

[0107] The above-mentioned horizontal, vertical, 45° and 135° refer to the detection direction of the detection operator. For example, the horizontal detection operator refers to an operator that detects in the horizontal direction, and the definitions of other detection operators can be understood in the same way. The sizes and specific values ​​of the above-mentioned detection operators are obtained by the inventors based on their in-depth understanding of the structure of Quad Bayer Raw image pixels and creative labor.

[0108] It should be understood that in different embodiments, for the sake of calculation accuracy, all of the above detection operators may be selected for detection calculation, or only a portion of the above detection operators may be selected for calculation, and a rough detection result may also be obtained.

[0109] In order to verify the actual effect of the above-mentioned embodiment, this application provides three test pictures, respectively as follows: Figure 3a , Figure 4a and Figure 5a As shown, the operating results of the three test images under an embodiment of the present invention and the operating results of the control group are respectively as follows Figure 3b , Figure 3c , Figure 3d , Figure 4b , Figure 4c , Figure 4d , Figure 5b , Figure 5c and Figure 5d As shown, method one is the method one introduced in the background technology of this application, and method two is the method two introduced in the background technology of this application.

[0110] Depend on Figure 3a to Figure 5dIt can be seen that, for different processing objects, the detection results of the first embodiment of the present invention are clearer and more accurate than the detection results of the first and second methods. This is because the original data of the Quad BayerRaw image is directly analyzed and processed in the embodiment of the present invention, thereby avoiding the information loss and distortion caused by the conversion process.

[0111] This embodiment also provides a method for distinguishing whether an edge detection method is an embodiment of the present invention. In the present invention, edge detection is centered on the 2*2 pixel group, and the G channel around the center is selected to participate in the edge detection calculation. The edge detection unit is 2*2. Overlapping is prone to occur for high-frequency single-pixel edge detection. Such data can be used to judge or doubt whether it is an embodiment of the present invention.

[0112] Please refer to Figure 6a , Figure 6a A test image is provided in which there are high-frequency alternating single-pixel edges, and such an image can be generated by a computer algorithm. Figure 6b~6d As shown in FIG. 1 , when the edge detection method of an embodiment of the present invention is used for processing, the pixel overlap phenomenon is obviously present in the processing result, while it is not present in the processing results of method 1 and method 2. Therefore, it can be solved by using a method similar to Figure 6a Whether the image distinguishing edge detection method is an embodiment of the present invention, or providing reference data for the distinction.

[0113] It should be understood that the judgment results of the above method are only reference results, not definitive results.

[0114] In order to solve the above technical problems, the present invention also provides a readable storage medium, on which a program is stored, and when the program is run, the above edge detection method is executed. The readable storage medium also has the beneficial effects of concise calculation process and high accuracy.

[0115] In summary, the present embodiment provides an edge detection method and a readable storage medium. The edge detection method comprises: performing convolution calculation based on a 2*2 pixel group as the center to obtain the convolution of convolution pixels, wherein the color channels of the original pixels in each of the 2*2 pixel groups are the same, and each of the convolution pixels corresponds to a 2*2 pixel group; calculating the gradient of the convolution pixel based on the convolution of the convolution pixel; judging whether the current convolution pixel is an edge pixel based on the gradient of the convolution pixel. Such a configuration solves the problem in the prior art of lacking a method for directly performing edge detection on the original information contained in the Quad Bayer Raw image. At the same time, the above method also has the beneficial effects of a simple calculation process and high accuracy.

[0116] The above description is only a description of the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any changes or modifications made by a person skilled in the art in the field of the present invention based on the above disclosure shall fall within the scope of protection of the technical solution of the present invention.

Claims

1. An edge detection method, characterized in that: Applied to Quad Bayer Raw images, the edge detection method includes: Performing convolution calculation based on a 2*2 pixel group as the center to obtain a convolution of convolution pixels, wherein the color channels of the original pixels in each of the 2*2 pixel groups are the same, and each of the convolution pixels corresponds to one of the 2*2 pixel groups; Calculating a gradient of the convolved pixel based on the convolution of the convolved pixel; Determining whether the current convolution pixel is an edge pixel based on the gradient of the convolution pixel; The step of performing convolution calculation based on the 2*2 pixel group as the center to obtain the convolution of the convolution pixel includes: performing convolution calculation with at least two detection operators respectively based on the 2*2 pixel group as the center to obtain at least two convolutions of the convolution pixel; The detection operators include at least two of a horizontal detection operator, a vertical detection operator, a first 45° detection operator, a second 45° detection operator, a third 45° detection operator, a first 135° detection operator, a second 135° detection operator, and a third 135° detection operator.

2. The edge detection method according to claim 1, characterized in that: The step of judging whether the current convolution pixel is the edge pixel based on the gradient of the convolution pixel comprises: It is determined whether the gradient of the convolution pixel is greater than a first threshold value. If yes, it is determined that the current convolution pixel is the edge pixel.

3. The edge detection method according to claim 2, characterized in that: If it is determined that the gradient of the convolution pixel is less than or equal to the first threshold, the step of determining whether the current convolution pixel is the edge pixel based on the gradient of the convolution pixel further includes: If the gradient of the convolution pixel is less than a second threshold, it is determined that the current convolution pixel is not the edge pixel; If the gradient of the convolution pixel is greater than or equal to the second threshold and at least one of the remaining convolution pixels in the nine-square grid centered on the convolution pixel is the edge pixel, then it is determined that the current convolution pixel is the edge pixel; If the gradient of the convolution pixel is greater than or equal to the second threshold and the remaining convolution pixels in the nine-square grid centered on the convolution pixel are not the edge pixels, it is determined that the current convolution pixel is not the edge pixel.

4. The edge detection method according to any one of claims 1 to 3, characterized in that: The step of calculating the gradient of the convolution pixel based on the convolution of the convolution pixel includes: performing absolute value calculation, normalization operation and summation operation on the convolution pixel to obtain the gradient of the convolution pixel.

5. The edge detection method according to claim 4, characterized in that: The step of normalizing comprises dividing by the number of subtraction factors in the detection operator.

6. The edge detection method according to claim 1, characterized in that: The detection operator includes the horizontal detection operator. When the color channel of the 2*2 pixel group is B or R, the horizontal detection operator is: When the color channel of the 2*2 pixel group is G, the horizontal detection operator is:

7. The edge detection method according to claim 1, characterized in that: The detection operator includes the vertical detection operator. When the color channel of the 2*2 pixel group is B or R, the vertical detection operator is: When the color channel of the 2*2 pixel group is G, the vertical detection operator is:

8. The edge detection method according to claim 1, characterized in that: The detection operator includes the first 45° detection operator, the second 45° detection operator and the third 45° detection operator. When the color channel of the 2*2 pixel group is B or R, the first 45° detection operator, the second 45° detection operator and the third 45° detection operator are respectively: When the color channel of the 2*2 pixel group is G, the first 45° detection operator, the second 45° detection operator and the third 45° detection operator are respectively:

9. The edge detection method according to claim 1, characterized in that: The detection operator includes the first 135° detection operator, the second 135° detection operator and the third 135° detection operator. When the color channel of the 2*2 pixel group is B or R, the first 135° detection operator, the second 135° detection operator and the third 135° detection operator are respectively: When the color channel of the 2*2 pixel group is G, the first 135° detection operator, the second 135° detection operator and the third 135° detection operator are respectively:

10. A readable storage medium, characterized in that: The readable storage medium stores a program, and when the program is run, the edge detection method according to any one of claims 1 to 9 is executed.