Image scaling implementation method, processing apparatus and computing device

By calculating the output coordinates of the quadrilateral vertices in the target image in the original image, and relying solely on vertex coordinates for interpolation calculations, the problem of high computational cost in bilinear interpolation algorithms is solved, thus improving the computational efficiency and smoothness of image scaling.

CN114418847BActive Publication Date: 2026-03-27UNIONTECH SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing bilinear interpolation algorithms involve a large amount of computation during image scaling, resulting in slow computation speed, which affects image scaling performance and may also cause image outline blurring.

Method used

By calculating the output coordinates of the four vertices of the target quadrilateral in the target image in the original image, interpolation calculations are performed only based on the vertex coordinates, avoiding mapping and interpolation of each target pixel one by one, thus reducing the amount of computation.

Benefits of technology

While ensuring image quality, the computational load of interpolation operations has been reduced, and the computational efficiency of image scaling has been improved, making image scaling operations smoother.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114418847B_ABST
    Figure CN114418847B_ABST
Patent Text Reader

Abstract

The application discloses an image scaling implementation method, a processing device and a computing device. The method comprises the following steps: obtaining an original image and determining the size of the original image; receiving a transformation operation on the original image, forming a target image based on the transformation operation and determining the size of the target image; calculating a scaling ratio based on the sizes of the original image and the target image; calculating the corresponding output coordinates of four vertices of a target quadrangle in the target image in the original image based on the scaling ratio; calculating the corresponding output pixel point coordinates of each target pixel point in the target quadrangle in the original image based on the corresponding output coordinates of the four vertices of the target quadrangle in the original image; and determining the pixel value corresponding to each output pixel point coordinate as the output pixel value of the corresponding target pixel point to output a final target image. According to the technical scheme of the application, the calculation amount of interpolation operation can be reduced on the basis of ensuring the image quality, and the calculation efficiency during image scaling is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer and Internet technology, and in particular to an image scaling method, processing device, and computing device. Background Technology

[0002] Scaling a raster image using nearest-neighbor interpolation often results in a mosaic effect, with numerous pixel blocks sharing the same grayscale value appearing after a certain magnification, while shrinking it leads to distortion. In contrast, bilinear interpolation is a superior image scaling algorithm. It effectively utilizes the four real pixel values ​​surrounding a virtual point in the original image to collectively determine a single pixel value in the target image, resulting in better scaling performance, higher image quality after scaling, and the absence of discontinuous pixel values.

[0003] However, the bilinear interpolation algorithm also has obvious drawbacks. On the one hand, because it has the property of a low-pass filter, it will damage high-frequency components, resulting in the outline of the image after processing by the bilinear interpolation algorithm becoming blurred to some extent. On the other hand, the bilinear interpolation algorithm performs three linear interpolation operations on each input pixel, which leads to a large amount of computation.

[0004] The existing bilinear interpolation algorithm treats each pixel coordinate in the target image as input and the corresponding coordinate in the original image as output. If an input pixel is mapped to four output pixels, the value of that input pixel is determined by the values ​​of these four output pixels.

[0005] In actual calculations, there may be situations where different input pixel coordinates in the target image are mapped to the same four output pixel coordinates in the original image. In this case, mapping and interpolation calculations for each pixel coordinate in the target image are redundant, wasting time, increasing the amount of computation, and slowing down the calculation speed, thus affecting the performance of image scaling.

[0006] Therefore, an image scaling method is needed to solve the problems existing in the above technical solutions. Summary of the Invention

[0007] Therefore, the present invention provides an image scaling method and processing device in an attempt to solve or at least alleviate the problems mentioned above.

[0008] According to one aspect of the present invention, an image scaling method is provided, executed in a computing device, comprising the steps of: acquiring an original image and determining the size of the original image; receiving a transformation operation on the original image, forming a target image based on the transformation operation and determining the size of the target image, wherein one or more grids in the original image form one or more target quadrilaterals in the target image; calculating a scaling ratio based on the sizes of the original image and the target image; calculating the output coordinates of the four vertices of the target quadrilateral in the target image corresponding to the four vertices in the original image based on the scaling ratio; calculating the output pixel coordinates of each target pixel in the target quadrilateral in the original image based on the output coordinates of the four vertices of the target quadrilateral in the original image; and determining the pixel value corresponding to each output pixel coordinate as the output pixel value of the corresponding target pixel, so as to output the final target image.

[0009] Optionally, in the image scaling implementation method according to the present invention, the step of determining the pixel value corresponding to the coordinates of each output pixel point as the output pixel value of the corresponding target pixel point includes: determining the pixel value of the output pixel point based on the coordinates of the output pixel point, and assigning the pixel value to the corresponding target pixel point.

[0010] Optionally, in the image scaling implementation method according to the present invention, the step of calculating the output pixel coordinates corresponding to each target pixel in the target quadrilateral in the original image includes: traversing each target pixel in the target quadrilateral and sequentially calculating the output pixel coordinates corresponding to each target pixel in the original image until the traversal is completed.

[0011] Optionally, in the image scaling implementation method according to the present invention, the transformation operation includes a scaling operation.

[0012] Optionally, in the image scaling implementation method according to the present invention, the scaling ratio includes a width scaling ratio and a height scaling ratio.

[0013] Optionally, in the image scaling implementation method according to the present invention, the target quadrilateral includes a rectangle.

[0014] Optionally, in the image scaling implementation method according to the present invention, the coordinates of the four vertices of the target quadrilateral are represented as A(Ax, Ay), B(Bx, By), C(Cx, Cy), and D(Dx, Dy), respectively, and the corresponding output coordinates of the four vertices in the original image are represented as a(ax, ay), b(bx, by), c(cx, cy), and d(dx, dy), respectively; the coordinates of the target pixel in the target quadrilateral are represented as M(X, Y), and the corresponding output pixel coordinates are represented as m(x, y); and the output pixel coordinates of each target pixel in the target quadrilateral in the original image are calculated using the following formula:

[0015] X=(1-β)(1-α)*Ax+(1-β)α*Dx+(1-α)β*Bx+αβ*Cx;

[0016] Y=(1-β)(1-α)*Ay+(1-β)α*Dy+(1-α)β*By+αβ*Cy;

[0017] x=(1-β)(1-α)*ax+(1-β)α*dx+(1-α)β*bx+αβ*cx;

[0018] y=(1-β)(1-α)*ay+(1-β)α*dy+(1-α)β*by+αβ*cy;

[0019] Where 0≤α≤1, 0≤β≤1.

[0020] According to one aspect of the present invention, a processing apparatus residing in a computing device is provided, comprising: a receiving module adapted to receive a transformation operation on an original image, form a target image based on the transformation operation, and determine the size of the target image, wherein one or more grids in the original image form one or more target quadrilaterals in the target image; a calculation module adapted to calculate a scaling ratio based on the sizes of the original image and the target image, calculate the output coordinates of the four vertices of the target quadrilaterals in the target image corresponding to the four vertices in the original image based on the scaling ratio, and calculate the output pixel coordinates of each target pixel in the target quadrilateral in the original image based on the output coordinates of the four vertices of the target quadrilaterals in the original image; and an output module adapted to determine the pixel value corresponding to each output pixel coordinate as the output pixel value of the corresponding target pixel, so as to output the final target image.

[0021] According to one aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions including instructions for performing the image scaling implementation method as described above.

[0022] According to one aspect of the present invention, a readable storage medium storing program instructions is provided, which, when read and executed by a computing device, causes the computing device to perform the method described above.

[0023] According to the technical solution of the present invention, an image scaling method is provided. This method calculates the output coordinates of all target pixels within a target quadrilateral based on its four vertices, without relying on the corresponding output pixels in the original image or their four adjacent pixels for interpolation calculations. Therefore, by calculating the output coordinates of the four vertices of the target quadrilateral in the original image, interpolation calculations can be performed based on these vertex coordinates to obtain the corresponding output pixel coordinates of all pixels within the target quadrilateral in the original image. This significantly reduces the computational load of interpolation, improves computational efficiency, and consequently enhances image processing efficiency, resulting in a smoother image scaling experience for users. The technical solution of the present invention reduces the computational load of interpolation while ensuring image quality, thereby improving computational efficiency during image scaling.

[0024] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0025] To achieve the foregoing and related objectives, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings. These aspects indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The foregoing and other objectives, features, and advantages of this disclosure will become more apparent from the following detailed description, taken in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.

[0026] Figure 1 A schematic diagram of a computing device 100 according to an embodiment of the present invention is shown;

[0027] Figure 2 A flowchart of an image scaling implementation method 200 according to an embodiment of the present invention is shown;

[0028] Figure 3 A schematic diagram is shown of a target quadrilateral ABCD in a target image according to an embodiment of the present invention, and the corresponding output quadrilateral abcd in the original image; and

[0029] Figure 4 A schematic diagram of a processing apparatus 400 according to an embodiment of the present invention is shown. Detailed Implementation

[0030] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0031] Figure 1 This is a schematic block diagram of an example computing device 100.

[0032] like Figure 1 As shown, in the basic configuration 102, the computing device 100 typically includes a system memory 106 and one or more processors 104. A memory bus 108 can be used for communication between the processors 104 and the system memory 106.

[0033] Depending on the desired configuration, processor 104 can be any type of processor, including but not limited to: microprocessor (UP), microcontroller (UC), digital information processor (DSP), or any combination thereof. Processor 104 may include one or more levels of cache such as L1 cache 110 and L2 cache 112, processor core 114, and registers 116. Example processor core 114 may include an arithmetic logic unit (ALU), floating-point unit (FPU), digital signal processing core (DSP core), or any combination thereof. Example memory controller 118 may be used with processor 104, or in some implementations, memory controller 118 may be an internal part of processor 104.

[0034] Depending on the desired configuration, system memory 106 can be any type of memory, including but not limited to volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 106 may include operating system 120, one or more applications 122, and program data 124. In some embodiments, application 122 may be arranged to execute instructions on the operating system using program data 124 by one or more processors 104.

[0035] The computing device 100 also includes a storage device 132, which includes a removable storage device 136 and a non-removable storage device 138.

[0036] The computing device 100 may also include a storage interface bus 134. The storage interface bus 134 enables communication from storage devices 132 (e.g., removable storage 136 and non-removable storage 138) to the basic configuration 102 via a bus / interface controller 130. At least a portion of the operating system 120, application 122, and data 124 may be stored on the removable storage 136 and / or the non-removable storage 138, and loaded into system memory 106 via the storage interface bus 134 when the computing device 100 is powered on or when application 122 is to be executed, and executed by one or more processors 104.

[0037] The computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to the basic configuration 102 via a bus / interface controller 130. Example output devices 142 include an image processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices such as displays or speakers via one or more A / V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, touch input devices) or other peripherals (e.g., printers, scanners, etc.) via one or more I / O ports 158. Example communication devices 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other computing devices 162 via a network communication link through one or more communication ports 164.

[0038] A network communication link can be an example of a communication medium. A communication medium can typically be embodied in a modulated data signal, such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A “modulated data signal” can be a signal whose data set, or its modifications, can be encoded as information within the signal. As a non-limiting example, a communication medium can include wired media such as wired networks or leased lines, and various wireless media including sound, radio frequency (RF), microwave, infrared (IR), or other wireless media. The term “computer-readable medium” as used herein can include both storage media and communication media.

[0039] The computing device 100 can be implemented as a personal computer, including desktop and laptop computer configurations. Of course, the computing device 100 can also be implemented as part of a small-sized portable (or mobile) electronic device, such as a cellular phone, digital camera, personal digital assistant (PDA), personal media player device, wireless network browsing device, personal head-mounted device, application-specific device, or a hybrid device that may include any of the above functions. It can even be implemented as a server, such as a file server, database server, application server, and web server. The embodiments of the present invention do not limit this.

[0040] In an embodiment of the present invention, a computing device 100 is configured to execute an image scaling implementation method 200 according to the present invention. The application of the computing device 100 includes multiple program instructions for executing the image scaling implementation method 200 of the present invention. These program instructions can instruct a processor to execute the image scaling implementation method 200 of the present invention, so that the computing device 100, by executing the image scaling implementation method 200 of the present invention, can reduce the computational load of interpolation operations and improve the algorithm's operating efficiency while ensuring image quality.

[0041] According to one embodiment of the present invention, one or more applications arranged on an operating system 120 include a processing device 400, the processing device 400 including a plurality of program instructions for executing the image scaling implementation method 200 of the present invention, such that the image scaling implementation method 200 of the present invention can be executed in the processing device 400.

[0042] Figure 2 A flowchart of an image scaling implementation method 200 according to an embodiment of the present invention is shown. The image scaling implementation method 200 can be executed in a processing apparatus of a computing device (e.g., the aforementioned computing device 100).

[0043] Figure 2 As shown, the image scaling implementation method 200 begins with step S210.

[0044] In step S210, the original image is first acquired and its size is determined.

[0045] Subsequently, in step S220, a transformation operation on the original image is received, a preliminary target image is formed based on the transformation operation, and the size of the target image is determined.

[0046] In embodiments of the present invention, the original image is an image that can be displayed in a variety of applications. For example, one or more image viewing applications can acquire the original image locally from a computing device and display it for users to view; or, for example, the original image can be displayed as resource content on the interface of applications such as browsers for users to view; or, for example, the original image can be sent as chat content in a social application to one or more friends' clients so that client users can view it after receiving it. When viewing the original image, users can zoom in and out to see the target image formed after the zoom operation more clearly.

[0047] It should be noted that the original image can be considered as being composed of one or more grids. In other words, the original image includes one or more grids. After transforming the original image to form the target image, one or more grids in the original image are transformed into one or more target quadrilaterals in the target image. The target quadrilaterals can be rectangles, thus the target image includes one or more target quadrilaterals corresponding to one or more grids in the original image. It can be understood that after transforming the original image, the shape and size of the initially formed target image can be determined.

[0048] In one embodiment, the transformation operation on the original image includes scaling, translation, rotation, etc. Specifically, the scaling operation can include proportional scaling and non-proportional scaling. Here, proportional scaling means scaling the length and width of the original image by the same ratio; correspondingly, non-proportional scaling means scaling the length and width of the original image by different ratios.

[0049] In one implementation, based on the coordinate data of the original image, the coordinate data of the target image formed after the transformation operation on the original image can be calculated using a geometric transformation matrix, thereby determining the coordinates of each pixel in the target image.

[0050] In step S230, the scaling ratio is calculated based on the dimensions of the original image and the target image.

[0051] Here, scaling ratio is the ratio of the target image size to the original image size. Scaling ratio includes width scaling ratio (the ratio of the width of the target image to the width of the original image) and height scaling ratio (the ratio of the height of the target image to the height of the original image).

[0052] According to an embodiment of the present invention, after obtaining the target image based on a transformation operation on the original image, an interpolation operation is performed on the target image. During the interpolation operation on the target image, the target image is used as the input image, and the pixels in the target image are used as input pixels. The pixels in the original image that the input pixels map to are the corresponding output pixels. Here, the input pixels in the target quadrilateral on the target image are referred to as target pixels.

[0053] In an embodiment of the present invention, by calculating the position (coordinates) of the four vertices of each target quadrilateral in the target image in the original image, interpolation calculation can be performed only based on the four vertices of the target quadrilateral to complete the interpolation operation for each target pixel inside the target quadrilateral. This allows the target quadrilateral to complete the interpolation operation simultaneously when it completes the geometric shape transformation (i.e., the process of transforming each grid in the original image into the target quadrilateral), thereby improving the overall processing efficiency of the image.

[0054] In step S240, based on the scaling ratio calculated in step S230, the output coordinates of the four vertices of each target quadrilateral in the target image are calculated in the original image.

[0055] Specifically, by determining the input coordinates (i.e., coordinates in the target image) of the four vertices of the target quadrilateral, the output coordinates of the four vertices in the original image can be calculated based on the input coordinates and scaling ratio of the four vertices.

[0056] Here, the target quadrilateral is used as the input quadrilateral, and the output coordinates of the four vertices of the target quadrilateral in the original image are also the coordinates of the four vertices of the corresponding output quadrilateral in the original image.

[0057] Subsequently, in step S250, for each target quadrilateral in the target image, the output pixel coordinates of each target pixel in the target quadrilateral in the original image are calculated based on the output coordinates of the four vertices of the target quadrilateral in the original image.

[0058] Here, based on the output coordinates of the four vertices of the target quadrilateral obtained above in the original image, for all target pixels within the target quadrilateral, the bilinear interpolation algorithm can be used to interpolate and calculate the output pixel coordinates corresponding to each target pixel based on the input coordinates of the four vertices of the target quadrilateral and their corresponding output coordinates.

[0059] Figure 3 A schematic diagram is shown of a target quadrilateral ABCD in a target image according to an embodiment of the present invention, and the corresponding output quadrilateral abcd in the original image.

[0060] like Figure 3 As shown, the coordinates (input coordinates) of the four vertices of the target quadrilateral ABCD are represented as A(Ax, Ay), B(Bx, By), C(Cx, Cy), and D(Dx, Dy), respectively. The corresponding output pixel coordinates of these four vertices in the original image are represented as a(ax, ay), b(bx, by), c(cx, cy), and d(dx, dy), respectively.

[0061] According to an embodiment of the present invention, it is only necessary to calculate the output coordinates of the four vertices of the target quadrilateral ABCD in the original image, and then the output pixel coordinates of all pixels in the target quadrilateral ABCD in the original image can be obtained by interpolation based on the vertex coordinates, without the need to perform backward mapping for each target pixel individually.

[0062] Specifically, such as Figure 3 As shown, the x and y coordinates of any point P(Px, Py) on line AB can be calculated using the following formula:

[0063] Px = (1-α)*Ax + α*Bx;

[0064] Py = (1-α)*Ay + α*By;

[0065] In the above formula, 0 ≤ α ≤ 1.

[0066] Similarly, the x and y coordinates of any point Q(Qx, Qy) on line BC can be calculated using the following formula:

[0067] Qx = (1-β)*Bx + β*Cx;

[0068] Qy = (1-β)*By + β*Cy;

[0069] In the above formula, 0 ≤ β ≤ 1.

[0070] The coordinates of any target pixel in the target quadrilateral are represented as M(X,Y), and the coordinates of the corresponding output pixel in the original image are represented as m(x,y).

[0071] Suppose there exists a point E on line AD and a point F on line BC. Then M(X, Y) can be considered as a point on line EF. The coordinates of points E and F can be calculated using formulas similar to those used for points P and Q. The coordinates of M(X, Y) can be calculated based on the coordinates of points E and F, using the following formula:

[0072] X=(1-β)(1-α)*Ax+(1-β)α*Dx+(1-α)β*Bx+αβ*Cx; (1)

[0073] Y=(1-β)(1-α)*Ay+(1-β)α*Dy+(1-α)β*By+αβ*Cy; (2)

[0074] In formulas (1) and (2), 0 ≤ α ≤ 1, 0 ≤ β ≤ 1.

[0075] Since the coordinates of the four vertices A(Ax, Ay), B(Bx, By), C(Cx, Cy), and D(Dx, Dy) of the target quadrilateral ABCD can be obtained directly, and the coordinates of M(X, Y) can also be obtained directly, the values ​​of α and β can be calculated by subtracting formulas (1) and (2) based on the known values ​​of Ax, Ay, Bx, By, Cx, Cy, Dx, Dy, X, and Y.

[0076] Points E and F correspond to points e and f in the output quadrilateral of the original image.

[0077] Similarly, the output pixel coordinates m(x, y) corresponding to the target pixel M(X, Y) in the original image can be calculated based on the coordinates of points e and f in the output quadrilateral. The specific calculation formula is as follows:

[0078] x=(1-β)(1-α)*ax+(1-β)α*dx+(1-α)β*bx+αβ*cx; (3)

[0079] y=(1-β)(1-α)*ay+(1-β)α*dy+(1-α)β*by+αβ*cy; (4)

[0080] Since the output coordinates of the four vertices in the original image are calculated in step S240, ax, ay, bx, by, cx, cy, dx, and dy are already determined. Based on this, by substituting the values ​​of α and β calculated based on formulas (1) and (2) into formulas (3) and (4), the values ​​of x and y can be calculated. Here, x and y are integer values. In this way, the coordinates of the output pixel m(x, y) corresponding to the target pixel M(X, Y) are determined.

[0081] According to the formulas (1) to (4) above, it can be understood that the coordinates of each pixel point within the target quadrilateral are only related to the four vertices of the target quadrilateral, and the vertex coordinates are fixed. Therefore, in the embodiment of the present invention, it is only necessary to calculate the output coordinates of the four vertices of the target quadrilateral ABCD in the original image, and then interpolation calculation can be performed based on the vertex coordinates to obtain the output pixel coordinates of all pixels within the target quadrilateral ABCD in the original image. This will greatly reduce the computational load of interpolation operations, improve computational efficiency, and thus help improve the processing efficiency of images, making it smoother for users to perform transformation operations such as scaling on images.

[0082] According to the above method, by traversing each target pixel in the target quadrilateral, the coordinates of the corresponding output pixel in the original image can be calculated sequentially. After the traversal is completed, the coordinates of the output pixel corresponding to all target pixels in the target quadrilateral can be obtained.

[0083] Finally, in step S260, the pixel value corresponding to the coordinates of each output pixel point obtained in the above steps is sequentially determined as the output pixel value of the corresponding target pixel point, and the final target image is obtained and output. Here, the final target image is displayed on the screen of the computing device so that the user can view a clear final target image.

[0084] Here, for each output pixel coordinate, the pixel value of the output pixel can be determined based on the output pixel coordinate, and the pixel value is assigned to the corresponding target pixel in the target image. After the assignment is completed, the final target image can be obtained.

[0085] Figure 4 A schematic diagram of a processing apparatus 400 according to an embodiment of the present invention is shown. The processing apparatus 400 resides in a computing device (e.g., the aforementioned computing device 100) and is adapted to execute the image scaling implementation method 200 of the present invention.

[0086] like Figure 4 As shown, the processing device 400 includes an acquisition module 410, a receiving module 420, a calculation module 430, and an output module 440 connected together. The acquisition module 410 is adapted to acquire an original image and determine its size. The receiving module 420 is adapted to receive a transformation operation on the original image, form a target image based on the transformation operation, and determine its size. One or more grids in the original image form one or more target quadrilaterals in the target image. The calculation module 430 is adapted to calculate a scaling ratio based on the sizes of the original and target images, calculate the output coordinates of the four vertices of the target quadrilaterals in the target image corresponding to the coordinates in the original image based on the scaling ratio, and calculate the output pixel coordinates of each target pixel in the target quadrilateral in the original image based on the output coordinates of the four vertices of the target quadrilaterals in the original image. The output module 440 is adapted to determine the pixel value corresponding to each output pixel coordinate as the output pixel value of the corresponding target pixel, thereby outputting the final target image.

[0087] It should be noted that the acquisition module 410 is used to execute the aforementioned step S210, the receiving module 420 is used to execute the aforementioned step S220, the calculation module 430 is used to execute the aforementioned steps S230 to S250, and the output module 440 is used to execute the aforementioned step S260. Here, the specific execution logic of the acquisition module 410, the receiving module 420, the calculation module 430, and the output module 440 are described in the preceding method 200 for steps S210 to S260, and will not be repeated here.

[0088] The image scaling method 200 of the present invention relies on the four vertices of the target quadrilateral to calculate the output coordinates of all target pixels inside the quadrilateral, without relying on the output pixel corresponding to the target pixel in the original image and its four adjacent pixels to perform interpolation calculations for each target pixel. Therefore, by only calculating the output coordinates of the four vertices of the target quadrilateral in the original image, interpolation calculations can be performed based on the vertex coordinates to obtain the output pixel coordinates of all pixels inside the target quadrilateral in the original image. This significantly reduces the computational load of interpolation operations, improves computational efficiency, and thus improves image processing efficiency, making image scaling operations smoother for users. According to the technical solution of the present invention, the bilinear interpolation algorithm used in the prior art for image scaling has been optimized, which can reduce the computational load of interpolation operations while ensuring image quality, and improve the computational efficiency when scaling images.

[0089] The various techniques described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, USB flash drive, floppy disk, CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the present invention.

[0090] When the program code is executed on a programmable computer, the computing device generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code; the processor is configured to execute the image scaling implementation method of the present invention according to instructions in the program code stored in the memory.

[0091] By way of example, and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer-readable instructions, data structures, program modules, or other data. Communication media generally embodies computer-readable instructions, data structures, program modules, or other data in the form of modulated data signals such as carrier waves or other transmission mechanisms, and includes any information delivery medium. Any combination of the above is also included within the scope of readable media.

[0092] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with the examples of this invention. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the invention.

[0093] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0094] Similarly, it should be understood that, in order to streamline this disclosure and aid in understanding one or more aspects of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the above description of exemplary embodiments of the invention. However, this method of disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of the invention.

[0095] Those skilled in the art will understand that modules, units, or components of the devices disclosed in the examples herein can be arranged in the devices described in this embodiment, or alternatively, can be located in one or more devices different from the devices in this example. The modules in the foregoing examples can be combined into a single module or, in addition, can be divided into multiple sub-modules.

[0096] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0097] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention and form different embodiments.

[0098] Furthermore, some of the embodiments described herein are methods or combinations of method elements that can be implemented by a processor of a computer system or by other means of performing the functions. Therefore, a processor having the necessary instructions for implementing the methods or method elements forms means for implementing the methods or method elements. Furthermore, the elements described herein in the apparatus embodiments are examples of means for implementing the functions performed by elements for the purposes of carrying out the invention.

[0099] As used herein, unless otherwise specified, the use of ordinal numbers such as “first,” “second,” “third,” etc., to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, ordering, or any other manner.

[0100] Although the invention has been described with reference to a limited number of embodiments, those skilled in the art will understand from the foregoing description that other embodiments are conceivable within the scope of the invention described herein. Furthermore, it should be noted that the language used in this specification has been chosen primarily for readability and edibility purposes, and not for the purpose of interpreting or limiting the subject matter of the invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the invention is illustrative and not restrictive, and the scope of the invention is defined by the appended claims.

Claims

1. A method for image scaling implementation, executed in a computing device, comprising the steps of: obtaining an original image, and determining a size of the original image, the original image being adapted to be displayed as resource content on an interface of a browser application for a user to view, and being adapted to be sent as chat content in a social application to one or more friends' clients for a user to view; receiving a transformation operation on the original image when viewing the original image, forming a target image based on the transformation operation and determining a size of the target image, wherein, one or more grids in the original image form one or more target quadrilaterals in the target image, the transformation operation comprises a scaling operation, the scaling operation comprises a same scaling operation, a different scaling operation; calculating a scaling ratio of the target image size relative to the original image size based on the sizes of the original image and the target image, the scaling ratio comprises a width scaling ratio and a height scaling ratio; calculating corresponding output coordinates of four vertices of the target quadrilateral in the original image based on the scaling ratio; calculating corresponding output pixel point coordinates of each target pixel point in the target quadrilateral in the original image based on the corresponding output coordinates of the four vertices of the target quadrilateral in the original image; and determining a pixel value corresponding to each output pixel point coordinate as an output pixel value of the corresponding target pixel point to output a final target image; wherein the four vertex coordinates of the target quadrilateral are represented as A(Ax, Ay), B(Bx, By), C(Cx, Cy), D(Dx, Dy) respectively, the corresponding output coordinates of the four vertices in the original image are represented as a(ax, ay), b(bx, by), c(cx, cy), d(dx, dy) respectively, the coordinates of the target pixel point in the target quadrilateral are represented as M(X, Y), and the corresponding output pixel point coordinates are represented as m(x, y), the corresponding output pixel point coordinates of each target pixel point in the target quadrilateral in the original image are calculated by the following formulas: X = (1 - β)(1 - α) * Ax + (1 - β)α * Dx + (1 - α)β * Bx + αβ * Cx; Y = (1 - β)(1 - α) * Ay + (1 - β)α * Dy + (1 - α)β * By + αβ * Cy; x = (1 - β)(1 - α) * ax + (1 - β)α * dx + (1 - α)β * bx + αβ * cx; y = (1 - β)(1 - α) * ay + (1 - β)α * dy + (1 - α)β * by + αβ * cy; wherein 0 ≤ α ≤ 1, 0 ≤ β ≤ 1. The step of determining a pixel value corresponding to each output pixel point coordinate as an output pixel value of the corresponding target pixel point comprises: determining the pixel value of the output pixel point based on the output pixel point coordinate, and assigning the pixel value to the corresponding target pixel point. The step of calculating the corresponding output pixel point coordinates of each target pixel point in the target quadrilateral in the original image comprises: traversing each target pixel point in the target quadrilateral, and sequentially calculating the corresponding output pixel point coordinates of each target pixel point in the original image until the traversal is completed. The target quadrilateral comprises a rectangle.

2. The method of claim 1, wherein, ​ ​ 3. The method of claim 1, wherein, ​ ​ 4. The method of any one of claims 1-3, wherein, ​ 5. A processing apparatus residing in a computing device, comprising: an obtaining module adapted to obtain an original image and determine a size of the original image, the original image adapted to be displayed as resource content on an interface of a browser application for a user to view and adapted to be sent as chat content in a social application to one or more friends' clients for a user to view; a receiving module adapted to receive a transformation operation on the original image when the original image is viewed, form a target image based on the transformation operation and determine a size of the target image, wherein one or more grids in the original image form one or more target quadrilaterals in the target image, the transformation operation comprising a scaling operation, the scaling operation comprising a same scale operation, a different scale operation; a calculating module adapted to calculate a scaling ratio of the target image size relative to the original image size based on the sizes of the original image and the target image, the scaling ratio comprising a width scaling ratio and a height scaling ratio, calculate output coordinates of four vertices of a target quadrilateral in the target image in the original image based on the scaling ratio, and calculate an output pixel point coordinate of each target pixel point in the target quadrilateral in the original image based on the output coordinates of the four vertices of the target quadrilateral in the original image, wherein the four vertices of the target quadrilateral are represented as A (Ax, Ay), B (Bx, By), C (Cx, Cy), and D (Dx, Dy), the output coordinates of the four vertices in the original image are represented as a (ax, ay), b (bx, by), c (cx, cy), and d (dx, dy), the coordinate of the target pixel point in the target quadrilateral is represented as M (X, Y), and the corresponding output pixel point coordinate is represented as m (x, y), and the output pixel point coordinate of each target pixel point in the target quadrilateral in the original image is calculated by the following formulas: X = (1 - β) (1 - α) * Ax + (1 - β) α * Dx + (1 - α) β * Bx + α β * Cx; Y = (1 - β) (1 - α) * Ay + (1 - β) α * Dy + (1 - α) β * By + α β * Cy; x = (1 - β) (1 - α) * ax + (1 - β) α * dx + (1 - α) β * bx + α β * cx; y = (1 - β) (1 - α) * ay + (1 - β) α * dy + (1 - α) β * by + α β * cy; wherein 0 ≤ α ≤ 1 and 0 ≤ β ≤ 1. an outputting module adapted to determine a pixel value corresponding to each output pixel point coordinate as an output pixel value of the corresponding target pixel point to output a final target image.

6. A computing device, comprising: at least one processor; and a memory storing program instructions configured to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any one of claims 1-4.

7. A readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to perform the method of any one of claims 1-4. ​

Citation Information

Patent Citations

  • Image local highlighting-scaling method for medical display

    CN107422953A

  • Image processing method, device and apparatus

    CN109089093A