Method, system, device and storage medium for downscaling image resolution
By performing piecewise interpolation downscaling and low-pass filtering during the image resolution reduction process, and by enhancing the edges of the interpolated image, the problem of strong jagged edges in the image is solved, and the image quality is improved.
Patent Information
- Application Number
- CN202111229442.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-21
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2041-10-21
AI Technical Summary
Existing methods of reducing image resolution result in jagged edges and poor image quality.
By obtaining the resolution of the initial image and the target resolution, the image reduction factor is calculated, one or more interpolation reductions are performed, and low-pass filtering is applied during the interpolation process. Then, edge enhancement is applied to the interpolated image.
It reduces the jagged edges caused by image downsizing, improving image clarity and quality.
Smart Images

Figure CN116012223B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and for example to a method, system, computer device, and storage medium for reducing image resolution. Background Technology
[0002] With the development of electronic technology, the image resolution that cameras on electronic devices can output is getting higher and higher. However, in network video calls, in order to improve the smoothness of the video under poor network conditions, lower resolution images are generally used. Therefore, it is necessary to reduce the resolution of high-resolution images in embedded platforms.
[0003] Existing methods for reducing image resolution typically involve interpolating the processed image to reduce it step by step, with each step reducing it by a factor of 6. However, the resulting image has strong jagged edges and poor image quality. Summary of the Invention
[0004] The purpose of this disclosure is to provide a method, system, computer device, and storage medium for reducing image resolution, resulting in images with smoother edges and higher image quality.
[0005] To achieve the above objectives, the present disclosure adopts the following technical solution:
[0006] This disclosure provides a method for reducing image resolution, comprising the following steps:
[0007] Get the initial image;
[0008] Obtain the initial resolution and target resolution of the initial image, and obtain the image scaling factor value based on the initial resolution and target resolution;
[0009] The initial image is downsized once or multiple times based on the image downsizing factor to obtain the interpolated image at the target resolution. In the process of downsizing once or multiple times, at least one image to be downsized is subjected to low-pass filtering.
[0010] Edge enhancement is performed on the interpolated image to obtain a target image that meets the target resolution.
[0011] This disclosure also provides an image resolution reduction system, including:
[0012] The image acquisition unit is used to acquire the initial image;
[0013] The scaling factor acquisition unit is used to acquire the initial resolution and target resolution of the initial image, and to obtain the image scaling factor value based on the initial resolution and target resolution;
[0014] An interpolation downsizing unit is used to perform one or more interpolation downsizing operations on the initial image based on the image downsizing factor value to obtain an interpolated image of the target resolution, wherein, during one or more interpolation downsizing operations, at least one image to be downsized is subjected to low-pass filtering.
[0015] An edge enhancement unit is used to enhance the edges of the interpolated image to obtain a target image that meets the target resolution.
[0016] This disclosure also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the image resolution reduction method described in any of the preceding claims.
[0017] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the image resolution reduction method described in any of the preceding claims.
[0018] The image resolution reduction method, system, device, and storage medium disclosed herein reduce the image resolution by performing piecewise interpolation reduction on an initial image using an image reduction factor value, thereby reducing the gradient of each reduction and thus mitigating the jaggedness caused by image reduction; by performing low-pass filtering during the interpolation reduction process, the high-frequency components of the image are reduced during the reduction process, thereby reducing the interference of low frequencies after aliasing; and by performing edge enhancement on the interpolated image, the image clarity is improved. Attached Figure Description
[0019] Figure 1 A schematic diagram illustrating the steps of a method for reducing image resolution;
[0020] Figure 2 This is a schematic diagram of the structure of an image resolution reduction system;
[0021] Figure 3 This is a schematic block diagram of the structure of a computer device.
[0022] The realization of the purpose, functional features and advantages of this disclosure will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this disclosure.
[0024] Reference Figure 1 This is a schematic diagram illustrating the steps of an image resolution reduction method in one embodiment of this solution. The method includes:
[0025] S1. Obtain the initial image;
[0026] S2. Obtain the initial resolution and target resolution of the initial image, and obtain the image reduction factor value based on the initial resolution and target resolution;
[0027] S3. Based on the image reduction factor value, perform one or more interpolation reductions on the initial image to obtain an interpolated image with the target resolution, wherein, in the one or more interpolation reduction processes, at least one image to be reduced is subjected to low-pass filtering;
[0028] S4. Perform edge enhancement on the interpolated image to obtain a target image that meets the target resolution.
[0029] For step S1 above, the above method is usually applied in electronic devices such as interactive flat panels, mobile phones, and computers that can capture images through cameras. Specifically, the camera module captures MIPI (Mobile Industry Processor Interface) signals, and the processor converts the MIPI signals into an initial image in YUV format, where Y represents luminance and U and V are used to represent chrominance, so as to facilitate image processing and final display.
[0030] For step S2 above, in order to improve the image transmission efficiency in real-time communication scenarios such as video calls, a target resolution can be preset, such as 640x360. If the initial image resolution is 3840x2160, then the image reduction factor is 6x6 times.
[0031] For step S3 above, in the specific sampling process, image reduction means a decrease in the sampling rate in the spatial domain. For example, reducing the resolution from 1280×720 to 640×360 reduces the sampling rate by a factor of 2 in both the horizontal and vertical directions. According to the Nyquist sampling theorem, the sampling rate must be higher than twice the signal bandwidth; otherwise, aliasing will occur. If no frequency domain processing is performed and the image is directly reduced by a factor of 2, the high-frequency components of the high-resolution image will alias into the entire bandwidth of the low-resolution image, causing image distortion, with jagged edges being the main manifestation. Since the jaggedness in low resolution is caused by the aliasing of high-frequency components from the high-resolution image to low frequencies, this embodiment divides the high-frequency and low-frequency components of the image according to a preset frequency threshold before reduction. Low-pass filtering is performed on the high-resolution image to weaken the components that meet the high-frequency conditions, thereby reducing the interference of aliasing on the low-frequency components. Therefore, interpolation reduction processing is required for the initial image.
[0032] Specifically, in order to reduce the gradient of image reduction, the number of segmented interpolation reductions can be set according to the image reduction factor value. For example, when the image reduction factor value is 4, the initial image can be reduced by interpolation twice according to the reduction factor value of 2.
[0033] Specifically, when the number of interpolation reductions is 1, the image to be reduced, i.e., the initial image, is first low-pass filtered, and then the low-pass filtered image is interpolated and reduced. When the number of interpolation reductions is 2 or greater, the image to be reduced, i.e., the initial image, can be low-pass filtered before the first interpolation reduction, and then the low-pass filtered image is interpolated and reduced. Alternatively, after the first interpolation reduction, a reduced image is obtained, i.e., the next image to be reduced, which is then low-pass filtered, and then the low-pass filtered image is interpolated and reduced a second time. That is, before the last interpolation reduction, at least one image to be reduced needs to be low-pass filtered, thereby reducing the interference of image aliasing on low frequencies during interpolation reduction.
[0034] In practical applications, a low-pass filter is typically used for step S4. However, since the transition band of a low-pass filter cannot be narrow enough, some low-frequency components will also be filtered out when high-frequency components are filtered out. This results in a blurry image at low resolution. Therefore, edge enhancement is needed to improve the clarity of the target image.
[0035] In summary, segmented interpolation downscaling of the initial image by using the image downscaling factor reduces the gradient of each downscaling step, thereby mitigating the jagged edges caused by image downscaling; low-pass filtering during the interpolation downscaling process weakens the high-frequency components of the image, thus reducing the interference of aliasing on low frequencies; and edge enhancement of the interpolated image improves image clarity.
[0036] In one embodiment, edge enhancement of the interpolated image includes:
[0037] The low-frequency components of the interpolated image are separated by a filter;
[0038] The high-frequency components in the separated interpolated image are enhanced to achieve edge enhancement.
[0039] As described above, the filter is a 3×3 Gaussian low-pass filter. The Gaussian low-pass filter filters out low-frequency components in the interpolated image. Since its template coefficients decrease as the distance from the center of the template increases, the Gaussian low-pass filter causes less blurring of the image compared to the mean filter. This enhances the remaining high-frequency components, effectively suppresses noise, smooths the image, and improves the image clarity.
[0040] In one embodiment, performing one or more interpolation reductions on the initial image based on the image reduction factor value includes:
[0041] Calculate the number of magnification segments included in the image reduction ratio and the reduction ratio value of each segment;
[0042] The initial image is interpolated and reduced according to the number of magnification segments and the reduction magnification value of each segment.
[0043] As mentioned above, interpolation downsizing can be bilinear interpolation or bicubic interpolation downsizing. Since in bilinear or bicubic interpolation, if the downsizing factor is greater than 2x2, it may cause pixel loss in the image. Therefore, the downsizing factor can be set to less than or equal to 2x2, and the number of downsizing segments can be obtained accordingly. For example, when the image downsizing factor is 6x6, since each downsizing factor is no greater than 2x2, interpolation downsizing can be performed in the form of three downsizing segments: 2x2, 2x2, and 1.5x1.5. This reduces the resolution of the initial image while avoiding pixel loss.
[0044] In one embodiment, when the number of scaling segments is 3, the scaling factor value of each segment includes a first scaling factor value, a second scaling factor value, and a third scaling factor value, wherein the first scaling factor value is not less than the second scaling factor value;
[0045] In one or more interpolation downsizing processes, at least one image to be downsized is subjected to low-pass filtering, including:
[0046] The initial image is interpolated and reduced once according to the first reduction ratio to obtain the first reduced image. Then, the first reduced image is interpolated and reduced a second time according to the second reduction ratio to obtain the second reduced image.
[0047] The second reduced image is low-pass filtered to obtain a filtered image;
[0048] The filtered image is reduced by three interpolations based on the third reduction factor value.
[0049] As described above, in the actual interpolation downscaling process, since the points around the edges are converged towards the center, the larger the downscaling factor, the greater the convergence gradient, resulting in more pronounced jagged edges in the downscaled image. Therefore, this embodiment limits the first downscaling factor to be no less than the second downscaling factor, ensuring that the jagged edges of the downscaled image at the second downscaling factor are no greater than those at the first downscaling factor. When the first downscaling factor is greater than the second downscaling factor, a gradual reduction in jagged edges can be achieved.
[0050] As mentioned above, taking an image reduction factor of 6x6 as an example, since the interpolation reduction is performed in three segments of 2x2, 2x2, and 1.5x1.5, and the first reduction factor is not less than the second reduction factor, the interpolation reduction can be performed in the order of the first reduction factor being 2x2, the second reduction factor being 1.5x1.5, and the third reduction factor being 2x2. For an initial image with a resolution of 3840x2160, after the above three interpolation reductions, images of 1920x1080, 1280x720, and 640x360 can be obtained respectively. The final image of 640x360 is the target resolution, so the 640x360 image is the desired target image.
[0051] In a specific implementation, since each interpolation downsizing before low-pass filtering will superimpose the high-frequency components of the previous one onto the image waiting for the next downsizing, in order to improve the overall high-frequency component filtering effect, low-pass filtering can be performed on the image before the last interpolation downsizing. In this embodiment, low-pass filtering is performed before the third interpolation downsizing.
[0052] It should be noted that, in specific implementations, depending on the actual scenario, the low-pass filtering step can be set before the first or second interpolation reduction, or it can be set between the first and second interpolation reduction.
[0053] In one embodiment, the step of performing low-pass filtering on at least one image to be downsized during one or more interpolation downsizing processes includes:
[0054] Before each interpolation downsizing step, a low-pass filter is applied to the image to be downsized.
[0055] As mentioned above, since low-pass filtering requires a large amount of computation, when the computing device or computing platform allows, low-pass filtering can be performed before each interpolation reduction, thereby ensuring that the high-frequency components superimposed by the previous interpolation reduction are filtered out before the next interpolation reduction, further reducing the interference of high-frequency components on low frequencies after aliasing.
[0056] In one embodiment, the low-pass filtering method includes:
[0057] By using a Gaussian low-pass filter, a two-dimensional convolution calculation is performed on each pixel in the image to be reduced in size, thus completing the two-dimensional low-pass filtering.
[0058] As mentioned above, the low-pass filtering step is actually a two-dimensional convolution operation for each pixel in the interpolated image, which is computationally intensive. Therefore, it can be achieved by using the large number of convolution processing units built into the deep learning architecture of CNN (Convolutional Neural Networks), hereinafter referred to as NPU (Neural-network Processing Unit). Thus, the NPU can be used to perform Gaussian low-pass filtering, thereby enabling deployment on embedded platforms and ensuring image processing efficiency.
[0059] In one embodiment, edge enhancement of the separated interpolated image includes:
[0060] Obtain the pixel values of the separated interpolated image;
[0061] The pixel value is multiplied by a preset multiplier to complete edge enhancement.
[0062] As mentioned above, the edge enhancement method involves multiplying the corresponding pixel value by a preset fixed multiplier. In the actual calculation process, a Gaussian low-pass filter, which is the same as the low-pass filtering process, can be used for edge enhancement calculation. Since the Gaussian low-pass filter requires multiplication of each pixel value, the computational load is large. Therefore, an NPU, which is the same as the low-pass filtering process mentioned above, can be used for the calculation.
[0063] Reference Figure 2 This is a block diagram of an image resolution reduction system disclosed in this solution. The system includes:
[0064] Image acquisition unit 100 is used to acquire an initial image;
[0065] The scaling factor acquisition unit 200 is used to acquire the initial resolution and target resolution of the initial image, and to obtain the image scaling factor value based on the initial resolution and target resolution;
[0066] The interpolation downsizing unit 300 is used to perform one or more interpolation downsizing operations on the initial image based on the image downsizing factor value to obtain an interpolated image of the target resolution, wherein, during the one or more interpolation downsizing operations, at least one image to be downsized is subjected to low-pass filtering.
[0067] The edge enhancement unit 400 is used to enhance the edges of the interpolated image to obtain a target image that meets the target resolution.
[0068] In one embodiment, the edge reinforcement unit 400 is further configured to:
[0069] The low-frequency components of the interpolated image are separated;
[0070] Edge enhancement is performed on the separated interpolated image.
[0071] In one embodiment, the interpolation reduction unit 300 is further configured to:
[0072] Calculate the number of magnification segments included in the image reduction ratio and the reduction ratio value of each segment;
[0073] The initial image is interpolated and reduced according to the number of magnification segments and the reduction magnification value of each segment.
[0074] In one embodiment, when the number of scaling segments is 3, the scaling factor value of each segment includes a first scaling factor value, a second scaling factor value, and a third scaling factor value, wherein the first scaling factor value is not less than the second scaling factor value;
[0075] The interpolation reduction unit 300 is also used for:
[0076] The initial image is interpolated and reduced once according to the first reduction ratio to obtain the first reduced image. Then, the first reduced image is interpolated and reduced a second time according to the second reduction ratio to obtain the second reduced image.
[0077] The second reduced image is low-pass filtered to obtain a filtered image;
[0078] The filtered image is reduced by three interpolations based on the third reduction factor value.
[0079] In one embodiment, the interpolation reduction unit 300 is further configured to:
[0080] Before each interpolation downsizing step, a low-pass filter is applied to the image to be downsized.
[0081] In one embodiment, the low-pass filtering method includes:
[0082] By using a Gaussian low-pass filter, a two-dimensional convolution calculation is performed on each pixel in the image to be reduced in size, thus completing the two-dimensional low-pass filtering.
[0083] In one embodiment, the edge reinforcement unit 400 is further configured to:
[0084] Obtain the pixel values of the separated interpolated image;
[0085] The pixel value is multiplied by a preset multiplier to complete edge enhancement.
[0086] Reference Figure 3 This disclosure also provides a computer device, which may be a server, and its internal structure may be as follows: Figure 3As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores image resolution reduction data, etc. The network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements an image resolution reduction method.
[0087] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the computer equipment on which the present disclosure is applied.
[0088] This disclosure also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for reducing image resolution. It is understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0089] In summary, the image resolution reduction method, system, device, and storage medium provided in this disclosure reduce the image resolution by performing segmented interpolation reduction on the initial image using an image reduction factor value, thereby reducing the gradient of each reduction and thus mitigating the jaggedness caused by image reduction; by performing low-pass filtering during the interpolation reduction process, the high-frequency components of the image are weakened during the reduction process, thereby reducing the interference of aliasing on low frequencies; edge enhancement of the interpolated image improves the image clarity; the remaining high-frequency components are enhanced by the filter, effectively suppressing noise, smoothing the image, and improving image clarity; the initial image is reduced in resolution by interpolating the initial image using the number of reduction factor segments and the reduction factor value of each segment, thereby avoiding pixel loss; and by performing low-pass filtering before each interpolation reduction, the high-frequency components superimposed in the previous interpolation reduction are filtered out before the next interpolation reduction, further reducing the interference of high-frequency components aliasing on low frequencies.
[0090] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media provided in this disclosure and used in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0091] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0092] The above description is only a preferred embodiment of this disclosure and does not limit the patent scope of this disclosure. Any equivalent structural or procedural changes made based on the content of this disclosure and its drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this disclosure.
Claims
1. A method for reducing image resolution, wherein, include: Get the initial image; Obtain the initial resolution and target resolution of the initial image, and obtain the image scaling factor value based on the initial resolution and target resolution; The initial image is interpolated and reduced multiple times based on the image reduction ratio value to obtain the interpolated image of the target resolution. In the multiple interpolation and reduction processes, at least one image to be reduced is subjected to low-pass filtering. Edge enhancement is performed on the interpolated image to obtain a target image that meets the target resolution; The process of performing multiple interpolation reductions on the initial image based on the image reduction ratio value includes: Calculate the number of magnification segments included in the image reduction ratio and the reduction ratio value of each segment; The initial image is interpolated and reduced according to the number of magnification segments and the reduction magnification value of each segment; When the number of magnification segments is 3, the reduction magnification value of each segment includes a first reduction magnification value, a second reduction magnification value, and a third reduction magnification value. The first reduction magnification value is not less than the second reduction magnification value, such that the jaggedness of the reduced image at the second reduction magnification value is not greater than that of the reduced image at the first reduction magnification value. In the process of multiple interpolation downsizing operations, at least one image to be downsized is subjected to low-pass filtering, including: The initial image is interpolated and reduced once according to the first reduction ratio value to obtain the first reduced image; The first reduced image is then reduced by a second interpolation based on the second reduction factor value to obtain the second reduced image. The second reduced image is low-pass filtered to obtain a filtered image; The filtered image is reduced by three interpolations based on the third reduction factor value.
2. The image resolution reduction method according to claim 1, wherein, The edge enhancement of the interpolated image includes: The low-frequency components of the interpolated image are separated; Edge enhancement is performed on the separated interpolated image.
3. The image resolution reduction method according to claim 1, wherein, In the process of multiple interpolation downsizing operations, at least one image to be downsized is subjected to low-pass filtering, including: Before each interpolation downsizing step, a low-pass filter is applied to the image to be downsized.
4. The image resolution reduction method according to claim 1, wherein, The low-pass filtering method includes: By using a Gaussian low-pass filter, a two-dimensional convolution calculation is performed on each pixel in the image to be reduced in size, thus completing the two-dimensional low-pass filtering.
5. The image resolution reduction method according to claim 2, wherein, The edge enhancement of the separated interpolated image includes: Obtain the pixel values of the separated interpolated image; The pixel value is multiplied by a preset multiplier to complete edge enhancement.
6. An image resolution reduction system for implementing the method of any one of claims 1-5, characterized in that, include: The image acquisition unit is used to acquire the initial image; The scaling factor acquisition unit is used to acquire the initial resolution and target resolution of the initial image, and to obtain the image scaling factor value based on the initial resolution and target resolution; An interpolation downsizing unit is used to perform multiple interpolation downsizing operations on the initial image based on the image downsizing factor value to obtain an interpolated image with the target resolution, wherein, during the multiple interpolation downsizing processes, at least one image to be downsized is subjected to low-pass filtering; An edge enhancement unit is used to enhance the edges of the interpolated image to obtain a target image that meets the target resolution. The process of performing multiple interpolation reductions on the initial image based on the image reduction ratio value includes: Calculate the number of magnification segments included in the image reduction ratio and the reduction ratio value of each segment; The initial image is interpolated and reduced according to the number of magnification segments and the reduction magnification value of each segment; When the number of magnification segments is 3, the reduction magnification value of each segment includes a first reduction magnification value, a second reduction magnification value, and a third reduction magnification value. The first reduction magnification value is not less than the second reduction magnification value, such that the jaggedness of the reduced image at the second reduction magnification value is not greater than that of the reduced image at the first reduction magnification value. In the process of multiple interpolation downsizing operations, at least one image to be downsized is subjected to low-pass filtering, including: The initial image is interpolated and reduced once according to the first reduction ratio value to obtain the first reduced image; The first reduced image is then reduced by a second interpolation based on the second reduction factor value to obtain the second reduced image. The second reduced image is low-pass filtered to obtain a filtered image; The filtered image is reduced by three interpolations based on the third reduction factor value.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the image resolution reduction method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the image resolution reduction method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Image reduction method and device
CN106780336A
Image scaling processing method, image scaling processing device and image scaling processing system
CN113052762A
Method and apparatus for changing digital image size
CN1652155A
