CN112001842A - Picture generation method and device, electronic equipment and computer readable storage medium - Google Patents

Picture generation method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN112001842A
CN112001842A CN202010688248.7A CN202010688248A CN112001842A CN 112001842 A CN112001842 A CN 112001842A CN 202010688248 A CN202010688248 A CN 202010688248A CN 112001842 A CN112001842 A CN 112001842A
Authority
CN
China
Prior art keywords
picture
target
size
image
original
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010688248.7A
Other languages
Chinese (zh)
Inventor
樊哲
樊京鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010688248.7A priority Critical patent/CN112001842A/en
Publication of CN112001842A publication Critical patent/CN112001842A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping

Abstract

The invention provides a picture generation method and device, electronic equipment and a computer readable storage medium, and belongs to the technical field of picture processing. In the method, one or more target size proportions are determined for at least one specified target size, for each target size proportion, a first intermediate graph conforming to the target size proportion is generated according to a picture to be processed, and a picture with the size matched with the target size is generated according to the first intermediate graph to obtain a target picture. The first intermediate graph which accords with the proportion of each target size is generated firstly, and the target picture is generated on the basis of the first intermediate graph, so that the target pictures with different target sizes can be obtained by zooming based on the first intermediate graph without performing one-time clipping operation on each target size, the number of times of performing clipping can be reduced to a certain extent, and the picture processing efficiency is improved.

Description

Picture generation method and device, electronic equipment and computer readable storage medium
Technical Field
The invention belongs to the technical field of picture processing, and particularly relates to a picture generation method and device, electronic equipment and a computer readable storage medium.
Background
In order to enrich the internet experience of the user, the resource provider often needs to generate various pictures for displaying in the internet surfing process of the user. In order to adapt to different display scenes and different display devices, a resource provider often needs to generate a plurality of pictures with different sizes for displaying the pictures of the same content.
In the prior art, when generating pictures with different sizes, a corresponding cropping operation is often performed for each target size, so as to obtain a target picture conforming to the target size. Thus, when there are multiple target sizes, the cropping operation needs to be repeatedly performed for multiple times, for example, when there are m target sizes, the cropping operation needs to be performed for m times, which results in a complicated picture processing operation and low efficiency.
Disclosure of Invention
The invention provides a picture generation method, a picture generation device, electronic equipment and a computer readable storage medium, which are used for solving the problems of more complicated picture processing operation and lower efficiency.
According to a first aspect of the present invention, there is provided a picture generation method, including:
for at least one specified target size, determining one or more target size ratios, one target size ratio corresponding to the one or more target sizes;
for each target size proportion, generating a first intermediate graph conforming to the target size proportion according to the picture to be processed; the total number of the first intermediate maps is equal to the total number of the target size ratios;
for each first intermediate image, generating an image with the size matched with the target size according to the first intermediate image to obtain a target image; the total number of the target pictures is larger than the number of the pictures to be processed.
According to a second aspect of the present invention, there is provided a picture generation apparatus, the apparatus comprising:
a determining module for determining one or more target size ratios for a specified at least one target size, one target size ratio corresponding to one or more target sizes;
the first generation module is used for generating a first intermediate graph which accords with the target size proportion according to the picture to be processed for each target size proportion; the total number of the first intermediate maps is equal to the total number of the target size ratios;
a second generation module, configured to generate, for each first intermediate image, an image with a size matching the target size according to the first intermediate image, so as to obtain a target image; the total number of the target pictures is larger than the number of the pictures to be processed.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium, having stored therein instructions, which when run on a computer, cause the computer to execute any one of the above-mentioned picture generation methods.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above-described picture generation methods.
Aiming at the prior art, the invention has the following advantages:
for at least one specified target size, determining one or more target size ratios, wherein one target size ratio corresponds to one or more target sizes, then generating a first intermediate graph conforming to the target size ratio according to the picture to be processed for each target size ratio, wherein the total number of the first intermediate graphs is equal to the total number of the target size ratios, and then generating a picture with the size matched with the target size according to the first intermediate graph to obtain a target picture; the total number of target pictures is greater than the number of pictures to be processed. Therefore, the first intermediate graph which accords with the proportion of each target size is generated firstly, and the target picture is generated on the basis of the first intermediate graph, so that the target pictures with different target sizes can be obtained by zooming based on the first intermediate graph without performing one-time clipping operation on each target size, the number of times of performing clipping can be reduced to a certain extent, and the picture processing efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart illustrating steps of a method for generating a picture according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of another method for generating a picture according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of a further method for generating a picture according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating steps of a still further method for generating pictures according to an embodiment of the present invention;
fig. 5 is a schematic diagram of generating a picture according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating another example of generating a picture according to an embodiment of the present invention;
fig. 7 is a block diagram of a picture generation apparatus according to an embodiment of the present invention;
fig. 8 is a block diagram of another picture generation apparatus provided in the embodiment of the present invention;
fig. 9 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
Fig. 1 is a flowchart of steps of a picture generation method provided in an embodiment of the present invention, which is applied to a terminal, and as shown in fig. 1, the method may include:
step 101, for at least one specified target size, determining one or more target size ratios, one target size ratio corresponding to the one or more target sizes.
In the embodiment of the present invention, the target size may be set according to actual requirements. When the target size ratio is determined, the size ratio of each target size may be determined, and then the size ratios of the target sizes corresponding to the same size ratio may be summarized as one target size ratio. For example, assume that the target dimensions include: 30 × 40, 10 × 10, 60 × 80, 100 × 100, the target sizes correspond to the size ratios: 3:4, 1:1, 3:4, 1: 1. Accordingly, the same size ratio 3:4 corresponding to the target sizes 30 × 40 and 60 × 80 may be determined as one target size ratio, and the same size ratio 1:1 corresponding to the target sizes 10 × 10 and 100 × 100 may be determined as one target size ratio, thereby obtaining two target size ratios.
102, generating a first intermediate graph according with the target size proportion according to the picture to be processed for each target size proportion; the total number of the first intermediate figures is equal to the total number of the target size ratios.
In the embodiment of the invention, the pictures to be processed can be pictures which need to be manufactured into different sizes, and the pictures to be processed can be selected according to actual requirements. Further, in an actual application scenario, since the target size is often a ratio of a mainstream display size or a ratio of a mainstream display scene belonging to the device, for example, 16:9, 1:1, 3:2, 3:4, and so on, that is, a plurality of target sizes are often attributed to several size ratios, the number of target size ratios is often not greater than the number of target sizes. Therefore, in the embodiment of the present invention, a first intermediate map meeting the target size ratio may be generated according to the to-be-processed picture, and for example, if there are 5 target size ratios, 5 first intermediate maps may be generated accordingly. In the subsequent steps, the picture does not need to be respectively cut for each target size, and the picture with the target size can be obtained only by zooming on the first intermediate graph, so that the execution times of cutting are reduced to a certain extent.
103, generating a picture with the size matched with the target size according to the first intermediate graph for each first intermediate graph to obtain a target picture; the total number of the target pictures is larger than the number of the pictures to be processed.
In the embodiment of the present invention, the terminal may adjust the size of the first middle graph by scaling the size of the first middle graph, and specifically, may scale the size of the first middle graph to a target size that meets a target size proportion of the first middle graph, thereby implementing generation of the target picture. Wherein scaling may refer to scaling down or up. Accordingly, in the embodiment of the present invention, if the size of the first intermediate map is larger than the target size, scaling the size of the first intermediate map may specifically be: and reducing the size of the first intermediate image to a target size. If the size of the first intermediate map is smaller than the target size, scaling the size of the first intermediate map may specifically be: the size of the first intermediate image is enlarged to a target size. It should be noted that, if the size of the first intermediate map is equal to the target size, the first intermediate map may be directly used as the target picture.
In summary, in the image generating method provided in the embodiment of the present invention, for at least one specified target size, one or more target size ratios are determined, where one target size ratio corresponds to one or more target sizes, then for each target size ratio, according to the to-be-processed image, a first intermediate image conforming to the target size ratio is generated, and then, according to the first intermediate image, an image with a size matching the target size is generated, so as to obtain a target image; the total number of target pictures is greater than the number of pictures to be processed. Therefore, the first intermediate graph which accords with the proportion of each target size is generated firstly, and the target picture is generated on the basis of the first intermediate graph, so that the target pictures with different target sizes can be obtained by zooming based on the first intermediate graph without performing one-time clipping operation on each target size, the number of times of performing clipping can be reduced to a certain extent, and the picture processing efficiency is improved.
Fig. 2 is a flowchart of steps of another picture generation method provided in an embodiment of the present invention, which is applied to a terminal, and as shown in fig. 2, the method may include:
step 201, sequentially executing picture information acquisition operation, picture enhancement operation, element identification operation and picture transcoding operation on an original picture to obtain the picture to be processed.
In this step, the original picture may be a basic picture provided in advance in a preset picture production process. When generating pictures with different target sizes, it is often necessary to acquire related information of an original picture, perform operations such as picture enhancement, picture transcoding, and identification of elements in the original picture on the original picture, and these processes are performed on the basis of the original picture with the same content. Therefore, in the embodiment of the present invention, operations that are repeatedly executed for different target sizes in the image processing flow may be uniformly executed on the original image: the method comprises the steps of picture information obtaining operation, picture enhancing operation, picture transcoding operation and element identification operation, and then a picture to be processed can be obtained.
The operation of obtaining the picture information is also called a picture reverse display operation. The operation may be used to obtain related information of the original picture, for example, to obtain information of the width and height of the original picture, picture quality information, original format, number of original frames of the picture, picture rotation direction, and original data amount, which may be used to guide a subsequent production strategy, that is, used in performing a subsequent operation on the picture.
The picture enhancement operation can be used for enhancing parameters such as brightness, color and definition of the original picture so as to improve the quality of the original picture, further optimize the display effect of a target picture finally generated based on the original picture when the target picture is displayed, and improve the viewing experience of a user.
The image transcoding operation may include one or more of a watermark covering operation, a watermark adding operation, and a format conversion operation, where the watermark removing operation may be used to remove a watermark from an original image to avoid an influence of the watermark on subsequent processing, and the watermark adding operation may be used to add a specified uniform watermark to the original image, where the uniform watermark refers to a watermark that needs to be added to target images of different target sizes. The format conversion operation may be used to convert the picture format of the original picture to a specified base format.
The element recognition operation is also called an intelligent recognition operation, and the operation can be used for recognizing information such as persons, objects, color distribution and the like contained in the picture.
Accordingly, this step may include: executing picture information acquisition operation on the original picture to obtain picture related information of the original picture; the picture related information at least comprises picture quality information; performing a picture enhancement operation on the original picture based on the picture quality information; and performing picture transcoding operation and element identification operation on the original picture after the picture enhancement operation is performed. In the embodiment of the invention, the picture to be processed is obtained by executing the picture information obtaining operation, the picture enhancing operation, the picture transcoding operation and the element identification operation, the quality of the picture to be processed can be improved to a certain extent, the picture to be processed is obtained by only executing the operations once on the original picture, the target pictures with different target sizes can be generated by carrying out subsequent operations on the basis of the picture to be processed, and the processing resources required by picture processing can be further reduced to a certain extent.
Specifically, when the image information obtaining operation is executed, the original image may be subjected to image analysis, and then the related information may be obtained from the analyzed image. Accordingly, the obtained related information can be cached for use in the subsequent steps.
Further, when performing a picture enhancement operation, picture quality information may be obtained from the cached information, and the picture quality information may be parameters capable of representing the current image quality of the original picture, such as the brightness, the sharpness, and the like of the picture.
Then, the current picture quality information and the original picture can be used as the input of a preset image enhancement model, and the original picture is enhanced through the preset image enhancement model.
Further, when the watermark removing operation is performed, image recognition may be performed on the enhanced picture, that is, the original picture after the picture enhancing operation is performed, to determine the watermark included in the original picture and the position of the watermark, and then the watermark at the position may be deleted. When the watermark adding operation is executed, the watermark to be added can be added at the designated position, and when the format conversion operation is executed, the original picture can be used as the input of a preset format conversion algorithm, and the original picture is converted into the designated format through the preset format conversion algorithm. When the element identification operation is performed, element detection may be performed on the original picture after the picture enhancement operation is performed by using a preset detection algorithm, and then the distribution position of each element included in the original picture in the picture is determined.
For at least one of the target sizes specified, one or more target size ratios are determined, one target size ratio corresponding to the one or more target sizes, step 202.
And 203, generating a first intermediate graph according with the target size proportion according to the picture to be processed for each target size proportion.
Step 204, for each first intermediate image, generating an image with the size matched with the target size according to the first intermediate image to obtain a target image; the total number of the target pictures is larger than the number of the pictures to be processed.
It should be noted that, for implementation of each step in the embodiment of the present invention, reference may be made to relevant descriptions in other embodiments, and details are not described here again.
According to the picture generation method provided by the embodiment of the invention, a picture to be processed is obtained by sequentially executing picture information acquisition operation, picture enhancement operation, element identification operation and picture transcoding operation on an original picture; for at least one specified target size, determining one or more target size proportions, wherein one target size proportion corresponds to one or more target sizes, then generating a first intermediate graph conforming to the target size proportion according to the picture to be processed for each target size proportion, and then generating a picture with the size matched with the target size according to the first intermediate graph to obtain a target picture; the total number of target pictures is greater than the number of pictures to be processed. In this way, by first extracting and executing operations that are repeatedly executed for different target sizes in the picture processing flow: the method comprises the steps of obtaining picture information, enhancing pictures, transcoding pictures and identifying elements, unnecessary repeated execution can be avoided to a certain extent, processing resources consumed by picture generation are reduced, meanwhile, first intermediate pictures which accord with all target size proportions are generated firstly, and target pictures are generated on the basis of the first intermediate pictures, so that cutting operation is not required to be executed once for each target size, target pictures of different target sizes can be obtained by zooming based on the first intermediate pictures, the number of times of execution of cutting can be reduced to a certain extent, and the picture processing efficiency is improved.
Fig. 3 is a flowchart of steps of another image generating method provided in an embodiment of the present invention, which is applied to a terminal, and as shown in fig. 3, the method may include:
step 301, sequentially executing picture information obtaining operation, picture enhancing operation, element identification operation and picture transcoding operation on an original picture to obtain the picture to be processed.
Step 302, for at least one specified target size, one or more target size ratios are determined, one target size ratio corresponding to the one or more target sizes.
And 303, for each target size ratio, cutting the to-be-processed picture into a picture which meets the target size ratio and has the largest size according to the original size acquired by the picture information acquisition operation and the element distribution identified by the element identification operation, so as to obtain the first intermediate picture.
In an actual application scenario, the size of a target picture that needs to be generated finally, that is, the target size is often different from the size of an original picture, that is, the size of a picture to be processed. Thus, it is often necessary to perform a cropping operation for each target size. Therefore, in this step, the to-be-processed picture can be cut into the picture with the largest size and the target size ratio, so as to obtain the first intermediate map. Therefore, in the subsequent steps, the cutting is not needed, and the target pictures with different target sizes under the target size proportion corresponding to the first intermediate picture can be obtained only by scaling the first intermediate picture according to the different target sizes under the target size proportion corresponding to the first intermediate picture, so that the cutting times are reduced to a certain extent, and the resources consumed by the cutting operation are reduced.
Specifically, in the embodiment of the present invention, the target size ratio may be determined according to the at least one target size specified in step 302, and then the clipping may be performed according to the target size ratio. Wherein each target size ratio corresponds to a clipping operation. For example, assume that 11 target sizes are included: 100 x 100, 200 x 200, 300 x 300, 300 x 200, 600 x 400, 1200 x 800, 1600 x 900, 3200 x 1800, 300 x 400, 600 x 800, 1200 x 1600. If clipping is done directly, 11 clipping operations need to be performed. In the embodiment of the present invention, 4 target size ratios can be determined according to the 11 target sizes: 1:1, 3:2, 16:9, 1: 1. Accordingly, only 4 cropping needs to be performed to obtain a first intermediate map with a scale of 1:1, a first intermediate map with a scale of 3:2, a first intermediate map with a scale of 16:9, and a first intermediate map with a scale of 3: 4. Subsequently, the first intermediate graph with the comparison ratio of 1:1 is scaled according to the target size meeting 1:1, and the size is obtained as follows: the three pictures, 100 x 100, 200 x 200, 300 x 300, were scaled according to the target size according to 3:2 by the first intermediate graph of comparative example 3:2, to obtain the dimensions: the three pictures 300 x 200, 600 x 400, 1200 x 800 were scaled according to the target size of 16:9 by the first intermediate graph of comparative example 16:9, resulting in the sizes: 1600 x 900, 3200 x 1800, scaled by the target size according to 3:4 by the first middle graph of comparative example 3:4, the size is obtained as: 300 x 400, 600 x 800, 1200 x 1600.
Further, according to the original size obtained by the picture information obtaining operation and the element distribution identified by the element identifying operation, when clipping is performed, the maximum size which can be reserved under the condition of meeting the target size proportion can be determined according to the original size, and according to the element distribution, the optimal clipping position which can cause the minimum damage to important elements under the condition of meeting the target size proportion and being reserved to the maximum size is determined. Finally, the clipping can be performed according to the maximum size and the optimal clipping position. When determining the optimal cropping position, important elements may be determined from the identified elements, for example, a person element may be determined as an important element, or an element with the largest area may be determined as an important element. Then, the damage degree of the important element at each clipping position can be determined, and the clipping position with the minimum damage degree is determined as the optimal clipping position. Wherein, the smaller the remaining area of the important element after clipping from the clipping position, the greater the destruction degree corresponding to the clipping position.
For example, assuming a target size ratio of 1:1, the size of the picture to be processed is 2150 × 2050, and the maximum size that can be retained is 2050 × 2050. Further, assuming that the important element in the to-be-processed picture is determined to be a character element, and the damage degree to the important element at different cropping positions is determined, when the position of the 100 th element on the left side is vertically cropped, the damage to the character element is the minimum, then the position of the 100 th element on the left side can be vertically cropped, and the first intermediate picture which meets the target size ratio and has the largest size is obtained.
In the embodiment of the invention, the first intermediate graph is maximized during clipping, so that when the first intermediate graph is zoomed to generate the pictures with the target sizes on the basis of the first intermediate graph, the problem of poor definition of the pictures obtained after zooming due to small size of the first intermediate graph can be avoided to the greatest extent, and the quality of the generated pictures can be further ensured to a certain extent.
Step 304, for each first intermediate image, generating an image with the size matched with the target size according to the first intermediate image to obtain a target image; the total number of the target pictures is larger than the number of the pictures to be processed.
It should be noted that, for implementation of each step in the embodiment of the present invention, reference may be made to relevant descriptions in other embodiments, and details are not described here again.
In summary, the image generating method provided in the embodiment of the present invention may first extract and execute operations that are repeatedly executed in the image processing flow for different target sizes: the method comprises the steps of obtaining picture information, enhancing pictures, transcoding pictures and identifying elements, avoiding unnecessary repeated execution to a certain extent, further reducing processing resources consumed by picture generation, simultaneously generating a first intermediate picture which accords with each target size proportion and has the largest size by first generation, and generating target pictures on the basis of the first intermediate picture, so that cutting operation is not required to be executed for each target size, the target pictures with different target sizes can be obtained by scaling based on the first intermediate picture, further reducing the execution times of cutting to a certain extent, improving the picture processing efficiency, and avoiding the problem of poor definition of the pictures obtained after scaling due to the fact that the size of the first intermediate picture is small to the greatest extent, and further ensuring the quality of the generated pictures to a certain extent.
Fig. 4 is a flowchart of steps of another image generating method provided in an embodiment of the present invention, which is applied to a terminal, and as shown in fig. 4, the method may include:
step 401, sequentially executing picture information obtaining operation, picture enhancing operation, element identification operation and picture transcoding operation on an original picture to obtain the picture to be processed.
Step 402, for at least one specified target size, determining one or more target size ratios, one target size ratio corresponding to the one or more target sizes.
Step 403, for each target size ratio, according to the original size obtained by the picture information obtaining operation and the element distribution identified by the element identification operation, cutting the picture to be processed into a picture which meets the target size ratio and has the largest size, and obtaining the first intermediate picture.
The implementation manner of each step in the embodiments of the present invention may refer to the related description in other embodiments, and is not described herein again.
And step 404, for each first intermediate graph, according to the picture related information obtained by the picture information obtaining operation, performing transcoding operation meeting the personalized transcoding requirement corresponding to the target size on the first intermediate graph to obtain a second intermediate graph.
In this step, the picture related information may include at least one of an original data size, an original format, a picture original frame number, and a picture rotation direction, and accordingly, at least one of the following operations may be performed on the first intermediate map:
operation A: and compressing the data size of the first intermediate graph to a target size according to the original data size.
Specifically, when the data size of the first intermediate map is compressed to the target size according to the original data size, the difference between the original data size and the target size may be determined first, and then the compression mode may be selected according to the difference. Finally, the first intermediate graph can be compressed based on the compression mode.
And operation B: adding a target watermark to the first intermediate map.
Further, when adding the target watermark to the first intermediate map, the watermark to be added, which is set in advance for the target size ratio corresponding to the first intermediate map, may be obtained first, and then the watermark to be added is added to the preset position. Wherein, one target size ratio may correspond to a plurality of watermarks to be added, and for example, it is assumed that for the target size ratio: 1:1 sets 3 to-be-added watermarks, then 3 first intermediate graphs can be copied to obtain 3 first intermediate graphs, and then the 3 first intermediate graphs are respectively added with a watermark a, a watermark b and a watermark c.
And operation C: and converting the format of the first intermediate graph into a target format according to the original format.
According to the original format, when the format of the first intermediate graph is converted into the target format, a format conversion mode can be selected according to the original format and the target format, and finally, the format of the first intermediate graph is converted based on the format conversion mode. The target format can be various formats such as jpg, png, gif, webp, bpg and the like.
Operation D: and adjusting the frame number of the first intermediate image to be a target frame number according to the original frame number of the image.
When the frame number of the first intermediate map is adjusted to the target frame number according to the original frame number of the picture, a difference between the original frame number of the picture and the target frame number may be determined, and then frame extraction or frame addition may be performed on the first intermediate map according to the difference, so that the frame number of the first intermediate map reaches the target frame number.
Operation E: and adjusting the direction of the first intermediate map to be a target direction according to the picture rotation direction.
When the direction of the first intermediate map is adjusted to the target direction according to the picture rotation direction, a rotation mode may be determined according to the picture rotation direction and the target direction, and then the picture may be rotated according to the rotation mode so that the direction of the first intermediate map is changed to the target direction.
The target size, the target watermark, the target format, the target frame number and the target direction all meet the individual transcoding requirements, different individual transcoding requirements can be determined according to requirements, and the individual transcoding requirements corresponding to different target sizes may be different. For example, the target direction may be rotated by 90 ° when generating a target picture of a target size 100 × 100, and may be rotated by 270 ° when generating a target picture of a target size 300 × 300.
Further, these operations may be performed in an overlapping manner, that is, after one operation is performed, the next operation is performed continuously on the operation performing result, for example, the watermarking may be performed first, the intermediate map a is produced, format conversion is performed on the basis of the intermediate map a, the intermediate map b conforming to the target format is produced, and then scaling is performed on the basis of these b through subsequent steps. Of course, the operations described above may also be executed independently, and the embodiment of the present invention is not limited thereto. In this way, the transcoding operation meeting the personalized transcoding requirement corresponding to the target size can be executed on the first intermediate by executing the operations.
And 405, scaling the size of the second intermediate image to the target size to obtain the target image.
It should be noted that, since the second intermediate map obtained in the embodiment of the present invention is a picture which meets the target size scale and has the largest size, in this case, the operation of scaling the size of the second intermediate map to the target size may specifically be: and reducing the size of the second intermediate image to the target size. For example, assuming that the size of the second middle graph is 2050 × 2050, the second middle graph may be reduced to obtain a 100 × 100 target graph, a 200 × 200 target graph, and a 300 × 300 target graph in a 1:1 ratio.
In the embodiment of the invention, the transcoding operation meeting the personalized transcoding requirement corresponding to the target size is performed on the first intermediate image to obtain the second intermediate image, and the second intermediate image is zoomed to obtain the target image with the size meeting the requirement and the image effect meeting the requirement, so that the image effect of the target image can be improved.
It should be noted that, in the embodiment of the present invention, the terminal may cache the pictures or information obtained after each operation is performed, so as to facilitate use in the subsequent step. Further, the terminal can also send the finally obtained target picture to a preset server, and accordingly, the server can store the received target picture so as to facilitate display of other equipment. The server may be a Content Delivery Network (CDN) server.
Furthermore, in the embodiment of the present invention, each step is executed by a terminal, so that data transmission among the steps is transmitted among each component inside the terminal, and thus, the cost of network IO can be saved to a certain extent. Of course, each step in the image generation method provided in the embodiment of the present invention may also be performed in the cloud, that is, executed by the server. Accordingly, each step may be implemented by one cloud service call, and the picture generation method is implemented by multiple service calls, which is not limited in the embodiment of the present invention.
In summary, the image generating method provided in the embodiment of the present invention may first extract and execute operations that are repeatedly executed in the image processing flow for different target sizes: the method comprises the steps of obtaining picture information, enhancing pictures, transcoding pictures and identifying elements, avoiding unnecessary repeated execution to a certain extent, further reducing processing resources consumed by picture generation, simultaneously generating a first intermediate picture which accords with each target size proportion and has the largest size by first generation, and generating target pictures on the basis of the first intermediate picture, so that cutting operation is not required to be executed for each target size, the target pictures with different target sizes can be obtained by scaling based on the first intermediate picture, further reducing the execution times of cutting to a certain extent, improving the picture processing efficiency, and avoiding the problem of poor definition of the pictures obtained after scaling due to the fact that the size of the first intermediate picture is small to the greatest extent, and further ensuring the quality of the generated pictures to a certain extent.
Fig. 5 is a schematic diagram of generating a picture according to a specific example provided in an embodiment of the present invention, and as shown in fig. 5, the embodiment of the present invention may implement picture production by performing the following operations:
operation 1, performing image reverse display, image enhancement, intelligent identification and transcoding operation on an original image in sequence to obtain a first intermediate image with a ratio of 16:9, a first intermediate image with a ratio of 3:2, a first intermediate image with a ratio of 3:4, a first intermediate image with a ratio of 1:1 and a first intermediate image with a ratio of 4:3 respectively.
And 2, performing batch transcoding on each first intermediate graph to obtain the operation graphs of each size in each proportion.
The batch transcoding is the transcoding operation that meets the requirement of personalized transcoding and the operation of scaling the picture size to the target size in the above embodiments. The operation graph of each size under each proportion is a target picture of different target sizes under the target size proportion.
And operation 3, distributing the operation graphs of all sizes under all proportions.
Specifically, the operation diagram may be sent to a server, and accordingly, the server may store the received operation diagram to facilitate the acquisition and display of other devices. When the operation diagrams are transmitted to the servers, all the operation diagrams may be transmitted to each server, or the operation diagrams at each ratio may be transmitted to the servers corresponding to the ratio.
For example, fig. 6 shows another schematic diagram of picture generation, as shown in fig. 6, when an operation diagram with a size of 1080 × 608 is generated, it is necessary to perform one-pass operations of picture reverse rendering, picture enhancement, intelligent recognition and transcoding on an original picture, and when an operation diagram of 600 × 600 is generated, it is also necessary to perform one-pass operations of picture reverse rendering, picture enhancement, intelligent recognition and transcoding on an original picture. That is, when generating a plurality of target sizes, the process flow needs to be executed a plurality of times. It should be noted that the production transcoding and the bulk transcoding in fig. 5 may be equivalent to the transcoding in fig. 6, and the production transcoding and the bulk transcoding may be performed by calling two services.
In the embodiment of the invention, when the operation graphs of different proportions and sizes are generated, only one time of picture reverse display, picture enhancement, intelligent identification and transcoding manufacture is needed, and then batch transcoding is carried out on the obtained first intermediate graphs of the proportions, so that the operation graphs of the sizes, namely the target pictures, can be obtained. Therefore, when the pictures with various target sizes are generated, the required resource consumption can be reduced to a certain extent through multiplexing part of operations, and the generation efficiency is further improved.
Fig. 7 is a block diagram of a picture generating apparatus according to an embodiment of the present invention, where the apparatus may be as shown in fig. 7, and the apparatus 70 may include:
a determining module 701, configured to determine, for at least one specified target size, one or more target size ratios, where one target size ratio corresponds to one or more target sizes;
a first generating module 702, configured to generate, for each target size ratio, a first intermediate map that meets the target size ratio according to the to-be-processed picture; the total number of the first intermediate maps is equal to the total number of the target size ratios;
a second generating module 703, configured to generate, for each first intermediate image, an image with a size matching the target size according to the first intermediate image, so as to obtain a target image; the total number of the target pictures is larger than the number of the pictures to be processed
Optionally, fig. 8 is a block diagram of another image generating apparatus according to an embodiment of the present invention, and as shown in fig. 8, the apparatus 70 further includes:
and the processing module 704 is configured to sequentially perform a picture information obtaining operation, a picture enhancing operation, an element identifying operation, and a picture transcoding operation on the original picture to obtain the picture to be processed. The processing module 704 may specifically include an obtaining processing sub-module, an enhancing processing sub-module, an identifying processing sub-module, and a transcoding processing sub-module, so as to sequentially execute an image information obtaining operation, an image enhancing operation, an element identifying operation, and an image transcoding operation on an original image, thereby obtaining an operation of the image to be processed.
Optionally, the first generating module 702 is specifically configured to:
and cutting the picture to be processed into a picture which meets the target size proportion and has the largest size according to the original size acquired by the picture information acquisition operation and the element distribution identified by the element identification operation to obtain the first intermediate picture.
Optionally, the second generating module 703 is specifically configured to:
according to the picture related information acquired by the picture information acquisition operation, performing transcoding operation meeting the personalized transcoding requirement corresponding to the target size on the first intermediate graph to obtain a second intermediate graph;
and scaling the size of the second intermediate image into the target size to obtain the target image.
Optionally, the picture related information includes at least one of an original data size, an original format, an original frame number of the picture, and a picture rotation direction;
the second generating module 703 is further specifically configured to:
performing at least one of the following operations on the first intermediate graph:
compressing the data size of the first intermediate graph to a target size according to the original data size;
adding a target watermark to the first intermediate map;
converting the format of the first intermediate graph into a target format according to the original format;
adjusting the frame number of the first intermediate image to a target frame number according to the original frame number of the image;
adjusting the direction of the first intermediate image to be a target direction according to the image rotation direction;
and the target size, the target watermark, the target format, the target frame number and the target direction all meet the personalized transcoding requirement.
Optionally, the processing module 704 is specifically configured to:
executing picture information acquisition operation on the original picture to obtain picture related information of the original picture; the picture related information at least comprises picture quality information;
performing a picture enhancement operation on the original picture based on the picture quality information;
performing a picture transcoding operation and an element identification operation on the original picture after the picture enhancement operation is performed; the image transcoding operation comprises one or more of a watermarking covering operation, a watermarking adding operation and a format conversion operation.
In summary, in the image generating apparatus provided in the embodiment of the present invention, for at least one specified target size, one or more target size ratios are determined, where one target size ratio corresponds to one or more target sizes, then for each target size ratio, according to the image to be processed, a first intermediate map conforming to the target size ratio is generated, and then, according to the first intermediate map, an image with a size matching the target size is generated, so as to obtain a target image; the total number of target pictures is greater than the number of pictures to be processed. Therefore, the first intermediate graph which accords with the proportion of each target size is generated firstly, and the target picture is generated on the basis of the first intermediate graph, so that the target pictures with different target sizes can be obtained by zooming based on the first intermediate graph without performing one-time clipping operation on each target size, the number of times of performing clipping can be reduced to a certain extent, and the picture processing efficiency is improved.
For the above device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiment of the present invention further provides an electronic device, as shown in fig. 9, which includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904.
A memory 903 for storing computer programs;
the processor 901 is configured to implement the following steps when executing the program stored in the memory 903:
for at least one specified target size, determining one or more target size ratios, one target size ratio corresponding to the one or more target sizes;
for each target size proportion, generating a first intermediate graph conforming to the target size proportion according to the picture to be processed;
for each first intermediate image, generating an image with the size matched with the target size according to the first intermediate image to obtain a target image; the total number of the target pictures is larger than the number of the pictures to be processed.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which instructions are stored, and when the instructions are executed on a computer, the computer is enabled to execute the picture generation method in any one of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the picture generation method as described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (14)

1. A picture generation method, characterized in that the method comprises:
for at least one specified target size, determining one or more target size ratios, one target size ratio corresponding to the one or more target sizes;
for each target size proportion, generating a first intermediate graph conforming to the target size proportion according to the picture to be processed; the total number of the first intermediate maps is equal to the total number of the target size ratios;
for each first intermediate image, generating an image with the size matched with the target size according to the first intermediate image to obtain a target image; the total number of the target pictures is larger than the number of the pictures to be processed.
2. The method according to claim 1, wherein before generating the first intermediate map conforming to the target size ratio from the picture to be processed for each of the target size ratios, the method further comprises:
and sequentially executing picture information acquisition operation, picture enhancement operation, element identification operation and picture transcoding operation on the original picture to obtain the picture to be processed.
3. The method according to claim 2, wherein the generating a first intermediate map conforming to the target size ratio according to the picture to be processed comprises:
and cutting the picture to be processed into a picture which meets the target size proportion and has the largest size according to the original size acquired by the picture information acquisition operation and the element distribution identified by the element identification operation to obtain the first intermediate picture.
4. The method according to claim 2 or 3, wherein the generating a picture with a size matching the target size according to the first intermediate map to obtain a target picture comprises:
according to the picture related information acquired by the picture information acquisition operation, performing transcoding operation meeting the personalized transcoding requirement corresponding to the target size on the first intermediate graph to obtain a second intermediate graph;
and scaling the size of the second intermediate image into the target size to obtain the target image.
5. The method of claim 4, wherein the picture related information comprises at least one of an original data amount, an original format, a picture original frame number, and a picture rotation direction;
the transcoding operation of the first intermediate graph, which meets the personalized transcoding requirement corresponding to the target size, is executed according to the picture related information acquired by the picture information acquisition operation, and includes:
performing at least one of the following operations on the first intermediate graph:
compressing the data size of the first intermediate graph to a target size according to the original data size;
adding a target watermark to the first intermediate map;
converting the format of the first intermediate graph into a target format according to the original format;
adjusting the frame number of the first intermediate image to a target frame number according to the original frame number of the image;
adjusting the direction of the first intermediate image to be a target direction according to the image rotation direction;
and the target size, the target watermark, the target format, the target frame number and the target direction all meet the personalized transcoding requirement.
6. The method of claim 2, wherein the sequentially performing a picture information obtaining operation, a picture enhancing operation, an element identifying operation, and a picture transcoding operation on the original picture to obtain the picture to be processed comprises:
executing picture information acquisition operation on the original picture to obtain picture related information of the original picture; the picture related information at least comprises picture quality information;
performing a picture enhancement operation on the original picture based on the picture quality information;
performing a picture transcoding operation and an element identification operation on the original picture after the picture enhancement operation is performed; the image transcoding operation comprises one or more of a watermarking covering operation, a watermarking adding operation and a format conversion operation.
7. A picture generation apparatus, characterized in that the apparatus comprises:
a determining module for determining one or more target size ratios for a specified at least one target size, one target size ratio corresponding to one or more target sizes;
the first generation module is used for generating a first intermediate graph which accords with the target size proportion according to the picture to be processed for each target size proportion; the total number of the first intermediate maps is equal to the total number of the target size ratios;
a second generation module, configured to generate, for each first intermediate image, an image with a size matching the target size according to the first intermediate image, so as to obtain a target image; the total number of the target pictures is larger than the number of the pictures to be processed.
8. The apparatus of claim 7, further comprising:
and the processing module is used for sequentially executing image information acquisition operation, image enhancement operation, element identification operation and image transcoding operation on the original image to obtain the image to be processed.
9. The apparatus of claim 8, wherein the first generating module is specifically configured to:
and cutting the picture to be processed into a picture which meets the target size proportion and has the largest size according to the original size acquired by the picture information acquisition operation and the element distribution identified by the element identification operation to obtain the first intermediate picture.
10. The apparatus according to claim 8 or 9, wherein the second generating module is specifically configured to:
according to the picture related information acquired by the picture information acquisition operation, performing transcoding operation meeting the personalized transcoding requirement corresponding to the target size on the first intermediate graph to obtain a second intermediate graph;
and scaling the size of the second intermediate image into the target size to obtain the target image.
11. The apparatus of claim 10, wherein the picture related information comprises at least one of an original data amount, an original format, a picture original frame number, and a picture rotation direction;
the second generating module is further specifically configured to:
performing at least one of the following operations on the first intermediate graph:
compressing the data size of the first intermediate graph to a target size according to the original data size;
adding a target watermark to the first intermediate map;
converting the format of the first intermediate graph into a target format according to the original format;
adjusting the frame number of the first intermediate image to a target frame number according to the original frame number of the image;
adjusting the direction of the first intermediate image to be a target direction according to the image rotation direction;
and the target size, the target watermark, the target format, the target frame number and the target direction all meet the personalized transcoding requirement.
12. The apparatus of claim 8, wherein the processing module is specifically configured to:
executing picture information acquisition operation on the original picture to obtain picture related information of the original picture; the picture related information at least comprises picture quality information;
performing a picture enhancement operation on the original picture based on the picture quality information;
performing a picture transcoding operation and an element identification operation on the original picture after the picture enhancement operation is performed; the image transcoding operation comprises one or more of a watermarking covering operation, a watermarking adding operation and a format conversion operation.
13. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202010688248.7A 2020-07-16 2020-07-16 Picture generation method and device, electronic equipment and computer readable storage medium Pending CN112001842A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010688248.7A CN112001842A (en) 2020-07-16 2020-07-16 Picture generation method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010688248.7A CN112001842A (en) 2020-07-16 2020-07-16 Picture generation method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN112001842A true CN112001842A (en) 2020-11-27

Family

ID=73467463

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010688248.7A Pending CN112001842A (en) 2020-07-16 2020-07-16 Picture generation method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112001842A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024037402A1 (en) * 2022-08-18 2024-02-22 华为技术有限公司 Image acquisition method and electronic device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103903221A (en) * 2012-12-24 2014-07-02 腾讯科技(深圳)有限公司 Image generation method, image generation device and image generation system
CN106157239A (en) * 2015-04-22 2016-11-23 阿里巴巴集团控股有限公司 A kind of image processing method and relevant device and system
CN108986032A (en) * 2018-07-18 2018-12-11 天津璧合信息技术有限公司 A kind of advertising pictures processing method and processing device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103903221A (en) * 2012-12-24 2014-07-02 腾讯科技(深圳)有限公司 Image generation method, image generation device and image generation system
CN106157239A (en) * 2015-04-22 2016-11-23 阿里巴巴集团控股有限公司 A kind of image processing method and relevant device and system
CN108986032A (en) * 2018-07-18 2018-12-11 天津璧合信息技术有限公司 A kind of advertising pictures processing method and processing device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024037402A1 (en) * 2022-08-18 2024-02-22 华为技术有限公司 Image acquisition method and electronic device

Similar Documents

Publication Publication Date Title
CN109784181B (en) Picture watermark identification method, device, equipment and computer readable storage medium
CN110392306B (en) Data processing method and equipment
CN110071938B (en) Virtual image interaction method and device, electronic equipment and readable storage medium
CN106202086B (en) Picture processing and obtaining method, device and system
CN111681291A (en) Image processing method, device, equipment and computer readable storage medium
CN110297927B (en) Article publishing method, device, equipment and storage medium
CN110765799B (en) Client code scanning identification method, device, equipment and storage medium
CN109272526B (en) Image processing method and system and electronic equipment
JP2024502117A (en) Image processing method, image generation method, device, equipment and medium
CN112001842A (en) Picture generation method and device, electronic equipment and computer readable storage medium
CN109710783B (en) Picture loading method and device, storage medium and server
CN110572713B (en) Transcoding method and processing terminal for adaptive video bandwidth ratio
CN112183294A (en) Text elimination method and device, electronic equipment and storage medium
CN109522429B (en) Method and apparatus for generating information
CN112445394A (en) Screenshot method and device
CN114390307A (en) Image quality enhancement method, device, terminal and readable storage medium
CN110807300A (en) Image processing method and device, electronic equipment and medium
CN108810537B (en) Picture transcoding method and device and image processing equipment
CN112565819B (en) Video data processing method and device, electronic equipment and storage medium
CN112559111B (en) Screen capturing method and device for sharing desktop
CN109819318B (en) Image processing method, live broadcast method, device, computer equipment and storage medium
CN111079624B (en) Sample information acquisition method and device, electronic equipment and medium
CN116955873B (en) Method for rapidly displaying massive dynamic planar vector data on browser
CN114092334A (en) Image processing method, device and equipment
WO2023193648A1 (en) Image processing method and apparatus, electronic device, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination