CN112073730B - Method, device and equipment for packing atlas and storage medium - Google Patents

Method, device and equipment for packing atlas and storage medium Download PDF

Info

Publication number
CN112073730B
CN112073730B CN202010917150.4A CN202010917150A CN112073730B CN 112073730 B CN112073730 B CN 112073730B CN 202010917150 A CN202010917150 A CN 202010917150A CN 112073730 B CN112073730 B CN 112073730B
Authority
CN
China
Prior art keywords
atlas
packing
current search
area
packaging
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.)
Active
Application number
CN202010917150.4A
Other languages
Chinese (zh)
Other versions
CN112073730A (en
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 ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network 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 ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010917150.4A priority Critical patent/CN112073730B/en
Publication of CN112073730A publication Critical patent/CN112073730A/en
Application granted granted Critical
Publication of CN112073730B publication Critical patent/CN112073730B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/423Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements
    • H04N19/426Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements using memory downsizing methods
    • H04N19/428Recompression, e.g. by spatial or temporal decimation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/177Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a group of pictures [GOP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Packaging Of Special Articles (AREA)

Abstract

The present disclosure provides an atlas packaging method, apparatus, device and storage medium, which relate to the technical field of image storage, and the method includes: executing an atlas packing algorithm aiming at the atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed; determining a target packing area based on an initial packing area corresponding to the initial atlas packing result, wherein the target packing area is not larger than the initial packing area; executing an atlas packing algorithm for the atlas to be packed based on the target packing area; and determining the atlas packing result output by the atlas packing algorithm successfully executed as the final atlas packing result of the atlas to be packed. The method and the device can effectively reduce the occupied storage space of the atlas packing result.

Description

Method, device and equipment for packing atlas and storage medium
Technical Field
The present disclosure relates to the field of image storage technologies, and in particular, to an album packing method, apparatus, device, and storage medium.
Background
The atlas refers to a set of a certain number of pictures, and the atlas packaging refers to packaging and storing the atlas.
At present, the packing of an atlas is realized by executing an atlas packing algorithm once for the atlas to be packed to obtain an atlas packing result. However, since the smaller the storage space occupied by the atlas packaging result is, the smaller the memory occupied by applying the atlas packaging result to the terminal is, so how to obtain the atlas packaging result occupying a smaller storage space for the same atlas is a technical problem that needs to be solved at present.
Disclosure of Invention
To solve the above technical problem or at least partially solve the above technical problem, the present disclosure provides an album packing method, apparatus, device, and storage medium.
The present disclosure provides an atlas packaging method, the method comprising: executing an atlas packing algorithm aiming at an atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed; determining a target packing area based on an initial packing area corresponding to the initial atlas packing result; the target packing area is not greater than the initial packing area; executing the atlas packing algorithm for the atlas to be packed based on the target packing area; and determining the successfully executed atlas packing result output by the atlas packing algorithm as a final atlas packing result of the atlas to be packed.
Optionally, the determining a target packing area based on an initial packing area corresponding to the initial atlas packing result includes: and determining the initial packing area corresponding to the initial atlas packing result as a target packing area.
Optionally, before executing the atlas packing algorithm for the atlas to be packed based on the target packing area, the method further includes: determining the direction of the long edge in the initial atlas packing result as the current searching direction; determining the length of the long edge as a current search upper limit value, and determining a value obtained by squaring the sum of the areas of all the pictures in the to-be-packaged atlas as a current search lower limit value; correspondingly, the executing the atlas packaging algorithm for the atlas to be packaged based on the target packaging area includes: executing the atlas packing algorithm for the atlas to be packed based on the current search value, the current search direction and the target packing area; wherein the current search value is a value between the current search upper limit value and the current search lower limit value; if the atlas packaging algorithm fails to be executed, the current search value is updated to the current search lower limit value, the step of executing the atlas packaging algorithm aiming at the atlas to be packaged based on the current search value, the current search direction and the target packaging area is continuously executed until the current search lower limit value is determined to be not smaller than the current search upper limit value, and the atlas packaging result with the atlas area smaller than the target packaging area does not exist in the current search direction.
Optionally, after the performing the atlas packing algorithm for the atlas to be packed based on the current search value, the current search direction, and the target packing area, the method includes: if the atlas packaging algorithm is successfully executed, updating the target packaging area by utilizing the area of the atlas packaging result output by the successfully executed atlas packaging algorithm, updating the current search value to the current search upper limit value, continuing to execute the step of executing the atlas packaging algorithm aiming at the atlas to be packaged based on the current search value, the current search direction and the target packaging area until determining that the atlas packaging result of which the atlas area is smaller than the current target packaging area does not exist in the current search direction.
Optionally, before determining the atlas packing result output by the atlas packing algorithm that is successfully executed as the final atlas packing result of the atlas to be packed, the method further includes: changing the current search direction, updating the current search lower limit value in the current search direction to 0, updating the current search upper limit value to the length of the long edge corresponding to the current search direction in the current atlas packing result, and updating the target packing area based on the current atlas packing result; the executing the atlas packaging algorithm for the atlas to be packaged based on the target packaging area comprises: and executing the atlas packing algorithm aiming at the atlas to be packed based on the target packing area in the changed current searching direction.
Optionally, the determining, as a final atlas packing result of the atlas to be packed, an atlas packing result output by the atlas packing algorithm that is successfully executed includes: and determining an atlas packing result output by the atlas packing algorithm successfully executed in the changed current searching direction as a final atlas packing result of the atlas to be packed.
Optionally, before executing an atlas packing algorithm on the atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed, the method further includes: and cutting transparent pixels around each picture in the picture set to be packaged.
Optionally, before cutting the transparent pixels around each picture in the to-be-packaged atlas, the method further includes: and setting the transparent interval between two adjacent pictures in the picture set to be packaged as the pixels with the preset number.
Optionally, after cutting the transparent pixels around each picture in the to-be-packaged atlas, the method further includes: and sequencing all the images in the image set to be packaged according to a preset sequencing rule.
The present disclosure provides an album packing apparatus, the apparatus including: the first packing module is used for executing an atlas packing algorithm aiming at an atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed; the area determining module is used for determining a target packing area based on an initial packing area corresponding to the initial atlas packing result; the target packing area is not greater than the initial packing area; the second packing module is used for executing the atlas packing algorithm aiming at the atlas to be packed based on the target packing area; and the packing result determining module is used for determining the successfully executed atlas packing result output by the atlas packing algorithm as the final atlas packing result of the atlas to be packed.
The present disclosure provides a computer-readable storage medium having instructions stored therein, which when run on a terminal device, cause the terminal device to implement an atlas packaging method.
The present disclosure provides an apparatus comprising: the system comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein when the processor executes the computer program, the atlas packaging method is realized.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
the embodiment of the disclosure provides an atlas packaging method, an atlas packaging device and a storage medium, wherein the method comprises the following steps: firstly, executing an atlas packing algorithm aiming at an atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed; then determining a target packing area which is not larger than the initial packing area based on the initial packing area corresponding to the initial atlas packing result; and finally, executing the atlas packing algorithm aiming at the atlas to be packed again based on the target packing area so as to determine the atlas packing result output by the atlas packing algorithm which is successfully executed as the final atlas packing result of the atlas to be packed. The embodiment of the disclosure executes the atlas packing algorithm again on the basis of determining the target packing area which is not larger than the initial packing area, and because the container corresponding to the target packing area obtained when the atlas packing algorithm is successfully executed can store the atlas to be packed, and the atlas packing algorithm is executed at least twice on the atlas to be packed, through comparing the executing processes of the atlas packing algorithm at least twice, the atlas packing result which occupies a smaller storage space can be accurately determined as the final atlas packing result, and further the storage space occupied by the atlas packing result is effectively reduced.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a flowchart of an atlas handling method according to an embodiment of the present disclosure;
FIG. 2 is a diagram illustrating an atlas packing result according to an embodiment of the disclosure;
FIG. 3 is a diagram illustrating a result of a failure to execute an atlas packing algorithm in accordance with an embodiment of the present disclosure;
FIG. 4 is a flowchart of another method for packaging an atlas according to an embodiment of the disclosure;
FIG. 5 is a flowchart of another method for packaging an atlas according to an embodiment of the disclosure;
FIG. 6 is a diagram of an original picture without cropping according to an embodiment of the present disclosure;
FIG. 7 is a diagram illustrating a non-cropped result picture according to an embodiment of the present disclosure;
FIG. 8 is a diagram illustrating a cropped result picture according to an embodiment of the present disclosure;
fig. 9 is a block diagram of an atlas packaging apparatus according to an embodiment of the present disclosure;
fig. 10 is a block diagram illustrating an album packing apparatus according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
Atlas packing belongs to the two-dimensional rectangle packing problem in the field of combinatorial optimization, and the two-dimensional rectangle packing problem refers to that a set of rectangles is given, and a minimum number of containers (each container is the same in size) are found so as to put all the rectangles in. The main algorithm for solving the problem is an online (online) algorithm and an offline (offline) algorithm. The length and width of a rectangle put next in the rectangle array are not known in advance by the online algorithm, and the length and width of all rectangles in the rectangle array are known by the offline algorithm, so that the packing space utilization rate is higher than that of the online algorithm during combination optimization.
There are various existing atlas packing Algorithms, such as Guillotine deformation Algorithms like Guillotine Algorithms (decapitated algorithm), Guillotine Best Area Fit (decapitated Best Area Fit) Algorithms, etc., MaxRects (maximum rectangles) Algorithms of texturepack (picture resource packer), etc.; however, when these algorithms select a container placement rectangle, there are multiple strategies to determine a final placement position, which may result in fragmentation of the remaining space, and it is difficult to utilize as much of the remaining space as possible, so that it is difficult to obtain an optimal atlas packing result with a smaller storage space. Taking Guillotine Algorithms as an example, the idea of the algorithm is that when a rectangle is placed in a container, there will be two ways of dividing the remaining space into smaller containers, namely, transverse and longitudinal. And the Guillotine Algorithms keeps a set F for recording the rectangles of the residual space, firstly judges whether the rectangles are placed in the set F in a traversing way, if so, uses the existing Guillotine split strategy to generate two small containers and adds the small containers into the set F, and if not, reopens one large container and adds the large container into the set F. It can be seen that when there are multiple containers that can be placed in a rectangle, there are multiple strategies for determining the final placement position, which can lead to fragmentation of the remaining space.
In view of the above problems of the existing atlas packing algorithm, the embodiment of the present disclosure provides an informationized sticker atlas. In contrast to the scene defined by the atlas packaging algorithm, the informative sticker atlas may be understood as a collection of rectangles that need to be placed in a container that does not exceed 2048 by 2048. This requires that the container size be initially limited to 2048 x 2048, otherwise even dropping all rectangles would result in an excessively large free atlas. Therefore, an algorithm capable of searching out an optimal packing space is needed, and more residual space is utilized as much as possible to obtain an atlas packing result with smaller occupied storage space.
Based on this, the embodiments of the present disclosure provide an album packing method, apparatus, device and storage medium, which may be applied to various fields requiring album packing, such as image recognition and picture decoding, and for understanding, the embodiments of the present disclosure are described in detail below.
The first embodiment is as follows:
the disclosed embodiments provide an atlas packaging method, which may be implemented, for example, on an electronic device such as a smartphone, a tablet, a computer, a camera, and the like.
Referring to the flowchart of the atlas packaging method shown in fig. 1, the method may include the following steps:
and S102, executing an atlas packing algorithm aiming at the atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed.
Wherein the atlas packing algorithm is such as: a shelf algorithm, a Guillootine Best Area Fit (Guillootine Best Area Fit, heuristic cut-off table) algorithm, a MAXECTS-CP (maximum rectangular Contact Point) algorithm, etc. Referring to FIG. 2, an atlas to be packed (R) comprising five pictures is shown for the atlas to be packed (R)1,R2,...,Rn) Wherein R isi=(wi,hi) Indicates that one width and one height of the graph set are wi、hiBy taking the MAXECTS-CP algorithm as an example, the atlas (R) is to be packed1,R2,...,Rn) Executing the MAXECTS-CP algorithm, each time the picture R is to be processediPicture R placed in contact container and previously placedi-1Based on the position with the longest contact surface length, when all the images in the to-be-packaged atlas are placed into the container, obtaining an initial atlas packaging result corresponding to the to-be-packaged atlas; the atlas packing result may indicate an arrangement and combination manner of the pictures in the atlas in the container, and the storage space occupied by the pictures is different under different atlas packing results.
Step S104, determining a target packing area based on an initial packing area corresponding to the initial atlas packing result; wherein the target packing area is not greater than the initial packing area. The determination of the target packing area may be made as follows: and determining the initial packing area corresponding to the initial atlas packing result, namely the storage space occupied by the picture corresponding to the initial atlas packing result in the container, as the target packing area. Or, based on the initial atlas packing result, executing the atlas packing algorithm again at least once on the atlas to be packed, and determining a packing area corresponding to a new atlas packing result obtained by executing the atlas packing algorithm each time as a target packing area.
And S106, executing an atlas packing algorithm aiming at the atlas to be packed based on the target packing area.
After the current atlas packing algorithm is executed and the target packing area is obtained, the atlas packing algorithm is executed again for the atlas to be packed. For example, when the target packing area is a packing area directly corresponding to the initial atlas packing result, the atlas packing algorithm may be executed again for the atlas to be packed after the initial atlas packing result is obtained.
And step S108, determining the atlas packaging result output by the successfully executed atlas packaging algorithm as the final atlas packaging result of the atlas to be packaged.
If the atlas packing algorithm can be successfully executed, the container corresponding to the target packing area can store the atlas to be packed; on the contrary, if the execution of the atlas packing algorithm fails, it indicates that the container corresponding to the target packing area cannot store the atlas to be packed.
In the embodiment, at least two times of atlas packing algorithm are executed for the atlas to be packed, and the atlas packing algorithm executed in the next time is optimized for the atlas packing algorithm executed in the previous time; therefore, if the at least two atlas packing algorithms are successfully executed, the atlas packing result output by the atlas packing algorithm executed for the last time is represented, and is the result obtained after the packing area is optimized for multiple times, so that the atlas packing result is determined as the final atlas packing result of the atlas to be packed; if the last execution of the atlas packing algorithm fails, the atlas packing result output by the atlas packing algorithm executed last time before the execution failure (namely, the previous time before the execution failure) is the atlas packing result with the optimal packing area, and thus the atlas packing result is determined as the final atlas packing result of the atlas to be packed.
The method for packaging the atlas provided by the embodiment of the disclosure comprises the following steps: firstly, executing an atlas packing algorithm on an atlas to be packed to obtain an initial atlas packing result, and determining a target packing area; and then based on the target packing area, executing the atlas packing algorithm aiming at the atlas to be packed again so as to determine the atlas packing result output by the successfully executed atlas packing algorithm as the final atlas packing result of the atlas to be packed. In the above manner, on the basis that the target packing area is not greater than the initial packing area, further, the to-be-packed atlas can be stored in the container corresponding to the target packing area obtained when the atlas packing algorithm is successfully executed, and the atlas packing algorithm is executed at least twice on the to-be-packed atlas, so that the atlas packing result occupying a smaller storage space can be accurately determined as the final atlas packing result by comparing the execution processes of the at least twice atlas packing algorithms, and the storage space occupied by the atlas packing result is effectively reduced.
Before performing step S106, the present embodiment may first determine current search parameters based on the initial atlas packaging result, where the current search parameters may include: the current search direction, the current search upper limit value, the current search lower limit value and the current target packing area. The determination process of the current search parameter is as follows:
determining the direction of the long edge in the initial atlas packing result as the current searching direction; and determining the length of the long edge as the current search upper limit value, and determining the value obtained by squaring the sum of the areas of all the pictures in the to-be-packaged atlas as the current search lower limit value.
Wherein, the current search direction refers to a horizontal or vertical search direction. In practical application, because the atlas packing algorithm is executed for the first time with respect to the atlas to be packed, the current search direction is unknown when the atlas packing algorithm is executed for the second time, and in this case, the direction in which the long side in the initial atlas packing result is located can be determined as the current search direction. As shown in FIG. 2, for the initial atlas packing result P corresponding to the first-time atlas packing algorithm executed when i is 11It can be seen that the initial atlas packing result P1The direction of the middle long side is the transverse direction, so that the current searching direction is determined to be the transverse searching direction. The current search upper limit value is a maximum search value along the current search direction, and for example, the length of the long side may be determined as the current search upper limit value; the current search lower limit value is the minimum search value along the current search direction, for example, a value obtained by squaring the sum of the areas of the pictures in the to-be-packed atlas
Figure BDA0002665413790000091
The current search lower limit value is determined.
The target packing area corresponding to the initial atlas packing result can be understood as: referring to fig. 2, the area of the rectangle frame determined by the long side (i.e., the maximum width value) and the maximum height value in the initial atlas packing result indicates the target packing area, where the background is a thick line rectangle filled with dots.
And the method is used for optimizing the initial atlas packing result, and the optimization mode can refer to the subsequent steps.
Accordingly, according to the above current search parameters, based on the target packing area, executing the atlas packing algorithm for the atlas to be packed may include the following steps (1) - (3):
(1) and executing an atlas packing algorithm aiming at the atlas to be packed based on the current search value, the current search direction and the target packing area. The current search value is a value between a current search upper limit value and the current search lower limit value; in order to improve the search efficiency, the present embodiment may determine the current search value by using a two-half search method, that is, the current search value seekCurrent is one half of the sum of the current search upper limit value seekUpper and the current search lower limit value seekLower: seekCurrent (seekLower + seekUpper)/2.
In this embodiment, in the process of executing the atlas packing algorithm on the atlas to be packed based on the current search parameter, the atlas packing algorithm may be executed at least once for the atlas to be packed, and at least one new atlas packing result in the current search direction is correspondingly obtained, so as to determine whether an atlas packing result whose atlas area is smaller than the target packing area exists in the current search direction.
If the atlas packing algorithm fails to be executed for the atlas to be packed, the following step (2) is executed, and if the atlas packing algorithm is successfully executed for the atlas to be packed, the following step (3) is executed.
(2) And (3) if the execution of the atlas packaging algorithm fails, updating the current search value to the current search lower limit value, and continuing to execute the step (1) until the current search lower limit value is determined to be not smaller than the current search upper limit value, and determining that the atlas packaging result with the atlas area smaller than the target packaging area does not exist in the current search direction.
The failure of executing the atlas packing algorithm indicates that all pictures in the atlas to be packed cannot be successfully stored in the container determined based on the current search value, for example, when the scene shown in fig. 3 is the failure of executing the atlas packing algorithm, the picture 4 in the atlas to be packed cannot be stored in the container. Therefore, the space of the container needs to be enlarged to store the atlas to be packaged, and the way of enlarging the space of the container can be easily understood as follows: and taking the current search value as the minimum search value in the current search direction, and searching for a better atlas packing result in a range determined by the current search value and the current search upper limit value.
Further, the current search lower limit value seekLower is updated(i+1)For the current search value seekCurrent(i)Then, continuing to execute the step (1); where i represents the order in which the atlas packing algorithm is performed. If the execution is successful, the atlas packing result of which the atlas area is smaller than the current target packing area exists in the current searching direction can be determined. And if the execution fails, updating the current search upper limit value or the current search lower limit value and continuing to execute the step (1). And repeating the steps until the execution is successful or the repeated execution is failed until the current searching lower limit value is determined to be not smaller than the current searching upper limit value, wherein the searching space indicates that the current searching lower limit value is overlapped with the current searching upper limit value and is no longer possible, and thus the situation that the atlas packing result with the atlas area smaller than the current target packing area does not exist in the current searching direction is determined.
(3) And (3) if the atlas packaging algorithm is successfully executed, updating the target packaging area by utilizing the area of the atlas packaging result output by the successfully executed atlas packaging algorithm, updating the current search value to the current search upper limit value, and continuing to execute the step (1) until the atlas packaging result of which the atlas area is smaller than the current target packaging area does not exist in the current search direction.
The atlas packing algorithm can perform successfully, indicating that the container determined based on the current search value can hold the atlas to be packed. It can be understood that the container determined based on the current search lower limit value is a square container in an ideal state, in which the to-be-packaged atlas is just stored and no free storage space exists between the pictures, and a certain storage space also exists between the current search value and the current search lower limit value, so that the target packaging area can be updated by using the area of the atlas packaging result output by the successfully-executed atlas packaging algorithm, and the atlas packaging algorithm is continuously executed until the final atlas packaging result of the to-be-packaged atlas is determined when the atlas packaging result whose atlas area is smaller than the current target packaging area does not exist in the current search direction.
According to the step of determining the result of the atlas packaging, the embodiment provides an atlas packaging method as shown in fig. 4, which includes the following steps:
and S402, executing an atlas packing algorithm aiming at the atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed.
Step S404, determining the current search parameter based on the initial atlas packing result.
Step S406, based on the current search direction, the current search upper limit value, the current search lower limit value and the current target packing area in the current search parameters, executing an atlas packing algorithm for the atlas to be packed to determine whether an atlas packing result with an atlas area smaller than the current target packing area exists in the current search direction.
Step S408, if the execution of the atlas packing algorithm is successful, determining that the atlas packing result with the atlas area smaller than the current target packing area exists in the current searching direction, and then determining the atlas packing result with the smallest atlas area for the atlas to be packed in the current searching direction.
In this embodiment, step (d) may be performed by repeatedly performing steps (a) to (c) below until it is determined that the current search lower limit value is not less than the current search upper limit value: and determining the atlas packing result output by the atlas packing algorithm which is successfully executed for the last time in the current searching direction as the atlas packing result with the smallest atlas area for the atlas to be packed in the current searching direction.
(a) And executing an atlas packing algorithm aiming at the atlas to be packed based on the current search value, the current search direction and the current target packing area. Wherein, the current search value can be expressed as seekCurrent(i)=(seekLower(i)+seekUpper(i)) And/2, reference is made to step (1) in the above embodiments, and detailed description is omitted here.
(b) And if the atlas packing algorithm is successfully executed, obtaining an atlas packing result, updating the current target packing area by using the atlas packing result, and determining the current search value as the current search upper limit value.
Packing the current ith (i is more than or equal to 1) execution atlasWhen the algorithm is successful, the atlas packing result P can be obtainediIt may also be determined that there is an atlas packing result in the current search direction with an atlas area that is smaller than the current target packing area. So that the current search value seekCurrent can be used(i)As the maximum search value in the current search direction, the search value between it and the current search lower limit value seekLower(i)Searching for a better atlas package result in the determined range. Based on this, if the ith atlas packing algorithm is successfully executed, the result P is packed by the atlasiUpdating the current search parameter S of the (i + 1) th execution atlas packing algorithmi+1And then returning to the step (a), namely, continuing to execute the step of executing the atlas packing algorithm for the (i + 1) th time of the atlas to be packed based on the current search value, the current search direction and the current target packing area.
Wherein the current search parameter S for executing the atlas packing algorithm for the (i + 1) th timei+1The updating method comprises the following steps: obtaining an atlas packing result P according to the ith execution atlas packing algorithmiThe current target packing area A is calculated by the maximum width value and the maximum height value ini+1(ii) a Executing the search value seekCurrent of the atlas packing algorithm for the ith time(i)Is determined as the current search parameter Si+1The current search upper limit value seekUpper in (1)(i+1)(ii) a The current search lower limit value seekLower(i+1)Determined as the search lower limit value seekLower of the ith time(i)The same; the current search direction Di+1Determining the search direction D corresponding to the ith timeiThe same; and, according to the current search upper limit value seekUpper(i+1)And the current search lower limit value seekLower(i+1)Determining the current search value seekCurrent(i+1)
(c) And if the execution of the atlas packing algorithm fails, determining the current search value as the current search lower limit value.
When the ith (i is more than or equal to 1) execution of the atlas packing algorithm fails, the current search value seekCurrent can be used(i)As the minimum search value in the current search direction, the search value between it and the current search upper limit value seekUpper(i)Searching for a better atlas package result in the determined range. Based on this, if the ith atlasIf the packing algorithm fails to execute, updating the current search parameter S of the (i + 1) th execution atlas packing algorithmi+1And then returning to the step (a), namely, continuing to execute the steps of determining a current search value based on the current search upper limit value and the current search lower limit value, and executing the atlas packing algorithm for the (i + 1) th time of the atlas to be packed based on the current search value, the current search direction and the current target packing area.
Wherein the current search parameter S for executing the atlas packing algorithm for the (i + 1) th timei+1The updating method comprises the following steps: executing the search value seekCurrent of the atlas packing algorithm for the ith time(i)Is determined as the current search parameter Si+1Current search lower limit value seekLower in (1)(i+1)(ii) a Searching the current upper limit value seekUpper(i+1)Determined as the search upper limit value seekUpper of the ith time(i)The same; the current search direction Di+1Determining the search direction D corresponding to the ith timeiThe same; and, according to the current search upper limit value seekUpper(i+1)And the current search lower limit value seekLower(i+1)Determining the current search value seekCurrent(i+1)(ii) a Obtaining the packing result of the last successfully executed atlas (such as P) before the ith execution of the packing algorithm of the atlasi-1) Packing the result P according to the atlasi-1The current target packing area A is calculated by the maximum width value and the maximum height value ini+1
Stopping by repeatedly performing the above steps (a) to (c) until it is determined that the current search lower limit value is not less than the current search upper limit value. It can be understood that the process of repeatedly performing the above steps (a) to (c) is a process of continuously adjusting the search lower limit value and the search upper limit value to search for a better album packing result; when the condition that the current search lower limit value is not less than the current search upper limit value is reached, the condition indicates that a better atlas packaging result cannot be searched any more through the adjustment of the upper limit value and the lower limit value, and therefore, the following step (d) can be executed.
(d) And determining the atlas packing result obtained by successfully executing the atlas packing algorithm for the last time in the current searching direction as the atlas packing result with the smallest atlas area for the atlas to be packed in the current searching direction.
And step S410, determining the atlas packing result output by the atlas packing algorithm which is successfully executed for the last time in the current searching direction as the final atlas packing result corresponding to the atlas to be packed.
According to the method for packing the atlas, the packing algorithm of the atlas is repeatedly executed, and in the process of repeated execution, the current search parameters (mainly the current search upper limit value and the current search lower limit value) are continuously adjusted, so that the packing result of the atlas is optimized; therefore, the atlas packing result with the smallest atlas area in the current searching direction can be obtained, and the storage space occupied by the atlas packing result is effectively reduced.
On the basis of the atlas packing method provided by the foregoing embodiment, it is considered that if the search direction is changed, there may further exist a more optimal atlas packing result in the changed search direction; based on this, in order to avoid missing a possible atlas packaging result and further reduce the storage space occupied by the atlas packaging result, this embodiment may further provide a method for determining the atlas packaging result, where the implementation step of the method may be performed after step S408 and before step S410 of the foregoing embodiment, and includes:
changing the current searching direction, and updating current searching parameters such as a current searching lower limit value, a current searching upper limit value, a current target packing area and the like in the changed current searching direction; and then, in the changed current searching direction, executing an atlas packing algorithm aiming at the atlas to be packed based on the target packing area, and determining an atlas packing result output by the atlas packing algorithm successfully executed in the changed current searching direction as a final atlas packing result of the atlas to be packed.
According to the above step of determining the result of packing an album after changing the current search direction, the present embodiment provides an album packing method as shown in fig. 5, including the following steps:
step S402, executing an atlas packing algorithm aiming at the atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed.
Step S404, determining current search parameters based on the initial atlas packing result, wherein the current search parameters comprise a current search direction, a current search upper limit value, a current search lower limit value and a current target packing area, and the current search parameters are used for optimizing the initial atlas packing result.
Step S406, based on the current search direction, the current search value and the current target packing area in the current search parameter, executing an atlas packing algorithm for the atlas to be packed to determine whether an atlas packing result with an atlas area smaller than the current target packing area exists in the current search direction. If the execution of the atlas packaging algorithm is successful, it can be determined that an atlas packaging result with an atlas area smaller than the current target packaging area exists in the current search direction.
Step S408, after determining that the atlas packing result with the atlas area smaller than the current target packing area exists in the current searching direction, determining the atlas packing result with the smallest atlas area for the atlas to be packed in the current searching direction.
Step S409, updating the current search parameter by changing the search direction, and continuing to execute step S406 based on the updated current search parameter until it is determined that there is no album packing result with an album area smaller than the current target packing area in the changed current search direction, executing step S410 as follows.
For the convenience of understanding step S409, a specific embodiment may be given here. With respect to step S408, the result P of packing the atlas is the smallest atlas area determined at the time of executing the atlas packing algorithm the ith timeiAnd the corresponding current search direction is the horizontal search direction
Figure BDA0002665413790000151
For example; meanwhile, after changing the search direction, i is updated to j to represent the order in which the atlas packing algorithm is performed for the sake of distinction. On this basis, the following two ways are provided to describe the implementation process of step S409 in the present embodiment according to the first change search direction and the non-first change search direction.
(Mode)Firstly, the method comprises the following steps: when the search direction is changed for the first time, updating the current search parameter S of the jth execution atlas packing algorithmjThe method comprises the following steps:
altering a current search parameter SjIs detected. Specifically, when the ith execution of the atlas packing algorithm, the current search direction is horizontal
Figure BDA0002665413790000161
Then, the changed current search direction is determined as
Figure BDA0002665413790000162
The search direction in the j-th execution of the atlas packing algorithm is shown as the vertical search direction.
Altering a current search parameter SjThe current target packing area in (1). Packing the results P based on the current atlasiUpdating the target packing area, specifically, obtaining an atlas packing result P obtained by executing the atlas packing algorithm for the ith timeiTarget packing area a in (1)iDetermined as the current search parameter SjCurrent target packing area a in (1)j
Altering a current search parameter SjIs currently searched for the lower limit value. Specifically, if the search direction is changed for the first time, the current search direction is changed to
Figure BDA0002665413790000163
And the current search parameter SjCurrent search lower limit value seekLower in (1)(j)Is updated to 0.
Altering a current search parameter SjIs currently searched for the upper limit value. Specifically, if the search direction is changed for the first time, the current search parameter S is setjThe current search upper limit value seekUpper in (1)(j)Updating into the current atlas packing result PiCurrent search direction in
Figure BDA0002665413790000164
The length of the corresponding long side, as shown in fig. 2.
The second method comprises the following steps: when the search direction is not changed for the first timeThat is, when the (j + 1) th and later execution of the atlas packaging algorithm, the current search parameter S of the (j + 1) th execution of the atlas packaging algorithm is updatedj+1In the above embodiment, the searching direction can be referred to
Figure BDA0002665413790000165
The updating mode of the corresponding current search upper and lower limit values under the condition comprises the following steps:
if the j (i is more than or equal to 1) th execution of the atlas packing algorithm is successful, packing the result P according to the atlasjThe current target packing area A is calculated by the maximum width value and the maximum height value inj+1(ii) a Searching the j search value seekCurrent(j)Determined as the current search upper limit value seekUpper(j+1)(ii) a Searching the current lower limit value seekLower(j+1)Determined as the lower limit value seekLower of the j-th search(j)The same; the current search direction Dj+1Updating to the j-th search direction DjIn contrast, for example, the current search direction when the graph set packing algorithm is executed the jth time is vertical
Figure BDA0002665413790000171
The current search direction when the (j + 1) th album packing algorithm is performed is changed to the landscape
Figure BDA0002665413790000172
If the jth (i is more than or equal to 1) execution of the atlas packing algorithm fails, the current search value seekCurrent of the jth execution of the atlas packing algorithm is used(j)Is determined as the current search parameter Sj+1Current search lower limit value seekLower in (1)(j+1)(ii) a Searching the current upper limit value seekUpper(j+1)Determined as the j-th search upper limit value seekUpper(j)The same; the current search direction Dj+1Updating to the j-th search direction DjThe reverse is true.
In the above first and second modes, the current search value may be an average value of the current search upper limit value and the current search lower limit value.
After the current search parameter is updated according to the first and second manners, step S406 is continuously executed based on the updated current search parameter, that is, in the changed current search direction, based on the current target packing area, an atlas packing algorithm is executed for the atlas to be packed, so as to determine whether an atlas packing result whose atlas area is smaller than the current target packing area exists in the current search direction. If so, repeating the steps S406 to S409 by changing the search direction until determining that no atlas packing result with the atlas area smaller than the current target packing area exists in the changed current search direction.
It can be understood that the process of repeatedly performing the steps S406 to S409 is a double adjustment process of continuously adjusting the search direction and continuously adjusting the search lower limit value and the search upper limit value of each search direction, and the double adjustment process can search a better atlas packing result; when the condition that there is no atlas packing result with the atlas area smaller than the current target packing area in the changed current search direction is reached, it indicates that a better atlas packing result cannot be searched any more by the double adjustment of the search direction and the upper and lower limit values, and thus, the following step S410 may be performed.
And step S410, determining the atlas packaging result output by the atlas packaging algorithm successfully executed in the changed current searching direction as the final atlas packaging result of the atlas to be packaged. In the process of executing the atlas packing algorithm for multiple times, the target packing area corresponding to the atlas packing result output after double adjustment of the search direction and the upper and lower limit values is the smallest packing area, so that the atlas packing result output by the atlas packing algorithm which is successfully executed for the last time is determined as the optimal atlas packing result of the atlas to be packed.
According to the method for packing the atlas, the packing algorithm of the atlas is repeatedly executed by changing the search direction, and in the process of repeated execution, the packing result of the atlas is optimized by continuously adjusting the current search parameters (mainly the current search upper limit value and the current search lower limit value) corresponding to the search direction and the current search direction; therefore, the atlas packing result with the smallest atlas area in different search directions can be obtained, and the storage space occupied by the atlas packing result is further reduced.
In addition, considering that transparent pixels are generally arranged around the non-frame type pictures, in this embodiment, before the step of executing an atlas packing algorithm for the atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed, transparent pixels around each picture in the atlas to be packed may be cut in advance.
Referring to fig. 6, there are shown 9 original pictures input without cropping, and the picture size is 298 × 472; the 9 original pictures were not cropped, and the resulting non-cropped picture is a 894 × 1416 picture as shown in fig. 7. If each picture is cut in the above manner, the resulting cut picture is a 388 × 451 picture as shown in fig. 8. Obviously, by clipping, the size of the atlas to be packed can be significantly reduced.
However, due to the precision problem, when each picture in the album is clipped, the edge of the adjacent picture is usually clipped, so that pixel defects occasionally appear on the edge of the drawn picture. In order to improve the problem of pixel defects of the pictures, in this embodiment, the transparent interval between two adjacent pictures in the to-be-packaged atlas may be set as a preset number (for example, 2) of pixels, and then the transparent pixels around each picture in the to-be-packaged atlas are cut based on the preset number of pixels. The method can avoid the problem of poor picture effect caused by clipping precision.
In practical application, the packing of the picture set can be realized on line, and the length and the width of the picture put into a container next in the picture set to be packed are uncertain; and the packing of the atlas can also be realized under the line, wherein the under the line refers to the length and width of all pictures in the known atlas to be packed. Therefore, in the process of realizing the packing of the atlas under the line, because the sizes of the pictures are known, if the pictures can be sequenced according to a certain rule, the packing effect of the atlas is favorably improved. Based on this, after cropping the transparent pixels around each picture in the to-be-packed atlas, this embodiment may further include: and sequencing the images in the image set to be packaged according to a preset sequencing rule.
The preset ordering rule is determined based on picture parameters such as: the picture area, the picture perimeter, the picture maximum edge length, the picture width, the picture height and the picture original sequence number; the original serial number of the picture can be the acquisition time of the picture, the serial number of the picture, and the like. For ease of understanding, an example of a preset sort rule is given here:
arranging the pictures in the picture set to be packed front and back according to the sequence of the areas of the pictures from large to small; if the areas of the pictures are the same, arranging the pictures in a front-back manner according to the descending order of the perimeters of the pictures; if the perimeters of the pictures are the same, sequencing the pictures according to the sequence that the maximum side length of the pictures is from large to small; if the maximum edge lengths of the pictures are the same, sequencing the pictures according to the sequence of the picture widths from large to small; if the widths of the pictures are the same, sequencing the pictures according to the sequence of the heights of the pictures from large to small; and if the heights of the pictures are the same, sequencing the pictures according to the sequence of the original sequence numbers of the pictures from large to small.
In summary, the method for packaging an album provided in the above embodiment can improve the efficiency of packaging an album by sorting the pictures in the album to be packaged; the method comprises the steps of performing packaging on an atlas to be packaged at least twice after updating search parameters, and realizing optimization of an atlas packaging result by adjusting search upper and lower limit values and/or a search direction in the process of repeatedly performing an atlas packaging algorithm; meanwhile, the storage space occupied by the atlas packing result can be effectively reduced by combining the previous picture clipping process.
The second embodiment:
the present embodiment provides an album packing apparatus, configured to implement the album packing method provided in the first embodiment, with reference to fig. 9, the apparatus includes:
a first packing module 902, configured to execute an atlas packing algorithm for the atlas to be packed, to obtain an initial atlas packing result corresponding to the atlas to be packed;
an area determining module 904, configured to determine a target packing area based on an initial packing area corresponding to the initial atlas packing result; the target packing area is not larger than the initial packing area;
a second packing module 906, configured to execute an atlas packing algorithm for the atlas to be packed based on the target packing area;
and a packing result determining module 908, configured to determine an atlas packing result output by the successfully executed atlas packing algorithm as a final atlas packing result of the atlas to be packed.
For a brief description, reference may be made to the corresponding contents in the first embodiment of the method for a part of the present embodiment that is not mentioned.
The atlas packaging apparatus provided by the embodiment of the present disclosure: firstly, executing an atlas packing algorithm aiming at an atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed; then determining a target packing area based on an initial packing area corresponding to the initial atlas packing result; the target packing area is not larger than the initial packing area; and finally, executing the atlas packing algorithm aiming at the atlas to be packed again based on the target packing area so as to determine the atlas packing result output by the successfully executed atlas packing algorithm as the final atlas packing result of the atlas to be packed. The embodiment of the disclosure executes the atlas packing algorithm again on the basis of determining the target packing area which is not larger than the initial packing area, because the container corresponding to the target packing area obtained when the atlas packing algorithm is successfully executed can store the atlas to be packed, and the atlas packing algorithm is executed at least twice on the atlas to be packed, thereby, by comparing the executing processes of the atlas packing algorithms at least twice, the atlas packing result which occupies a smaller storage space can be accurately determined as the final atlas packing result, and further, the storage space occupied by the atlas packing result is effectively reduced.
In an embodiment, the area determination module 904 is further configured to: and determining the initial packing area corresponding to the initial atlas packing result as the target packing area.
In an embodiment, the above-mentioned atlas packaging apparatus further includes a parameter determining module (not shown in the figure) configured to: determining the direction of the long edge in the initial atlas packing result as the current searching direction; determining the length of the long edge as a current search upper limit value, and determining a value obtained by squaring the sum of the areas of all pictures in the to-be-packaged atlas as a current search lower limit value; correspondingly, the second packing module 906 is further configured to: executing an atlas packing algorithm for the atlas to be packed based on the current search value, the current search direction and the target packing area; the current search value is a value between a current search upper limit value and a current search lower limit value; if the execution of the atlas packing algorithm fails, the current search value is updated to the current search lower limit value, the step of executing the atlas packing algorithm aiming at the atlas to be packed based on the current search value, the current search direction and the target packing area is continuously executed until the current search lower limit value is determined to be not smaller than the current search upper limit value, and the atlas packing result of which the atlas area is smaller than the target packing area does not exist in the current search direction.
In an embodiment, the second packing module 906 is further configured to: if the atlas packaging algorithm is successfully executed, updating the target packaging area by utilizing the area of the atlas packaging result output by the successfully executed atlas packaging algorithm, updating the current search value to the current search upper limit value, continuously executing the step of executing the atlas packaging algorithm aiming at the atlas to be packaged based on the current search value, the current search direction and the target packaging area until the atlas packaging result of which the atlas area is smaller than the current target packaging area does not exist in the current search direction.
In an embodiment, the second packing module 906 is further configured to: changing the current searching direction, updating the current searching lower limit value in the current searching direction to be 0, updating the current searching upper limit value to be the length of the long edge corresponding to the current searching direction in the current atlas packing result, and updating the target packing area based on the current atlas packing result; and executing an atlas packing algorithm for the atlas to be packed based on the target packing area in the changed current search direction.
In an embodiment, the packing result determination module 908 is further configured to: and determining the atlas packing result output by the atlas packing algorithm successfully executed in the changed current searching direction as the final atlas packing result of the atlas to be packed.
In one embodiment, the album packing apparatus further includes a cropping module (not shown in the figure) for: and cutting transparent pixels around each picture in the atlas to be packaged.
In one embodiment, the cropping module is further configured to: and setting the transparent interval between two adjacent pictures in the picture set to be packaged as the pixels with the preset number.
In one embodiment, the cropping module is further configured to: and sequencing the images in the image set to be packaged according to a preset sequencing rule.
Based on the foregoing embodiment, this embodiment provides a computer-readable storage medium, where instructions are stored, and when the instructions are executed on a terminal device, the terminal device is enabled to implement the above atlas packaging method.
This embodiment also provides an apparatus, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for packing an album when executing the computer program, and referring to fig. 10, the apparatus for packing an album may include:
a processor 1001, a memory 1002, an input device 1003 and an output device 1004. The number of processors 1001 in the album packaging apparatus may be one or more, and one processor is exemplified in fig. 10. In some embodiments of the present invention, the processor 1001, the memory 1002, the input device 1003 and the output device 1004 may be connected through a bus or other means, wherein the bus connection is taken as an example in fig. 10.
The memory 1002 may be used to store software programs and modules, and the processor 1001 executes various functional applications and data processing of the album packaging apparatus by operating the software programs and modules stored in the memory 1002. The memory 1002 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like. Further, the memory 1002 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. The input device 1003 may be used to receive entered numeric or character information and generate signal inputs relating to user settings and function controls of the album packaging apparatus.
Specifically, in this embodiment, the processor 1001 loads an executable file corresponding to one or more processes of an application program into the memory 1002 according to the following instructions, and the processor 1001 runs the application program stored in the memory 1002, thereby implementing various functions of the above-described album packaging apparatus.
It is noted that, in this document, 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.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (12)

1. A method for packing an atlas, the method comprising:
executing an atlas packing algorithm aiming at an atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed;
determining a target packing area based on an initial packing area corresponding to the initial atlas packing result; the target packing area is not greater than the initial packing area;
executing the atlas packing algorithm for the atlas to be packed based on the target packing area;
determining an atlas packing result output by the atlas packing algorithm which is successfully executed as a final atlas packing result of the atlas to be packed;
wherein the executing the atlas packaging algorithm for the atlas to be packaged based on the target packaging area comprises:
executing the atlas packing algorithm for the atlas to be packed based on the current search value, the current search direction and the target packing area; the current search value is a value between a current search upper limit value and a current search lower limit value;
if the execution of the atlas packaging algorithm fails, updating the current search value to the current search lower limit value, continuing to execute the step of executing the atlas packaging algorithm aiming at the atlas to be packaged based on the current search value, the current search direction and the target packaging area until the atlas packaging result that the atlas area is smaller than the target packaging area does not exist in the current search direction when the current search lower limit value is determined to be not smaller than the current search upper limit value.
2. The method of claim 1, wherein determining the target packing area based on the initial packing area corresponding to the initial atlas packing result comprises:
and determining the initial packing area corresponding to the initial atlas packing result as a target packing area.
3. The method of claim 2, wherein before performing the atlas packing algorithm for the atlas to be packed based on the target packing area, further comprising:
determining the direction of the long edge in the initial atlas packing result as the current searching direction;
and determining the length of the long edge as a current search upper limit value, and determining a value obtained by squaring the sum of the areas of all the pictures in the to-be-packaged atlas as a current search lower limit value.
4. The method of claim 3, wherein after performing the atlas packing algorithm for the atlas to be packed based on the current search value, the current search direction, and the target packing area, comprises:
if the atlas packaging algorithm is successfully executed, updating the target packaging area by utilizing the area of the atlas packaging result output by the successfully executed atlas packaging algorithm, updating the current search value to the current search upper limit value, continuing to execute the step of executing the atlas packaging algorithm aiming at the atlas to be packaged based on the current search value, the current search direction and the target packaging area until determining that the atlas packaging result of which the atlas area is smaller than the current target packaging area does not exist in the current search direction.
5. The method of claim 3, wherein before determining the atlas packaging result output by the atlas packaging algorithm successfully executed as the final atlas packaging result of the atlas to be packaged, the method further comprises:
changing the current search direction, updating the current search lower limit value in the current search direction to 0, updating the current search upper limit value to the length of the long edge corresponding to the current search direction in the current atlas packing result, and updating the target packing area based on the current atlas packing result;
the executing the atlas packing algorithm for the atlas to be packed based on the target packing area comprises:
and executing the atlas packing algorithm aiming at the atlas to be packed based on the target packing area in the changed current searching direction.
6. The method of claim 5, wherein determining the atlas packaging result output by the atlas packaging algorithm successfully executed as a final atlas packaging result of the atlas to be packaged comprises:
and determining an atlas packing result output by the atlas packing algorithm successfully executed in the changed current searching direction as a final atlas packing result of the atlas to be packed.
7. The method of claim 1, wherein before the performing the atlas packing algorithm on the atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed, the method further comprises:
and cutting transparent pixels around each picture in the atlas to be packaged.
8. The method of claim 7, wherein before cropping the transparent pixels around the pictures in the album to be packed, the method further comprises:
and setting the transparent interval between two adjacent pictures in the picture set to be packaged as the pixels with the preset number.
9. The method of claim 8, wherein after cropping the transparent pixels around the pictures in the album to be packed, the method further comprises:
and sequencing all the images in the image set to be packaged according to a preset sequencing rule.
10. An album packaging apparatus, comprising:
the first packing module is used for executing an atlas packing algorithm aiming at an atlas to be packed to obtain an initial atlas packing result corresponding to the atlas to be packed;
the area determining module is used for determining a target packing area based on an initial packing area corresponding to the initial atlas packing result; the target packing area is not greater than the initial packing area;
the second packing module is used for executing the atlas packing algorithm aiming at the atlas to be packed based on the target packing area;
the packaging result determining module is used for determining an atlas packaging result output by the atlas packaging algorithm which is successfully executed as a final atlas packaging result of the atlas to be packaged;
wherein the second packing module is further configured to:
executing the atlas packing algorithm for the atlas to be packed based on the current search value, the current search direction and the target packing area; the current search value is a value between a current search upper limit value and a current search lower limit value;
if the execution of the atlas packaging algorithm fails, updating the current search value to the current search lower limit value, continuing to execute the step of executing the atlas packaging algorithm aiming at the atlas to be packaged based on the current search value, the current search direction and the target packaging area until the atlas packaging result that the atlas area is smaller than the target packaging area does not exist in the current search direction when the current search lower limit value is determined to be not smaller than the current search upper limit value.
11. A computer-readable storage medium having stored therein instructions which, when run on a terminal device, cause the terminal device to implement the method of any one of claims 1-9.
12. An album packaging apparatus comprising: memory, a processor, and a computer program stored on the memory and executable on the processor, when executing the computer program, implementing the method of any of claims 1-9.
CN202010917150.4A 2020-09-03 2020-09-03 Method, device and equipment for packing atlas and storage medium Active CN112073730B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010917150.4A CN112073730B (en) 2020-09-03 2020-09-03 Method, device and equipment for packing atlas and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010917150.4A CN112073730B (en) 2020-09-03 2020-09-03 Method, device and equipment for packing atlas and storage medium

Publications (2)

Publication Number Publication Date
CN112073730A CN112073730A (en) 2020-12-11
CN112073730B true CN112073730B (en) 2022-06-24

Family

ID=73666426

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010917150.4A Active CN112073730B (en) 2020-09-03 2020-09-03 Method, device and equipment for packing atlas and storage medium

Country Status (1)

Country Link
CN (1) CN112073730B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113408657B (en) * 2021-07-14 2024-01-30 福建天晴在线互动科技有限公司 Method and system for dynamic planning and merging of game atlas

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140376616A1 (en) * 2013-06-25 2014-12-25 Vixs Systems Inc. Quantization parameter adjustment based on sum of variance and estimated picture encoding cost
CN107204024A (en) * 2016-03-16 2017-09-26 腾讯科技(深圳)有限公司 Handle the method and device of sequence of pictures frame
CN111553847A (en) * 2020-05-15 2020-08-18 网易(杭州)网络有限公司 Image processing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140376616A1 (en) * 2013-06-25 2014-12-25 Vixs Systems Inc. Quantization parameter adjustment based on sum of variance and estimated picture encoding cost
CN107204024A (en) * 2016-03-16 2017-09-26 腾讯科技(深圳)有限公司 Handle the method and device of sequence of pictures frame
CN111553847A (en) * 2020-05-15 2020-08-18 网易(杭州)网络有限公司 Image processing method and device

Also Published As

Publication number Publication date
CN112073730A (en) 2020-12-11

Similar Documents

Publication Publication Date Title
US5450536A (en) Technique for automatically resizing tables
US9983760B2 (en) Apparatus, method and computer readable recording medium for arranging a plurality of items automatically in a canvas
CN109493281A (en) Image processing method, device, electronic equipment and computer readable storage medium
CN109389659B (en) Rendering method and device of mathematical formula in PPT, storage medium and terminal equipment
CN108492342B (en) Method, device, processor, storage medium and terminal for merging broken graphs
CN112073730B (en) Method, device and equipment for packing atlas and storage medium
CN110308835B (en) Method and device for controlling view control and electronic equipment
CN111369599B (en) Image matching method, device, apparatus and storage medium
CN109063085B (en) Thumbnail generation method and device
EP3882821A1 (en) Apparatus and method for processing detection boxes
US9767583B2 (en) Method and device for packing multiple images
CN113052928A (en) Image processing method and image processing system
US10115031B1 (en) Detecting rectangular page and content boundaries from smartphone video stream
CN110059563B (en) Text processing method and device
CN105447839A (en) Rectangular frame merging method and system
CN112580638A (en) Text detection method and device, storage medium and electronic equipment
CN113688798A (en) Ultrahigh-definition image-based identification method and device
CN112991375A (en) Method and system for reshaping arbitrary-shaped image area into N rectangular areas
US10217036B2 (en) Printing apparatus, printing method, and medium
CN112488051A (en) Cargo loading state judgment method and device, storage medium and terminal
CN111368822B (en) Method, device, equipment and storage medium for cutting express delivery face list area in image
CN116643975B (en) Method, system and related equipment for testing output stability of picture generation module
JP2014158071A (en) Image layout device
US10747558B2 (en) Dynamic splitting algorithm for splitting a desktop screen into non-overlapping equal-size blocks
US20230177640A1 (en) Padding method, apparatus, system and computer readable 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
GR01 Patent grant
GR01 Patent grant