Method and device for converting RAW images in quad-Bayer format, and electronic device

By calculating the weighting factor and pixel estimates of each pixel point in the quad-Bayer format RAW image and converting it into a normal quad-Bayer format RAW image, the problem that the quad-Bayer format image cannot directly use the existing processing algorithm is solved, and the efficiency and accuracy of format conversion are achieved.

CN119741195APending Publication Date: 2025-04-01CHENGDU LIGHT COLLECTOR TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411880668.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

Four Bayer format RAW images cannot directly use the existing image signal processing algorithms, and need to be converted to ordinary Bayer format RAW images before subsequent processing is performed.

Method used

By obtaining the four-Bayer format RAW image, calculate the weight factor and pixel estimate value of each four-Bayer pixel point in the cache window, and then calculate the pixel value of the corresponding ordinary Bayer pixel point, and finally count and output the ordinary Bayer format RAW image.

Benefits of technology

The conversion of four Bayer format RAW images into ordinary Bayer format RAW images is implemented, which solves the problem of format conversion and facilitates the subsequent use of existing image signal processing algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119741195A_ABST
    Figure CN119741195A_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for converting the format of a four-Bayer format RAW image, and an electronic device, comprising: obtaining a four-Bayer format RAW image; calculating a weight factor of a current four-Bayer pixel in a cache window; calculating a pixel estimation value of the current four-Bayer pixel in the cache window; calculating the pixel value of an ordinary Bayer pixel corresponding to the current four-Bayer pixel according to the weight factor and the pixel estimation value; and counting the pixel values ​​of all ordinary Bayer pixels to output an ordinary Bayer format RAW image. By calculating the weight factor and the pixel estimation value of the four-Bayer pixel, and then calculating the pixel value of the corresponding ordinary Bayer pixel, the pixel value of the four-Bayer format pixel is accurately converted into the pixel value of the ordinary Bayer format pixel with less computing resources, and the problem of how to convert the four-Bayer format RAW image into the ordinary Bayer format RAW image is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method and device for converting a RAW image in a quad-Bayer format, and an electronic device. Background Art

[0002] Image sensors are devices that convert optical images into electronic signals. They are widely used in digital cameras and other electronic optical devices. There is a huge difference in the sensitivity of image sensors in environments with sufficient light and insufficient light. For example, when there is insufficient light at night, the image sensor is prone to a decrease in signal-to-noise ratio, which makes the denoising effect in the later image signal processing process unsatisfactory.

[0003] In order to improve the imaging quality in dark environments, a new type of image sensor is proposed, whose RAW images are arranged in a quad-Bayer format. Since the arrangement of pixels in the RAW images in the quad-Bayer format is equivalent to splitting each pixel in the existing Bayer format into four pixels of the same color, the imaging quality can be significantly improved by merging effective pixels.

[0004] However, since the format of the quad-Bayer format RAW image is different from the existing ordinary Bayer format, the existing image signal processing algorithm cannot be directly used for subsequent processing. It must first be converted into the existing ordinary Bayer format RAW image before subsequent image signal processing. Summary of the invention

[0005] The object of the present invention is to provide a method and device for converting a RAW image in a quad-Bayer format, and an electronic device, so as to solve the problem of how to convert a RAW image in a quad-Bayer format into a RAW image in a common Bayer format.

[0006] In order to solve the above technical problems, the present invention provides a method for converting a RAW image in a quad-Bayer format, comprising: Get quad-Bayer format RAW images; In the cache window, calculate the weight factor of the current four-Bayer pixel; In the buffer window, the pixel estimation value of the current four-Bayer pixel is calculated; According to the weight factor and the pixel estimation value, the pixel value of the common Bayer pixel corresponding to the current four Bayer pixels is calculated; Count the pixel values ​​of all normal Bayer pixels to output a normal Bayer format RAW image.

[0007] Optionally, in the method for converting the format of a four-Bayer format RAW image, the method for calculating the weight factor of the current four-Bayer pixel in the cache window includes: In the cache window, calculate the east gradient, west gradient, south gradient and north gradient of the current four-Bayer pixel; According to the easting gradient, westing gradient, southing gradient and northing gradient, the easting weight factor, westing weight factor, southing weight factor and northing weight factor of the current four-Bayer pixel are calculated.

[0008] Optionally, in the method for converting the format of a four-Bayer format RAW image, the method for calculating the east gradient, west gradient, south gradient and north gradient of the current four-Bayer pixel in the cache window includes: Extracting a cache window, wherein the current four-Bayer pixel is located at the center of the cache window; Using the pixels in the cache window that are in the same direction as the gradient direction and the current four-bayer pixel, the eastward gradient, westward gradient, southward gradient, and northward gradient of the current pixel are calculated.

[0009] Optionally, in the method for converting the format of a four-Bayer format RAW image, the method for calculating the east gradient, west gradient, south gradient and north gradient of the current pixel point by using the pixel points in the cache window that are in the same direction as the gradient direction and the current four-Bayer pixel point includes: If the current four-Bayer pixel is an R pixel or a B pixel, the east gradient, west gradient, south gradient and north gradient of the three pixels to be converted are calculated; If the current four-Bayer pixel is a G pixel, the east gradient, west gradient, south gradient and north gradient of the two pixels to be converted are calculated.

[0010] Optionally, in the method for converting the format of a four-Bayer format RAW image, the method for calculating the east weight factor, west weight factor, south weight factor and north weight factor of the current four-Bayer pixel point according to the east gradient, west gradient, south gradient and north gradient includes: Using the easting gradient, the easting weight factor of the current four-Bayer pixel is calculated, which is expressed as:

[0011] Using the westward gradient, the westward weight factor of the current four-Bayer pixel is calculated, which is expressed as:

[0012] Using the south gradient, the south weight factor of the current four-Bayer pixel is calculated, which is expressed as:

[0013] Using the north gradient, the north weight factor of the current four-Bayer pixel is calculated, which is expressed as:

[0014] Optionally, in the method for converting the format of a four-Bayer format RAW image, the method for calculating the pixel estimation value of the current four-Bayer pixel in the cache window includes: Extracting a cache window, wherein the current four-Bayer pixel is located at the center of the cache window; Get the target color pixel of the pixel to be converted in the current four-Bayer pixel; Using the pixel points in the cache window that have the same color as the target color pixel, the east pixel estimation value, west pixel estimation value, south pixel estimation value and north pixel estimation value of the pixel point to be converted are calculated.

[0015] Optionally, in the method for converting the format of a RAW image in a four-Bayer format, the method for calculating the pixel value of a common Bayer pixel corresponding to the current four-Bayer pixel according to the weight factor and the pixel estimation value includes: The pixel estimation values ​​are weighted averaged by using the weight factor to obtain the pixel value of the common Bayer pixel corresponding to the pixel to be converted among the current four Bayer pixels.

[0016] Optionally, in the method for converting the format of a four-Bayer format RAW image, the method for counting the pixel values ​​of all ordinary Bayer pixels to output an ordinary Bayer format RAW image includes: According to the ordinary Bayer format, the pixel values ​​of the ordinary Bayer pixels corresponding to the current four Bayer pixels are arranged to output an ordinary Bayer format RAW image.

[0017] In order to solve the above technical problems, the present invention further provides a format conversion device for a RAW image in a four-Bayer format, which is used to implement the format conversion method for a RAW image in a four-Bayer format as described in any one of the above items. The format conversion device for a RAW image in a four-Bayer format comprises: An image acquisition module, used for acquiring a four-Bayer format RAW image; A weight factor calculation module, used to calculate the weight factor of the current four-Bayer pixel in the cache window; A pixel estimation value calculation module, used for calculating the pixel estimation value of the current four-Bayer pixel in the cache window; A pixel conversion module, used for calculating the pixel value of the common Bayer pixel corresponding to the current four Bayer pixel according to the weight factor and the pixel estimation value; Image conversion module, used to count the pixel values ​​of all ordinary Bayer pixels; The image output module is used to output ordinary Bayer format RAW images.

[0018] In order to solve the above technical problems, the present invention also provides an electronic device, comprising a memory, a processor, and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, the format conversion method of the four-Bayer format RAW image as described in any one of the above items is executed.

[0019] The method and device for converting the format of a four-Bayer format RAW image provided by the present invention, and the electronic device, include: obtaining a four-Bayer format RAW image; calculating the weight factor of the current four-Bayer pixel in a cache window; calculating the pixel estimation value of the current four-Bayer pixel in the cache window; calculating the pixel value of the ordinary Bayer pixel corresponding to the current four-Bayer pixel according to the weight factor and the pixel estimation value; and counting the pixel values ​​of all ordinary Bayer pixels to output an ordinary Bayer format RAW image. By calculating the weight factor and the pixel estimation value of the four-Bayer pixel, and then calculating the pixel value of the corresponding ordinary Bayer pixel, the pixel value of the four-Bayer format pixel is accurately converted into the pixel value of the ordinary Bayer format pixel with less computing resources, and the problem of how to convert the four-Bayer format RAW image into the ordinary Bayer format RAW image is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A flowchart of a method for converting a RAW image in a quad-Bayer format provided in this embodiment; Figure 2 A schematic diagram of pixel arrangement of a RAW image in a four-Bayer format with the central pixel being an R pixel provided in this embodiment; Figure 3 A schematic diagram of pixel arrangement of a RAW image in a four-Bayer format with a central pixel being a G pixel provided in this embodiment; Figure 4 The embodiment provided Figure 2 The schematic diagram of pixel arrangement after the quad-Bayer format RAW image is converted into a normal Bayer format RAW image; Figure 5 This is a structural block diagram of the format conversion device for a quad-Bayer format RAW image provided in this embodiment. DETAILED DESCRIPTION

[0021] The following is a further detailed description of the method and device for converting the format of the RAW image in the four-Bayer format and the electronic device proposed by the present invention in combination with the accompanying drawings and specific embodiments. It should be noted that the accompanying drawings are all in a very simplified form and use non-precise proportions, which are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention. In addition, the structure shown in the accompanying drawings is often a part of the actual structure. In particular, the emphasis of each accompanying drawing is different, and sometimes different proportions are used.

[0022] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present invention are used to distinguish similar objects in order to describe the embodiments of the present invention, rather than to describe a specific order or sequence. It should be understood that the structures used in this way can be interchanged under appropriate circumstances. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0023] This embodiment provides a method for converting a RAW image in a quad-Bayer format. Figure 1 As shown, including: S1, acquiring a four-Bayer format RAW image; S2, in the cache window, calculate the weight factor of the current four-Bayer pixel; S3, calculating the pixel estimation value of the current four-Bayer pixel in the cache window; S4, calculating the pixel value of the common Bayer pixel corresponding to the current four Bayer pixels according to the weight factor and the pixel estimation value; S5, counting the pixel values ​​of all ordinary Bayer pixels to output an ordinary Bayer format RAW image.

[0024] The format conversion method of a four-Bayer format RAW image provided in this embodiment calculates the weight factors and pixel estimation values ​​of the four-Bayer pixels, and then calculates the pixel values ​​of the corresponding ordinary Bayer pixels, thereby achieving accurate conversion of the pixel values ​​of the four-Bayer format pixels into the pixel values ​​of the ordinary Bayer format pixels using fewer computing resources, and solving the problem of how to convert a four-Bayer format RAW image into a ordinary Bayer format RAW image.

[0025] In practical applications, the order of step S2 and step S3 can be interchanged or performed simultaneously, and this application does not limit this. The technical solution after the order is adjusted without violating the purpose of this application should also fall within the protection scope of this application.

[0026] Specifically, in this embodiment, in step S1, the method for obtaining a RAW image in a four-Bayer format may be to obtain an original RAW image in a four-Bayer format from various photographic and video equipment using a new type of image sensor.

[0027] Raw images are original image files obtained from image sensors of devices such as digital cameras, scanners, or film scanners. Raw images are not processed and therefore have internal colors with a wide color gamut, allowing for precise adjustments.

[0028] In a RAW image of the four-Bayer format, two adjacent G pixels in each row are separated by two adjacent R pixels or two B pixels, and there are only G pixels and R pixels or G pixels and B pixels in the same row; the pixel arrangement of every two rows is consistent, and the G pixels in the first two rows and the last two rows are staggered, and the G pixels in the first two rows and the last two rows are separated by R pixels and B pixels respectively; the arrangement of columns is consistent with that of rows. For example, Figure 2 As shown, when two adjacent G pixels in the i-th row are separated by two adjacent R pixels, the two adjacent G pixels in the i+1-th row are also separated by two adjacent R pixels, and the pixel arrangement of the i+1-th row is consistent with the pixel arrangement of the i-th row; the two adjacent G pixels in the i+2-th row are separated by two adjacent B pixels, and the two G pixels are staggered with the two G pixels in the i-th row; the two adjacent G pixels in the i+3-th row are also separated by two adjacent B pixels, and the pixel arrangement of the i+3-th row is consistent with the pixel arrangement of the i+2-th row.

[0029] Furthermore, in this embodiment, in step S2, the method for calculating the weight factor of the current four-Bayer pixel in the cache window includes: S21, in the cache window, calculating the east gradient, west gradient, south gradient and north gradient of the current four-Bayer pixel.

[0030] Specifically, in this embodiment, first, a cache window is extracted, wherein the current four-Bayer pixel is located at the center of the cache window; then, the east gradient, west gradient, south gradient and north gradient of the current pixel are calculated using the pixel points in the cache window that are in the same direction as the gradient direction and the current four-Bayer pixel.

[0031] In practical applications, due to the different arrangements of G pixels and R pixels or B pixels, there are slight differences in the gradient calculation of G pixels and the gradient calculation of R pixels and B pixels: If the current four-Bayer pixel is an R pixel or a B pixel, the east gradient, west gradient, south gradient and north gradient of the three pixels to be converted are calculated.

[0032] like Figure 2As shown in the figure, the current four-Bayer pixel is an R pixel, which is located at the center of the 6×6 buffer window, that is, the four pixels in the current four-Bayer pixel are located at the coordinate positions (2,2), (2,3), (3,2) and (3,3) of the buffer window respectively. Among them, the R pixels at the coordinate positions (2,2), (2,3) and (3,2) correspond to B pixels or G pixels after being converted to the ordinary Bayer format; and the R pixel at the coordinate position (3,3) still corresponds to the R pixel after being converted to the ordinary Bayer format. Therefore, only the R pixels at the coordinate positions (2,2), (2,3) and (3,2) need to be gradient calculated.

[0033] This embodiment uses Figure 2 Taking the buffer window shown in the figure as an example, a specific method for calculating the gradient of the current four-Bayer pixel as the R pixel is given: For the R pixel at the (2,2) coordinate position, its eastward gradient It can be expressed as:

[0034] Westward gradient It can be expressed as:

[0035] Southward gradient It can be expressed as:

[0036] North gradient It can be expressed as:

[0037] Similarly, for the R pixel at the coordinate position (2,3), its eastward gradient It can be expressed as:

[0038] Westward gradient It can be expressed as:

[0039] Southward gradient It can be expressed as:

[0040] North gradient It can be expressed as:

[0041] It can be found that the gradients of the R pixel at the coordinate position (2,3) in the east and west directions are the same as the gradients of the R pixel at the coordinate position (2,2) in the east and west directions.

[0042] And, for the R pixel at the coordinate position (3,2), its eastward gradient It can be expressed as:

[0043] Westward gradient It can be expressed as:

[0044] Southward gradient It can be expressed as:

[0045] North gradient It can be expressed as:

[0046] It can be found that the gradients of the R pixel at the coordinate position (3,2) in the north-south direction are the same as the gradients of the R pixel at the coordinate position (2,2) in the north-south direction.

[0047] When calculating the gradient of the R pixel above, D(i,j) represents the pixel value of the pixel point with coordinate position (i,j) in the 6×6 cache window.

[0048] If the current four-Bayer pixel is a B pixel, the gradient of the B pixel can be calculated by referring to the gradient calculation method of the R pixel, which will not be described in detail in this application.

[0049] If the current four-Bayer pixel is a G pixel, the east gradient, west gradient, south gradient and north gradient of the two pixels to be converted are calculated.

[0050] like Figure 3 As shown in the figure, the current four-Bayer pixel is a G pixel, which is located at the center of the 10×10 buffer window, that is, the four pixels in the current four-Bayer pixel are located at the coordinate positions (4,4), (4,5), (5,4) and (5,5) of the buffer window respectively. Among them, the G pixels at the coordinate positions (4,4) and (5,5) correspond to B pixels or R pixels after being converted to the ordinary Bayer format; and the G pixels at the coordinate positions (4,5) and (5,4) still correspond to G pixels after being converted to the ordinary Bayer format. Therefore, only the gradient calculation of the G pixels at the coordinate positions (4,4) and (5,5) is required.

[0051] This embodiment uses Figure 3 Taking the buffer window shown in the figure as an example, a specific method for calculating the gradient of the current four-Bayer pixel as a G pixel is given: For the G pixel at the coordinate position (4,4), its eastward gradient It can be expressed as:

[0052] Westward gradient It can be expressed as:

[0053] Southward gradient It can be expressed as:

[0054] North gradient It can be expressed as:

[0055] Similarly, for the G pixel at the coordinate position (5,5), its eastward gradient It can be expressed as:

[0056] Westward gradient It can be expressed as:

[0057] Southward gradient It can be expressed as:

[0058] North gradient It can be expressed as:

[0059] When calculating the gradient of the G pixel above, D(i,j) represents the pixel value of the pixel point with coordinate position (i,j) in the 10×10 cache window. Of course, in actual calculation, you can also choose 6×6, 14×14 and other cache windows for gradient calculation. The coordinate correspondence of the pixel points in different cache windows is well known to those skilled in the art. The gradient calculation method of the G pixel in the 6×6 and 14×14 cache windows can be obtained by coordinate conversion, and this application will not repeat it.

[0060] In practical applications, the gradient calculation of R pixels, B pixels and G pixels can be performed sequentially in a preset order, or can be performed simultaneously to improve calculation efficiency, and this application does not impose any restrictions on this.

[0061] Also, when calculating the gradient, a larger cache window can be selected to use more pixels for gradient calculation to improve the calculation accuracy, but the amount of calculation will increase. In actual application, it can be set according to actual needs, and this application does not impose any restrictions on this.

[0062] Of course, in practical applications, there may be other gradient calculation methods, such as changing the position interval between two pixels in the pixel value difference calculation, and this application does not limit this either.

[0063] S22, calculating the east weight factor, west weight factor, south weight factor and north weight factor of the current four-Bayer pixel according to the east gradient, west gradient, south gradient and north gradient.

[0064] Specifically, in this embodiment, a method for calculating the weight factor is given: Using the easting gradient, the easting weight factor of the current four-Bayer pixel is calculated, which is expressed as:

[0065] Using the westward gradient, the westward weight factor of the current four-Bayer pixel is calculated, which is expressed as:

[0066] Using the south gradient, the south weight factor of the current four-Bayer pixel is calculated, which is expressed as:

[0067] Using the north gradient, the north weight factor of the current four-Bayer pixel is calculated, which is expressed as:

[0068] Through the above calculation formula, the weight factors of each pixel to be converted in four directions can be calculated, where We(i,j), Ww(i,j), Ws(i,j) and Wn(i,j) represent the east weight factor, west weight factor, south weight factor and north weight factor of the pixel at coordinate (i,j) respectively. And the total weight of the pixel at coordinate (i,j) Wall(i,j)=We(i,j)+Ww(i,j)+Ws(i,j)+Wn(i,j).

[0069] Furthermore, in this embodiment, in step S3, the method for calculating the pixel estimation value of the current four-Bayer pixel in the cache window includes: S31, extracting a cache window, wherein the current four-Bayer pixel is located at the center of the cache window.

[0070] Specifically, in practical applications, the cache window used for pixel estimation may be consistent with the cache window used for weight factor calculation.

[0071] S32, obtaining the target color pixel of the pixel to be converted in the current four-Bayer pixel.

[0072] Still taking the above example, Figure 2 In the cache window shown, the coordinate positions of the R pixels to be converted in the current four Bayer pixels are (2,2), (2,3) and (3,2), wherein the target color pixel after the pixel at the coordinate position (2,2) is a B pixel, and the target color pixels after the pixel at the coordinate positions (2,3) and (3,2) are G pixels. Therefore, it is necessary to estimate the B pixel estimation values ​​in four directions for the R pixel at the coordinate position (2,2), and to estimate the G pixel estimation values ​​in four directions for the R pixel at the coordinate positions (2,3) and (3,2).

[0073] Figure 3 In the cache window shown, the coordinate positions of the G pixel points to be converted in the current four Bayer pixels are (4,4) and (5,5), wherein the target color pixel after the pixel point at the coordinate position (4,4) is converted to a B pixel, and the target color pixel after the pixel point at the coordinate position (5,5) is converted to an R pixel. Therefore, it is necessary to estimate the B pixel estimation values ​​in four directions for the G pixel point at the coordinate position (4,4), and to estimate the R pixel estimation values ​​in four directions for the G pixel point at the coordinate position (5,5).

[0074] S33, using the pixel points in the cache window that have the same color as the target color pixel, calculate the east pixel estimation value, west pixel estimation value, south pixel estimation value and north pixel estimation value of the pixel points to be converted.

[0075] In practical applications, the positions of the same-color pixels used in the calculation should correspond to the direction of the pixel estimation value. For example, when calculating the east-direction pixel estimation value, several pixels on the east side of the pixel to be converted that have the same color as the target color pixel and are closest to the pixel to be converted should be selected for calculation.

[0076] Since G pixels and R pixels or B pixels are arranged differently, the pixel estimation value calculation for G pixels is slightly different from that for R pixels and B pixels: If the current four-Bayer pixel is an R pixel or a B pixel, Figure 2 As shown in the figure, for the R pixel at the coordinate position (2,2), it is necessary to estimate the B pixel estimation values ​​in four directions, among which the east pixel estimation value It can be expressed as:

[0077] West-facing pixel estimate It can be expressed as:

[0078] South pixel estimate It can be expressed as:

[0079] Pixel north estimate It can be expressed as:

[0080] Similarly, for the R pixel at the coordinate position (2,3), it is necessary to estimate the G pixel estimation values ​​in four directions, among which the east pixel estimation value is It can be expressed as:

[0081] West-facing pixel estimate It can be expressed as:

[0082] South pixel estimate It can be expressed as:

[0083] Pixel north estimate It can be expressed as:

[0084] And, for the R pixel at the coordinate position (3,2), it is necessary to estimate the G pixel estimation values ​​in four directions, among which the east pixel estimation value is It can be expressed as:

[0085] West-facing pixel estimate It can be expressed as:

[0086] South pixel estimate It can be expressed as:

[0087] Pixel north estimate It can be expressed as:

[0088] When calculating the gradient of the R pixel above, D(i,j) represents the pixel value of the pixel point with coordinate position (i,j) in the 6×6 cache window.

[0089] When the current four-Bayer pixel is a B pixel, the pixel estimation values ​​in four directions corresponding to the B pixel can be calculated with reference to the pixel estimation value calculation method of the R pixel, which will not be described in detail in this application.

[0090] If the current four-Bayer pixel is a G pixel, Figure 3 As shown in the figure, for the G pixel at the coordinate position (4,4), it is necessary to estimate the B pixel estimation values ​​in four directions, among which the east pixel estimation value It can be expressed as:

[0091] West-facing pixel estimate It can be expressed as:

[0092] South pixel estimate It can be expressed as:

[0093] Pixel north estimate It can be expressed as:

[0094] Similarly, for the G pixel at the coordinate position (5,5), it is necessary to estimate the R pixel estimation values ​​in four directions, among which the east pixel estimation value is It can be expressed as:

[0095] West-facing pixel estimate It can be expressed as:

[0096] South pixel estimate It can be expressed as:

[0097] Pixel north estimate It can be expressed as:

[0098] When calculating the gradient of the G pixel above, D(i,j) represents the pixel value of the pixel point with coordinate position (i,j) in the 10×10 cache window.

[0099] In practical applications, the calculation of pixel estimation values ​​of R pixels, B pixels and G pixels can be performed sequentially in a preset order, or can be performed simultaneously to improve calculation efficiency, and this application does not impose any restrictions on this.

[0100] Also, when calculating pixel estimation values, a larger cache window can be selected to utilize more pixels for pixel estimation calculations to improve calculation accuracy. However, this will increase the amount of calculation. In actual applications, it can be set according to actual needs, and this application does not impose any restrictions on this.

[0101] Of course, in practical applications, there may be other ways to calculate pixel estimation values, such as calculating pixel estimation values ​​by weighted average, etc., and this application does not limit this either.

[0102] Further, in this embodiment, in step S4, the method of calculating the pixel value of the common Bayer pixel corresponding to the current four Bayer pixel according to the weight factor and the pixel estimation value includes: The pixel estimation values ​​are weighted averaged by using the weight factor to obtain the pixel value of the common Bayer pixel corresponding to the pixel to be converted among the current four Bayer pixels.

[0103] Still Figure 2 As shown in the figure, for the R pixel at the coordinate position (2,2), its corresponding ordinary Bayer pixel is the B pixel, and the converted B pixel value can be expressed as:

[0104] For the R pixel at the coordinate position (2,3), its corresponding ordinary Bayer pixel is the G pixel, and the converted G pixel value can be expressed as:

[0105] For the R pixel at the coordinate position (3,2), its corresponding ordinary Bayer pixel is the G pixel, and the converted G pixel value can be expressed as:

[0106] Still Figure 3 As an example, for the G pixel at the coordinate position (4,4), its corresponding ordinary Bayer pixel is the B pixel, and the converted B pixel value can be expressed as:

[0107] For the G pixel at the coordinate position (5,5), its corresponding ordinary Bayer pixel is the R pixel, and the converted R pixel value can be expressed as:

[0108] In practical applications, the calculation of the pixel values ​​of ordinary Bayer pixels corresponding to R pixels, B pixels and G pixels can be performed sequentially in a preset order, or can be performed simultaneously to improve calculation efficiency, and this application does not impose any restrictions on this.

[0109] Furthermore, in this embodiment, in step S5, pixel values ​​of all common Bayer pixels are counted to output a common Bayer format RAW image.

[0110] According to the ordinary Bayer format, the pixel values ​​of the ordinary Bayer pixels corresponding to the current four Bayer pixels are arranged to output an ordinary Bayer format RAW image. In other words, the pixel values ​​of the pixels to be converted are converted to the pixel values ​​of the corresponding ordinary Bayer pixels, and the pixel values ​​of the pixels that do not need to be converted are retained, and the pixel values ​​at the positions of the pixels are recombined to obtain an ordinary Bayer format RAW image.

[0111] Figure 2 The four-Bayer format RAW image shown in FIG. 1 is converted by the format conversion method of the four-Bayer format RAW image provided in this embodiment to obtain a normal Bayer format RAW image as shown in FIG. Figure 4 As shown. Figure 2 and Figure 4 It can be seen that the format conversion method of the quad-Bayer format RAW image provided in this embodiment can effectively and accurately convert the quad-Bayer format RAW image into a common Bayer format RAW image, and then can use the existing image processing algorithm for the common Bayer format RAW image to perform subsequent image processing.

[0112] The method for converting a RAW image in a four-Bayer format provided in this embodiment calculates the gradients, weight factors and pixel estimation values ​​in four directions for the pixel points to be converted, so as to accurately obtain the pixel values ​​in the ordinary Bayer format after conversion, so that the RAW image in the four-Bayer format can be smoothly converted into the RAW image in the ordinary Bayer format, which is conducive to the subsequent processing of the RAW image using existing image signal processing technology. The method for converting a RAW image in a four-Bayer format provided in this embodiment is simple in calculating the gradients, weight factors and pixel estimation values ​​in four directions, thereby saving hardware resources and improving the efficiency of format conversion.

[0113] This embodiment also provides a format conversion device for a four-Bayer format RAW image, which is used to implement the format conversion method for a four-Bayer format RAW image as described above. Figure 5 As shown, the format conversion device of the four-Bayer format RAW image includes: An image acquisition module, used for acquiring a four-Bayer format RAW image; A weight factor calculation module, used to calculate the weight factor of the current four-Bayer pixel in the cache window; A pixel estimation value calculation module, used for calculating the pixel estimation value of the current four-Bayer pixel in the cache window; A pixel conversion module, used for calculating the pixel value of the common Bayer pixel corresponding to the current four Bayer pixel according to the weight factor and the pixel estimation value; Image conversion module, used to count the pixel values ​​of all ordinary Bayer pixels; The image output module is used to output ordinary Bayer format RAW images.

[0114] The format conversion device for a four-Bayer format RAW image provided in this embodiment calculates the weight factors and pixel estimation values ​​of the four-Bayer pixels through various functional modules, and then calculates the pixel values ​​of the corresponding ordinary Bayer pixels, thereby achieving accurate conversion of the pixel values ​​of the four-Bayer format pixels into the pixel values ​​of the ordinary Bayer format pixels using fewer computing resources, and solving the problem of how to convert a four-Bayer format RAW image into an ordinary Bayer format RAW image.

[0115] Of course, in practical applications, those skilled in the art can realize the specific structure and function of each functional module and unit according to the functional setting of the format conversion device for the four-Bayer format RAW image provided by this application. The design of various functional modules and units without violating the main purpose of this application shall fall within the protection scope of this application.

[0116] Furthermore, this embodiment further provides an electronic device, comprising a memory, a processor, and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, the format conversion method of the four-Bayer format RAW image as described above is executed.

[0117] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other. In addition, the different parts between the various embodiments can also be used in combination with each other, and the present invention is not limited to this.

[0118] The method and device for converting the format of a four-Bayer format RAW image provided in this embodiment, and the electronic device, include: obtaining a four-Bayer format RAW image; calculating the weight factor of the current four-Bayer pixel in the cache window; calculating the pixel estimation value of the current four-Bayer pixel in the cache window; calculating the pixel value of the ordinary Bayer pixel corresponding to the current four-Bayer pixel according to the weight factor and the pixel estimation value; and counting the pixel values ​​of all ordinary Bayer pixels to output an ordinary Bayer format RAW image. By calculating the weight factor and the pixel estimation value of the four-Bayer pixel, and then calculating the pixel value of the corresponding ordinary Bayer pixel, the pixel value of the four-Bayer format pixel is accurately converted to the pixel value of the ordinary Bayer format pixel with less computing resources, and the problem of how to convert the four-Bayer format RAW image to the ordinary Bayer format RAW image is solved.

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

Claims

1. A method for converting a RAW image in a quad-Bayer format, characterized in that: include: Get quad-Bayer format RAW images; In the cache window, calculate the weight factor of the current four-Bayer pixel; In the buffer window, the pixel estimation value of the current four-Bayer pixel is calculated; According to the weight factor and the pixel estimation value, the pixel value of the common Bayer pixel corresponding to the current four Bayer pixels is calculated; Count the pixel values ​​of all normal Bayer pixels to output a normal Bayer format RAW image.

2. The method for converting a RAW image in a quad-Bayer format according to claim 1, wherein: The method for calculating the weight factor of the current four-Bayer pixel in the cache window includes: In the cache window, calculate the east gradient, west gradient, south gradient and north gradient of the current four-Bayer pixel; According to the easting gradient, westing gradient, southing gradient and northing gradient, the easting weight factor, westing weight factor, southing weight factor and northing weight factor of the current four-Bayer pixel are calculated.

3. The method for converting a RAW image in a quad-Bayer format according to claim 2, wherein: The method of calculating the east gradient, west gradient, south gradient and north gradient of the current four-Bayer pixel in the cache window includes: Extracting a cache window, wherein the current four-Bayer pixel is located at the center of the cache window; Using the pixels in the cache window that are in the same direction as the gradient direction and the current four-bayer pixel, the eastward gradient, westward gradient, southward gradient, and northward gradient of the current pixel are calculated.

4. The method for converting a RAW image in a quad-Bayer format according to claim 3, wherein: The method of calculating the east gradient, west gradient, south gradient and north gradient of the current pixel point by using the pixel points in the same direction as the gradient direction in the cache window and the current four-bayer pixel point comprises: If the current four-Bayer pixel is an R pixel or a B pixel, the east gradient, west gradient, south gradient and north gradient of the three pixels to be converted are calculated; If the current four-Bayer pixel is a G pixel, the east gradient, west gradient, south gradient and north gradient of the two pixels to be converted are calculated.

5. The method for converting the format of a quad-Bayer RAW image according to claim 2, characterized in that: The method for calculating the eastward weight factor, the westward weight factor, the southward weight factor and the northward weight factor of the current four-Bayer pixel point according to the eastward gradient, the westward gradient, the southward gradient and the northward gradient comprises: Using the easting gradient, the easting weight factor of the current four-Bayer pixel is calculated, which is expressed as: Using the westward gradient, the westward weight factor of the current four-Bayer pixel is calculated, which is expressed as: Using the south gradient, the south weight factor of the current four-Bayer pixel is calculated, which is expressed as: Using the north gradient, the north weight factor of the current four-Bayer pixel is calculated, which is expressed as: 。 6. The method for converting a RAW image in a quad-Bayer format according to claim 1, wherein: The method for calculating the pixel estimation value of the current four-Bayer pixel in the cache window includes: Extracting a cache window, wherein the current four-Bayer pixel is located at the center of the cache window; Get the target color pixel of the pixel to be converted in the current four-Bayer pixel; Using the pixel points in the cache window that have the same color as the target color pixel, the east pixel estimation value, west pixel estimation value, south pixel estimation value and north pixel estimation value of the pixel point to be converted are calculated.

7. The method for converting a RAW image in a quad-Bayer format according to claim 1, wherein: The method for calculating the pixel value of the common Bayer pixel corresponding to the current four Bayer pixel according to the weight factor and the pixel estimation value includes: The pixel estimation values ​​are weighted averaged by using the weight factor to obtain the pixel value of the common Bayer pixel corresponding to the pixel to be converted among the current four Bayer pixels.

8. The method for converting the format of a quad-Bayer RAW image according to claim 1, characterized in that: The method for counting pixel values ​​of all ordinary Bayer pixels to output an ordinary Bayer format RAW image comprises: According to the ordinary Bayer format, the pixel values ​​of the ordinary Bayer pixels corresponding to the current four Bayer pixels are arranged to output an ordinary Bayer format RAW image.

9. A device for converting a RAW image in a four-Bayer format, used to implement the method for converting a RAW image in a four-Bayer format as claimed in any one of claims 1 to 8, characterized in that: The format conversion device of the four-Bayer format RAW image comprises: An image acquisition module, used for acquiring a four-Bayer format RAW image; A weight factor calculation module, used to calculate the weight factor of the current four-Bayer pixel in the cache window; A pixel estimation value calculation module, used for calculating the pixel estimation value of the current four-Bayer pixel in the cache window; A pixel conversion module, used for calculating the pixel value of the common Bayer pixel corresponding to the current four Bayer pixel according to the weight factor and the pixel estimation value; Image conversion module, used to count the pixel values ​​of all ordinary Bayer pixels; The image output module is used to output ordinary Bayer format RAW images.

10. An electronic device, characterized in that: The invention comprises a memory, a processor and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, the format conversion method of the four-Bayer format RAW image as described in any one of claims 1 to 8 is executed.