Method and apparatus for image reduction
By performing de-mosaicing and phase coefficient filtering during image downsizing, the problem of image quality degradation is solved, and image clarity and high-frequency performance are improved, especially with more accurate pixel calculations at edge locations.
Patent Information
- Application Number
- CN202080099741.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-21
- Publication Date
- 2026-03-20
- Estimated Expiration
- 2040-04-21
AI Technical Summary
Existing technologies suffer from image quality degradation and issues such as moiré patterns or false color due to varying aliasing across the four channels during image downscaling.
By acquiring the phase coefficients in the image, the image is de-mosaiced, converting multiple pixels into a single pixel, especially increasing B-channel pixels in the same area, shortening the sampling interval, and combining the phase coefficients for filtering and reduction.
It improves the sharpness of images after downsizing, maintains more high-frequency performance, and reduces image quality degradation, especially with more accurate pixel calculations at edge locations.
Smart Images

Figure CN115380521B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image processing, and more particularly, to a method and device for image downscaling. BACKGROUND
[0002] An image sensor receives incident light and converts the light signal into an electrical signal, and outputs a raw image to an image signal processor (ISP) module. The ISP module outputs an image in a red green blue (RGB) or other color space to a back-end video acquisition unit through a series of underlying image processing algorithms.
[0003] Generally, if the ISP module processes the image in full size, a higher definition image with more complete high-frequency details can be obtained. However, in a video case, in order to make the human eye appear more smooth, a high frame rate (at least 30 fps) must be maintained. If full-size processing is still performed, the amount of data per frame is too large, and the data processing capability requirement of the ISP module is too high. Therefore, in order to save the bandwidth or power consumption of the ISP module, the ISP module can perform a certain downscaling operation on the raw image, thereby reducing the bandwidth or power consumption of the ISP module by reducing the image size.
[0004] In a traditional scheme, the pixels in four channels (i.e., R channel, Gr channel, Gb channel, and B channel) in the image are respectively down-scaled. Due to different aliasing conditions of the four channels, the quality of the down-scaled image is degraded (e.g., moire patterns or false colors are generated). Therefore, how to improve the image quality needs to be solved. SUMMARY
[0005] The present application provides a method and device for image downscaling, which can improve the image quality.
[0006] In a first aspect, a method for image downscaling is provided, which includes: obtaining a phase coefficient of a first position in an image, the image including N×N pixels, and the N×N pixels including M×M first pixels, M<N, M and N are integers, and the first position is the position of one of the M×M first pixels; performing demosaicing processing on the N×N pixels to obtain N×N first pixels; and filtering and downscaling pixel values of the N×N first pixels by using the phase coefficient of the first position.
[0007] The phase coefficient corresponding to the position of a first pixel point in an image including N*N pixel points is acquired, and N*N first pixel points are obtained by performing demosaicing on the pixel points in the image, and then the N*N first pixel points are reduced according to the phase coefficient. That is, through the demosaicing, a plurality of pixel points can be converted into the same pixel point, so that the first pixel points in a region of the image are increased, which helps to maintain more high-frequency performance when the reduction operation is performed, thereby improving the definition of the reduced image.
[0008] In some possible implementation manners, the demosaicing of the N*N pixel points to obtain N*N first pixel points comprises: converting a target second pixel point in the N*N pixel points into the first pixel point, the first pixel point being any one of an R channel pixel point, a B channel pixel point, a Gr channel pixel point or a Gb channel pixel point, and the target second pixel point being any one of an R channel pixel point, a B channel pixel point, a Gr channel pixel point or a Gb channel pixel point except the first pixel point.
[0009] The B channel pixel points in the same region are increased, that is, the distance of the sampling interval is shortened. That is, the embodiment integrates the high-frequency form through the demosaicing operation, so that more high-frequency details are maintained, thereby helping to improve the definition of the reduced image.
[0010] In some possible implementation manners, in the case where the first pixel point is an R channel pixel point, the method further comprises: determining the average of the pixel values of the four first pixel points around the target second pixel point as the pixel value of the first pixel point converted from the target second pixel point, the target second pixel point being a B channel pixel point; or determining the average of the pixel values of the two first pixel points adjacent to the target second pixel point as the pixel value of the first pixel point converted from the target second pixel point, the target second pixel point being a Gr channel or a Gb channel pixel point.
[0011] The B channel pixel points in the same region are increased, thereby shortening the distance of the sampling interval. That is, the embodiment provides an implementation manner for shortening the distance of the sampling interval, thereby helping to improve the definition of the reduced image.
[0012] In some possible implementation manners, the method further comprises: determining the pixel value of the first pixel point converted from the target second pixel point according to the pixel value of the target second pixel point, the pixel values of the two first pixel points adjacent to the target second pixel point and the pixel values of the two second pixel points adjacent to the target second pixel point.
[0013] After the target second pixel point is converted into the first pixel point, the pixel value of the converted first pixel point can also be determined in combination with the original pixel value of the target second pixel point, the pixel values of the two second pixel points adjacent to the target second pixel point, and the pixel values of the two first pixel points adjacent to the target second pixel point. In this way, the high-frequency information can be further enhanced, the pixel value of the converted first pixel point is more accurate, and thus the clarity of the image after being reduced can be further improved.
[0014] In some possible implementation manners, the determining the pixel value of the first pixel point converted from the target second pixel point according to the pixel value of the target second pixel point, the pixel values of the two first pixel points adjacent to the target second pixel point, and the pixel values of the two second pixel points adjacent to the target second pixel point includes that the original pixel value of the target second pixel point, the pixel values of the two first pixel points adjacent to the target second pixel point, the pixel values of the two second pixel points adjacent to the target second pixel point, and the pixel value of the converted first pixel point satisfy the following formula: G b =(G1+G2) / 2+weight*(2*R c -R1-R2), where G b is the pixel value of the first pixel point converted from the target second pixel point, G1 and G2 are the pixel values of the two first pixel points adjacent to the target second pixel point, R1 and R2 are the pixel values of the two second pixel points adjacent to the target second pixel point, R c is the pixel value of the target second pixel point, the first pixel point is a Gb channel pixel point, the second pixel point is an R channel pixel point, and weight is a preset value.
[0015] This embodiment provides another implementation manner for shortening the distance of the sampling interval, and thus the clarity of the image after being reduced can be improved.
[0016] In some possible implementation manners, the method further includes determining the pixel value of the first pixel point converted from the target second pixel point according to the pixel value of the target second pixel point and a directional color difference value, where the directional color difference value is a color difference value along an edge direction.
[0017] The directional color difference can be considered when the pixel point conversion is performed, and especially for the pixel points at edge positions, the pixel value of the converted pixel point can be more accurately calculated, and thus the clarity of the image after being reduced can be further improved.
[0018] In some possible implementation manners, the determining the pixel value of the first pixel point according to the pixel value and the directional color difference value of the target second pixel point comprises: Rc'= Rc+ color difference, where Rc' is the pixel value of the first pixel point converted from the target second pixel point, Rc is the pixel value of the target second pixel point, and color difference is the directional color difference.
[0019] The embodiment provides a specific scheme for considering the directional color difference when performing pixel point conversion, and can more accurately calculate the pixel value of the converted pixel point, thereby helping to further improve the definition of the reduced image.
[0020] In a second aspect, an image reduction apparatus is provided, which is configured to perform the method in the first aspect or any possible implementation manner of the first aspect.
[0021] In a third aspect, an image reduction apparatus is provided, which comprises a processor and a memory. The memory is configured to store program instructions, and the processor is configured to invoke the program instructions to perform the method in the first aspect or any possible implementation manner of the first aspect.
[0022] In a fourth aspect, a computer readable storage medium is provided, which stores program codes for execution by a device. The program codes comprise codes for performing the method in the first aspect or any possible implementation manner of the first aspect.
[0023] In a fifth aspect, a chip is provided, which comprises a processor and a data interface. The processor reads instructions stored on a memory through the data interface, to perform the method in the first aspect or any possible implementation manner of the first aspect. Based on the technical solution, a phase coefficient corresponding to the position of a first pixel point in an image comprising N*N pixel points is obtained, the pixel points in the image are subjected to demosaicing processing to obtain N*N first pixel points, and the N*N first pixel points are subjected to reduction processing according to the phase coefficient. That is, the plurality of pixel points can be converted into the same pixel point through the demosaicing processing, so that the number of first pixel points in a region of the image is increased, which helps to maintain more high-frequency performance when performing the reduction operation, thereby improving the definition of the reduced image. BRIEF DESCRIPTION OF DRAWINGS
[0024] Figure 1 FIG. 1 is a schematic diagram of an ISP architecture of an embodiment of the present application;
[0025] Figure 2 FIG. 2 is a schematic diagram of a method of image reduction in a conventional scheme;
[0026] Figure 3 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0027] Figure 4 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0028] Figure 5 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0029] Figure 6 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0030] Figure 7 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0031] Figure 8 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0032] Figure 9 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0033] Figure 10 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0034] Figure 11 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0035] Figure 12 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0036] Figure 13 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0037] Figure 14 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0038] Figure 15 is a schematic flow chart of the method of image reduction according to an embodiment of the application;
[0039] Figure 16 is a schematic block diagram of the apparatus for image reduction according to an embodiment of the application;
[0040] Figure 17 is a schematic block diagram of the apparatus for image reduction according to an embodiment of the application. DETAILED DESCRIPTION
[0041] The technical solutions in the present application will be described below with reference to the drawings.
[0042] The related terms involved in the present application will be described in detail below.
[0043] RAW:
[0044] A light sensing element (CMOS or CCD) image sensor converts the captured light source signal into a digital signal. A RAW file is a file that records the original information of a digital camera sensor and records some metadata generated by the camera shooting. The metadata can be the setting of the light sensitivity, shutter speed, aperture value, or white balance, etc.
[0045] Bayer format:
[0046] For a color image, three different color wavelength filters are needed to obtain red (R), green (G), and blue (B) information, respectively. The three filters are expensive and have high costs. In order to save costs, a color filter array is covered in front of the image sensor, and only one color (R or G or B) is transmitted at each pixel point. Therefore, each light sensing point of the image sensor only captures one color information, and a mosaic image is obtained. Subsequently, the R, G, and B color information of each point is obtained by interpolation. If the color filter array is arranged in RGRG / GBGB, the raw data obtained is called Bayer format raw data.
[0047] ISP module:
[0048] The ISP module is used to process the image signal transmitted by the front-end image sensor. The front-end image sensor outputs a Bayer format image, which is processed in the ISP module through modules such as black level compensation, lens shading correction, bad pixel correction, Raw domain denoising, white balance correction (AWB), color correction, demosaicing, Gamma brightness correction, RGB to color (YUV) space conversion, and YUV domain enhancement. YUV image data is output. In addition, the ISP module is the first step in the camera imaging process, and plays a very key role in image quality.
[0049] Figure 1 The ISP basic framework of the embodiment of the present application is shown. As shown in FIG. 1, the ISP module includes a front-end image sensor, a RAW image signal processor, a YUV image signal processor, and a back-end image signal processor. Figure 1As shown, the ISP basic architecture includes a sensor 101, a black level correction module 102, a bad point detection and correction module 103, a Raw downscaling module 104, a denoising module 105, a demosaicing module 106, a color space conversion module 107, and a color enhancement module 108. The sensor 101 inputs an image to the online pre-processing function modules at the front end of the ISP module (for example, the black level correction module 102 and the bad point detection and correction module 103), and then performs downscaling processing via the Raw downscaling module 104 to reduce the power consumption overhead of the Raw downscaling module, performs denoising processing via the denoising module 105, performs demosaicing processing via the demosaicing module 104, and finally performs processing via the color space conversion module 107 and the color enhancement module 108, to finally output an image meeting the visual requirements of the human eye.
[0050] It should be noted that the demosaicing processing in the embodiments of the present application is not performed in the demosaicing processing module 104, but the demosaicing technology is adopted in the downscaling processing of the Raw downscaling module 104.
[0051] In the conventional scheme, the Raw downscaling module respectively performs downscaling on the pixel points in four channels (namely, the R channel, the Gr channel, the Gb channel, and the B channel) of the image. For example, as shown in the following table, the Raw downscaling module selects eight pixel points of the same channel attribute around a target position. Figure 2 As shown, the Raw downscaling module selects eight pixel points of the same channel attribute around a target position. Decimal analysis is performed on the target position coordinates to obtain eight phases, and then a combination of coefficients corresponding to the eight phases is selected from a phase coefficient table. The eight phases and the combination of coefficients are normalized to obtain an interpolation result. Subsequently, the Raw downscaling module performs horizontal direction downscaling on the image, and then performs vertical direction downscaling on the downscaling result. However, since the Raw downscaling module performs single-channel sampling on the pixel points in the image, aliasing is relatively serious. In addition, the four channels are respectively down-scaled in the downscaling process, which further aggravates the aliasing of the four channels. Therefore, the image quality is reduced (for example, moire or pseudo-color is generated) after the image is down-scaled by using the conventional scheme.
[0052] Figure 3 FIG. 1 shows a schematic diagram of the image downscaling method according to an embodiment of the present application.
[0053] It should be noted that the execution subject of the image downscaling method according to the embodiments of the present application can be a terminal, an ISP module in the terminal, or a Raw downscaling module. For the convenience of description, the Raw downscaling module is taken as an example in the following embodiments, but the present application is not limited thereto.
[0054] 301, acquire a phase coefficient of a first position in an image, the image comprising N*N pixel points, and the N*N pixel points comprising M*M first pixel points, the first position being a position of one of the M*M first pixel points.
[0055] Specifically, different positions correspond to different phase coefficients. The Raw reduction module can acquire a phase coefficient of a first position of a first pixel point in an image. The Raw reduction module can determine the corresponding phase according to the first position. Assuming that 8 pixel points need to be interpolated, the phase can be calculated from the decimal position (Ldec) of the position coordinates of the first position, i.e. phase=(floor)(8*Ldec). The RAW reduction module can also store the correspondence between different phases and phase coefficients (such as a coefficient table). As shown in Figure 4 , taking the B channel pixel point as the first pixel point, the selected 8*8 range is [-3, 4]*[-3, 4]. The RAW reduction module can acquire the phase coefficient corresponding to the position of a certain B channel pixel point (such as the B channel pixel point in the box in Figure 4 .
[0056] It can be understood that the image in step 301 can be the entire image that needs to be reduced, or a part of the entire image.
[0057] It can also be understood that the pixel points in the embodiments of the present application can be R channel, Gr channel, Gb channel and B channel pixel points. That is, the N*N pixel points included in the image can be at least two of the four types of pixel points, and the following embodiments are described taking the image including four types of pixel points as an example.
[0058] 302, performing demosaicing processing on the N*N pixel points to obtain N*N first pixel points.
[0059] Specifically, the RAW reduction module can perform demosaicing processing on the pixel points in the image to obtain a type of pixel points, i.e. the same channel attribute pixel points in the same region are increased, which helps to maintain more high frequency performance when performing the reduction operation, thereby improving the clarity of the reduced image. For example, as shown in Figure 4 , the image includes 4*4 first pixel points, and 8*8 first pixel points are obtained after demosaicing processing. That is, converting other channel pixel points into first pixel points can also be understood as interpolating the first pixel point in other channel pixel points. That is, interpolating B channel pixel points in R channel pixel points, interpolating B channel pixel points in Gr channel pixel points, interpolating B channel pixel points in Gb channel pixel points, and interpolating B channel pixel points in B channel pixel points.
[0060] It's understandable that interpolating B-channel pixels can result in the interpolated pixel having the same value as the original B-channel pixel. Alternatively, interpolating B-channel pixels can mean taking the B-channel pixel value directly.
[0061] Optionally, step 302 specifically involves converting the target second pixel among the N×N pixels into the first pixel, wherein the first pixel is any one of an R-channel pixel, a B-channel pixel, a Gr-channel pixel, or a Gb-channel pixel, and the target second pixel is at least one of the R-channel pixel, B-channel pixel, Gr-channel pixel, or Gb-channel pixel other than the first pixel.
[0062] Specifically, the RAW downscaling module can convert pixels that are not the first pixel among the N×N pixels into the first pixel, thus reducing the sampling interval between adjacent first pixels. For example, as Figure 5 As shown, with Figure 4 Using a portion of the image shown as an example, the B-channel pixels are calculated from the Gb-channel pixels. This increases the number of B-channel pixels within the same area, thus shortening the sampling interval. In other words, this embodiment completes the high-frequency morphology through demosaicing, preserving more high-frequency details and thus helping to improve the clarity of the image after reduction.
[0063] Understandable Figure 5 Other channel pixels shown can be partially or completely converted into the first pixel, and this application does not limit this.
[0064] It is also understandable that the RAW downsizing module can convert the N×N pixels into pixels with other channel attributes, and this application does not limit this.
[0065] In one embodiment, if the first pixel is an R-channel pixel and the target second pixel is a B-channel pixel, then after the RAW downscaling module converts the target second pixel into a first pixel, the pixel value of the converted first pixel is the average of the pixel values of the four first pixels surrounding the target second pixel.
[0066] Specifically, the RAW downsizing module converts the second pixel of the target into the first pixel, which can be understood as interpolating the first pixel value at the position of the second pixel of the target. For example... Figure 6 As shown, the first pixel is an R-channel pixel, and the second pixel is a B-channel pixel. The pixel value R(B) after converting the B-channel pixel to an R-channel pixel is the average of the pixel values of the four surrounding R-channel pixels, i.e., R(B) = (R... 11 +R 13 +R31 +R 33 ) / 4.
[0067] If the first pixel point is an R channel pixel point and the target second pixel point is a Gr channel pixel point, the RAW reducing module converts the target second pixel point into a first pixel point, and the pixel value of the converted first pixel point is the average of the pixel values of the two first pixel points adjacent to the target second pixel point.
[0068] Specifically, as shown in Figure 7 , the first pixel point is an R channel pixel point and the target second pixel point is a Gb channel pixel point. The pixel value R(Gb) of the Gb channel pixel point converted into an R channel pixel point is the average of the pixel values of the two first pixel points adjacent above and below, i.e. R(Gb) = (R 12 +R 32 ) / 2.
[0069] If the first pixel point is an R channel pixel point and the target second pixel point is a Gr channel pixel point, the RAW reducing module converts the target second pixel point into a first pixel point, and the pixel value of the converted first pixel point is the average of the pixel values of the two first pixel points adjacent to the target second pixel point.
[0070] Specifically, as shown in Figure 8 , the first pixel point is an R channel pixel point and the target second pixel point is a Gr channel pixel point. The pixel value R(Gr) of the Gr channel pixel point converted into an R channel pixel point is the average of the pixel values of the two first pixel points adjacent left and right, i.e. R(Gr) = (R 21 +R 23 ) / 2.
[0071] It can be understood that the demosaicing method of the embodiment can also be called "simple demosaicing".
[0072] In another embodiment, the RAW reducing module can also determine the pixel value of the first pixel point converted from the target second pixel point according to the pixel value of the target second pixel point, the pixel values of the two second pixel points adjacent to the target second pixel point, and the pixel values of the two first pixel points adjacent to the target second pixel point.
[0073] Specifically, after the RAW reducing module converts the target second pixel point into a first pixel point, the pixel value of the converted first pixel point can also be determined in combination with the original pixel value of the target second pixel point, the pixel values of the two second pixel points adjacent to the target pixel point, and the pixel values of the two first pixel points adjacent to the target second pixel point. In this way, the RAW reducing module can further enhance the high-frequency information, so that the pixel value of the converted first pixel point is more accurate, thereby helping to further improve the clarity of the reduced image.
[0074] It should be noted that since the sampling density of the Gb channel pixel point or the Gr channel pixel point is higher, more high-frequency details are contained, and therefore the scheme is more effective when the first pixel point is a Gr channel pixel point or a Gb channel pixel point.
[0075] It can also be understood that the calculation manner of the pixel value of the first pixel point converted from the target second pixel point in the embodiment is based on that the black level processing and the white balance processing of the image have been completed by the RAW down-sampling module.
[0076] Optionally, in the case where the first pixel point is a Gb channel pixel point and the second pixel point is an R channel pixel point, the pixel value of the first pixel point after the target second pixel point is converted can specifically be the original pixel value of the target second pixel point, the pixel values of the two adjacent first pixel points of the target second pixel point, the pixel values of the two adjacent second pixel points of the target second pixel point, and the pixel value of the converted first pixel point satisfy the following formula:
[0077] Gb(R) = (G1+G2) / 2+weight*(2*R c -R1-R2), where Gb(R) is the pixel value of the first pixel point converted from the target second pixel point, G1 and G2 are the pixel values of the two adjacent first pixel points of the target second pixel point, R1 and R2 are the pixel values of the two adjacent second pixel points of the target second pixel point, R c is the pixel value of the target second pixel point, and weight is a preset value.
[0078] For example, as shown in FIG. 2, the target second pixel point of the R channel (i.e., R 32 ) is converted into a Gb channel pixel point. R 32 The two adjacent first pixel points of R 22 are Gb 42 and Gb 32 , and the two adjacent second pixel points of R 12 are R 52 and R 22 . Therefore, R(Gb) = (Gb 42 + Gb 32 ) / 2+weight*(2*R 12 -R 52 -R b ). The weight can be flexibly configured according to the requirement of definition.
[0079] It can be understood that the target second pixel point is one of the plurality of second pixel points.
[0080] It is also understood that the de-mosaic method in this embodiment can also be called "high-frequency enhanced de-mosaic".
[0081] In another embodiment, the RAW reduction module can also determine the pixel value of the first pixel after it has been transformed from the target second pixel based on the pixel value of the target second pixel and the directional color difference value, wherein the directional color difference value is the color difference along the edge direction.
[0082] Specifically, the edge direction can be divided into four directions: 0 degrees, 45 degrees, 90 degrees, and 135 degrees. This allows the RAW downsizing module to determine the pixel value of the first pixel after conversion based on the pixel value of each target's second pixel and the directional color difference value. In other words, the RAW downsizing module can consider directional color differences during pixel conversion, especially for pixels at edges, enabling more accurate calculation of the converted pixel value and further improving the sharpness of the downsized image.
[0083] For example, such as Figure 10 As shown, if the edge direction is 0 degrees, the directional color difference value colordiff_0 corresponding to 0 degrees is determined through the mapping relationship between direction and directional color difference values. If the edge direction is 90 degrees, the directional color difference value colordiff_90 corresponding to 90 degrees is determined through the mapping relationship between direction and directional color difference values (e.g., ...). Figure 11 If the edge direction is 45 degrees, then the directional color difference value colordiff_45 corresponding to 45 degrees is determined through the mapping relationship between direction and directional color difference value (e.g., ...). Figure 12 If the edge direction is 135 degrees, then the directional color difference value colordiff_135 corresponding to 135 degrees is determined through the mapping relationship between direction and directional color difference value (e.g., ...). Figure 13 If we take the first pixel as the Gr channel pixel as an example, then all other channel pixels are converted to the first pixel, and the image will look like this. Figure 14 As shown.
[0084] In one implementation, the RAW downsizing module determines the pixel value of the first pixel based on the pixel value of the target second pixel and the directional color difference value. Specifically, the pixel value of the target second pixel, the directional color difference value, and the pixel value of the first pixel satisfy the following formula:
[0085] Rc′=Rc+colordiff, where Rc′ is the pixel value of the first pixel after being converted from the second pixel of the target, Rc is the pixel value of the second pixel of the target, and colordiff is the directional color difference.
[0086] It can be understood that the demosaicing manner of the embodiment can also be referred to as "directional demosaicing".
[0087] It can also be understood that the RAW downsizing module can flexibly select a specific demosaicing manner according to its own needs, and the present application does not limit this.
[0088] 303, filtering and downsizing the pixel values of the N*N first pixel points through the phase coefficient of the first position.
[0089] Specifically, the RAW downsizing module downsizes the image processed by the demosaicing. The RAW downsizing module can first downsize the image in the horizontal direction, that is, multiply the point column centered on the integer position (Lint) of the first position by the phase coefficient (coefficient) obtained in step 301 to obtain the horizontal interpolation result. Then, multiply the horizontal interpolation result with the point column in the vertical direction, and obtain the numerical downsizing result by weighted averaging. For example, as shown in Figure 15 As shown in the figure, for 8*8 pixel points, multiply the 8-order point column centered on the integer position of the first position by the 8-order point column obtained in step 301 to obtain 8 rows of horizontal interpolation results. Multiply the 8 rows of horizontal interpolation results with the 8-order point column in the vertical direction, and then obtain the downsizing result by weighted averaging.
[0090] It should be understood that the specific examples in the embodiments of the present application are only to help those skilled in the art better understand the embodiments of the present application, and do not limit the scope of the embodiments of the present application.
[0091] It should also be understood that the size of the serial number of the above processes does not mean the order of execution, and the execution order of the processes should be determined according to their functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0092] It should also be understood that in the embodiments of the present application, "pre-configuration" can be achieved by pre-storing corresponding codes, tables or other ways that can be used to indicate related information in devices (such as smart devices and cloud servers), and the present application does not limit the specific implementation manner.
[0093] It should also be understood that in the various embodiments of the present application, the terms and / or descriptions of different embodiments are consistent and can be mutually referred to if there is no special description and logical conflict, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship.
[0094] The above, in combination with Figures 3-15 The method provided by the embodiments of the present application is described in detail. In the following, in combination with Figures 16-17The device provided by the embodiments of the present application is described in detail. It should be understood that the description of the device embodiments corresponds to the description of the method embodiments, and therefore, the content not described in detail can be referred to the method embodiments, and some content will not be described again for the sake of brevity.
[0095] Figure 16 A structural diagram of the device 1600 for image downsizing in one embodiment of the present application is shown. It should be understood that the device 1600 can implement the method shown in 3. The device can be a terminal, or a module (for example, a RAW downsizing module) or component in the terminal.
[0096] The device 1600 can include units for performing various operations in the foregoing method embodiments. Also, each unit in the device 1600 is respectively for implementing the corresponding flow of any of the foregoing methods. The device 1600 includes a transceiver module 1610 and a processing module 1620.
[0097] The transceiver module 1610 is configured to obtain a phase coefficient of a first position in an image, the image including N×N pixel points, and the N×N pixel points including M×M first pixel points, M<N, M and N are integers, and the first position is a position of one of the M×M first pixel points.
[0098] The processing module 1620 is configured to perform demosaicing processing on the N×N pixel points to obtain N×N first pixel points.
[0099] The processing module 1620 is further configured to filter and downsize pixel values of the N×N first pixel points by using the phase coefficient of the first position.
[0100] Optionally, the processing module 1620 is specifically configured to:
[0101] convert a target second pixel point in the N×N pixel points into the first pixel point, the first pixel point being any one of an R channel pixel point, a B channel pixel point, a Gr channel pixel point or a Gb channel pixel point, and the target second pixel point being any one of an R channel pixel point, a B channel pixel point, a Gr channel pixel point or a Gb channel pixel point except the first pixel point.
[0102] Optionally, in a case where the first pixel point is an R channel pixel point, the processing module 1620 is further configured to:
[0103] determine an average of pixel values of four first pixel points around the target second pixel point as a pixel value of the first pixel point converted from the target second pixel point, the target second pixel point being a B channel pixel point; or
[0104] The average pixel value of the two first pixels adjacent to the second pixel of the target is determined as the pixel value of the first pixel after conversion from the second pixel of the target. The second pixel of the target is a Gr channel or Gb channel pixel.
[0105] Optionally, the processing module 1620 is further configured to determine the pixel value of the first pixel after being transformed from the target second pixel based on the pixel value of the target second pixel, the pixel values of the two adjacent first pixels of the target second pixel, and the pixel values of the two adjacent second pixels of the target second pixel.
[0106] Optionally, the original pixel value of the target second pixel, the pixel values of the two adjacent first pixels of the target second pixel, the pixel values of the two adjacent second pixels of the target second pixel, and the pixel value of the transformed first pixel satisfy the following formula:
[0107] G b = (G1+G2) / 2+weight*(2*R) c -R1-R2), where G b Let G1 and G2 be the pixel values of the first pixel after the second pixel of the target is converted, and R1 and R2 be the pixel values of the two first pixels adjacent to the second pixel of the target. c The first pixel is a Gb channel pixel, the second pixel is an R channel pixel, and the weight is a preset value.
[0108] Optionally, the processing module 1620 is further configured to determine the pixel value of the first pixel after being converted from the second pixel of the target based on the pixel value of the second pixel of the target and the directional color difference value, wherein the directional color difference value is the color difference value along a preset direction.
[0109] Optionally, the processing module 1620 is specifically used for:
[0110] Rc′=Rc+colordiff, where Rc′ is the pixel value of the first pixel after being converted from the second pixel of the target, Rc is the pixel value of the second pixel of the target, and colordiff is the directional color difference.
[0111] It should be understood that the specific process of each module performing the above-mentioned steps has been described in detail in the above method embodiments, and will not be repeated here for the sake of brevity.
[0112] Figure 17 An image reduction apparatus 1700 according to an embodiment of this application is shown. This apparatus can employ, for example... Figure 17The illustrated hardware architecture. The apparatus can include a processor 1710 and a transceiver 1720, and optionally, the apparatus can further include a memory 1730, the processor 1710, the transceiver 1720 and the memory 1730 communicate with each other through an internal connection path. Figure 16 The related functions implemented by the processing module 1620 in the apparatus can be implemented by the processor 1710, and the related functions implemented by the transceiving module 1610 can be implemented by the processor 1710 controlling the transceiver 1720.
[0113] Optionally, the processor 1710 can be a general central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), a special-purpose processor, or one or more integrated circuits for executing the technical solutions of the embodiments of the present application. Alternatively, the processor can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions). For example, it can be a baseband processor or a central processor. The baseband processor can be used to process communication protocols and communication data, and the central processor can be used to control the communication apparatus (such as a base station, a terminal, or a chip, etc.), execute software programs, and process data of software programs.
[0114] Optionally, the processor 1710 can include one or more processors, for example, including one or more central processing units (CPUs), and in the case of the processor being a CPU, the CPU can be a single-core CPU or a multi-core CPU.
[0115] The transceiver 1720 is used to send and receive data and / or signals, and receive data and / or signals. The transceiver can include a transmitter and a receiver, the transmitter is used to send data and / or signals, and the receiver is used to receive data and / or signals.
[0116] The memory 1730 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable memory (EPROM), compact disc read-only memory (CD-ROM), and the memory 1730 is used to store related instructions and data.
[0117] The memory 1730 is configured to store program codes and data of the network device, and can be a separate device or integrated in the processor 1710.
[0118] Specifically, the processor 1710 is configured to control the transceiver to perform information transmission with the terminal. For details, refer to the description in the method embodiments, which will not be repeated here.
[0119] In specific implementations, as an embodiment, the apparatus 1700 can further include an output device and an input device. The output device and the processor 1710 are in communication, and can display information in various ways. For example, the output device can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device and the processor 1710 are in communication, and can receive user input in various ways. For example, the input device can be a mouse, a keyboard, a touch screen device, a sensor device, etc.
[0120] It can be understood that, Figure 17 Only a simplified design of the communication apparatus is shown. In actual applications, the apparatus can also include other necessary elements, including but not limited to any number of transceivers, processors, controllers, memories, etc., and all network devices that can implement the present application are within the protection scope of the present application.
[0121] It should also be understood that the apparatus 1600 is a terminal, a chip or a chip system configured in the terminal. When the apparatus 1600 is a chip or a chip system configured in the terminal, the transceiver module 1610 in the apparatus 1600 can be a data transmission interface, an interface circuit, a data transmission circuit or a pin, the processing module 1620 can be a processor, a processing circuit or a logic circuit, and the storage unit can be a memory or a storage circuit.
[0122] It should be understood that when the above device 1600 is a chip, the chip can be a field programmable gate array (FPGA), can be an application specific integrated circuit (ASIC), can also be a system on chip (SoC), can also be a central processor unit (CPU), can also be a network processor (NP), can also be a digital signal processing circuit (DSP), can also be a microcontroller unit (MCU), can also be a programmable logic device (PLD) or other integrated chip.
[0123] In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor or the instructions in the form of software. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as hardware processor execution completion, or executed by hardware and software module combination in the processor. The software module can be located in the mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, register and the like. The storage medium is located in the memory, and the processor reads the information in the memory, and combines the hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.
[0124] It should be noted that the processor in the embodiments of the present application can be an integrated circuit chip with a signal processing capability. In the implementation process, the steps of the method embodiments described above can be completed by an integrated logic circuit or an instruction in the form of software in the processor. The processor described above can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register, and other mature storage media in the art. The storage medium is located in the storage, and the processor reads the information in the storage, and combines the hardware to complete the steps of the above method.
[0125] According to the method provided by the embodiments of the present application, the present application further provides a computer program product, which comprises computer program code, when the computer program code runs on a computer, so that the computer executes the method in any one of the preceding method embodiments.
[0126] According to the method provided by the embodiments of the present application, the present application further provides a computer readable medium, which stores instructions, when the instructions run on a computer, so that the computer executes the method in any one of the preceding method embodiments.
[0127] Those skilled in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0128] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the system, device and unit described above can refer to the corresponding process in the preceding method embodiments, which will not be repeated here.
[0129] In the embodiments of the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the embodiments of the device described above are merely schematic; the division of the units is merely logical function division; there can be another division manner in actual implementation; for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0130] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.
[0131] In addition, each functional unit in the various embodiments of the present application can be integrated into a processing unit, or each unit can be a physically independent unit, or two or more units can be integrated into a unit.
[0132] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program codes that can be stored in the medium.
[0133] The above description is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, which should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for reducing image size, characterized in that, The method is applied to the RAW downscaling module of an Image Signal Processor (ISP), and the method includes: Obtain the phase coefficient of a first position in an image. The image includes N×N pixel points, and among the N×N pixel points, there are M×M first pixel points, where M < N, and both M and N are integers. The first position is the position of one of the M×M first pixel points. Convert a target second pixel point among the N×N pixel points into the first pixel point according to demosaicing. The first pixel point is any one of an R-channel pixel point, a B-channel pixel point, a Gr-channel pixel point, or a Gb-channel pixel point. The target second pixel point is an R-channel pixel point, a B-channel pixel point, a Gr-channel pixel point, or a Gb-channel pixel point other than the first pixel point. Among them, the conversion of the target second pixel point among the N×N pixel points into the first pixel point according to demosaicing includes: When the first pixel point is an R-channel pixel point, determine the average value of the pixel values of 4 first pixel points around the target second pixel point as the pixel value of the first pixel point after conversion from the target second pixel point, where the target second pixel point is a B-channel pixel point; or, When the first pixel point is an R-channel pixel point, determine the average value of the pixel values of 2 adjacent first pixel points of the target second pixel point as the pixel value of the first pixel point after conversion from the target second pixel point, where the target second pixel point is a Gr-channel or Gb-channel pixel point; or, Determine the pixel value of the first pixel point after conversion from the target second pixel point according to the pixel value of the target second pixel point, the pixel values of the adjacent 2 first pixel points of the target second pixel point, and the pixel values of the adjacent 2 second pixel points of the target second pixel point. The target second pixel point is one pixel point among multiple second pixel points. Filter and downscale the pixel values of the N×N first pixel points by the phase coefficient at the first position.
2. The method according to claim 1, characterized in that, The determination of the pixel value of the first pixel point after conversion from the target second pixel point according to the pixel value of the target second pixel point, the pixel values of the adjacent 2 first pixel points of the target second pixel point, and the pixel values of the adjacent 2 second pixel points of the target second pixel point includes: The original pixel value of the target second pixel point, the pixel values of the adjacent 2 first pixel points of the target second pixel point, the pixel values of the adjacent 2 second pixel points of the target second pixel point, and the pixel value of the first pixel point after conversion satisfy the following formula: Among them, G b G1 and G2 are the pixel values of the first pixel after being converted from the target second pixel, and R1 and R2 are the pixel values of the two first pixels adjacent to the target second pixel. c The first pixel is a Gb channel pixel, the second pixel is an R channel pixel, and the weight is a preset value.
3. The method according to claim 1, characterized in that, The method further includes: Determine the pixel value of the first pixel point after conversion from the target second pixel point according to the pixel value of the target second pixel point and the directional chromatic aberration value, where the directional chromatic aberration value is the chromatic aberration along the edge direction.
4. The method according to claim 3, characterized in that, The determination of the pixel value of the first pixel point according to the pixel value of the target second pixel point and the directional chromatic aberration value includes: Rc´ = Rc + colordiff, where Rc´ is the pixel value of the first pixel point converted from the target second pixel point, Rc is the pixel value of the target second pixel point, and colordiff is the directional color difference.
5. An image reduction device, characterized in that, The device serves as a RAW reduction module of an Image Signal Processor (ISP). The device includes: A transceiver module, configured to obtain the phase coefficient at a first position in an image. The image includes N×N pixel points, and among the N×N pixel points, there are M×M first pixel points, where M < N, and both M and N are integers. The first position is the position of one of the M×M first pixel points. A processing module, configured to: Convert a target second pixel point among the N×N pixel points into the first pixel point according to demosaicing processing. The first pixel point is any one of an R-channel pixel point, a B-channel pixel point, a Gr-channel pixel point, or a Gb-channel pixel point. The target second pixel point is an R-channel pixel point, a B-channel pixel point, a Gr-channel pixel point, or a Gb-channel pixel point other than the first pixel point. Among them, converting the target second pixel point among the N×N pixel points into the first pixel point according to demosaicing processing includes: When the first pixel point is an R-channel pixel point, determining the average value of the pixel values of 4 first pixel points around the target second pixel point as the pixel value of the first pixel point converted from the target second pixel point, where the target second pixel point is a B-channel pixel point; or, When the first pixel point is an R-channel pixel point, determining the average value of the pixel values of 2 adjacent first pixel points of the target second pixel point as the pixel value of the first pixel point converted from the target second pixel point, where the target second pixel point is a Gr-channel or Gb-channel pixel point; or, Determining the pixel value of the first pixel point converted from the target second pixel point according to the pixel value of the target second pixel point, the pixel values of 2 adjacent first pixel points of the target second pixel point, and the pixel values of 2 adjacent second pixel points of the target second pixel point. The target second pixel point is one pixel point among multiple second pixel points. The processing module is further configured to filter and reduce the pixel values of the N×N first pixel points through the phase coefficient at the first position.
6. The apparatus according to claim 5, characterized in that, The original pixel value of the target second pixel point, the pixel values of 2 adjacent first pixel points of the target second pixel point, the pixel values of 2 adjacent second pixel points of the target second pixel point, and the pixel value of the converted first pixel point satisfy the following formula: Among them, G b G1 and G2 are the pixel values of the first pixel after being converted from the target second pixel, and R1 and R2 are the pixel values of the two first pixels adjacent to the target second pixel. c The first pixel is a Gb channel pixel, the second pixel is an R channel pixel, and the weight is a preset value.
7. The apparatus according to claim 5, characterized in that, The processing module is further configured to determine the pixel value of the first pixel point converted from the target second pixel point according to the pixel value of the target second pixel point and the directional color difference value, where the directional color difference value is the color difference along the edge direction.
8. The apparatus according to claim 7, characterized in that, The processing module is specifically configured to: Rc' = Rc + colordiff, where Rc' is the pixel value of the first pixel after being converted from the second pixel of the target, Rc is the pixel value of the second pixel of the target, and colordiff is the directional color difference.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code for execution by the device, the program code including methods for performing any one of claims 1 to 4.
10. A chip, characterized in that, The chip includes a processor and a data interface. The processor reads instructions stored in the memory through the data interface to execute the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
System and method for image processing
CN103327218A