Correction method and device of phase detection pixel, electronic equipment and chip
By detecting and correcting abnormal pixels of phase detection pixels in the Quad Bayer camera sensor and correcting them in the texture area, the problem of abnormal photosensitive phase detection pixels is solved, and image quality and focus speed are improved.
Patent Information
- Application Number
- CN202311021710.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-14
- Publication Date
- 2025-02-21
AI Technical Summary
In the Quad Bayer camera sensor, the phase detection pixel is blocked and the photosensitive is abnormal, which causes the image signal processor to correct it, but because it consists of 4 pixels, the correction difficulty increases.
By determining whether the pixel to be processed is a preset phase detection pixel, if so, the pixels abnormally in the same channel are detected in the preset window, and the texture area corresponding to the phase detection pixel is determined, and the corrected pixel is used in this area for Correction.
It effectively solves the problem of phase detection pixel correction in Quad Bayer camera sensor, improves image quality, and ensures improvement in focus speed and image quality.
Smart Images

Figure CN119496887A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing, and in particular to a correction method, device, electronic equipment and chip for a phase detection pixel. Background Art
[0002] At present, human society's demand for scientific and technological products is increasing day by day, especially digital technology products with display devices such as mobile phones, cameras, televisions, and projectors. After meeting basic needs, users have put forward higher requirements for display quality, especially in the field of mobile phone photography. The pursuit of extreme image quality is endless.
[0003] Most cameras use phase focusing, which only requires one calculation to complete the focus, and the focusing speed is fast. However, this camera sensor needs to reserve some masked pixels, which are also called phase detection pixels. Phase detection pixels are used for phase focusing. Since the phase detection pixels are masked, the phase detection pixels are not normally sensitive to light, and the image signal processor (ISP) needs to correct the phase detection pixels. On a Quad Bayer camera sensor, since the phase detection pixels are composed of 4 pixels, it is more difficult to correct the phase detection pixels. Therefore, a phase detection pixel correction method based on a Quad Bayer camera sensor is needed. Summary of the invention
[0004] The present disclosure provides a correction method, device, electronic device and chip for phase detection pixels to solve the problems in the related art, and can correct the phase detection pixels based on Quad Bayer camera sensors.
[0005] A first aspect of the present disclosure provides a method for correcting a phase detection pixel, the method comprising:
[0006] Determine whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is a central pixel of a preset window;
[0007] When it is determined that the pixel to be processed is the preset phase detection pixel, detecting abnormal pixels in the same channel in the preset window, and correcting the abnormal pixels to obtain corrected pixels;
[0008] Determining a texture area corresponding to the preset phase detection pixel;
[0009] The preset phase detection pixels are corrected in the texture area using the corrected pixels.
[0010] In some embodiments of the present disclosure, the detecting of abnormal pixels in the same channel in the preset window includes:
[0011] Sorting all pixels in the preset window according to their numerical values;
[0012] Determine the maximum pixel value, the second maximum pixel value, the minimum pixel value and the second minimum pixel value in the preset window;
[0013] Calculate the difference between the minimum pixel value and the second minimum pixel value to obtain a first difference value;
[0014] Calculate the difference between the maximum pixel value and the second maximum pixel value to obtain a second difference value;
[0015] If it is determined that the first difference is smaller than the second difference, determining that the abnormal pixel is a pixel corresponding to the minimum pixel value;
[0016] If it is determined that the first difference is greater than or equal to the second difference, the abnormal pixel is determined to be a pixel corresponding to the maximum pixel value.
[0017] In some embodiments of the present disclosure, the correcting the abnormal pixel to obtain the corrected pixel includes:
[0018] Acquire all target pixels in the preset window except the maximum pixel value and the minimum pixel value;
[0019] Calculating the average value of all target pixels;
[0020] The abnormal pixel is corrected based on the average value of all the target pixels to obtain the corrected pixel.
[0021] In some embodiments of the present disclosure, the correcting the abnormal pixel to obtain the corrected pixel includes:
[0022] The abnormal pixel is linearly interpolated based on the maximum pixel value, the second maximum pixel value, the minimum pixel value, the second minimum pixel value, the first difference value, the second difference value and a preset threshold value to obtain the corrected pixel.
[0023] In some embodiments of the present disclosure, determining the texture area corresponding to the preset phase detection pixel includes:
[0024] In the preset window, respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction;
[0025] Determine a maximum value and a minimum value of the gradient value from the gradient values in the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction;
[0026] If a third difference between the maximum value of the gradient value and the minimum value of the gradient value satisfies a preset difference threshold, determining the direction of the minimum value of the gradient value as the edge direction of the preset window, and determining the area corresponding to the preset window as the edge area based on the edge direction;
[0027] If the third difference between the maximum value of the gradient value and the minimum value of the gradient value does not meet the preset difference threshold, it is determined that the area corresponding to the preset window is a flat area.
[0028] In some embodiments of the present disclosure, if the pixel to be processed is located in the B / R channel, respectively calculating the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction in the preset window includes:
[0029] A first preset algorithm is called to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction.
[0030] In some embodiments of the present disclosure, if the pixel to be processed is located in the G channel, respectively calculating the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction in the preset window includes:
[0031] A second preset algorithm is called to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction.
[0032] In some embodiments of the present disclosure, in the texture area, and the preset phase detection pixel is located in the B / R channel, correcting the preset phase detection pixel using the corrected pixel in the texture area includes:
[0033] Calculate in sequence the four color differences between the pixel in the same channel of the preset phase detection pixel and the pixel in the adjacent G channel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction for any pixel in the preset phase detection pixel; wherein the preset phase detection pixel includes four pixels;
[0034] Calculate a first total color difference value according to the four color differences and the first distance weights between the preset phase detection pixels and the pixels in the same channel;
[0035] Calculate the pixel values of the first G channel of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively;
[0036] The preset phase detection pixel is corrected according to the sum of the first total color difference value and the pixel values of the first G channel corresponding to the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively.
[0037] In some embodiments of the present disclosure, in the flat area, and the preset phase detection pixel is located in the B / R channel, correcting the preset phase detection pixel using the corrected pixel in the texture area includes:
[0038] Sequentially calculating eight color differences between pixels in the same channel as the preset phase detection pixel and pixels in adjacent G channels; calculating an average value of the eight color differences to obtain a second total color difference value;
[0039] Calculating a pixel value of a second G channel based on all pixels of the G channel adjacent to the preset phase detection pixel;
[0040] The preset phase detection pixel is corrected according to the sum of the second total color difference value and the pixel value of the second G channel.
[0041] In some embodiments of the present disclosure, in the texture area, and the preset phase detection pixel is located in the G channel, correcting the preset phase detection pixel using the corrected pixel in the texture area includes:
[0042] Calculating a first correction value of any pixel in the preset phase detection pixels in the horizontal direction according to the preset adjustable parameters;
[0043] Calculating a second correction value of any pixel in the preset phase detection pixels in the vertical direction according to the preset adjustable parameters;
[0044] Calculating a third correction value of any pixel among the preset phase detection pixels in the diagonal direction according to second distance weights between the preset phase detection pixels and the pixels in the same channel respectively;
[0045] Calculating a fourth correction value of any pixel among the preset phase detection pixels in the anti-diagonal direction according to third distance weights between the preset phase detection pixels and the pixels in the same channel respectively;
[0046] The preset phase detection pixel is corrected according to the first correction value, the second correction value, the third correction value and the fourth correction value.
[0047] In some embodiments of the present disclosure, in the flat area, and the preset phase detection pixel is located in the G channel, correcting the preset phase detection pixel using the corrected pixel in the texture area includes:
[0048] Calculating an average value of all pixel values adjacent to the preset phase detection pixel in the same channel as the preset phase detection pixel;
[0049] The preset phase detection pixel is corrected according to an average value between the adjacent pixel values.
[0050] In some embodiments of the present disclosure, before determining whether the pixel to be processed is a preset phase detection pixel, the process includes:
[0051] Determining whether the pixel to be processed can be used as the center of the preset window;
[0052] If it is determined that the pixel to be processed cannot be used as the center of the preset window, mirror image expansion processing is performed on the image to be processed based on the size of the preset window.
[0053] A second aspect of the present disclosure provides a correction device for a phase detection pixel, the device comprising:
[0054] A first judgment unit is used to judge whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is a central pixel of a preset window;
[0055] A detection unit, configured to detect abnormal pixels in the same channel in the preset window when it is determined that the pixel to be processed is the preset phase detection pixel;
[0056] A first correction unit, used for correcting the abnormal pixel to obtain a corrected pixel;
[0057] A determination unit, configured to determine a texture area corresponding to the preset phase detection pixel;
[0058] The second correction unit is configured to correct the preset phase detection pixels in the texture area using the corrected pixels.
[0059] In some embodiments of the present disclosure, the detection unit includes:
[0060] A sorting module, used to sort all pixels in the preset window according to their numerical values;
[0061] A first determination module is used to determine the maximum pixel value, the second maximum pixel value, the minimum pixel value and the second minimum pixel value in the preset window;
[0062] A calculation module, used for calculating the difference between the minimum pixel value and the second minimum pixel value to obtain a first difference value;
[0063] The calculation module is further used to calculate the difference between the maximum pixel value and the second maximum pixel value to obtain a second difference value;
[0064] A second determination module, configured to determine that the abnormal pixel is a pixel corresponding to a pixel minimum value when it is determined that the first difference is smaller than the second difference;
[0065] The second determination module is further configured to, when it is determined that the first difference is greater than or equal to the second difference, determine that the abnormal pixel is a pixel corresponding to a pixel maximum value.
[0066] In some embodiments of the present disclosure, the first correction unit includes:
[0067] An acquisition module, used for acquiring all target pixels in the preset window except the maximum pixel value and the minimum pixel value;
[0068] A calculation module, used for calculating the average value of all target pixels;
[0069] A correction module is used to correct the abnormal pixel based on the average value of all the target pixels to obtain the corrected pixel.
[0070] In some embodiments of the present disclosure, the first correction unit further includes:
[0071] An interpolation module is used to perform linear interpolation on the abnormal pixel based on the maximum pixel value, the second maximum pixel value, the minimum pixel value, the second minimum pixel value, the first difference value, the second difference value and a preset threshold value to obtain the corrected pixel.
[0072] In some embodiments of the present disclosure, the determining unit includes:
[0073] A calculation module, used to calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction in the preset window respectively;
[0074] A first determination module is used to determine a maximum gradient value and a minimum gradient value from the gradient values in the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction;
[0075] A second determining module is used to determine that the direction of the minimum value of the gradient value is the edge direction of the preset window when a third difference between the maximum value of the gradient value and the minimum value of the gradient value meets a preset difference threshold;
[0076] The second determining module is further configured to determine, based on the edge direction, that the area corresponding to the preset window is an edge area;
[0077] The second determination module is further configured to determine that the area corresponding to the preset window is a flat area when a third difference between the maximum value of the gradient and the minimum value of the gradient does not satisfy the preset difference threshold.
[0078] In some embodiments of the present disclosure, the calculation module in the determination unit is further used to call a first preset algorithm to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction.
[0079] In some embodiments of the present disclosure, the calculation module in the determination unit is further used to call a second preset algorithm to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction.
[0080] In some embodiments of the present disclosure, the second correction unit includes:
[0081] A first calculation module is used to sequentially calculate four color differences between any pixel in the preset phase detection pixels and a pixel in the same channel of the preset phase detection pixel and a pixel in an adjacent G channel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction, respectively; wherein the preset phase detection pixel includes four pixels;
[0082] The first calculation module is further used to calculate a first total color difference value according to the four color differences and the first distance weights between the preset phase detection pixels and the same channel pixels respectively;
[0083] A second calculation module, used to calculate the pixel values of the first G channel of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively;
[0084] The correction module is used to correct the preset phase detection pixel according to the sum of the first total color difference value and the pixel values of the first G channel corresponding to the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively.
[0085] In some embodiments of the present disclosure, in the second correction unit:
[0086] The first calculation module is further used to sequentially calculate eight color differences between pixels in the same channel as the preset phase detection pixel and pixels in adjacent G channels; calculate an average value of the eight color differences to obtain a second total color difference value;
[0087] The second calculation module is further used to calculate the pixel value of the second G channel based on all pixels of the G channel adjacent to the preset phase detection pixel;
[0088] The correction module is further configured to correct the preset phase detection pixel according to a sum of the second total color difference value and the pixel value of the second G channel.
[0089] In some embodiments of the present disclosure, the second correction unit further includes:
[0090] A third calculation module, configured to calculate a first correction value of any pixel in the preset phase detection pixels in the horizontal direction according to a preset adjustable parameter;
[0091] The third calculation module is further used to calculate, according to a preset adjustable parameter, a second correction value of any pixel in the preset phase detection pixels in the vertical direction;
[0092] The third calculation module is further used to calculate a third correction value of any pixel in the preset phase detection pixels in the diagonal direction according to the second distance weights between the preset phase detection pixels and the pixels in the same channel respectively;
[0093] The third calculation module is further used to calculate a fourth correction value of any pixel in the preset phase detection pixels in the anti-diagonal direction according to a third distance weight between the preset phase detection pixels and the pixels in the same channel respectively;
[0094] The correction module is further configured to correct the preset phase detection pixel according to the first correction value, the second correction value, the third correction value, and the fourth correction value.
[0095] In some embodiments of the present disclosure, the second correction unit further includes:
[0096] A fourth calculation module, used to calculate an average value between all pixel values adjacent to the preset phase detection pixel in the same channel as the preset phase detection pixel;
[0097] The correction module is further configured to correct the preset phase detection pixel according to an average value between the adjacent pixel values.
[0098] In some embodiments of the present disclosure, the device further comprises:
[0099] A second judging unit, used to judge whether the pixel to be processed can be used as the center of the preset window;
[0100] The edge expansion unit is used to perform mirror edge expansion processing on the image to be processed based on the size of the preset window when it is determined that the pixel to be processed cannot be used as the center of the preset window.
[0101] The third aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect embodiment of the present disclosure.
[0102] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.
[0103] The fifth aspect embodiment of the present disclosure proposes a chip, which includes one or more interfaces and one or more processors; the interface is used to receive signals from a memory of an electronic device and send signals to the processor, the signals include computer instructions stored in the memory, and when the processor executes the computer instructions, the electronic device executes the method described in the first aspect embodiment of the present disclosure.
[0104] In summary, according to the correction method, device, electronic device and chip of phase detection pixels proposed in the present disclosure, it is determined whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is the center pixel of a preset window; when it is determined that the pixel to be processed is the preset phase detection pixel, the abnormal pixels of the same channel in the preset window are detected, and the abnormal pixels are corrected to obtain the corrected pixels; the texture area corresponding to the preset phase detection pixel is determined; and the preset phase detection pixel is corrected using the corrected pixels in the texture area. Compared with the related art, the scheme of the present disclosure corrects the preset phase detection pixels by detecting and correcting the abnormal pixels of the phase detection pixels and determining the texture area of the phase detection pixels, and can be applied to Quad Bayer camera sensors to correct the phase detection pixels of Quad Bayer camera sensors.
[0105] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0106] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0107] Figure 1 A flowchart of a method for correcting a phase detection pixel provided by an embodiment of the present disclosure;
[0108] Figure 2A schematic diagram of abnormal pixel positions in a window provided by an embodiment of the present disclosure;
[0109] Figure 3 A schematic diagram of abnormal pixel positions in a window provided by an embodiment of the present disclosure;
[0110] Figure 4 A schematic diagram of a phase detection pixel located in a B / R channel provided in an embodiment of the present disclosure;
[0111] Figure 5 A schematic diagram of a phase detection pixel located in a G channel provided in an embodiment of the present disclosure;
[0112] Figure 6 A flowchart of a method for correcting a phase detection pixel provided by an embodiment of the present disclosure;
[0113] Figure 7 A flowchart of a method for correcting a phase detection pixel provided by an embodiment of the present disclosure;
[0114] Figure 8 A flowchart of a method for correcting a phase detection pixel provided by an embodiment of the present disclosure;
[0115] Fig. 9 A flowchart of a method for correcting a phase detection pixel provided by an embodiment of the present disclosure;
[0116] Fig.10 A flowchart of a method for correcting a phase detection pixel provided by an embodiment of the present disclosure;
[0117] Fig.11 A schematic diagram of an image mirroring and edge expansion method provided in an embodiment of the present disclosure;
[0118] Fig.12 A schematic diagram of a digital and flat area correction effect provided by an embodiment of the present disclosure;
[0119] Fig.13 A schematic diagram of an arc area correction effect provided by an embodiment of the present disclosure;
[0120] Fig.14 A schematic diagram of a high-frequency texture area correction effect provided by an embodiment of the present disclosure;
[0121] Fig.15 A schematic structural diagram of a phase detection pixel correction device provided in an embodiment of the present disclosure;
[0122] Fig.16 A schematic structural diagram of a phase detection pixel correction device provided in an embodiment of the present disclosure;
[0123] Fig.17A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;
[0124] Fig.18 A schematic diagram of the structure of a chip provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0125] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0126] At present, human society's demand for scientific and technological products is increasing day by day, especially digital technology products with display devices such as mobile phones, cameras, televisions, and projectors. After meeting basic needs, users have put forward higher requirements for display quality, especially in the field of mobile phone photography. The pursuit of extreme image quality is endless.
[0127] Most cameras use phase focusing, which only requires one calculation to complete the focus, and the focusing speed is fast. However, this camera sensor needs to reserve some masked pixels, which are also called phase detection pixels. Phase detection pixels are used for phase focusing. Since the phase detection pixels are masked, the phase detection pixels are not normally sensitive to light, and the image signal processor (ISP) needs to correct the phase detection pixels. On a Quad Bayer camera sensor, since the phase detection pixels are composed of 4 pixels, it is more difficult to correct the phase detection pixels. Therefore, a phase detection pixel correction method based on a Quad Bayer camera sensor is needed. .
[0128] Therefore, in order to solve the problems existing in the related art, the present disclosure proposes a correction method, device, electronic device and chip for phase detection pixels, by judging whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is the center pixel of a preset window; when it is determined that the pixel to be processed is the preset phase detection pixel, the abnormal pixels of the same channel in the preset window are detected, and the abnormal pixels are corrected to obtain corrected pixels; the texture area corresponding to the preset phase detection pixel is determined; and the preset phase detection pixel is corrected using the corrected pixel in the texture area.
[0129] The scheme corrects phase detection pixels by detecting and correcting abnormal pixels of phase detection pixels and determining the texture area of phase detection pixels. It can be applied to Quad Bayer camera sensors to correct the phase detection pixels of QuadBayer camera sensors.
[0130] The embodiments of the present disclosure are not exhaustive, but are merely illustrative of some embodiments, and are not intended to be a specific limitation on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a certain embodiment can also be implemented as an independent embodiment, and the order of the steps in a certain embodiment can be arbitrarily exchanged. In addition, the optional implementation methods in a certain embodiment can be arbitrarily combined; in addition, the embodiments can be arbitrarily combined, for example, some or all of the steps of different embodiments can be arbitrarily combined, and a certain embodiment can be arbitrarily combined with the optional implementation methods of other embodiments.
[0131] In each embodiment of the present disclosure, unless otherwise specified or there is a logical conflict, the terms and / or descriptions between the embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form a new embodiment based on their internal logical relationships.
[0132] The terms used in the embodiments of the present disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure.
[0133] In the embodiments of the present disclosure, unless otherwise specified, elements expressed in the singular form, such as "a", "an", "the", "above", "said", "aforementioned", "this", etc., may mean "one and only one", or "one or more", "at least one", etc. For example, when using articles such as "a", "an", "the" in English in translation, the noun after the article may be understood as a singular expression or a plural expression.
[0134] In some embodiments, terms such as "in response to ...", "in response to determining ...", "in the case of ...", "at the time of ...", "when ...", "if ...", "if ...", etc. can be used interchangeably.
[0135] In some embodiments, terms such as "greater than", "greater than or equal to", "not less than", "more than", "more than or equal to", "not less than", "higher than", "higher than or equal to", "not lower than", and "above" can be replaced with each other, and terms such as "less than", "less than or equal to", "not greater than", "less than", "less than or equal to", "no more than", "lower than", "lower than or equal to", "not higher than", and "below" can be replaced with each other.
[0136] The prefixes such as "first" and "second" in the embodiments of the present disclosure are only for distinguishing different description objects and do not constitute any restrictions on the position, order, priority, quantity or content of the description objects. For the statement of the description objects, please refer to the description in the context of the claims or embodiments, and no unnecessary restrictions should be constituted due to the use of prefixes.
[0137] In the embodiments of the present disclosure, “plurality” refers to two or more.
[0138] In the embodiments of the present disclosure, terms such as "import", "input", and "read in" can be used interchangeably.
[0139] In some embodiments, devices, etc. can be interpreted as physical or virtual, and their names are not limited to the names recorded in the embodiments. Terms such as "device", "equipment", "device", "circuit", "network element", "node", "function", "unit", "section", "system", "network", "chip", "chip system", "entity", and "subject" can be used interchangeably.
[0140] In some embodiments, the terms "terminal", "terminal device", "user equipment (UE)", "user terminal" "mobile station (MS)", "mobile terminal (MT)", subscriber station, mobile unit, subscriber unit, wireless unit, remote unit, mobile device, wireless device, wireless communication device, remote device, mobile subscriber station, access terminal, mobile terminal, wireless terminal, remote terminal, handset, user agent, mobile client, client and the like can be used interchangeably.
[0141] Figure 1 This is a flow chart of a phase detection pixel correction method provided by an embodiment of the present disclosure. This method can be applied to any application scenario such as any smart terminal carrying a camera, such as digital image chip processing using a Quad Bayer sensor or digital image processing in the hardware and software end of industrial camera imaging, and the design and development process of the ISP Pipeline, which is not limited by the present disclosure. Figure 1 As shown, the method includes:
[0142] Step 101, determining whether a pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is a central pixel of a preset window.
[0143] In the embodiment of the present disclosure, the pixel to be processed is first judged. If the pixel to be processed is not a preset phase detection pixel, the terminal does not need to perform correction processing on the pixel to be processed, and can directly output the image according to the pixel to be processed; if the pixel to be processed is a preset phase detection pixel, it is necessary to correct the preset phase detection pixel and then output the image according to the corrected pixel to ensure the quality of the image output.
[0144] Among them, the preset phase detection pixel is a special pixel, which is a shielded pixel point reserved by the sensor, also called a phase point. Since the preset phase detection pixel is shielded, the pixel is not normally sensitive to light and only one side of the light can pass through. Therefore, in order to normally output a high-quality image, the preset phase detection pixel needs to be corrected. The preset window is a pixel window with the pixel to be processed as the center pixel, for example: an 8*8 pixel window, etc. Specifically, the size of the preset window is not limited by this disclosure.
[0145] It should be noted here that the method for determining whether the pixel to be processed is a preset phase detection pixel can be implemented in the following manner but is not limited to: based on the known minimum periodic arrangement of the phase detection pixels, the coordinates of the phase detection pixel are calculated and compared with the coordinates of the pixel to be processed. If the coordinate comparison results are consistent, it is determined that the pixel to be processed is the preset phase detection pixel; if the coordinate comparison results are inconsistent, it is determined that the pixel to be processed is not the preset phase detection pixel. Among them, the known minimum periodic arrangement of the phase detection pixels can be directly determined by the description in the relevant documents, and the calculation of the coordinates of the phase detection pixels can refer to the description in the relevant technology, so they will not be repeated here.
[0146] Step 102: When it is determined that the pixel to be processed is the preset phase detection pixel, detect abnormal pixels in the same channel in the preset window, and correct the abnormal pixels to obtain corrected pixels.
[0147] In the embodiment of the present disclosure, the arrangement of the preset phase detection pixels in the preset window is different when the central pixel of the preset window is located in different channels, and the channels include but are not limited to: B / R channel, G channel, etc. Among them, the abnormal pixel is an abnormal point of the preset phase detection pixel in the preset window, and the abnormal point needs to be corrected before the correction of the preset phase detection pixel can be performed normally.
[0148] Regarding the abnormal pixels in the same channel in the preset window, the embodiment of the present disclosure provides a window abnormal pixel position map, such as Figure 2 as well as Figure 3 As shown, Figure 2 is an abnormal pixel position map where the central pixel of the preset window is located in the B / R channel, Figure 3 The center pixel of the preset window is located in the abnormal pixel position map of the G channel. The pixel to be detected is Figure 2 as well as Figure 3 Pixels P0-P15 in.
[0149] Step 103: Determine the texture area corresponding to the preset phase detection pixel.
[0150] In the embodiment of the present disclosure, the texture area is the texture position of the preset phase detection pixel in the preset window. Since the preset phase detection pixel has a better effect of interpolation along the edge when it is located at the edge texture in the preset window, it is necessary to determine the texture area corresponding to the preset phase detection pixel to accurately predict the edge direction and achieve a better correction effect. The texture area is divided into: a flat area and an edge area.
[0151] Step 104: calibrate the preset phase detection pixels in the texture area using the calibrated pixels.
[0152] In the embodiment of the present disclosure, when correcting the preset phase detection pixels, different channels and different texture areas correspond to different correction methods. Therefore, the correction of the preset phase detection pixels is divided into: B / R channel edge area correction, B / R channel flat area correction, G channel edge area correction and G channel flat area correction. At the same time, before correction, the channel where the preset phase detection pixel is located needs to be calculated based on the preset phase detection pixel coordinates and the Bayer pattern.
[0153] Regarding the correction of the preset phase detection pixel, the embodiment of the present disclosure provides a phase detection pixel schematic diagram, such as Figure 4 as well as Figure 5 As shown, Figure 4 is a schematic diagram of the preset phase detection pixel being located in the B / R channel, Figure 5 It is a schematic diagram of the preset phase detection pixel being located in the G channel.
[0154] In summary, according to the correction method of phase detection pixels proposed in the present disclosure, it is determined whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is the center pixel of a preset window; when it is determined that the pixel to be processed is the preset phase detection pixel, the abnormal pixels of the same channel in the preset window are detected, and the abnormal pixels are corrected to obtain the corrected pixels; the texture area corresponding to the preset phase detection pixel is determined; and the preset phase detection pixel is corrected using the corrected pixels in the texture area. Compared with the related art, the scheme of the present disclosure corrects the preset phase detection pixel by detecting and correcting the abnormal pixels of the phase detection pixel and determining the texture area of the phase detection pixel, and can be applied to a Quad Bayer camera sensor to correct the phase detection pixels of the Quad Bayer camera sensor.
[0155] In some embodiments of the present disclosure, based on Figure 1In the embodiment shown, step 102 is further explained. Regarding the detection of abnormal pixels in the same channel in the preset window, it can be implemented in the following manner but not limited to: sorting all pixels in the preset window according to the numerical value; determining the maximum pixel value v_max, the second largest pixel value v_second_max, the minimum pixel value v_min and the second smallest pixel value v_second_min in the preset window; calculating the difference between the minimum pixel value and the second smallest pixel value to obtain a first difference value diff1; calculating the difference between the maximum pixel value and the second largest pixel value to obtain a second difference value diff2; if it is determined that the first difference value is less than the second difference value, determining that the abnormal pixel is the pixel corresponding to the minimum pixel value; if it is determined that the first difference value is greater than or equal to the second difference value, determining that the abnormal pixel is the pixel corresponding to the maximum pixel value.
[0156] In summary, by determining the first difference between the minimum pixel value and the second minimum pixel value in the preset window, and the second difference between the maximum pixel value and the second maximum pixel value, the abnormal pixel can be determined more accurately to improve the detection effect of abnormal pixels in the same channel in the preset window.
[0157] In some embodiments of the present disclosure, based on Figure 1 The embodiment shown further explains step 102, and the methods for correcting the abnormal pixel to obtain the corrected pixel include but are not limited to: Method 1: correcting the abnormal pixel by averaging the target pixel after eliminating the maximum value of the pixel and the minimum value of the pixel; Method 2: correcting the abnormal pixel by linear interpolation using the secondary value, the maximum value, the difference and a given threshold.
[0158] Among them, regarding method one, it can be implemented by but not limited to the following methods: obtaining all target pixels in the preset window except the pixel maximum value and the pixel minimum value; calculating the average value of all target pixels; correcting the abnormal pixels based on the average value of all target pixels to obtain the corrected pixels.
[0159] Related to the above embodiment, regarding the second method, it can also be implemented in the following manner but is not limited to: based on the pixel maximum value v_max, the pixel second maximum value v_second_max, the pixel minimum value v_min, the pixel second minimum value v_second_min, the first difference diff1, the second difference diff2 and the preset threshold thre, the abnormal pixel is linearly interpolated to obtain the corrected pixel. The preset threshold is a value set by a user. Specifically, the setting of the preset threshold is not limited in the embodiment of the present disclosure.
[0160] In summary, through the above two methods of correcting the abnormal pixels, the correction of the abnormal pixels is achieved, and the correction effect and correction efficiency of the abnormal pixels are improved.
[0161] In some embodiments of the present disclosure, as a further explanation of step 103, the determination of the texture area corresponding to the preset phase detection pixel can be implemented in but not limited to the following manner: respectively calculating the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction in the preset window; determining the maximum gradient value and the minimum gradient value from the gradient values in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction; if the third difference between the maximum gradient value and the minimum gradient value meets the preset difference threshold, determining the direction of the minimum gradient value as the edge direction of the preset window; determining the area corresponding to the preset window as the edge area based on the edge direction; if the third difference between the maximum gradient value and the minimum gradient value does not meet the preset difference threshold, determining the area corresponding to the preset window as a flat area.
[0162] Among them, the diagonal direction is a 45° direction, the anti-diagonal direction is a 135° direction, the third difference is a multiple of the difference between the maximum value of the gradient value and the minimum value of the gradient value, the preset difference threshold is a multiple threshold set by a custom setting, and the third difference satisfies the preset difference threshold, which means that the multiple of the difference between the maximum value of the gradient value and the minimum value of the gradient value satisfies the preset difference threshold. Specifically, regarding the difference threshold, the embodiment of the present disclosure is not limited.
[0163] In summary, by determining the gradient values of the preset phase detection pixels in four directions and the third difference between the maximum value of the gradient value and the minimum value of the gradient value, the texture area corresponding to the preset phase detection pixel is determined, the edge direction can be accurately predicted, and a better correction effect can be achieved.
[0164] In some embodiments of the present disclosure, associated with the above embodiments, due to different channels, the arrangement of the preset phase detection pixels in the preset window is different. Therefore, when calculating the gradient values of the preset phase detection pixels in four directions in the preset window, it includes but is not limited to: Method 1: the calculation method when the preset phase detection pixel is located in the B / R channel; Method 2: the calculation method when the preset phase detection pixel is located in the G channel. Regarding Method 1, the calculation method when the preset phase detection pixel is located in the B / R channel can be implemented in the following manner but is not limited to: calling the first preset algorithm to calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction respectively.
[0165] The first preset algorithm is a method for calculating the gradient value when the preset phase detection pixel is located in the B / R channel. Regarding calling the first preset algorithm to calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction respectively, it can be implemented in but not limited to the following ways: When the preset phase detection pixel is located in the B / R channel, as above Figure 2 As shown, the first preset algorithm is called to calculate the gradient values in four directions: horizontal direction (edge_h), vertical direction (edge_v), diagonal direction (edge_45) and anti-diagonal direction (edge_135). The formula of the first preset algorithm is as follows:
[0166] edge_h=abs(value[0]-value[1])+abs(value[1]-value[4]) / 3+abs(value[4]-value[5])+
[0167] abs(value[2]-value[3])+abs(value[3]-value[6]) / 3+abs(value[6]-value[7])
[0168] edge_v=abs(value[8]-value
[10] )+abs(value
[10] -value
[12] ) / 3+abs(value
[12] -value
[14] )+
[0169] abs(value[9]-value
[11] )+abs(value
[11] -value
[13] ) / 3+abs(value
[13] -value
[15] )
[0170] edge_45=abs(value[9]-value
[10] )+abs(value
[10] -value[1])+abs(value[1]-value[2])+
[0171] abs(value[5]-value[6])+abs(value[6]-value
[13] )+abs(value
[13] -value
[14] )
[0172] edge_135=abs(value[8]-value
[11] )+abs(value
[11] -value[4])+abs(value[4]-value[7])+
[0173] abs(value[0]-value[3])+abs(value[3]-value
[12] ) / 3+abs(value
[12] -value
[15] )
[0174] In the above formula, value[0] is Figure 2 Similarly, value[0] to value
[15] correspond to pixel P0 in Figure 2 Pixels P0 to P15 in.
[0175] Regarding method 2: the calculation method when the preset phase detection pixel is located in the G channel can be implemented by but not limited to the following method: calling the second preset algorithm to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction.
[0176] The second preset algorithm is a method for calculating the gradient value when the preset phase detection pixel is located in the G channel. Regarding calling the second preset algorithm to calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction respectively, it can be implemented in the following manner but not limited to: when the preset phase detection pixel is located in the G channel, as above Figure 3 As shown, the second preset algorithm is called to calculate the gradient values in four directions: horizontal direction (edge_h), vertical direction (edge_v), diagonal direction (edge_45) and anti-diagonal direction (edge_135). The formula of the second preset algorithm is as follows:
[0177] edge_h=abs(value[2]-value[3])+abs(value[3]-value[6]) / 3+abs(value[6]-value[7])+
[0178] abs(value[8]-value[9])+abs(value[9]-value
[12] ) / 3+abs(value
[12] -value
[13] )
[0179] edge_v=abs(value[1]-value[3])+abs(value[3]-value[9]) / 3+abs(value[9]-value
[11] )+
[0180] abs(value[4]-value[6])+abs(value[6]-value
[12] ) / 3+abs(value
[12] -value
[14] )
[0181] edge_45=abs(value[1]-value[2])+abs(value[5]-value[6])+abs(value[9]-value
[10] )+
[0182] abs(value
[13] -value
[14] )+abs(value[6]-value[9]) / 3
[0183] edge_135=abs(value[0]-value[3])+abs(value[4]-value[7])+abs(value[8]-value
[11] )+
[0184] abs(value
[12] -value
[15] )+abs(value[3]-value
[12] ) / 3
[0185] In the above formula, value[0] is Figure 3 Similarly, value[0] to value
[15] correspond to pixel P0 in Figure 3 Pixels P0 to P15 in.
[0186] In summary, by determining the gradient values of the preset phase detection pixels in four directions and the third difference between the maximum value of the gradient value and the minimum value of the gradient value, the texture area corresponding to the preset phase detection pixel is determined, the edge direction can be accurately predicted, and a better correction effect can be achieved.
[0187] In some embodiments of the present disclosure, Figure 6 A flow chart of a phase detection pixel correction method proposed in the present disclosure is further shown. Figure 6 The following steps may be included:
[0188] Step 601, sequentially calculating four color differences between any pixel in the preset phase detection pixel and the pixel in the same channel of the preset phase detection pixel and the pixel in the adjacent G channel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction respectively; wherein the preset phase detection pixel includes four pixels.
[0189] The embodiment of the present disclosure is to correct the preset phase detection pixel located at the edge area of the B / R channel, which can be used Figure 4 Take this as an example to illustrate, where Figure 4 As shown, the pixels that need to be corrected are B1, B2, B3 and B4. Regarding the calculation of the four color differences, the following methods may be used but are not limited to: Figure 4 , taking the calculation of the horizontal color difference of pixel B1 as an example, the formula is as follows:
[0190] diff1_h1=5-G1
[0191] diff1_h2=7-G6
[0192] diff1_h3=6-G3
[0193] diff1_h4=8-G8
[0194] Taking the calculation of the vertical color difference of pixel B2 as an example, the formula is as follows:
[0195] diff2_1=B5-G1
[0196] diff2_2=B7-G6
[0197] diff2_3=B6-G3
[0198] diff2_4=B8-G8
[0199] Taking the calculation of the color difference of pixel B3 in the diagonal direction as an example, the formula is as follows:
[0200] diff3_1=B10-G9
[0201] diff3_2=B6-G1
[0202] diff3_3=B7-G8
[0203] diff3_4=B11-G16
[0204] Taking the calculation of the color difference of pixel B4 in the anti-diagonal direction as an example, the formula is as follows:
[0205] diff4_1=B9-G10
[0206] diff4_2=B5-G3
[0207] diff4_3=B8-G6
[0208] diff4_4=B12-G15
[0209] Step 602: Calculate a first total color difference value according to the four color differences and the first distance weights between the preset phase detection pixels and the pixels in the same channel.
[0210] In the embodiments of the present disclosure, Figure 4 As shown, the pixels that need to be corrected are B1, B2, B3 and B4. Regarding calculating the first total color difference, the following method may be used but is not limited to: Figure 4 , taking the calculation of the horizontal color difference of pixel B1 as an example, the formula is as follows:
[0211] diff1_h=(diff1_h1*6+diff1_h2*4+iff1_h3*4+diff1_h4*2) / 16
[0212] The calculation method of the formula is: Regarding the color difference in the horizontal direction, refer to Figure 4 , where the B / R channel pixel in the horizontal direction closest to pixel B1 is pixel B5, followed by B7, B6, and B8. The closer to pixel B1, the greater the color difference weight. The weights are 6, 4, 4, and 2 from large to small. This weight is a custom weight set when calculating the color difference in the horizontal direction. The weight size is based on the distance from the phase detection pixel to be corrected. The closer the distance, the greater the weight. Since the number of pixels in the preset window is 16, the weight must satisfy the sum of the weights to be 16.
[0213] Taking the calculation of the vertical color difference of pixel B2 as an example, the formula is as follows:
[0214] diff2_=(diff2_1*4+diff2_2*2+diff2_3*6+diff2_4*4) / 16
[0215] The calculation method of the formula is: Regarding the color difference in the vertical direction, refer to Figure 4 , where the B / R channel pixel closest to pixel B2 is pixel B7, followed by B5, B8, and B6. The closer to pixel B2, the greater the color difference weight. The weights are 6, 4, 4, and 2 from large to small. This weight is the custom weight when calculating the vertical color difference. For the setting of the weight, please refer to the above explanation of calculating the horizontal color difference of pixel B1, so I will not repeat them here.
[0216] Taking the calculation of the color difference of pixel B3 in the diagonal direction as an example, the formula is as follows:
[0217] diff3_=(diff3_1+diff3_2+diff3_3+diff3_4) / 5
[0218] The calculation method of the formula is: Regarding the color difference in the diagonal direction, refer to Figure 4 , where the weights are all 1 from far to near. This weight is a custom weight when calculating the color difference in the diagonal direction. When calculating the color difference, the color difference between pixels at a 45° diagonal angle is calculated.
[0219] Taking the calculation of the color difference of pixel B4 in the anti-diagonal direction as an example, the formula is as follows:
[0220] diff4_=(diff4_1+diff4_2+diff4_3+diff4_4) / 5
[0221] The calculation method of the formula is: Regarding the color difference in the diagonal direction, refer to Figure 4 , where the weights are all 1 from far to near. This weight is a custom weight when calculating the color difference in the anti-diagonal direction. When calculating the color difference, the color difference between pixels at a diagonal angle of 135° is calculated.
[0222] Step 603 , calculating the pixel values of the first G channel of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively.
[0223] In the embodiments of the present disclosure, Figure 4 As shown, the pixels that need to be corrected are B1, B2, B3 and B4. Regarding calculating the pixel value of the first G channel, the following method may be used but is not limited to: Figure 4 , taking the calculation of the pixel value of the first G channel in the horizontal direction of pixel B1 as an example, the formula is as follows:
[0224] G=(G2*6+1*4+5*4+6*2) / 16
[0225] The calculation method of the formula is as follows: Regarding the pixel value of the first G channel in the horizontal direction, refer to Figure 4 , where the B / R channel pixel closest to pixel B1 is pixel G2, followed by G1, G5, and G6, where the closer to pixel B1, the greater the weight. The weights are 6, 4, 4, and 2 from large to small, and this weight is the custom weight set when calculating the pixel value of the first G channel in the horizontal direction. For the setting of the weight, please refer to the explanation of the example of calculating the color difference of pixel B1 in the horizontal direction in step 602 above, so it will not be repeated here.
[0226] Taking the calculation of the pixel value of the first G channel in the vertical direction of pixel B2 as an example, the formula is as follows:
[0227] G=(12*6+G10*4+G14*4+G16*2) / 16
[0228] The calculation method of the formula is: Regarding the pixel value of the first G channel in the vertical direction, refer to Figure 4 , where the B / R channel pixel closest to pixel B2 is pixel G12, followed by G10, G14, and G16, where the closer to pixel B2, the greater the weight. The weights are 6, 4, 4, and 2 from large to small, and this weight is the custom weight set when calculating the pixel value of the first G channel in the vertical direction. For the setting of the weight, please refer to the explanation of calculating the color difference of pixel B1 in the horizontal direction in step 602, so it will not be repeated here.
[0229] Taking the calculation of the pixel value of the first G channel in the diagonal direction of pixel B3 as an example, the formula is as follows:
[0230] G=((12+G5)*2+(G4+G13)*6) / 16
[0231] The calculation method of the formula is: Regarding the pixel value of the first G channel in the diagonal direction, refer to Figure 4 , where the B / R channel pixels closest to pixel B3 are pixels G4 and G13, followed by G12 and G5. The closer to pixel B4, the greater the weight. The weights are 6 and 2 from large to small. This weight is the custom weight set when calculating the pixel value of the first G channel in the diagonal direction. When calculating the pixel value of the first G channel, the pixels at a 45° diagonal angle are added.
[0232] Taking the calculation of the pixel value of the first G channel in the anti-diagonal direction of pixel B4 as an example, the formula is as follows:
[0233] G=((7+G14)*6+(G2+G11)*2) / 16
[0234] The calculation method of the formula is: Regarding the pixel value of the first G channel in the diagonal direction, refer to Figure 4 , where the B / R channel pixels closest to pixel B4 are pixels G14 and G7, followed by G2 and G11. The closer to pixel B4, the greater the weight. The weights are 6 and 2 from large to small. This weight is the custom weight set when calculating the pixel value of the first G channel in the diagonal direction. When calculating the pixel value of the first G channel, the pixels at a diagonal angle of 135° are added.
[0235] Step 604: Correct the preset phase detection pixel according to the sum of the first total color difference value and the pixel values of the first G channel corresponding to the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction.
[0236] In the embodiments of the present disclosure, Figure 4 As shown, the pixels that need to be corrected are B1, B2, B3 and B4. Regarding the sum of the pixel value of the first G channel and the first total color difference value, the preset phase detection pixel can be corrected in the following manner but is not limited to: Figure 4 , taking the calculation of the horizontal correction of pixel B1 as an example, the formula is as follows:
[0237] B1_=G+diff_h
[0238] Taking the calculation of the vertical correction of pixel B2 as an example, the formula is as follows:
[0239] B2_=G+diff_
[0240] Taking the calculation of the correction of the diagonal direction of pixel B3 as an example, the formula is as follows:
[0241] B3_=G+diff_
[0242] Taking the calculation of the correction of pixel B4 in the anti-diagonal direction as an example, the formula is as follows:
[0243] B4_=G+diff_
[0244] It should be noted here that, for ease of understanding, in the above steps, only one direction correction on each preset phase detection pixel is taken as an example, and the correction methods in other directions are similar. In actual applications, each preset phase detection pixel needs to be corrected in four directions.
[0245] In summary, by sequentially calculating the four color differences between any pixel in the preset phase detection pixel and the pixel of the same channel of the preset phase detection pixel and the pixel of the adjacent G channel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction, and calculating the pixel value of the first G channel of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction, the preset phase detection pixel located in the edge area of the B / R channel is corrected, thereby achieving a better correction effect.
[0246] In some embodiments of the present disclosure, Figure 7 The following further shows a flow chart of a correction method for a phase detection pixel proposed in the present disclosure. Figure 1 The embodiment shown further explains step 104. Figure 7 The following steps may be included:
[0247] Step 701, sequentially calculating eight color differences between pixels in the same channel as the preset phase detection pixel and pixels in adjacent G channels; calculating an average value of the eight color differences to obtain a second total color difference value.
[0248] The embodiment of the present disclosure is a correction in which the preset phase detection pixel is located in the flat area of the B / R channel, which can be used Figure 4 Take this as an example to illustrate, where Figure 4 As shown, the pixels that need to be corrected are B1, B2, B3 and B4. Regarding calculating the eight color differences and the second total color difference value, the following method may be used but is not limited to: Figure 4 , the eight color differences and the second total color difference value can be calculated by the following formula:
[0249] diff1=B5-G1
[0250] diff2=B6-G3
[0251] diff3=B7-G6
[0252] diff4=B8-G8
[0253] diff5=B9-G9
[0254] diff6=B11-G15
[0255] diff7=B10-G10
[0256] diff8=B12-G16
[0257] Diff=(diff1+diff2+...+diff8) / 8
[0258] Step 702: Calculate the pixel value of the second G channel based on all the pixels of the G channel adjacent to the preset phase detection pixel.
[0259] In the embodiments of the present disclosure, Figure 4 As shown, the pixels that need to be corrected are B1, B2, B3 and B4. Regarding calculating the pixel value of the second G channel, the following method may be used but is not limited to: Figure 4 , the pixel value of the second G channel can be calculated by the following formula:
[0260] G=(G2+G4+G5+G7+G11+G12+G13+G14) / 8
[0261] Step 703: Correct the preset phase detection pixel according to the sum of the second total color difference value and the pixel value of the second G channel.
[0262] In the embodiments of the present disclosure, Figure 4 As shown, the pixels that need to be corrected are B1, B2, B3 and B4. Regarding the correction of the preset phase detection pixels, the following methods may be adopted but are not limited to: Figure 4 , the preset phase detection pixel can be corrected by the following formula:
[0263] B1_correction=G+Diff
[0264] It should be noted here that the correction of the preset phase detection pixels located in the flat region of the B / R channel is performed in the same manner for all preset phase detection pixels, as shown in the above formula.
[0265] In summary, eight color differences between pixels in the same channel as the preset phase detection pixel and the adjacent G channel are calculated; the average value of the eight color differences is calculated to obtain a second total color difference value, and the pixel value of the second G channel is calculated based on all pixels in the G channel adjacent to the preset phase detection pixel. According to the sum of the second total color difference value and the pixel value of the second G channel, the preset phase detection pixel located in the flat area of the B / R channel is corrected, achieving a better correction effect.
[0266] In some embodiments of the present disclosure, Figure 8 The following further shows a flow chart of a correction method for a phase detection pixel proposed in the present disclosure. Figure 1 The embodiment shown further explains step 104. Figure 8 The following steps may be included:
[0267] Step 801, calculating a first correction value in the horizontal direction for any pixel in the preset phase detection pixels according to preset adjustable parameters.
[0268] The embodiment of the present disclosure is the correction of the preset phase detection pixel located at the edge area of the G channel. The preset adjustable parameter is an adjustable weight with a range of [0,8]. Regarding the correction of the preset phase detection pixel, the above Figure 5 Take this as an example to illustrate, where Figure 5 As shown, the pixels that need to be corrected are G1, G2, G3 and G4. Regarding calculating the first correction value in the horizontal direction, the following method may be used but is not limited to: Figure 5 , taking the calculation of the first correction value of the pixel G1 in the horizontal direction as an example, the formula is as follows:
[0269] G1_correction=((G21+G23)*w1+(G8+G11)*(8-w1)) / 16
[0270] Wherein, w1 is the preset adjustable parameter, and the range is [0,8]. The first correction values of the horizontal direction of pixels G2, G3 and G4 are similar. For example, if the first correction value of the horizontal direction of pixel G3 is calculated, the formula is:
[0271] G1_correction=((G22+G24)*w1+(G14+G17)*(8-w1)) / 16
[0272] Step 802: Calculate a second correction value in the vertical direction for any pixel in the preset phase detection pixels according to preset adjustable parameters.
[0273] In the embodiments of the present disclosure, Figure 5As shown, the pixels that need to be corrected are G1, G2, G3 and G4. Regarding calculating the second correction value in the vertical direction, the following method may be used but is not limited to: Figure 5 , taking the calculation of the second correction value of the pixel G2 in the vertical direction as an example, the formula is as follows:
[0274] G2_correction=((G26+G28)*w1+(G9+G11)*(8-w1)) / 16
[0275] Wherein, w1 is the preset adjustable parameter, and the range is [0,8]. The second correction value in the vertical direction of pixels G1, G3 and G4 is similar. For example, if the first correction value in the horizontal direction of pixel G1 is calculated, the formula is:
[0276] G2_correction=((G25+G27)*w1+(G6+G8)*(8-w1)) / 16
[0277] Step 803 , calculating a third correction value of any pixel in the preset phase detection pixels in the diagonal direction according to the second distance weights between the preset phase detection pixels and the pixels in the same channel.
[0278] In the embodiments of the present disclosure, Figure 5 As shown, the pixels that need to be corrected are G1, G2, G3 and G4. Regarding calculating the third correction value in the diagonal direction, the following method may be used but is not limited to: Figure 5 , taking the calculation of the third correction value of the pixel G3 in the diagonal direction as an example, the formula is as follows:
[0279] G3_correction=(G14*6+G15*4+G11*4+G10*2) / 16
[0280] The calculation method of the formula is: Regarding the third correction value in the diagonal direction, refer to Figure 5 , where the G channel pixel closest to pixel G3 is pixel G14, followed by G15, G11, and G10, where the closer to pixel G3, the greater the weight. The weights are 6, 4, 4, and 2 from near to far, respectively. This weight is the exclusive weight for calculating the third correction value in the diagonal direction, where the angle calculated is the pixel at a 45° diagonal angle.
[0281] The same is true for the third correction value in the diagonal direction of pixels G1, G2 and G4. For example, if the third correction value in the diagonal direction of pixel G2 is calculated, the formula is:
[0282] G3_correction=(G11*6+G10*4+G14*4+G15*2) / 16
[0283] Step 804 : Calculate a fourth correction value of any pixel in the preset phase detection pixels in the anti-diagonal direction according to the third distance weights between the preset phase detection pixels and the pixels in the same channel.
[0284] In the embodiments of the present disclosure, Figure 5 As shown, the pixels that need to be corrected are G1, G2, G3 and G4. Regarding calculating the fourth correction value in the anti-diagonal direction, the following method may be used but is not limited to: Figure 5 , taking the calculation of the fourth correction value of the pixel G4 in the anti-diagonal direction as an example, the formula is as follows:
[0285] G4_correction=(G17*6+G20*4+G8*4+G5*2) / 16
[0286] The calculation method of the formula is: Regarding the fourth correction value in the anti-diagonal direction, refer to Figure 5 , where the G channel pixel closest to pixel G4 is pixel G17, followed by G20, G8, and G5, where the closer to pixel G4, the greater the weight. The weights are 6, 4, 4, and 2 from near to far, respectively. This weight is the exclusive weight for calculating the fourth correction value in the anti-diagonal direction, where the angle calculated is the pixel diagonal at 135°.
[0287] The same is true for the fourth correction values of the pixels G1, G2 and G3 in the anti-diagonal direction. For example, if the fourth correction value of the pixel G1 in the diagonal direction is calculated, the formula is:
[0288] G4_correction=(G8*6+G5*4+G17*4+G20*2) / 16
[0289] Step 805 , calibrating the preset phase detection pixel according to the first correction value, the second correction value, the third correction value, and the fourth correction value.
[0290] In the embodiment of the present disclosure, when the preset phase detection pixel is calibrated, the first correction value, the second correction value, the third correction value and the fourth correction value need to be calculated for each pixel.
[0291] It should be noted here that, for ease of understanding, in the above steps, only one direction correction on each preset phase detection pixel is taken as an example, and the correction methods in other directions are similar. In actual applications, each preset phase detection pixel needs to be corrected in four directions.
[0292] In summary, by calculating the first correction value, the second correction value, the third correction value and the fourth correction value for each pixel, the preset phase detection pixel located in the edge area of the G channel is corrected, thereby achieving a better correction effect.
[0293] In some embodiments of the present disclosure, Fig. 9 The following further shows a flow chart of a correction method for a phase detection pixel proposed in the present disclosure. Figure 1 The embodiment shown further explains step 104. Fig. 9 The following steps may be included:
[0294] Step 901, calculating an average value of all pixel values adjacent to the preset phase detection pixel in the same channel as the preset phase detection pixel.
[0295] The embodiment of the present disclosure is to calibrate the preset phase detection pixel in the flat region of the G channel. Regarding the calibration of the preset phase detection pixel, the following can be used: Figure 5 Take this as an example to illustrate, where Figure 5 As shown, the pixels that need to be corrected are G1, G2, G3 and G4. Regarding the average value between the pixel values adjacent to the preset phase detection pixel, the following method can be adopted but is not limited to: Figure 5 , the average value between the pixel values adjacent to the preset phase detection pixel can be calculated by the following formula:
[0296] G4_correction=(G8+G11+G14+G17) / 4
[0297] Step 902: calibrate the preset phase detection pixel according to the average value between the adjacent pixel values.
[0298] In the embodiment of the present disclosure, the preset phase detection pixels are located in the flat area of the G channel, and the correction method of all the preset phase detection pixels is the same, as shown in the above formula.
[0299] In summary, by calculating the average value of all pixel values adjacent to the preset phase detection pixel in the same channel as the preset phase detection pixel, the preset phase detection pixel located in the flat area of the G channel is corrected, thereby achieving a better correction effect.
[0300] In some embodiments of the present disclosure, before judging the pixel to be processed, it is necessary to determine whether the pixel to be processed is the center of the preset window. In order to facilitate understanding of the process of judging the pixel to be processed, the present disclosure provides Fig.10 , Fig.10 The following steps may be included:
[0301] Step 1001, determining whether the pixel to be processed can be used as the center of the preset window.
[0302] In the embodiment of the present disclosure, since the pixel to be processed is not the center of the preset window, it will affect the detection and correction of the preset phase detection pixel, so it is necessary to ensure that the pixel to be processed can be the center of the preset window.
[0303] Step 1002: If it is determined that the pixel to be processed cannot be used as the center of the preset window, mirror-expanding processing is performed on the image to be processed based on the size of the preset window.
[0304] In the disclosed embodiment, since the Quad Bayer sensor and the ordinary Bayer sensor have different pixel arrangements, and the Quad Bayer pixel is a 2*2 unit, the image edge expansion is slightly different from that of the ordinary Bayer sensor. The LineBuffer is refreshed every two lines, and special processing is required when expanding the first line, the second line, the last line, and the second to last line of the image, such as Fig.11 As shown in the figure, A represents the first row and Z represents the last row. After expanding the edge, an 8*8 window is extracted.
[0305] In summary, by judging whether the pixel to be processed can be used as the center of the preset window; if it is determined that the pixel to be processed cannot be used as the center of the preset window, the image to be processed is mirrored and expanded based on the size of the preset window, which can ensure that the pixel to be processed can be used as the center of the preset window, thereby providing better operating conditions for the subsequent detection and correction of the preset phase detection pixel.
[0306] In the embodiment of the present disclosure, in order to demonstrate the correction effect of the method described herein, a Fig.12 , Fig.13 as well as Fig.14 ,in, Fig.12 For digital and flat area correction effects, Fig.13 For the arc area correction effect, Fig.14 This is the correction effect of the high-frequency texture area. As shown in the figure, the image after correction is significantly better than before correction.
[0307] Therefore, this solution has the following beneficial effects:
[0308] 1. This solution corrects the preset phase detection pixels by detecting and correcting abnormal pixels of the phase detection pixels and determining the texture area of the phase detection pixels. It can be applied to the Quad Bayer camera sensor to correct the phase detection pixels of the Quad Bayer camera sensor.
[0309] 2. This solution can perform phase detection pixel correction on the Quad Bayer sensor. The subsequent modules of the image signal processing chip Pipeline will not be affected by the abnormal photosensitivity of the phase detection pixels, thus ensuring the image output effect.
[0310] 3. This solution can detect the preset phase detection pixels and use the phase detection pixel arrangement of the sensor to know the position of the phase detection pixels in advance, and then use the normal pixels around the phase detection pixels to correct them.
[0311] 4. This scheme formulates different correction methods for each phase detection pixel according to its position through B / R channel edge area correction, B / R channel flat area correction, G channel edge area correction and G channel flat area correction, so as to restore the texture in the complex texture area.
[0312] Corresponding to the above-mentioned correction method for a phase detection pixel, the present invention also proposes a correction device for a phase detection pixel. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, the details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.
[0313] Fig.15 A schematic diagram of a phase detection pixel correction device provided by an embodiment of the present disclosure is shown in FIG. Fig.15 As shown, the device comprises:
[0314] A first judging unit 151 is used to judge whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is a central pixel of a preset window;
[0315] A detection unit 152, configured to detect abnormal pixels in the same channel in the preset window when it is determined that the pixel to be processed is the preset phase detection pixel;
[0316] A first correction unit 153, used to correct the abnormal pixel to obtain a corrected pixel;
[0317] A determination unit 154, configured to determine a texture area corresponding to the preset phase detection pixel;
[0318] The second correction unit 155 is configured to correct the preset phase detection pixels in the texture area using the corrected pixels.
[0319] In summary, according to the correction device of the phase detection pixel proposed in the present disclosure, it is determined whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is the center pixel of a preset window; when it is determined that the pixel to be processed is the preset phase detection pixel, the abnormal pixels of the same channel in the preset window are detected, and the abnormal pixels are corrected to obtain the corrected pixels; the texture area corresponding to the preset phase detection pixel is determined; and the preset phase detection pixel is corrected using the corrected pixels in the texture area. Compared with the related art, the scheme of the present disclosure corrects the preset phase detection pixel by detecting and correcting the abnormal pixels of the phase detection pixel and determining the texture area of the phase detection pixel, and can be applied to the Quad Bayer camera sensor to correct the phase detection pixels of the Quad Bayer camera sensor.
[0320] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, the detection unit 152 includes:
[0321] A sorting module 1521 is used to sort all pixels in the preset window according to their numerical values;
[0322] A first determination module 1522, configured to determine a maximum pixel value, a second maximum pixel value, a minimum pixel value, and a second minimum pixel value in the preset window;
[0323] A calculation module 1523, configured to calculate a difference between the minimum pixel value and the second minimum pixel value to obtain a first difference value;
[0324] The calculation module 1523 is further used to calculate the difference between the maximum pixel value and the second maximum pixel value to obtain a second difference value;
[0325] A second determination module 1524, configured to determine that the abnormal pixel is a pixel corresponding to a pixel minimum value when it is determined that the first difference is smaller than the second difference;
[0326] The second determination module 1524 is further configured to, when it is determined that the first difference is greater than or equal to the second difference, determine that the abnormal pixel is a pixel corresponding to a pixel maximum value.
[0327] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, the first correction unit 153 includes:
[0328] An acquisition module 1531 is used to acquire all target pixels in the preset window except the maximum pixel value and the minimum pixel value;
[0329] A calculation module 1532, used for calculating the average value of all target pixels;
[0330] The correction module 1533 is used to correct the abnormal pixel based on the average value of all the target pixels to obtain the corrected pixel.
[0331] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, the first correction unit 153 also includes:
[0332] The interpolation module 1534 is used to perform linear interpolation on the abnormal pixel based on the maximum pixel value, the second maximum pixel value, the minimum pixel value, the second minimum pixel value, the first difference value, the second difference value and a preset threshold value to obtain the corrected pixel.
[0333] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, the determining unit 154 further includes:
[0334] A calculation module 1541, configured to calculate the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction in the preset window respectively;
[0335] A first determining module 1542 is used to determine a maximum gradient value and a minimum gradient value from the gradient values in the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction;
[0336] A second determining module 1543 is configured to determine, when a third difference between the maximum value of the gradient value and the minimum value of the gradient value satisfies a preset difference threshold, that the direction of the minimum value of the gradient value is the edge direction of the preset window;
[0337] The second determining module 1543 is further configured to determine, based on the edge direction, that the area corresponding to the preset window is an edge area;
[0338] The second determination module 1543 is further configured to determine that the area corresponding to the preset window is a flat area when a third difference between the maximum value of the gradient and the minimum value of the gradient does not satisfy the preset difference threshold.
[0339] Furthermore, in a possible implementation of the embodiment of the present disclosure, the calculation module 1541 in the determination unit 154 is also used to call a first preset algorithm to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction.
[0340] Furthermore, in a possible implementation of the embodiment of the present disclosure, the calculation module 1541 in the determination unit 154 is also used to call a second preset algorithm to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, vertical direction, diagonal direction and anti-diagonal direction.
[0341] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, the second correction unit 155 includes:
[0342] A first calculation module 1551 is used to sequentially calculate four color differences between a pixel in the same channel of the preset phase detection pixel and a pixel in an adjacent G channel in the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction for any pixel in the preset phase detection pixel; wherein the preset phase detection pixel includes four pixels;
[0343] The first calculation module 1551 is further used to calculate a first total color difference value according to the four color differences and the first distance weights between the preset phase detection pixels and the same channel pixels respectively;
[0344] A second calculation module 1552 is used to calculate the pixel values of the first G channel of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively;
[0345] The correction module 1553 is used to correct the preset phase detection pixel according to the sum of the first total color difference value and the pixel values of the first G channel corresponding to the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively.
[0346] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, in the second correction unit 155:
[0347] The first calculation module 1551 is further used to sequentially calculate eight color differences between pixels in the same channel as the preset phase detection pixel and pixels in adjacent G channels; calculate the average value of the eight color differences to obtain a second total color difference value;
[0348] The second calculation module 1552 is further used to calculate the pixel value of the second G channel based on all the pixels of the G channel adjacent to the preset phase detection pixel;
[0349] The correction module 1553 is further configured to correct the preset phase detection pixel according to a sum of the second total color difference value and the pixel value of the second G channel.
[0350] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, the second correction unit 155 further includes:
[0351] A third calculation module 1554, configured to calculate a first correction value in the horizontal direction for any pixel in the preset phase detection pixels according to preset adjustable parameters;
[0352] The third calculation module 1554 is further used to calculate, according to a preset adjustable parameter, a second correction value of any pixel in the preset phase detection pixels in the vertical direction;
[0353] The third calculation module 1554 is further configured to calculate a third correction value of any pixel in the preset phase detection pixels in the diagonal direction according to the second distance weights between the preset phase detection pixels and the pixels in the same channel respectively;
[0354] The third calculation module 1554 is further configured to calculate a fourth correction value of any pixel in the preset phase detection pixels in the anti-diagonal direction according to a third distance weight between the preset phase detection pixels and the same-channel pixels respectively;
[0355] The correction module 1553 is further configured to correct the preset phase detection pixel according to the first correction value, the second correction value, the third correction value and the fourth correction value.
[0356] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, the second correction unit 155 further includes:
[0357] A fourth calculation module 1555 is used to calculate an average value of all pixel values adjacent to the preset phase detection pixel in the same channel as the preset phase detection pixel;
[0358] The correction module 1553 is further configured to correct the preset phase detection pixel according to an average value between the adjacent pixel values.
[0359] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Fig.16 As shown, the device also includes:
[0360] A second judging unit 156, configured to judge whether the pixel to be processed can be used as the center of the preset window;
[0361] The edge expansion unit 157 is used to perform mirror edge expansion processing on the image to be processed based on the size of the preset window when it is determined that the pixel to be processed cannot be used as the center of the preset window.
[0362] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.
[0363] Fig.17 1 is a block diagram of an electronic device 1700 for implementing the above-mentioned image processing method according to an exemplary embodiment. For example, the electronic device 1700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0364] Reference Fig.17 , the electronic device 1700 may include one or more of the following components: a processing component 1702 , a memory 1704 , a power component 1706 , a multimedia component 1708 , an audio component 1710 , an input / output (I / O) interface 1712 , a sensor component 1714 , and a communication component 1716 .
[0365] The processing component 1702 generally controls the overall operation of the electronic device 1700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1702 may include one or more processors 1720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1702 may include one or more modules to facilitate the interaction between the processing component 1702 and other components. For example, the processing component 1702 may include a multimedia module to facilitate the interaction between the multimedia component 1708 and the processing component 1702.
[0366] The memory 1704 is configured to store various types of data to support operations on the electronic device 1700. Examples of such data include instructions for any application or method operating on the electronic device 1700, contact data, phone book data, messages, pictures, videos, etc. The memory 1704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0367] The power supply component 1706 provides power to the various components of the electronic device 1700. The power supply component 1706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1700.
[0368] The multimedia component 1708 includes a screen that provides an output interface between the electronic device 1700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1708 includes a front camera and / or a rear camera. When the electronic device 1700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0369] The audio component 1710 is configured to output and / or input audio signals. For example, the audio component 1710 includes a microphone (MIC), and when the electronic device 1700 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1704 or sent via the communication component 1716. In some embodiments, the audio component 1710 also includes a speaker for outputting audio signals.
[0370] I / O interface 1712 provides an interface between processing component 1702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0371] The sensor assembly 1714 includes one or more sensors for providing various aspects of status assessment for the electronic device 1700. For example, the sensor assembly 1714 can detect the open / closed state of the electronic device 1700, the relative positioning of components, such as the display and keypad of the electronic device 1700, and the sensor assembly 1714 can also detect the position change of the electronic device 1700 or a component of the electronic device 1700, the presence or absence of user contact with the electronic device 1700, the orientation or acceleration / deceleration of the electronic device 1700, and the temperature change of the electronic device 1700. The sensor assembly 1714 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1714 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0372] The communication component 1716 is configured to facilitate wired or wireless communication between the electronic device 1700 and other devices. The electronic device 1700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio) or a combination thereof. In an exemplary embodiment, the communication component 1716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0373] In an exemplary embodiment, the electronic device 1700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0374] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1704 including instructions, and the above instructions can be executed by the processor 1720 of the electronic device 1700 to perform the above method for image processing. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0375] The embodiments of the present disclosure further provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the above embodiments of the present disclosure.
[0376] For electronic devices that may be chips or chip systems, see Fig.18 Schematic diagram of the chip structure shown. Fig.18 The chip shown includes a processor 1801 and an interface 1802. The number of the processor 1801 can be one or more, and the number of the interface 1802 can be multiple.
[0377] Optionally, the chip further includes a memory 1803, and the memory 1803 is used to store necessary computer programs and data.
[0378] Those skilled in the art may also appreciate that the various illustrative logical blocks and steps listed in the embodiments of the present application may be implemented by electronic hardware, computer software, or a combination of the two. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art may use various methods to implement the functions for each specific application, but such implementation should not be understood as exceeding the scope of protection of the embodiments of the present application.
[0379] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0380] 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" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples 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. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0381] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.
[0382] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.
[0383] It should be understood that the various parts of the embodiments of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0384] A person skilled in the art may understand that all or part of the steps in the above-mentioned embodiment method may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0385] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0386] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for correcting a phase detection pixel, characterized in that: The method comprises: Determine whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is a central pixel of a preset window; When it is determined that the pixel to be processed is the preset phase detection pixel, detecting abnormal pixels in the same channel in the preset window, and correcting the abnormal pixels to obtain corrected pixels; Determining a texture area corresponding to the preset phase detection pixel; The preset phase detection pixels are corrected in the texture area using the corrected pixels.
2. The method according to claim 1, characterized in that The detecting of abnormal pixels in the same channel in the preset window comprises: Sorting all pixels in the preset window according to their numerical values; Determine the maximum pixel value, the second maximum pixel value, the minimum pixel value and the second minimum pixel value in the preset window; Calculate the difference between the minimum pixel value and the second minimum pixel value to obtain a first difference value; Calculate the difference between the maximum pixel value and the second maximum pixel value to obtain a second difference value; If it is determined that the first difference is smaller than the second difference, determining that the abnormal pixel is a pixel corresponding to the minimum pixel value; If it is determined that the first difference is greater than or equal to the second difference, the abnormal pixel is determined to be a pixel corresponding to the maximum pixel value.
3. The method according to claim 2, characterized in that The correcting the abnormal pixel to obtain a corrected pixel comprises: Acquire all target pixels in the preset window except the maximum pixel value and the minimum pixel value; Calculating the average value of all target pixels; The abnormal pixel is corrected based on the average value of all the target pixels to obtain the corrected pixel.
4. The method according to claim 2, characterized in that: The correcting the abnormal pixel to obtain a corrected pixel comprises: The abnormal pixel is linearly interpolated based on the maximum pixel value, the second maximum pixel value, the minimum pixel value, the second minimum pixel value, the first difference value, the second difference value and a preset threshold value to obtain the corrected pixel.
5. The method according to claim 1, characterized in that The determining the texture area corresponding to the preset phase detection pixel comprises: In the preset window, respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction; Determine a maximum value and a minimum value of the gradient value from the gradient values in the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction; If a third difference between the maximum value of the gradient value and the minimum value of the gradient value satisfies a preset difference threshold, determining the direction of the minimum value of the gradient value as the edge direction of the preset window, and determining the area corresponding to the preset window as the edge area based on the edge direction; If the third difference between the maximum value of the gradient value and the minimum value of the gradient value does not meet the preset difference threshold, it is determined that the area corresponding to the preset window is a flat area.
6. The method according to claim 5, characterized in that If the pixel to be processed is located in the B / R channel, respectively calculating the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction, and the anti-diagonal direction in the preset window includes: A first preset algorithm is called to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction.
7. The method according to claim 5, characterized in that If the pixel to be processed is located in the G channel, respectively calculating the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction in the preset window includes: A second preset algorithm is called to respectively calculate the gradient values of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction.
8. The method according to claim 5, characterized in that In the texture area, the preset phase detection pixel is located in a B / R channel, and the correcting the preset phase detection pixel using the corrected pixel in the texture area includes: Calculate in sequence the four color differences between the pixel in the same channel of the preset phase detection pixel and the pixel in the adjacent G channel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction for any pixel in the preset phase detection pixel; wherein the preset phase detection pixel includes four pixels; Calculate a first total color difference value according to the four color differences and the first distance weights between the preset phase detection pixels and the pixels in the same channel; Calculate the pixel values of the first G channel of the preset phase detection pixel in the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively; The preset phase detection pixel is corrected according to the sum of the first total color difference value and the pixel values of the first G channel corresponding to the horizontal direction, the vertical direction, the diagonal direction and the anti-diagonal direction respectively.
9. The method according to claim 5, characterized in that In the flat area, and the preset phase detection pixel is located in the B / R channel, correcting the preset phase detection pixel using the corrected pixel in the texture area includes: Sequentially calculating eight color differences between pixels in the same channel as the preset phase detection pixel and pixels in adjacent G channels; calculating an average value of the eight color differences to obtain a second total color difference value; Calculating a pixel value of a second G channel based on all pixels of the G channel adjacent to the preset phase detection pixel; The preset phase detection pixel is corrected according to the sum of the second total color difference value and the pixel value of the second G channel.
10. The method according to claim 5, characterized in that In the texture area, and the preset phase detection pixel is located in the G channel, correcting the preset phase detection pixel using the corrected pixel in the texture area includes: Calculating a first correction value of any pixel in the preset phase detection pixels in the horizontal direction according to the preset adjustable parameters; Calculating a second correction value of any pixel in the preset phase detection pixels in the vertical direction according to the preset adjustable parameters; Calculating a third correction value of any pixel among the preset phase detection pixels in the diagonal direction according to second distance weights between the preset phase detection pixels and the pixels in the same channel respectively; Calculating a fourth correction value of any pixel among the preset phase detection pixels in the anti-diagonal direction according to third distance weights between the preset phase detection pixels and the pixels in the same channel respectively; The preset phase detection pixel is corrected according to the first correction value, the second correction value, the third correction value and the fourth correction value.
11. The method according to claim 5, characterized in that In the flat area, and the preset phase detection pixel is located in the G channel, correcting the preset phase detection pixel using the corrected pixel in the texture area includes: Calculating an average value of all pixel values adjacent to the preset phase detection pixel in the same channel as the preset phase detection pixel; The preset phase detection pixel is corrected according to an average value between the adjacent pixel values.
12. The method according to any one of claims 1 to 11, characterized in that Before determining whether the pixel to be processed is a preset phase detection pixel, the method further includes: Determining whether the pixel to be processed can be used as the center of the preset window; If it is determined that the pixel to be processed cannot be used as the center of the preset window, mirror image expansion processing is performed on the image to be processed based on the size of the preset window.
13. A correction device for a phase detection pixel, characterized in that: The device comprises: A first judgment unit is used to judge whether the pixel to be processed is a preset phase detection pixel; wherein the pixel to be processed is a central pixel of a preset window; A detection unit, configured to detect abnormal pixels in the same channel in the preset window when it is determined that the pixel to be processed is the preset phase detection pixel; A first correction unit, used for correcting the abnormal pixel to obtain a corrected pixel; A determination unit, configured to determine a texture area corresponding to the preset phase detection pixel; The second correction unit is configured to correct the preset phase detection pixels in the texture area using the corrected pixels.
14. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 12.
15. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-12.
16. A chip, characterized in that: It comprises one or more interfaces and one or more processors; the interface is used to receive a signal from a memory of an electronic device and send the signal to the processor, the signal includes a computer instruction stored in the memory, and when the processor executes the computer instruction, the electronic device executes the method described in any one of claims 1-12.