Image scaling method, device, equipment and storage medium

By slicing and scaling the telescopic images, the problem of abnormal display effect after scaling and scaling in the prior art is solved, and the precise scaling and high-quality display effect of the telescopic areas are achieved.

CN112288623BActive Publication Date: 2025-02-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010518967.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-09
Publication Date
2025-02-21
Estimated Expiration
2040-06-09

AI Technical Summary

Technical Problem

The existing picture scaling method may cause abnormal display effects when processing pictures containing the area to be scaled and the area not scaled.

Method used

By obtaining the picture to be stretched and the area to be stretched, the picture is sliced ​​based on the area to be stretched, and a slice picture containing the area to be stretched and a slice picture containing the area to be stretched and does not contain the area to be stretched, and only the slice picture containing the area to be stretched and contracted is performed.

Benefits of technology

It realizes the individual expansion and contraction processing of any number of areas to be stretched, avoids unnecessary expansion and contraction processing of pictures that do not include areas to be stretched, and improves the display effect and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112288623B_ABST
    Figure CN112288623B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, device, equipment and storage medium for scaling an image. The method comprises: obtaining an image to be scaled and a region to be scaled on the image to be scaled; slicing the image to be scaled based on the region to be scaled to obtain a sliced ​​image; and scaling the sliced ​​image including the region to be scaled. The technical solution of the embodiment of the present invention can scale any number of regions to be scaled, and the image to be scaled after the scaling process can present a better display effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of image processing technology, and in particular to a method, device, equipment and storage medium for image scaling. Background Art

[0002] A certain client provides a method for scaling an image, which can directly scale the image to be scaled to a target size, thereby realizing the scaling processing of the image to be scaled.

[0003] In the process of implementing the present invention, the inventors discovered that the following technical problems exist in the prior art: assuming that a certain effect image includes a to-be-scaled image and an unscaled image that is displayed in conjunction with the image and does not need to be scaled, the existing image scaling method may cause abnormal image display effects. Summary of the invention

[0004] The embodiments of the present invention provide a method, device, equipment and storage medium for scaling an image, which solve the problem that an image after scaling may have display abnormalities.

[0005] In a first aspect, an embodiment of the present invention provides a method for scaling an image, which may include:

[0006] Get the image to be scaled and the area to be scaled on the image to be scaled;

[0007] Slice the image to be scaled based on the area to be scaled to obtain a sliced ​​image;

[0008] Scale the sliced ​​image that contains the area to be scaled.

[0009] Optionally, the above-mentioned image scaling method may further include:

[0010] An unscaled image to be displayed in coordination with the image to be scaled is obtained, and a to-be-scaled area is determined according to a coordination area between the image to be scaled and the unscaled image.

[0011] Optionally, slicing the to-be-scaled image based on the to-be-scaled area may include:

[0012] Obtain the expansion and contraction direction of the area to be expanded and contracted, and determine the slicing direction perpendicular to the expansion and contraction direction;

[0013] Slice the image to be scaled based on the area to be scaled and the slicing direction.

[0014] Optionally, scaling the slice image including the area to be scaled may include:

[0015] The slice image containing the area to be scaled is used as the slice image to be scaled;

[0016] Get the scaling size of the sliced ​​image to be scaled, and scale the sliced ​​image to be scaled according to the scaling size.

[0017] Optionally, the above-mentioned image scaling method may further include:

[0018] The target size after scaling and the original size before scaling of the image to be scaled are obtained, and the scaling size is determined according to the target size, the original size, and the number of regions to be scaled.

[0019] Optionally, scaling the slice image including the area to be scaled may include:

[0020] For the current slice picture in each slice picture, if the current slice picture includes the area to be scaled, the current slice picture is scaled, and the current slice picture after the scaling is spliced ​​to the spliced ​​picture, and the spliced ​​picture is updated according to the splicing result;

[0021] If the current slice image does not contain the area to be stretched, the current slice image is directly spliced ​​onto the spliced ​​image, and the spliced ​​image is updated according to the splicing result;

[0022] Update the next slice image of the current slice image to the current slice image, and repeat the steps if the current slice image contains the area to be scaled, until any current slice image is spliced, and use the spliced ​​image as the scaled image.

[0023] Optionally, the number of slices of the sliced ​​image is determined according to the number of regions to be scaled.

[0024] Optionally, the number of slices m is determined by the following formula: m=n*2+1, where n is the number of regions.

[0025] In a second aspect, an embodiment of the present invention further provides a device for scaling an image, which may include:

[0026] A data acquisition module, used to acquire the image to be scaled and the area to be scaled on the image to be scaled;

[0027] A picture slicing module, used to slice the to-be-scaled picture based on the to-be-scaled area to obtain a sliced ​​picture;

[0028] The image scaling module is used to scale the sliced ​​image containing the area to be scaled.

[0029] In a third aspect, an embodiment of the present invention further provides a device, which may include:

[0030] one or more processors;

[0031] A memory for storing one or more programs;

[0032] When one or more programs are executed by one or more processors, the one or more processors implement the image scaling method provided by any embodiment of the present invention.

[0033] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the image scaling method provided by any embodiment of the present invention is implemented.

[0034] The technical solution of the embodiment of the present invention can slice the image to be scaled based on the area to be scaled by obtaining the image to be scaled and the area to be scaled on the image to be scaled, and obtain sliced ​​images containing the area to be scaled and sliced ​​images not containing the area to be scaled; thus, only the sliced ​​images containing the area to be scaled can be scaled later, and there is no need to scale the sliced ​​images not containing the area to be scaled. The above technical solution can scale any number of areas to be scaled separately, and can present a good display effect after the scaling process, and the user experience is good. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 is a flow chart of a method for scaling an image in Embodiment 1 of the present invention;

[0036] Figure 2a This is a first application schematic diagram of a picture scaling method in the first embodiment of the present invention;

[0037] Figure 2b This is a second application schematic diagram of a picture scaling method in the first embodiment of the present invention;

[0038] Figure 2c This is a third application schematic diagram of a picture scaling method in the first embodiment of the present invention;

[0039] Figure 2d This is a fourth application schematic diagram of a picture scaling method in the first embodiment of the present invention;

[0040] Figure 3 This is a fifth application schematic diagram of a picture scaling method in the first embodiment of the present invention;

[0041] Figure 4 is a flow chart of a method for scaling an image in Embodiment 2 of the present invention;

[0042] Figure 5 This is a sixth application schematic diagram of a picture scaling method in the second embodiment of the present invention;

[0043] Figure 6 is a flowchart of an optional embodiment of a picture scaling method in Embodiment 2 of the present invention;

[0044] Figure 7 This is a structural block diagram of a picture scaling device in Embodiment 3 of the present invention;

[0045] Figure 8 It is a structural diagram of a device in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0046] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It is also necessary to explain that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0047] Before introducing the embodiments of the present invention, the application scenarios of the embodiments of the present invention are first exemplarily described:

[0048] Example 1: Assuming that the scaling requirement is to scale a certain area or several areas in a scaled image, the existing technology can only scale the entire image, but cannot scale the areas in the scaled image based on the scaling requirement.

[0049] Example 2: Take a picture of an effect in a display page of an application as an example. Figure 2a As shown, the effect picture includes a clown picture, and an arrow picture that is displayed in conjunction with the clown picture and does not need to be scaled. The dotted area is the coordination area between the clown picture and the arrow picture. The clown picture's hat is provided with text, and the vertices of the two arrows in the arrow picture are respectively connected to the two corners of the clown picture's mouth. When the number of words in the text changes, in order to ensure that the text does not exceed the area where the hat is located, the prior art directly scales the entire clown picture to change the size of the clown picture, and the change in the size of the clown picture means the change in the size of the hat in the clown picture, and the change in the number of words in the text is adapted by changing the size of the hat. However, considering that the arrow picture is fixed, when the clown picture is scaled, the vertices of the two arrows in the arrow picture can no longer be connected to the two corners of the clown picture's mouth, as shown in FIG. Figure 2b As shown, this causes the display effect of the entire effect picture to be abnormal.

[0050] Embodiment 1

[0051] Figure 11 is a flowchart of a method for scaling an image provided in Embodiment 1 of the present invention. This embodiment is applicable to the case where scaling is performed on a to-be-scaled area in a to-be-scaled image. The method can be performed by a device for scaling an image provided in an embodiment of the present invention, which can be implemented in software and / or hardware, and can be integrated in various user terminals or servers.

[0052] See also Figure 1 The method of the embodiment of the present invention specifically includes the following steps:

[0053] S110: Obtain a to-be-scaled picture and a to-be-scaled area on the to-be-scaled picture.

[0054] Among them, the image to be scaled is the image that needs to be scaled, and the area to be scaled is the area on the image to be scaled that needs to be scaled. Optionally, the number of areas to be scaled can be one, two, or more, and they can be interconnected areas or separated areas. Optionally, the area to be scaled can be a polygonal area such as a rectangular area, a triangular area, etc., or a curved area such as a circular area, an elliptical area, etc., which can be specifically determined according to the needs of the scaling process. Optionally, the area to be scaled can be a pre-set area or an automatically determined area.

[0055] Exemplarily, an optional solution for automatically determining the area to be scaled is to first obtain an unscaled image that does not need to be scaled and is displayed in coordination with the image to be scaled, and then determine the area to be scaled based on the coordination area between the image to be scaled and the unscaled image. Specifically, a certain effect image may include an image to be scaled and an unscaled image, and a coordination area for coordination between the two can be determined based on the image to be scaled and the unscaled image. The coordination area may be an overlapping area between the image to be scaled and the unscaled image. At this time, the area to be scaled may be all or part of the area in the image to be scaled except the coordination area, and the specific area to be scaled may be further determined based on the scaling requirements. For ease of explanation, the sliced ​​image containing the area to be scaled will be referred to as the sliced ​​image to be scaled. The advantage of the above steps is that since the sliced ​​image to be scaled does not contain the coordination area, when the scaling process is performed on the sliced ​​image to be scaled, it will not have any impact on the coordination area, that is, it will not have any impact on the coordinated display effect of the image to be scaled and the unscaled image. For example, Figure 2a For example, the clown image is the image to be stretched, the arrow image is the image that has not been stretched, and the virtual frame area is the coordination area between the clown image and the arrow image. When the number of words in the copy changes, in order to ensure that the copy does not exceed the area where the hat is located, the area to be stretched can be the area where the hat is located, or the area where the hat + black ball are located, and so on.

[0056] S120 , slicing the to-be-scaled picture based on the to-be-scaled area to obtain a sliced ​​picture.

[0057] Among them, after slicing the image to be scaled based on the area to be scaled, some sliced ​​images include the area to be scaled, and some sliced ​​images do not include the area to be scaled. In this way, only the sliced ​​images to be scaled are subsequently scaled, and there is no need to scale the sliced ​​images that do not include the area to be scaled. It should be noted that there are many ways to implement slicing the image to be scaled based on the area to be scaled, such as cutting the image to be scaled through based on the circumscribed rectangle of the area to be scaled, wherein cutting through means completely cutting the image to be scaled, rather than partially cutting and the parts are still connected, and the edges of the circumscribed rectangle and the edges of the image to be scaled can be parallel to each other; another example is cutting the image to be scaled through based on the area to be scaled, and at least one of the slicing direction, slicing position and slicing number; and so on.

[0058] On this basis, optionally, the slicing direction may be the direction of a straight edge of the area to be stretched or the tangent direction of a curved edge; the slicing direction may be the direction of an edge in a circumscribed rectangle of the area to be stretched; the slicing direction may also be determined according to the stretching direction of the area to be stretched, and may be a direction other than the stretching direction, such as a direction perpendicular to the stretching direction.

[0059] Optionally, the slice position may be the position of a certain edge of the area to be scaled, the position of a certain edge of the circumscribed rectangle of the area to be scaled, etc. In practical applications, the slice position may run through the entire image to be scaled. For example, when the image to be scaled is a rectangular area, the starting point of the slice position may be a point on a certain edge of the image to be scaled, and the ending point may be a point on another edge parallel to the edge, such as Figure 3 shown.

[0060] Optionally, the number of slices of the sliced ​​image can be determined according to the number of regions to be scaled, according to the region positions of the regions to be scaled, or according to both the number of regions and the region positions. If the number of regions is n, the number of slices m can be m≥n+1, or can be m=n*2+1, wherein the setting of m=n*2+1 can ensure that when the scaled sliced ​​image is scaled, the sliced ​​images on both sides that do not contain the region to be scaled are not affected.

[0061] S130: Perform scaling processing on the slice image including the area to be scaled.

[0062] The scaling process is performed on the slice image containing the area to be scaled (i.e., the slice image to be scaled), and the scaling process is not performed on the slice image not containing the area to be scaled. The scaling process may involve the scaling direction, scaling size, etc. Optionally, the scaling direction may be preset, or may be automatically determined according to the positional relationship between the area to be scaled and the matching area, etc.

[0063] Optionally, the scaling size can be pre-set, or it can be automatically determined based on the target size of the image to be scaled after scaling and the original size before scaling, or it can be automatically determined based on the target size, the original size and the number of regions, such as the scaling size of each slice image to be scaled = (target size - original size) / number of regions, the size of the slice image to be scaled after scaling is the sum of the size of the slice image to be scaled before scaling and the scaling size, which is a uniformly distributed calculation method, thereby ensuring the uniformity of each slice image.

[0064] It should be noted that, firstly, the number of the areas to be scaled may be at least one. After slicing the image to be scaled based on the areas to be scaled, sliced ​​images to be scaled corresponding to each area to be scaled may be obtained. In this way, only the sliced ​​images to be scaled may be subsequently scaled, thereby achieving the effect of separately scaling one or several areas to be scaled in the image to be scaled.

[0065] Secondly, when there is an unscaled picture to be displayed in conjunction with the picture to be scaled, the above-mentioned picture scaling method can obtain the sliced ​​picture to be scaled based on the pre-acquired area to be scaled, considering that the area to be scaled is the area other than the matching area between the picture to be scaled and the unscaled picture, therefore, when the sliced ​​picture to be scaled is scaled, it will not cause any impact on the matching area, thereby solving the problem that the display effect of the picture to be scaled or the entire effect picture after the scaling process may be abnormal.

[0066] Again, the above-mentioned image scaling method directly slices the image to be scaled to obtain sliced ​​images, and there is no need to introduce sliced ​​images from the outside world. Therefore, when the code for implementing the above-mentioned image scaling method is encapsulated into the installation package of an application, there is no need to encapsulate the sliced ​​images introduced from the outside world into the installation package, and there is no need to set up an image container in the code to carry the sliced ​​images introduced from the outside world. Therefore, the size of the installation package is reduced and the code is simplified, thereby achieving strict control of the size of the installation package in the application store.

[0067] Finally, based on the above-mentioned image scaling method, a basic class for implementing image scaling processing can be generated for client developers to call. It can be applicable to the case where one area to be scaled is scaled, and it can also be applicable to the case where two or more areas to be scaled are scaled. It can be applicable to processing regular images, such as images that will not be deformed after scaling, and it can also be applicable to processing irregular images, such as images that are easily deformed after scaling. It has a wide range of application scenarios.

[0068] The technical solution of the embodiment of the present invention can slice the image to be scaled based on the area to be scaled by obtaining the image to be scaled and the area to be scaled on the image to be scaled, and obtain sliced ​​images containing the area to be scaled and sliced ​​images not containing the area to be scaled; thus, only the sliced ​​images containing the area to be scaled can be scaled later, and there is no need to scale the sliced ​​images not containing the area to be scaled. The above technical solution can scale any number of areas to be scaled separately, and can present a good display effect after the scaling process, and the user experience is good.

[0069] Embodiment 2

[0070] Figure 4 It is a flow chart of a picture scaling method provided in the second embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, scaling is performed on a slice picture containing an area to be scaled, which may specifically include: for a current slice picture in each slice picture, if the current slice picture contains an area to be scaled, scaling is performed on the current slice picture, and the current slice picture after scaling is spliced ​​to the spliced ​​picture, and the spliced ​​picture is updated according to the splicing result; if the current slice picture does not contain the area to be scaled, the current slice picture is directly spliced ​​to the spliced ​​picture, and the spliced ​​picture is updated according to the splicing result; the next slice picture of the current slice picture is updated to the current slice picture, and the steps of if the current slice picture contains an area to be scaled are repeated until any current slice picture is spliced, and the spliced ​​picture is used as a scaled picture. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.

[0071] See also Figure 4 The method of this embodiment may specifically include the following steps:

[0072] S210: Obtain a to-be-scaled picture and a to-be-scaled area on the to-be-scaled picture.

[0073] S220 , slicing the to-be-scaled picture based on the to-be-scaled area to obtain a sliced ​​picture.

[0074] S230, for the current slice picture in each slice picture, if the current slice picture includes the area to be scaled, the current slice picture is scaled, and the current slice picture after the scaling is spliced ​​to the spliced ​​picture, and the spliced ​​picture is updated according to the splicing result; if the current slice picture does not include the area to be scaled, the current slice picture is directly spliced ​​to the spliced ​​picture, and the spliced ​​picture is updated according to the splicing result.

[0075] Among them, the current slice picture is the slice picture to be processed, and the spliced ​​picture is the picture after several slice pictures are spliced. After the current slice picture is selected from each slice picture, it can be determined whether the current slice picture contains the area to be scaled. If so, the current slice picture can be scaled and the current slice picture after the scaling can be spliced ​​to the spliced ​​picture; correspondingly, if not, there is no need to scale the current slice picture, and it can be directly spliced ​​to the spliced ​​picture with the original size. Then, the spliced ​​picture is updated according to the splicing result, and the updated spliced ​​picture is a picture containing the current slice picture.

[0076] S240: Update the next slice image of the current slice image to the current slice image, and repeat the step of if the current slice image includes the area to be scaled, until any current slice image is spliced, and use the spliced ​​image as the scaled image.

[0077] The next slice image of the current slice image is updated to the current slice image, and the next slice image may be a slice image that is adjacent to the current slice image in the to-be-scaled image. After repeatedly executing the above steps, each slice image that includes the to-be-scaled area may be scaled and spliced, and each slice image that does not include the to-be-scaled area may be spliced, and the resulting scaled image is the to-be-scaled image that meets the scaling requirements after the scaling of the to-be-scaled area is completed.

[0078] The technical solution of the embodiment of the present invention sequentially determines whether each current slice image includes the area to be scaled, so as to perform scaling and splicing processing on the current slice images including the area to be scaled, and performs splicing processing on the current slice images that do not include the area to be scaled, so that the scaled images obtained are the images to be scaled that meet the scaling processing requirements after the scaling processing is completed on the area to be scaled.

[0079] In order to better understand the specific implementation process of the above steps, considering the application scenarios that may be involved in the embodiments of the present invention, two specific examples are used below to illustrate them exemplarily.

[0080] Example 1: Figure 5 As an example, a certain image img to be scaled in a certain display page of an application program on the Apple client shown in FIG. 1 is used for the scaling process. Figure 6As shown, img and the area to be scaled on img are obtained. The area to be scaled is determined according to the scaling processing requirements. In practical applications, the area to be scaled can be represented in array form. Figure 5 For example, the area to be stretched can be expressed as edgeARR[range A, range B], where edgeARR is the array name, range A is the range of area 1 to be stretched, and range B is the range of area 2 to be stretched. Since edgeARR and img are both rectangular areas, range A and range B can be represented by the margins between the upper, left, lower, and right boundaries of edgeARR and img. Range A is 0 85 0 245, and range B is 0 255 0 80. The four numbers in each range are the top margin, left margin, bottom margin, and right margin, respectively. On this basis, since range A and range B are ranges with upper and lower margins of 0, this is suitable for the case where the stretching direction is the horizontal direction and the slicing direction is the vertical direction. Therefore, img is cut vertically with range A and range B as intervals to obtain (n*2+1) slice images, where n=2, and slice images 1-5 are stored in array imgArr, where slice images 1, 3, and 5 do not include the area to be stretched, and slice images 2 and 4 include the area to be stretched.

[0081] Further, each slice image in imgArr is traversed. Specifically, slice image 1 does not contain the area to be scaled, and slice image 1 is directly spliced ​​to the spliced ​​image img1. Since img1 does not exist at this time, slice image 1 is directly stored as img1; slice image 2 is a picture in range A, and slice image 2 is scaled. The specific scaling method can be to obtain the original size of img before the scaling and the target size of img after the scaling, the scaling size of slice image 2 = (original size - target size) / n, and the slice image 2 is scaled according to the scaling size and the scaling direction, wherein the slice image 2 is stretched when the scaling size is positive, and the slice image 2 is compressed when the scaling size is negative. At this time, the size of the slice image 2 after the scaling = the size of the slice image 2 before the scaling + the scaling size, and the slice image 2 after the scaling is spliced ​​on img1, and the splicing result is stored as img1; similarly, continue to traverse slice images 3, 4, and 5 in imgArr, and the specific implementation process is similar to the above process, which will not be repeated here. When each slice image in imgArr is traversed, img1 is now a multi-region scaling image, thus achieving the multi-region scaling effect in img. In actual applications, you can cut out slice images corresponding to range A and range B based on the CGImage class provided by Apple in Object-C, or you can use the drawInRect of the UIImage class in the context drawing board provided by Apple in Object-C to achieve image stitching.

[0082] Example 2: Figure 2a As shown in FIG. 1 , the image to be scaled is a clown image, and the area to be scaled is a hat. Therefore, when the clown image is sliced ​​horizontally, the sliced ​​images are black ball images, hat images, and face images from top to bottom. The hat image containing the hat is scaled, and the black ball image and the face image are not scaled. The processing effect is as follows: Figure 2c As shown in the figure, since the face image displayed with the arrow image is not scaled, and the hat image displayed with the text is scaled as the number of words in the text changes, the coordination area between the clown image after the scaling process and the fixed arrow image is still well coordinated, and the text is still in the area where the hat is located. Alternatively, when the clown image is sliced ​​horizontally, the sliced ​​images are the black ball hat image and the face image from top to bottom, and the black ball hat image containing the hat is scaled, and the face image is not scaled. The processing effect is as follows: Figure 2dAs shown, the matching area between the clown image and the fixed arrow image after the scaling process is still well matched, and the text is still in the area where the hat is located, thereby solving the problem that the display effect of the image to be scaled or the entire effect image after the scaling process may be abnormal.

[0083] Embodiment 3

[0084] Figure 7 This is a structural block diagram of a picture resizing device provided in Embodiment 3 of the present invention. The device is used to execute the picture resizing method provided in any of the above embodiments. The device and the picture resizing method in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the picture resizing device, please refer to the embodiment of the above picture resizing method. Figure 7 The device may specifically include: a data acquisition module 310, a picture slicing module 320 and a picture scaling module 330.

[0085] The data acquisition module 310 is used to acquire the image to be scaled and the area to be scaled on the image to be scaled;

[0086] The picture slicing module 320 is used to slice the to-be-scaled picture based on the to-be-scaled area to obtain a sliced ​​picture;

[0087] The image scaling module 330 is used to perform scaling processing on the slice image containing the area to be scaled.

[0088] Optionally, based on the above device, the device may further include:

[0089] The module for determining the area to be scaled is used to obtain an unscaled image to be displayed in coordination with the image to be scaled, and determine the area to be scaled according to the coordination area between the image to be scaled and the unscaled image.

[0090] Optionally, the picture slicing module 320 may specifically include:

[0091] A slicing direction determining unit, used to obtain the expansion direction of the area to be expanded and contracted, and determine a slicing direction perpendicular to the expansion direction;

[0092] The picture slicing unit is used to slice the to-be-scaled picture based on the to-be-scaled area and the slicing direction.

[0093] Optionally, the image scaling module 330 may be specifically used for:

[0094] A slice image including the to-be-scaled area is used as the to-be-scaled slice image, and a scaling size of the to-be-scaled slice image is obtained, and scaling processing is performed on the to-be-scaled slice image according to the scaling size.

[0095] Optionally, based on the above device, the device may further include:

[0096] The scaling size determination module is used to obtain the target size after scaling and the original size before scaling of the image to be scaled, and determine the scaling size according to the target size, the original size and the number of areas to be scaled.

[0097] Optionally, the image scaling module 330 may specifically include:

[0098] The scaling and splicing processing module is used for scaling the current slice image in each slice image, if the current slice image contains the area to be scaled, and splicing the current slice image after the scaling process to the splicing image, and updating the splicing image according to the splicing result;

[0099] A splicing processing module, used for directly splicing the current slice image to the splicing image if the current slice image does not contain the area to be scaled, and updating the splicing image according to the splicing result;

[0100] The repeated execution module is used to update the next slice image of the current slice image to the current slice image, and repeatedly execute the step of if the current slice image contains the area to be scaled, until any current slice image is spliced, and the spliced ​​image is used as the scaled image.

[0101] Optionally, the number of slices of the sliced ​​image is determined according to the number of regions to be scaled.

[0102] Optionally, the number of slices m is determined by the following formula: m=n*2+1, where n is the number of regions.

[0103] The image scaling device provided in the third embodiment of the present invention can obtain the image to be scaled and the area to be scaled on the image to be scaled by cooperating with the data acquisition module and the image slicing module, and can slice the image to be scaled based on the area to be scaled to obtain sliced ​​images containing the area to be scaled and sliced ​​images not containing the area to be scaled; thus, the image scaling module can only scale the sliced ​​images containing the area to be scaled, and there is no need to scale the sliced ​​images not containing the area to be scaled. The above device can scale any number of areas to be scaled separately, and can present a better display effect after the scaling process, and the user experience is better.

[0104] The image scaling device provided in the embodiment of the present invention can execute the image scaling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0105] It is worth noting that in the embodiment of the above-mentioned image retraction device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0106] Embodiment 4

[0107] Figure 8 A schematic diagram of a device structure provided in Embodiment 4 of the present invention is shown in FIG. Figure 8 As shown, the device includes a memory 410, a processor 420, an input device 430, and an output device 440. The number of processors 420 in the device can be one or more. Figure 8 A processor 420 is used as an example; the memory 410, the processor 420, the input device 430 and the output device 440 in the device can be connected via a bus or other means. Figure 8 The connection via bus 450 is taken as an example.

[0108] The memory 410, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the image scaling method in the embodiment of the present invention (for example, the data acquisition module 310, the image slicing module 320 and the image scaling module 330 in the image scaling device). The processor 420 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 410, that is, realizing the above-mentioned image scaling method.

[0109] The memory 410 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the device, etc. In addition, the memory 410 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 410 may further include a memory remotely arranged relative to the processor 420, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0110] The input device 430 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 440 may include a display device such as a display screen.

[0111] Embodiment 5

[0112] Embodiment 5 of the present invention provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to execute a picture scaling method when executed by a computer processor, the method comprising:

[0113] Get the image to be scaled and the area to be scaled on the image to be scaled;

[0114] Slice the image to be scaled based on the area to be scaled to obtain a sliced ​​image;

[0115] Scale the sliced ​​image that contains the area to be scaled.

[0116] Of course, the computer executable instructions of a storage medium including computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the image scaling method provided by any embodiment of the present invention.

[0117] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0118] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for scaling an image, characterized in that: include: Acquire a picture to be scaled and acquire an unscaled picture that does not need to be scaled and is displayed in conjunction with the picture to be scaled, wherein the picture to be scaled is a picture that needs to be scaled; According to the matching area between the to-be-scaled picture and the unscaled picture, determining a to-be-scaled area on the to-be-scaled picture that needs to be scaled except the matching area, wherein the matching area is an overlapping area between the to-be-scaled picture and the unscaled picture; Slicing the to-be-scaled picture based on the to-be-scaled area to obtain a sliced ​​picture; Performing scaling processing on the slice image including the area to be scaled, wherein the slice image not including the area to be scaled does not need to be scaled; The step of performing scaling processing on the slice image including the area to be scaled includes: Obtaining a target size after scaling and an original size before scaling of the to-be-scaled image, and obtaining the number of regions of the to-be-scaled region; For each of the to-be-scaled regions, a scaling size of the slice image including the to-be-scaled region is determined according to the target size, the original size, and the number of regions, and scaling processing is performed on the slice image including the to-be-scaled region according to the scaling size.

2. The method according to claim 1, characterized in that The slicing the to-be-scaled picture based on the to-be-scaled area includes: Acquire the expansion and contraction direction of the area to be expanded and contracted, and determine a slicing direction perpendicular to the expansion and contraction direction; The to-be-scaled picture is sliced ​​based on the to-be-scaled area and the slicing direction.

3. The method according to claim 1, characterized in that The scaling process of the slice image including the area to be scaled further includes: For a current slice picture in each of the slice pictures, if the current slice picture includes the to-be-scaled area, scaling the current slice picture, splicing the current slice picture after the scaling onto a spliced ​​picture, and updating the spliced ​​picture according to the splicing result; If the current slice image does not include the to-be-scaled area, directly splicing the current slice image to the spliced ​​image, and updating the spliced ​​image according to the splicing result; The next slice image of the current slice image is updated to the current slice image, and the step of if the current slice image includes the area to be scaled is repeatedly performed until any of the current slice images is spliced, and the spliced ​​image is used as the scaled image.

4. The method according to claim 1, characterized in that: The number of slices of the sliced ​​picture is determined according to the number of regions of the to-be-scaled region.

5. The method according to claim 4, characterized in that The number of slices m is determined by the following formula: m=n*2+1, where n is the number of regions.

6. A picture expansion device, characterized in that: include: A data acquisition module, used to acquire a picture to be scaled, wherein the picture to be scaled is a picture that needs to be scaled; a module for determining a region to be scaled, configured to obtain an unscaled image that does not need to be scaled and is displayed in coordination with the image to be scaled, and determine, based on a coordination region between the image to be scaled and the unscaled image, a region to be scaled that needs to be scaled other than the coordination region on the image to be scaled, wherein the coordination region is an overlapping region between the image to be scaled and the unscaled image; A picture slicing module, used for slicing the picture to be scaled based on the area to be scaled to obtain a sliced ​​picture; A picture scaling module, configured to perform scaling processing on the sliced ​​picture including the area to be scaled, wherein the sliced ​​picture not including the area to be scaled does not need to be scaled; The image scaling module is specifically used for: Obtaining a target size after scaling and an original size before scaling of the to-be-scaled image, and obtaining the number of regions of the to-be-scaled region; For each of the to-be-scaled regions, a scaling size of the slice image including the to-be-scaled region is determined according to the target size, the original size, and the number of regions, and scaling processing is performed on the slice image including the to-be-scaled region according to the scaling size.

7. A device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the image scaling method as described in any one of claims 1-5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image scaling method as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Image processing process for regulating human face ratio

    CN101478629A