Image processing method and device, storage medium and terminal equipment
Patent Information
- Application Number
- CN202310002723.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-03
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-01-03
AI Technical Summary
[0003]但是,现有技术的图像处理算法存在细节少、边缘出现锯齿、锐利边缘出现振铃(勾边)等效果问题
[0020]本申请技术方案中,对于输入图像中的每一待插值像素,分别使用第一正交方向和第二正交方向上的邻域像素进行插值获得插值结果,并分别使用每一正交方向对应的调整插值权重对插值结果进行加权,获得最终插值结果,其中,每一正交方向对应的调整插值权重的差异小于每一正交方向对应的初始插值权重的差异;根据最终插值结果以及输入图像获得输出图像。本申请技术方案通过对方向性插值时使用的插值权重进行调整,能够确保在正交方向上的插值权重差异差距很小的细节区域,经插值处理后不会出现明显的细节丢失问题,从而提升了插值后图像的质量。此外,本申请还能够灵活调节图像细节区域处理效果强弱,提升了图像处理的灵活性。
Smart Images

Figure CN115965533B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an image processing method and apparatus, storage medium, and terminal device. Background Technology
[0002] Conventional resolution conversion methods (such as nearest neighbor algorithms and bicubic interpolation algorithms) can easily adjust the resolution of an image during image processing.
[0003] However, existing image processing algorithms suffer from issues such as limited detail, jagged edges, and ringing (outlining) on sharp edges. Summary of the Invention
[0004] This application provides an image processing method, apparatus, storage medium, and terminal device that can retain more details and improve image quality while magnifying the image.
[0005] To achieve the above objectives, this application provides the following technical solution:
[0006] In a first aspect, an image processing method is provided, comprising: acquiring an input image; for each pixel to be interpolated in the input image, interpolating using neighboring pixels in a first orthogonal direction and a second orthogonal direction respectively to obtain an interpolation result, and weighting the interpolation result using adjusted interpolation weights corresponding to each orthogonal direction respectively to obtain a final interpolation result, wherein the difference in adjusted interpolation weights corresponding to each orthogonal direction is less than the difference in initial interpolation weights corresponding to each orthogonal direction; and obtaining an output image based on the final interpolation result and the input image.
[0007] Optionally, the first orthogonal direction is two diagonal directions, and the second orthogonal direction is a horizontal direction and a vertical direction. The step of using neighboring pixels in the first and second orthogonal directions to perform interpolation to obtain interpolation results, and then weighting the interpolation results using adjusted interpolation weights corresponding to each orthogonal direction, includes: using neighboring pixels in the two diagonal directions to perform interpolation to obtain a first initial interpolation result, and then weighting the first initial interpolation result using adjusted interpolation weights corresponding to the two diagonal directions to obtain a first interpolation result. The adjusted interpolation weights corresponding to the two diagonal directions... The difference in weight is less than the difference in the initial interpolation weights corresponding to the two diagonal directions; an intermediate image is obtained based on the first interpolation result and the input image; for each pixel to be interpolated in the intermediate image, interpolation is performed using the neighboring pixels in the horizontal and vertical directions to obtain a second initial interpolation result, and the second initial interpolation result is weighted using the adjusted interpolation weights corresponding to the horizontal and vertical directions to obtain the final interpolation result, wherein the difference in the adjusted interpolation weights corresponding to the horizontal and vertical directions is less than the difference in the initial interpolation weights corresponding to the horizontal and vertical directions.
[0008] Optionally, the adjusted interpolation weights corresponding to each orthogonal direction are calculated in the following manner: the initial interpolation weights corresponding to the two sub-directions of each orthogonal direction are calculated and normalized to obtain normalized difference weights; the difference between the normalized difference weights corresponding to the two sub-directions is calculated; the difference is adjusted so that the adjusted difference is less than the original difference; and the adjusted interpolation weights corresponding to the two sub-directions of each orthogonal direction are calculated using the adjusted difference.
[0009] Optionally, adjusting the difference includes: adjusting the difference using a difference mapping curve, wherein the value of the dependent variable is less than the value of the independent variable in the difference mapping curve.
[0010] Optionally, before obtaining the output image based on the final interpolation result and the input image, the method further includes: adjusting the final difference result so that the final difference result is within a target numerical range, or the numerical difference between the adjusted final difference result and the target range is less than the numerical difference between the unadjusted final difference result and the target range.
[0011] Optionally, the upper limit of the target numerical range is the maximum pixel value of the neighboring pixels, and the lower limit of the target numerical range is the minimum pixel value of the neighboring pixels; or, the upper limit of the target numerical range is the sum of the maximum pixel value of the neighboring pixels and the first adjustment value, and the lower limit of the target numerical range is the sum of the minimum pixel value of the neighboring pixels and the second adjustment value.
[0012] Optionally, obtaining the output image based on the final interpolation result and the input image includes: rearranging the pixels according to the position of each pixel to be interpolated and the position of each pixel in the input image to obtain the output image.
[0013] Secondly, this application also discloses an image processing apparatus, comprising: an acquisition module for acquiring an input image; an interpolation module for interpolating each pixel to be interpolated in the input image using neighboring pixels in a first orthogonal direction and a second orthogonal direction to obtain an interpolation result, and weighting the interpolation result using adjusted interpolation weights corresponding to each orthogonal direction to obtain a final interpolation result, wherein the difference in adjusted interpolation weights corresponding to each orthogonal direction is less than the difference in initial interpolation weights corresponding to each orthogonal direction; and an output module for obtaining an output image based on the final interpolation result and the input image.
[0014] Thirdly, a computer-readable storage medium is provided having a computer program stored thereon, the computer program being executed by a processor to perform the method provided in the first aspect.
[0015] Fourthly, a computer program product is provided, on which a computer program is stored, the computer program being executed by a processor to perform the method provided in the first aspect.
[0016] Fifthly, a communication system is provided, including the aforementioned terminal equipment and the aforementioned network equipment.
[0017] Sixthly, embodiments of this application also provide a chip (or data transmission device) on which a computer program is stored, and when the computer program is executed by the chip, the steps of the above method are implemented.
[0018] In a seventh aspect, embodiments of this application also provide a system chip for use in a terminal. The chip system includes at least one processor and an interface circuit, the interface circuit and the at least one processor being interconnected via a line. The at least one processor is used to execute instructions to perform the method provided in the first aspect.
[0019] Compared with the prior art, the technical solution of this application embodiment has the following beneficial effects:
[0020] In this technical solution, for each pixel to be interpolated in the input image, interpolation is performed using neighboring pixels in the first and second orthogonal directions to obtain interpolation results. The interpolation results are then weighted using adjusted interpolation weights corresponding to each orthogonal direction to obtain the final interpolation result. The difference in adjusted interpolation weights for each orthogonal direction is less than the difference in initial interpolation weights for each orthogonal direction. An output image is obtained based on the final interpolation result and the input image. This technical solution, by adjusting the interpolation weights used in directional interpolation, ensures that detail areas with small differences in interpolation weights in orthogonal directions do not suffer from significant detail loss after interpolation, thereby improving the quality of the interpolated image. Furthermore, this application allows for flexible adjustment of the processing strength in image detail areas, enhancing the flexibility of image processing.
[0021] Furthermore, the final difference result is adjusted so that it falls within the target value range, or the difference between the adjusted final difference result and the target range is smaller than the difference between the original final difference result and the target range. This application's technical solution uses the pixel values of neighboring pixels of the interpolation point as a reference point for amplitude limiting. This effectively ensures that the adjusted final difference result will not exhibit significant overexposure or underexposure, thereby effectively controlling the ringing phenomenon caused by the interpolation process and further improving image quality. Attached Figure Description
[0022] Figure 1 This is a flowchart of an image processing method provided in an embodiment of this application;
[0023] Figure 2 This is a flowchart of another image processing method provided in the embodiments of this application;
[0024] Figure 3 This is a schematic diagram illustrating a specific application scenario provided in an embodiment of this application;
[0025] Figure 4 This is a schematic diagram of a mapping curve provided in an embodiment of this application;
[0026] Figure 5 This is a schematic diagram of the structure of an image processing device provided in an embodiment of this application;
[0027] Figure 6 This is a schematic diagram of the hardware structure of an image processing device provided in an embodiment of this application. Detailed Implementation
[0028] As described in the background section, existing image processing algorithms suffer from problems such as lack of detail, jagged edges, and ringing (outlining) of sharp edges.
[0029] This application's technical solution, by adjusting the interpolation weights used in directional interpolation, ensures that detail areas with minimal differences in interpolation weights along orthogonal directions do not suffer from significant detail loss after interpolation, thereby improving the quality of the interpolated image. Furthermore, this application allows for flexible adjustment of the processing strength in image detail areas, enhancing the flexibility of image processing.
[0030] Furthermore, the limiting method of using the pixel values of the neighboring pixels of the point to be interpolated as the reference point in this application can effectively ensure that the final difference result after adjustment will not have obvious problems of being too bright or too dark, thereby effectively controlling the ringing phenomenon caused by the interpolation process and further improving the image quality.
[0031] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, specific embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0032] The image processing method in this application embodiment can be used in image processing chips related to image acquisition, image post-processing, and image display, and specifically in devices such as cameras, image processing platforms, and display devices.
[0033] See Figure 1 The methods provided in this application include:
[0034] Step 101: Obtain the input image;
[0035] Step 102: For each pixel to be interpolated in the input image, interpolation is performed using the neighboring pixels in the first orthogonal direction and the second orthogonal direction respectively to obtain the interpolation result. The interpolation result is then weighted using the adjusted interpolation weights corresponding to each orthogonal direction to obtain the final interpolation result. The difference in the adjusted interpolation weights corresponding to each orthogonal direction is less than the difference in the initial interpolation weights corresponding to each orthogonal direction.
[0036] Step 103: Obtain the output image based on the final interpolation result and the input image.
[0037] It should be noted that the sequence number of each step in this embodiment does not represent a limitation on the execution order of each step.
[0038] It is understood that, in specific implementations, the image processing method can be implemented using software programs, which run within a processor integrated into the chip or chip module. The method can also be implemented using a combination of software and hardware; this application does not impose any limitations on this approach.
[0039] In this embodiment, the input image is the image to be processed, that is, the image that needs to be enlarged. The output image is the enlarged image, and the resolution of the output image is higher than that of the input image. Alternatively, the input image can be called a low-resolution (LR) image, and the output image can be called a high-resolution (HR) image.
[0040] To enlarge the input image, pixels (i.e., pixels to be interpolated) need to be inserted into the input image, and the pixel values of the pixels to be interpolated need to be determined. In the specific implementation of step 102, for each pixel to be interpolated, interpolation can be performed in the first orthogonal direction and the second orthogonal direction respectively.
[0041] In practice, the first orthogonal direction is the two diagonal directions, namely the 45° direction and the 135° direction. The second orthogonal direction is the horizontal direction and the vertical direction, namely the 0° and 90° directions.
[0042] For the specific interpolation process, please refer to [link / reference]. Figure 2 .
[0043] In step 201, interpolation is performed using neighboring pixels along two diagonal directions to obtain a first initial interpolation result, and the first initial interpolation result is weighted using the adjusted interpolation weights corresponding to the two diagonal directions to obtain a first interpolation result, wherein the difference between the adjusted interpolation weights corresponding to the two diagonal directions is less than the difference between the initial interpolation weights corresponding to the two diagonal directions.
[0044] In step 202, an intermediate image is obtained based on the first interpolation result and the input image.
[0045] In step 203, for each pixel to be interpolated in the intermediate image, interpolation is performed using neighboring pixels in the horizontal and vertical directions to obtain a second initial interpolation result. The second initial interpolation result is then weighted using the adjusted interpolation weights corresponding to the horizontal and vertical directions to obtain a final interpolation result. The difference between the adjusted interpolation weights corresponding to the horizontal and vertical directions is less than the difference between the initial interpolation weights corresponding to the horizontal and vertical directions.
[0046] Refer to together Figure 3 Taking the pixel to be interpolated (2i+1, 2j+1) as an example, the interpolation process in the first orthogonal direction will be explained. The pixel to be interpolated is... Figure 3 The black pixel in a.
[0047] Specifically, the neighboring pixels of the pixel to be interpolated (2i+1, 2j+1) in the 45° and 135° directions are used, for example... Figure 3The four neighboring pixels (2i,2j), (2i+2,2j), (2i,2j+2), and (2i+2,2j+2) shown in diagram a are used to perform image interpolation on the input image IMGLR, yielding initial interpolation results I45 and I135 in two directions, respectively. Specifically, the initial interpolation result I45 can be obtained from the neighboring pixels in the 45° direction using an existing interpolation algorithm, and correspondingly, the initial interpolation result I135 can be obtained from the neighboring pixels in the 135° direction using an existing interpolation algorithm.
[0048] It should be noted that the specific implementation method for obtaining the first initial interpolation result using a specific interpolation algorithm can refer to the existing technology, and this application does not limit it.
[0049] The texture direction of the pixel to be interpolated is calculated using neighboring pixels, yielding initial interpolation weights W45 and W135 for the first orthogonal direction. Since the initial interpolation weights W45 and W135 are calculated independently, their sum may be greater than 1; therefore, the initial interpolation weights can be normalized. Normalized interpolation weights W... cal_45 and W cal_135 as follows:
[0050]
[0051]
[0052] In step 201, the normalized interpolation weights corresponding to the two diagonal directions can also be adjusted to obtain adjusted interpolation weights. The adjusted interpolation weights W corresponding to the two diagonal directions... adj_45 and W adj_135 The sum is 1.
[0053] Specifically, curve mapping can be used to apply the normalized interpolation weights W. cal_45 and W cal_135 The difference diff cal_45-135 Adjust the absolute value accordingly. Refer to the following: Figure 4 , Figure 4 The normalized interpolation weights W are shown. cal_45 and W cal_135 The difference is adjusted using a difference mapping curve. In a difference mapping curve, the value of the dependent variable is less than the value of the independent variable. In other words, the adjusted difference (diff) is obtained through the difference mapping curve. adj_45-135 Less than the original difference diff cal_45-135 .
[0054] diff adj_45-135 =sign(diff) cal_45-135 )×mapping(abs(diffcal_45-135 )).
[0055] Then, adjust the interpolation weight W adj_45 and W adj_135 As shown in the formula below:
[0056]
[0057]
[0058]
[0059] In step 201, the first initial interpolation results I45 and I135 are used, and the interpolation weights W are adjusted. adj_45 and W adj_135 Perform a weighted summation to obtain the pixel value of the pixel to be interpolated (2i+1, 2j+1), which is the first interpolation result Iout_tmp_1: I out_tmp_1 =W adj_45 ×I 45 +W adj_135 ×I 135 .
[0060] In this embodiment, the interpolation weights of the textures are calculated according to orthogonal directions, and the interpolation weights of the two directions are segmented. This further reduces the difference in interpolation weights when the difference between the interpolation weights is small (at which point the texture of the input image has no clear direction). This strategy can prevent the content of low-directional textures from being enhanced, thereby avoiding the problem of blurred details.
[0061] Furthermore, the first interpolation result Iout_tmp_1 can be subjected to amplitude limiting processing so that the adjusted first interpolation result is within the target value range, or the difference between the adjusted first interpolation result and the target range is smaller than the difference between the adjusted first interpolation result and the target range before adjustment.
[0062] Specifically, by referencing the neighboring pixels of the pixel to be interpolated in the 45° and 135° directions, the amplitude of the first interpolation result Iout_tmp_1 is limited to obtain an adjusted first interpolation result Iout1, thereby reducing the ringing problem caused by the interpolation process. Methods for limiting the amplitude of the first interpolation result Iout_tmp_1 include the following:
[0063] Method 1: If the pixel value range of the neighboring pixels is [min, max], then the first interpolation result Iout_tmp_1 is directly trimmed to obtain the adjusted first interpolation result Iout1, which is then restricted to this range.
[0064] Method 2: Trim the first interpolation result Iout_tmp_1 to obtain the adjusted first interpolation result Iout1, so that it is restricted to the interval [min+unsht_range,max+ovsht_range].
[0065] Method 3: Remove the portion of the first interpolation result Iout_tmp_1 that exceeds the range [min, max]. Scale by a factor of 1 to obtain the adjusted first interpolation result Iout1. The parameter scale_sht can be preset.
[0066] Method 4: First use Method 3, then use Send 2 to adjust the first interpolation result Iout_tmp_1 to obtain the adjusted first interpolation result Iout1.
[0067] This application embodiment uses a limiting method on the first interpolation result Iout_tmp_1 to prevent the interpolated pixels from exceeding the numerical range of their neighboring pixels, thereby achieving the purpose of eliminating image ringing.
[0068] In a specific implementation of step 202, the input image IMGLR and the interpolated pixel Iout1 are then... Figure 3 The intermediate image IMGmed is obtained by arranging the corresponding pixel positions as shown in figure a.
[0069] Similar to step 201, in the specific implementation of step 203, interpolation processing is performed on the pixels to be interpolated in the 0° and 90° directions. See also... Figure 3 b. Taking the pixel to be interpolated (2i, 2j+1) as an example, the interpolation process in the second orthogonal direction is explained.
[0070] Specifically, the neighboring pixels of the pixel to be interpolated (2i, 2j+1) in the 0° and 90° directions are used, for example... Figure 3 The four neighboring pixels (2i,2j), (2i,2j+2), (2i-1,2j+1), and (2i+1,2j+1) shown in b are used to interpolate the intermediate image IMGmed, yielding second initial interpolation results I0 and I90 in two directions. Specifically, the second initial interpolation result I0 can be obtained from the neighboring pixels in the 0° direction using an existing interpolation algorithm, and correspondingly, the second initial interpolation result I90 can be obtained from the neighboring pixels in the 90° direction using an existing interpolation algorithm.
[0071] The texture direction of the pixel to be interpolated is calculated using neighboring pixels, yielding initial interpolation weights W0 and W90 for the second orthogonal direction. Since the initial interpolation weights W0 and W90 are calculated independently, their sum may be greater than 1; therefore, the initial interpolation weights can be normalized. Normalized interpolation weights W... cal_0 and W cal_90 as follows:
[0072]
[0073]
[0074] In step 203, the normalized interpolation weights corresponding to the horizontal and vertical directions can also be adjusted to obtain adjusted interpolation weights. The adjusted interpolation weights W corresponding to the horizontal and vertical directions are... adj_0 and W adj_90 The sum is 1.
[0075] Specifically, curve mapping can be used to apply the normalized interpolation weights W. cal_0 and W cal_90 The difference diff cal_0-90 Adjust the absolute value accordingly. Refer to the following: Figure 4 , Figure 4 The normalized interpolation weights W are shown. cal_0 and W cal_90 The difference is adjusted using a difference mapping curve. In a difference mapping curve, the value of the dependent variable is less than the value of the independent variable. In other words, the adjusted difference (diff) is obtained through the difference mapping curve. adj_0-90 Less than the original difference diff cal_0-90 .
[0076] diff adj_0-90 =sign(diff) cal_0-90 )×mapping(abs(diff cal_0-90 )).
[0077] Then, adjust the interpolation weight W adj_0 and W adj_90 As shown in the formula below:
[0078]
[0079]
[0080]
[0081] In step 203, the second initial interpolation results I0 and I90 are used, and the interpolation weights W are adjusted. adj_0 and W adj_90Perform a weighted summation to obtain the pixel value of the pixel to be interpolated (2i, 2j+1), which is the final interpolation result Iout_tmp_2: I out_tmp_2 =W adj_0 ×I0+W adj_90 ×I 90 .
[0082] In this embodiment, the interpolation weights of the textures are calculated according to orthogonal directions, and the interpolation weights of the two directions are segmented. This further reduces the difference in interpolation weights when the difference between the interpolation weights is small (at which point the texture of the input image has no clear direction). This strategy can prevent the content of low-directional textures from being enhanced, thereby avoiding the problem of blurred details.
[0083] Furthermore, the final interpolation result Iout_tmp_2 can be subjected to amplitude limiting processing according to methods 1-4 described above, so that the adjusted final interpolation result I... out2 The value is within the target range, or the difference between the adjusted final interpolation result and the target range is smaller than the difference between the adjusted final interpolation result and the target range.
[0084] Furthermore, the interpolation results Iout1 and Iout2 obtained from the above process, along with the pixels in the input image IMGLR, are then processed according to... Figure 3 Arrange the images at the corresponding positions shown to obtain the final output image IMGHR.
[0085] For more specific implementations of the embodiments of this application, please refer to the foregoing embodiments, which will not be repeated here.
[0086] Please refer to Figure 5 , Figure 5 An image processing apparatus 50 is shown, which may include:
[0087] The acquisition module 501 is used to acquire the input image;
[0088] The interpolation module 502 is used to interpolate each pixel to be interpolated in the input image using the neighboring pixels in the first orthogonal direction and the second orthogonal direction respectively to obtain the interpolation result, and to weight the interpolation result using the adjusted interpolation weight corresponding to each orthogonal direction respectively to obtain the final interpolation result, wherein the difference of the adjusted interpolation weight corresponding to each orthogonal direction is less than the difference of the initial interpolation weight corresponding to each orthogonal direction.
[0089] The output module 503 is used to obtain the output image based on the final interpolation result and the input image.
[0090] In specific implementations, the aforementioned image processing device 50 may correspond to a chip with image processing function in a terminal device, such as a system-on-a-chip (SOC), a baseband chip, etc.; or to a chip module in a terminal device that includes a chip with image processing function; or to a chip module with a chip with data processing function; or to a terminal device.
[0091] Other relevant descriptions of the image processing apparatus 50 can be found in the descriptions in the foregoing embodiments, and will not be repeated here.
[0092] This application's embodiments, by adjusting the interpolation weights used in directional interpolation, ensure that detail regions with minimal differences in interpolation weights along orthogonal directions do not suffer significant detail loss after interpolation, thereby improving the quality of the interpolated image. Furthermore, this application allows for flexible adjustment of the processing strength in image detail regions, enhancing the flexibility of image processing.
[0093] Regarding the modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for devices and products applied to or integrated into a chip, all modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs running on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits. For devices and products applied to or integrated into a chip module, all modules / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The implementation is achieved through a software program that runs on a processor integrated within the chip module. The remaining modules / units (if any) can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into terminal equipment, each of their modules / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components within the terminal equipment. Alternatively, at least some modules / units can be implemented using a software program that runs on a processor integrated within the terminal equipment, while the remaining modules / units (if any) can be implemented using hardware methods such as circuits.
[0094] This application also discloses a storage medium, which is a computer-readable storage medium storing a computer program thereon. The computer program can be executed when it runs. Figures 1 to 3 The steps of the method shown are illustrated. The storage medium may include read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc. The storage medium may also include non-volatile memory or non-transitory memory, etc.
[0095] Please refer to Figure 6 This application also provides a schematic diagram of the hardware structure of a communication device. The device includes a processor 601, a memory 602, and a transceiver 603.
[0096] Processor 601 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program according to the present application. Processor 601 may also include multiple CPUs, and processor 601 can be a single-core processor or a multi-core processor. Here, processor can refer to one or more devices, circuits, or processing cores used to process data (e.g., computer program instructions).
[0097] The memory 602 can be a ROM or other type of static storage device capable of storing static information and instructions, RAM or other type of dynamic storage device capable of storing information and instructions, or it can be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer. This application embodiment does not impose any limitations on this. The memory 602 can exist independently (in this case, the memory 602 can be located outside or inside the device) or it can be integrated with the processor 601. The memory 602 may contain computer program code. The processor 601 is used to execute the computer program code stored in the memory 602, thereby implementing the method provided in this application embodiment.
[0098] The processor 601, memory 602, and transceiver 603 are connected via a bus. The transceiver 603 is used to communicate with other devices or communication networks. Optionally, the transceiver 603 may include a transmitter and a receiver. The device in the transceiver 603 that implements the receiving function can be considered as a receiver, which is used to perform the receiving steps in the embodiments of this application. The device in the transceiver 603 that implements the transmitting function can be considered as a transmitter, which is used to perform the transmitting steps in the embodiments of this application.
[0099] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article indicates that the preceding and following related objects have an "or" relationship.
[0100] In the embodiments of this application, "multiple" refers to two or more.
[0101] The descriptions of "first," "second," etc., appearing in the embodiments of this application are for illustrative purposes and to distinguish the objects being described. They have no order and do not indicate any special limitation on the number of devices in the embodiments of this application, nor do they constitute any limitation on the embodiments of this application.
[0102] In this application, the term "connection" refers to various connection methods, such as direct connection or indirect connection, to achieve communication between devices. This application does not impose any limitations on this.
[0103] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means.
[0104] It should be understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0105] In the several embodiments provided in this application, it should be understood that the disclosed methods, apparatuses, and systems can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0106] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0107] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can be physically included separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0108] The integrated unit implemented as a software functional unit described above can be stored in a computer-readable storage medium. This software functional unit, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute some steps of the methods described in the various embodiments of this application.
[0109] While this application discloses the above information, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of this application; therefore, the scope of protection of this application shall be determined by the scope defined in the claims.
Claims
1. An image processing method applied to a terminal device, characterized in that, include: Obtain the input image; For each pixel to be interpolated in the input image, interpolation is performed using neighboring pixels in the first orthogonal direction and the second orthogonal direction to obtain an interpolation result. The interpolation result is then weighted using the adjusted interpolation weights corresponding to each orthogonal direction to obtain the final interpolation result. The difference in the adjusted interpolation weights corresponding to each orthogonal direction is less than the difference in the initial interpolation weights corresponding to each orthogonal direction. The output image is obtained based on the final interpolation result and the input image; The adjusted interpolation weights for each orthogonal direction are calculated using the following method: Calculate the initial interpolation weights corresponding to the two sub-directions of each orthogonal direction, and normalize them to obtain normalized difference weights. Calculate the difference between the normalized difference weights corresponding to the two sub-directions; The difference is adjusted using a difference mapping curve, in which the value of the dependent variable is less than the value of the independent variable, so that the adjusted difference is less than the original difference. The adjusted interpolation weights for the two sub-directions of each orthogonal direction are calculated using the adjusted difference.
2. The image processing method according to claim 1, characterized in that, The first orthogonal direction is two diagonal directions, and the second orthogonal direction is a horizontal and a vertical direction. The step of interpolating using neighboring pixels along the first and second orthogonal directions to obtain interpolation results, and then weighting the interpolation results using the adjusted interpolation weights corresponding to each orthogonal direction, includes: The first initial interpolation result is obtained by interpolating the neighboring pixels in the two diagonal directions, and the first initial interpolation result is weighted by the adjusted interpolation weights corresponding to the two diagonal directions to obtain the first interpolation result. The difference between the adjusted interpolation weights corresponding to the two diagonal directions is less than the difference between the initial interpolation weights corresponding to the two diagonal directions. An intermediate image is obtained based on the first interpolation result and the input image; For each pixel to be interpolated in the intermediate image, interpolation is performed using the neighboring pixels in the horizontal and vertical directions to obtain a second initial interpolation result. The second initial interpolation result is then weighted using the adjusted interpolation weights corresponding to the horizontal and vertical directions to obtain the final interpolation result. The difference between the adjusted interpolation weights corresponding to the horizontal and vertical directions is less than the difference between the initial interpolation weights corresponding to the horizontal and vertical directions.
3. The image processing method according to claim 1, characterized in that, Before obtaining the output image based on the final interpolation result and the input image, the process further includes: The final difference result is adjusted so that it falls within the target value range, or the difference between the adjusted final difference result and the target range is smaller than the difference between the original final difference result and the target range.
4. The image processing method according to claim 3, characterized in that, The upper limit of the target numerical range is the maximum pixel value of the neighboring pixels, and the lower limit of the target numerical range is the minimum pixel value of the neighboring pixels; or, the upper limit of the target numerical range is the sum of the maximum pixel value of the neighboring pixels and the first adjustment value, and the lower limit of the target numerical range is the sum of the minimum pixel value of the neighboring pixels and the second adjustment value.
5. The image processing method according to claim 1, characterized in that, The step of obtaining the output image based on the final interpolation result and the input image includes: The pixels are rearranged according to the position of each pixel to be interpolated and the position of each pixel in the input image to obtain the output image.
6. An image processing apparatus, characterized in that, include: The acquisition module is used to acquire the input image; The interpolation module is used to interpolate each pixel to be interpolated in the input image using neighboring pixels in the first orthogonal direction and the second orthogonal direction to obtain an interpolation result, and to weight the interpolation result using the adjusted interpolation weight corresponding to each orthogonal direction to obtain a final interpolation result, wherein the difference in the adjusted interpolation weight corresponding to each orthogonal direction is less than the difference in the initial interpolation weight corresponding to each orthogonal direction. The output module is used to obtain an output image based on the final interpolation result and the input image; The interpolation module is configured to calculate the adjusted interpolation weights corresponding to each orthogonal direction in the following manner: calculate the initial interpolation weights corresponding to the two sub-directions of each orthogonal direction and normalize them to obtain normalized difference weights; calculate the difference between the normalized difference weights corresponding to the two sub-directions; adjust the difference using a difference mapping curve, wherein the value of the dependent variable is less than the value of the independent variable in the difference mapping curve, so that the adjusted difference is less than the original difference; and use the adjusted difference to calculate the adjusted interpolation weights corresponding to the two sub-directions of each orthogonal direction.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program, when run by a processor, performs the steps of the image processing method according to any one of claims 1 to 5.
8. A terminal device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor runs the computer program, it performs the steps of the image processing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
System and method for high quality image and video upscaling
CN101677358A
An image enlargement method and an image enlargement apparatus
CN109325909A