Image processing method and device, equipment and storage medium
By acquiring image configuration information and generating and verifying images based on this, the problem of low image generation efficiency in game design is solved, and an automated and intelligent image generation process is realized.
Patent Information
- Application Number
- CN202510155299.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-06-03
AI Technical Summary
In game design, image generation depends on the designer's personal experience, resulting in low image generation efficiency and repeated checksum debugging is required to obtain the desired image.
By obtaining image configuration information, including a generation policy and a verification policy, an initial image is generated based on the generation policy, and the generation policy is verified based on the verification policy until the verification is passed.
The initial image can be automatically generated without relying on the personal experience of the designer and automatically checked, reducing manual participation and significantly improving image generation efficiency.
Smart Images

Figure CN120079104A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to an image processing method, apparatus, device, and storage medium. Background Art
[0002] Currently, in the field of game design, images used to represent game levels can be obtained by grafting different elements together. As the number of game levels increases, generally, the game difficulty also gradually increases. Therefore, the images corresponding to the game levels will become more complex and diverse.
[0003] In practical applications, it is usually the designers who rely on personal experience to create the corresponding images. However, this method requires a high level of working ability from the designers. If there are mistakes in the designers' work, it will take multiple rounds of verification and debugging during the image generation process to obtain the desired image. But the efficiency of manual verification is relatively low. Therefore, the image generation efficiency is not high. Summary of the Invention
[0004] Embodiments of this application provide an image processing method, apparatus, device, and storage medium to improve the image generation efficiency.
[0005] In a first aspect, embodiments of this application provide an image processing method, including:
[0006] Obtain image configuration information, where the image configuration information includes a generation strategy and a verification strategy for a target image, and the generation strategy is used to meet the verification strategy;
[0007] Generate an initial image based on the generation strategy;
[0008] Verify the generation strategy based on the verification strategy and the initial image to obtain a verification result;
[0009] In the case where the verification result indicates that the generation strategy passes the verification, use the initial image as the target image.
[0010] Optionally, the generation strategy is used to indicate that the target image includes multiple layers, the number of first elements under each layer included in the multiple layers, the colors of multiple second elements, the number of second elements corresponding to different colors, the colors of multiple third elements, and the number of third elements corresponding to different colors. The multiple second elements and the multiple third elements are respectively located among the multiple first elements, the number of the multiple second elements and the multiple third elements is equal, and the multiple third elements are used to fill the multiple second elements one by one;
[0011] The generating the initial image based on the generation strategy includes:
[0012] For the first layer among the multiple layers, starting from the second element in the first first element under the first layer, traverse and use the third elements belonging to the first color among the multiple third elements to fill the second element until all the third elements belonging to the first color are filled into the second element;
[0013] Continue to use the third elements belonging to the second color among the multiple third elements to fill into the second element until all the multiple second elements are filled with third elements, and a first initial image is obtained.
[0014] Optionally, for the target third element among the multiple third elements, after obtaining the first initial image, the method further includes:
[0015] According to the first bounding polygon corresponding to the target third element and the second bounding polygon corresponding to the target first element where the target third element is located, use the separating axis algorithm to determine whether the target third element satisfies the intersection condition, where the intersection condition is used to represent the intersection between the first bounding polygon and the second bounding polygon;
[0016] When the target third element satisfies the intersection condition, determine any third element with a color different from that of the target third element in the first element in the layer above the layer where the target first element is located as the candidate third element corresponding to the target third element;
[0017] Exchange the positions of the candidate third element corresponding to the target third element and the target third element until all the third elements that satisfy the intersection condition among the multiple third elements are exchanged with the candidate third elements corresponding to the third elements that satisfy the intersection condition, and a second initial image is obtained.
[0018] Optionally, the method further includes:
[0019] Determine the quantities corresponding to the third elements of different colors under each layer;
[0020] Based on the quantities corresponding to the third elements of different colors under each layer, allocate fourth elements of the same color to the third elements of the same color in each layer, and each fourth element among the multiple fourth elements is used to be filled with a preset quantity of third elements of the same color when allowed;
[0021] Based on the arrangement order of the colors of the multiple third elements in the multiple layers, arrange the multiple fourth elements to obtain a third initial image.
[0022] Optionally, the verification policy includes the difficulty coefficients corresponding to the multiple third elements respectively, and the first difficulty coefficient and the second difficulty coefficient corresponding to the multiple fourth elements;
[0023] Verifying the generation policy based on the verification policy and the initial image to obtain a verification result, including:
[0024] Determining the difficulty weight corresponding to each third element based on the layer number of the layer where each third element is located and the difficulty coefficient corresponding to each third element;
[0025] When the multiple fourth elements include allowed fourth elements and disallowed fourth elements, taking the first difficulty coefficient as the difficulty weight corresponding to the allowed fourth elements to be operated, and determining the difficulty weight corresponding to the disallowed fourth elements based on the arrangement order of the disallowed fourth elements in the multiple fourth elements, the first difficulty coefficient, and the second difficulty coefficient;
[0026] Verifying the generation policy based on the difficulty weight corresponding to each third element, the difficulty weight corresponding to each fourth element, and the initial image to obtain the verification result.
[0027] Optionally, when the verification result indicates that the generation policy passes the verification, using the initial image as the target image, including:
[0028] When the verification result indicates that the generation policy fails the verification, adjusting the generation policy to obtain an adjusted generation policy;
[0029] Generating a new initial image based on the adjusted generation policy, and continuing to verify the new initial image to obtain a new verification result until the new verification result indicates that the adjusted generation policy passes the verification, and then using the new initial image as the target image.
[0030] In a second aspect, an embodiment of the present application provides an image processing apparatus, including:
[0031] An information acquisition module, configured to acquire image configuration information, where the image configuration information includes a generation policy and a verification policy for a target image, and the generation policy is used to satisfy the verification policy;
[0032] An image generation module, configured to generate an initial image based on the generation policy;
[0033] An image verification module, configured to verify the generation policy based on the verification policy and the initial image to obtain a verification result;
[0034] An image determination module, configured to use the initial image as the target image when the verification result indicates that the generation policy verification passes.
[0035] Optionally, the generation policy is used to indicate that the target image includes multiple layers, the number of first elements under each layer included in the multiple layers, the colors of multiple second elements, the number of second elements corresponding to different colors, the colors of multiple third elements, and the number of third elements corresponding to different colors. The multiple second elements and the multiple third elements are respectively located in the multiple first elements, the number of the multiple second elements and the multiple third elements is equal, and the multiple third elements are used to fill the multiple second elements one by one;
[0036] The image generation module is specifically configured to:
[0037] For the first layer among the multiple layers, starting from the second element in the first first element under the first layer, traverse and use the third elements of the first color among the multiple third elements to fill the second elements until all the third elements of the first color are filled into the second elements;
[0038] Continue to use the third elements of the second color among the multiple third elements to fill into the second elements until all the multiple second elements are filled with third elements, and a first initial image is obtained.
[0039] Optionally, for a target third element among the multiple third elements, the image generation module is further configured to:
[0040] According to the first bounding polygon corresponding to the target third element and the second bounding polygon corresponding to the target first element where the target third element is located, use the separating axis algorithm to determine whether the target third element satisfies the intersection condition, and the intersection condition is used to represent the intersection between the first bounding polygon and the second bounding polygon;
[0041] When the target third element satisfies the intersection condition, determine any third element with a color different from that of the target third element in the first element in the layer above the layer where the target first element is located as the candidate third element corresponding to the target third element;
[0042] Exchange the positions of the candidate third element corresponding to the target third element and the target third element until all the third elements that satisfy the intersection condition among the multiple third elements are exchanged with the candidate third elements corresponding to the third elements that satisfy the intersection condition, and a second initial image is obtained.
[0043] Optionally, the image generation module is further configured to:
[0044] Determine the quantity corresponding to the third elements of different colors under each of the layers;
[0045] Based on the quantity corresponding to the third elements of different colors under each of the layers, assign fourth elements of the same color to the third elements of the same color in each of the layers, and each of the multiple fourth elements is used to be filled with a preset quantity of third elements of the same color when allowed to be used;
[0046] Arrange the multiple fourth elements based on the arrangement order of the colors of the multiple third elements in the multiple layers to obtain a third initial image.
[0047] Optionally, the verification strategy includes the difficulty coefficients respectively corresponding to the multiple third elements and the first difficulty coefficient and the second difficulty coefficient corresponding to the multiple fourth elements;
[0048] The image verification module is specifically configured to:
[0049] Determine the difficulty weight corresponding to each of the third elements based on the layer number of the layer where each of the third elements is located and the difficulty coefficient corresponding to each of the third elements;
[0050] In the case where the multiple fourth elements include allowed fourth elements and non-allowed fourth elements, use the first difficulty coefficient as the difficulty weight corresponding to the allowed fourth elements to be operated, and based on the arrangement order of the non-allowed fourth elements in the multiple fourth elements, the first difficulty coefficient and the second difficulty coefficient, determine the difficulty weight corresponding to the non-allowed fourth elements;
[0051] Verify the generation strategy based on the difficulty weight corresponding to each of the third elements, the difficulty weight corresponding to each of the fourth elements, and the initial image to obtain the verification result.
[0052] Optionally, the image determination module is specifically configured to:
[0053] In the case where the verification result indicates that the generation strategy fails the verification, adjust the generation strategy to obtain an adjusted generation strategy;
[0054] Generate a new initial image based on the adjusted generation strategy, and continue to verify the new initial image to obtain a new verification result. Until the new verification result indicates that the adjusted generation strategy passes the verification, use the new initial image as the target image.
[0055] In a third aspect, an embodiment of the present application provides an electronic device, and the device includes: a processor, a memory, and a system bus;
[0056] The processor and the memory are connected via the system bus;
[0057] The memory is used to store a program, the program includes instructions, and when the instructions are executed by the processor, the processor is caused to execute any implementation step of the above image processing method.
[0058] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored, and when the instructions run on an electronic device, the electronic device is caused to execute any implementation step of the above image processing method.
[0059] As can be seen from the above technical solutions, the embodiments of the present application have the following advantages:
[0060] In the embodiments of the present application, first, image configuration information can be obtained. Among them, the above image configuration information may include a generation strategy and a verification strategy for a target image, and the generation strategy is used to meet the verification strategy. Correspondingly, an initial image can be generated based on the above generation strategy, and based on the verification strategy and the initial image, the generation strategy can be verified to obtain a verification result. In this way, when the verification result indicates that the generation strategy passes the verification, the initial image can be used as the target image. In this way, after obtaining the image configuration information, an initial image can be automatically generated without relying on the personal experience of the designer, and then the generated initial image can be automatically verified, without the designer manually debugging, so that the manual participation can be reduced, and the image expected by the designer can be accurately obtained in an automated and intelligent manner, significantly improving the image generation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 is a flowchart of an image processing method provided by an embodiment of the present application;
[0062] Figure 2 is a schematic diagram of a target image provided by an embodiment of the present application;
[0063] Figure 3 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0064] As described above, in practical applications, it is usually the designer who relies on personal experience to correspond to the image. However, this method has relatively high requirements for the working ability of the designer. If the designer makes a mistake in the work, the image needs to be repeatedly verified and debugged many times during the image generation process to obtain the desired image. However, the efficiency of manual verification is relatively low, so the image generation efficiency is not high.
[0065] Based on this, to solve the above problems, an embodiment of the present application provides an image processing method, which may include: First, image configuration information can be obtained. Among them, the above image configuration information may include a generation strategy and a verification strategy for a target image, and the generation strategy is used to meet the verification strategy. Accordingly, an initial image can be generated based on the above generation strategy, and the generation strategy can be verified based on the verification strategy and the initial image to obtain a verification result. In this way, when the verification result indicates that the generation strategy passes the verification, the initial image can be used as the target image.
[0066] In this way, after obtaining the image configuration information, an initial image can be automatically generated without relying on the personal experience of designers. Then, the generated initial image can also be automatically verified, without the need for designers to manually debug, thereby reducing manual participation and accurately obtaining the image expected by designers in an automated and intelligent manner, significantly improving the image generation efficiency.
[0067] It should be noted that the execution subject of the image processing method in the embodiment of the present application is not limited. For example, the image processing method in the embodiment of the present application can be applied to image processing devices such as terminal devices or servers. Among them, the terminal device can be an electronic device such as a smart phone, a computer, a personal digital assistant (PDA), or a tablet computer. The server can be an independent server, a cluster server, or a cloud server.
[0068] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0069] Figure 1 This is a flowchart of an image processing method provided by an embodiment of the present application. Combining Figure 1 As shown, for the image processing method provided by an embodiment of the present application, the specific implementation of the solution is described with a corresponding image processing device as the execution subject. The image processing method may include the following steps S101-S104.
[0070] S101: Obtain image configuration information, where the image configuration information includes a generation strategy and a verification strategy for a target image, and the generation strategy is used to meet the verification strategy.
[0071] In the embodiments of the present application, the generation strategy refers to the strategy for generating an image, and its ultimate goal is to generate the desired target image. The verification strategy is used to verify the above generation strategy, and its ultimate goal is to make the finally generated target image meet the generation requirements indicated by the generation strategy. Taking the game design scenario as an example, the generation requirements are, for example, the game difficulty or game duration indicated by the image.
[0072] Based on this, as an example, the above generation strategy may indicate that the finally desired target image includes multiple layers, the number of first elements under each layer included in the multiple layers, the colors of multiple second elements, the number corresponding to the second elements of different colors, the colors of multiple third elements, and the number corresponding to the third elements of different colors. And, the above multiple second elements and the above multiple third elements are respectively located in the above multiple first elements, the number of the multiple second elements and the multiple third elements is equal, and the multiple third elements are used to fill the multiple second elements one by one. Among them, taking Figure 2 as an example to illustrate the finally generated target image, the above first element is a disk-shaped structure including a second element, the second element is a hole position (since the second element in the target image has been filled with a third element, so Figure 2 the second element is not shown), and the third element is a thumbtack. Therefore, the third element can be filled into the second element one by one.
[0073] Furthermore, the above verification strategy may include the difficulty coefficient corresponding to each third element and the first difficulty coefficient and the second difficulty coefficient corresponding to multiple fourth elements. Taking the game design scenario as an example, the difficulty coefficient corresponding to the third element refers to the coefficient of the game difficulty corresponding to the image generated based on this difficulty coefficient; the first difficulty coefficient and the second difficulty coefficient corresponding to the fourth element are the coefficients of the game difficulty corresponding to the image generated based on this first difficulty coefficient or the second difficulty coefficient. For the convenience of understanding, for the content related to the verification strategy, reference can be made to the description made below, and it will not be elaborated here first.
[0074] S102: Generate an initial image based on the generation strategy.
[0075] As a possible implementation manner, in the process of generating an initial image based on the generation strategy, for the first layer among the multiple layers, first, it is possible to start traversing from the second element in the first first element under the first layer, and use the third elements of the first color among the multiple third elements to fill the second element until all the third elements of the first color are filled into the second element. Then, it is possible to continue to use the third elements of the second color among the multiple third elements to fill into the second element until all the multiple second elements are filled with the third elements, and a first initial image is obtained.
[0076] For example, still takingFigure 2 For example, first, it can start traversing from the hole positions of the thumbtack tray at the top layer of multiple layers, and sequentially fill the thumbtacks of the same color among the multiple thumbtacks into the hole positions until the thumbtacks of that color are consumed, and then sequentially fill the thumbtacks of other colors among the multiple thumbtacks into the hole positions until all thumbtacks are filled into the hole positions. Since the total number of hole positions and thumbtacks is the same, all hole positions have been filled at this time, and a first initial image is obtained. In addition, after obtaining this first initial image, for the target third element among the multiple third elements, that is, any one of the multiple third elements, it is also possible to further determine whether the target third element satisfies the intersection condition according to the first bounding polygon corresponding to the target third element and the second bounding polygon corresponding to the target first element where the target third element is located, through the separating axis algorithm, and the intersection condition is used to represent the intersection between the first bounding polygon and the second bounding polygon.
[0077] Among them, the separating axis algorithm is an algorithm for determining whether two convex polygons intersect. Its core principle is that if two convex polygons do not overlap, then there must be at least one straight line (called the separating axis) such that the projections of the two polygons on this straight line do not overlap. On the contrary, if such a straight line cannot be found, then these two polygons must intersect.
[0078] Based on this, in the embodiments of the present application, the first bounding polygon refers to the polygon used to enclose the third element, and the second bounding polygon refers to the polygon used to enclose the first element. Taking Figure 2 as an example, the first bounding polygon is the polygon corresponding to each thumbtack, and the second bounding polygon refers to the polygon corresponding to each disc-shaped structure. In this way, through the separating axis algorithm, it can effectively detect whether the first bounding polygon and the second bounding polygon intersect, that is, determine whether the target third element satisfies the intersection condition.
[0079] Correspondingly, when the target third element satisfies the intersection condition, any third element with a color different from that of the target third element is determined as the candidate third element corresponding to the target third element from the first elements in the layer above the layer where the target first element is located, and the candidate third element corresponding to the target third element and the target third element are exchanged in position. And if the target third element does not satisfy the intersection condition, another thumbtack among the other thumbtacks of the multiple third elements can be selected as the target third thumbtack. Repeat this process until when all the third elements that satisfy the intersection condition among the multiple third elements have exchanged positions with the candidate third elements corresponding to the third elements that satisfy the intersection condition, a second initial image is obtained.
[0080] For example, still taking Figure 2For example, if the target third element, i.e., the target thumbtack, meets the intersection condition, candidate thumbtacks with colors different from the target thumbtack can be selected from the layer above the layer where the target thumbtack is located, and the positions of the target thumbtack and the candidate thumbtacks are exchanged until all the thumbtacks that meet the above intersection condition have their positions exchanged.
[0081] Furthermore, after obtaining the second initial image, the number of third elements of different colors under each layer can be further determined. Then, based on the number of third elements of different colors under each layer, fourth elements of the same color can be assigned to the third elements of the same color in each layer, where each of the multiple fourth elements is used to be filled with a preset number of third elements of the same color when allowed. Then, based on the arrangement order of the colors of the multiple third elements in the multiple layers, the multiple fourth elements are arranged to obtain the third initial image.
[0082] For example, still taking Figure 2 as an example, the fourth element can be a box for holding thumbtacks. Based on this, starting from the plate structure in the first layer of the multiple layers, the number of thumbtacks of different colors in each layer can be calculated first. Then, assuming the preset number is 3, a box can be assigned to every 3 thumbtacks of the same color, and the boxes corresponding to the same color are sorted according to the order of the thumbtack colors in the multiple layers. For example, if the first layer includes blue and yellow thumbtacks, and the second layer includes purple and yellow thumbtacks, the blue and yellow boxes can be arranged first, and then the purple box.
[0083] S103: Based on the verification strategy and the initial image, verify the generation strategy to obtain a verification result.
[0084] As mentioned above, the verification strategy can include the difficulty coefficients corresponding to the multiple third elements respectively, and the first and second difficulty coefficients corresponding to the multiple fourth elements. Based on this, in the application embodiment, during the process of verifying the generation strategy, first, based on the layer number of each layer where each third element is located and the difficulty coefficient corresponding to each third element, the difficulty weight corresponding to each third element can be determined. For example, the difficulty weight corresponding to each third element can be obtained through the following formula (1):
[0085] Q1 = L1 × q1 (1)
[0086] where Q1 is the difficulty weight corresponding to each third element, L1 is the layer number of each layer where each third element is located, and q1 is the difficulty coefficient corresponding to each third element.
[0087] Next, as previously mentioned, each fourth element is used to be filled with a preset number of third elements of the same color when allowed. Therefore, in practical applications, the above-mentioned multiple fourth elements may include allowed fourth elements and disallowed fourth elements. Here, whether a fourth element is allowed means that the fourth element is allowed to be filled with a third element. Based on this, when the multiple fourth elements include allowed fourth elements and disallowed fourth elements, the first difficulty coefficient can be used as the difficulty weight corresponding to the allowed fourth elements for operation. And, based on the arrangement order of the disallowed fourth elements among the multiple fourth elements, the first difficulty coefficient, and the second difficulty coefficient, the difficulty weight corresponding to the disallowed fourth elements is determined. For example, the difficulty weight corresponding to each disallowed fourth element can be obtained through the following formula (2):
[0088] Q2 = (L2 - 3) × q2 × q3 (2)
[0089] Where Q1 is the difficulty weight corresponding to each disallowed fourth element, L2 is the arrangement order of each disallowed fourth element among the multiple fourth elements, q2 is the first difficulty coefficient, and q3 is the second difficulty coefficient.
[0090] Then, based on the difficulty weight corresponding to each third element, the difficulty weight corresponding to each fourth element, and the initial image, the generation strategy can be verified to obtain a verification result.
[0091] In specific implementation, the difficulty weights corresponding to each third element and each fourth element can be summed first to obtain a summation result, which is used as the difficulty index corresponding to the initial image. Taking the game design scenario as an example, this difficulty index can represent the difficulty of the game level corresponding to the initial image (i.e., the above-mentioned first initial image, second initial image, and third initial image). Then, it is further determined whether this difficulty index matches the generation requirements indicated by the generation strategy, such as a pre-designed difficulty index, so as to obtain a verification result.
[0092] S104: When the verification result indicates that the generation strategy passes the verification, the initial image is used as the target image.
[0093] For example, if the verification result indicates that the generation strategy passes the verification, it can be explained that the difficulty index corresponding to the initial image matches the pre-designed difficulty index, that is, the initial image meets the generation requirements, and then the initial image can be used as the target image to complete the image processing process.
[0094] In addition, if the verification result indicates that the generation strategy verification fails, the above generation strategy can be adjusted. For example, parameters such as the number of first elements under each layer, the colors of multiple second elements, the number of second elements corresponding to different colors, the colors of multiple third elements, and the number of third elements corresponding to different colors can be adjusted to obtain an adjusted generation strategy. Then, based on the adjusted generation strategy, a new initial image is generated, and the new initial image is continuously verified to obtain a new verification result until the new verification result indicates that the adjusted generation strategy passes the verification, and the new initial image is used as the target image.
[0095] It can be seen that based on the relevant content of the above steps S101 - S104, in the embodiment of the present application, first, image configuration information can be obtained. Among them, the above image configuration information can include a generation strategy and a verification strategy for the target image, and the generation strategy is used to meet the verification strategy. Correspondingly, an initial image can be generated based on the above generation strategy, and the generation strategy can be verified based on the verification strategy and the initial image to obtain a verification result. In this way, when the verification result indicates that the generation strategy passes the verification, the initial image can be used as the target image. In this way, after obtaining the image configuration information, an initial image can be automatically generated without relying on the personal experience of designers, and then the generated initial image can be automatically verified, without the need for designers to manually debug, thereby reducing manual participation and accurately obtaining the image expected by designers in an automated and intelligent manner, significantly improving the image generation efficiency.
[0096] Furthermore, based on the image processing method provided in the above embodiment, the embodiment of the present application can also provide an image processing device. The following will describe this image processing device in combination with the embodiment and the accompanying drawings respectively.
[0097] Figure 3 It is a schematic structural diagram of an image processing device provided in an embodiment of the present application. Combining Figure 3 As shown, the image processing device 300 provided in the embodiment of the present application may include:
[0098] An information acquisition module 301, configured to acquire image configuration information, where the image configuration information includes a generation strategy and a verification strategy for the target image, and the generation strategy is used to meet the verification strategy;
[0099] An image generation module 302, configured to generate an initial image based on the generation strategy;
[0100] An image verification module 303, configured to verify the generation strategy based on the verification strategy and the initial image to obtain a verification result;
[0101] The image determination module 304 is configured to use the initial image as the target image when the verification result indicates that the generation policy verification is passed.
[0102] Optionally, the generation policy is used to indicate that the target image includes multiple layers, the number of first elements under each layer included in the multiple layers, the colors of multiple second elements, the number of second elements corresponding to different colors, the colors of multiple third elements, and the number of third elements corresponding to different colors. The multiple second elements and the multiple third elements are respectively located in the multiple first elements, the number of the multiple second elements and the multiple third elements is equal, and the multiple third elements are used to fill the multiple second elements one by one;
[0103] The image generation module 302 is specifically configured to:
[0104] For the first layer among the multiple layers, starting from the second element in the first first element under the first layer, traverse and use the third elements belonging to the first color among the multiple third elements to fill the second elements until all the third elements belonging to the first color are filled into the second elements;
[0105] Continue to use the third elements belonging to the second color among the multiple third elements to fill into the second elements until all the multiple second elements are filled with third elements, and a first initial image is obtained.
[0106] Optionally, for the target third element among the multiple third elements, the image generation module 302 is further configured to:
[0107] According to the first bounding polygon corresponding to the target third element and the second bounding polygon corresponding to the target first element where the target third element is located, use the separating axis algorithm to determine whether the target third element satisfies the intersection condition, and the intersection condition is used to represent the intersection between the first bounding polygon and the second bounding polygon;
[0108] When the target third element satisfies the intersection condition, determine any third element with a color different from that of the target third element in the first element in the layer above the layer where the target first element is located as the candidate third element corresponding to the target third element;
[0109] Exchange the positions of the candidate third element corresponding to the target third element and the target third element until all the third elements that satisfy the intersection condition among the multiple third elements are exchanged with the candidate third elements corresponding to the third elements that satisfy the intersection condition, and a second initial image is obtained.
[0110] Optionally, the image generation module 302 is further configured to:
[0111] Determine the quantity corresponding to the third elements of different colors under each of the layers;
[0112] Based on the quantity corresponding to the third elements of different colors under each of the layers, assign fourth elements of the same color to the third elements of the same color in each of the layers, and each of the multiple fourth elements is used to be filled with a preset quantity of third elements of the same color when permitted;
[0113] Arrange the multiple fourth elements based on the arrangement order of the colors of the multiple third elements in the multiple layers to obtain a third initial image.
[0114] Optionally, the verification strategy includes the difficulty coefficients corresponding to the multiple third elements respectively, and the first difficulty coefficient and the second difficulty coefficient corresponding to the multiple fourth elements;
[0115] The image verification module 303 is specifically configured to:
[0116] Determine the difficulty weight corresponding to each of the third elements based on the layer number of the layer where each of the third elements is located and the difficulty coefficient corresponding to each of the third elements;
[0117] In the case where the multiple fourth elements include permitted fourth elements and non-permitted fourth elements, use the first difficulty coefficient as the difficulty weight corresponding to the permitted fourth elements, and determine the difficulty weight corresponding to the non-permitted fourth elements based on the arrangement order of the non-permitted fourth elements in the multiple fourth elements, the first difficulty coefficient, and the second difficulty coefficient;
[0118] Verify the generation strategy based on the difficulty weight corresponding to each of the third elements, the difficulty weight corresponding to each of the fourth elements, and the initial image to obtain the verification result.
[0119] Optionally, the image determination module 304 is specifically configured to:
[0120] In the case where the verification result indicates that the generation strategy fails the verification, adjust the generation strategy to obtain an adjusted generation strategy;
[0121] Generate a new initial image based on the adjusted generation strategy, and continue to verify the new initial image to obtain a new verification result. Until the new verification result indicates that the adjusted generation strategy passes the verification, use the new initial image as the target image.
[0122] Furthermore, an embodiment of the present application further provides an electronic device, including: a processor, a memory, and a system bus;
[0123] The processor and the memory are connected through the system bus;
[0124] The memory is used to store one or more programs, and the one or more programs include instructions, and when the instructions are executed by the processor, the processor is caused to execute any implementation step of the above image processing method.
[0125] Furthermore, an embodiment of the present application further provides a computer-readable storage medium, in which instructions are stored, and when the instructions run on an electronic device, any implementation step of the above image processing method is enabled.
[0126] From the description of the above embodiments, those skilled in the art can clearly understand that all or part of the steps in the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in each embodiment or some parts of the embodiments of the present application. It should be noted that the embodiments in this specification are described in a progressive manner, and the key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other.
[0127] For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the relevant parts, reference can be made to the description in the method part.
[0128] It should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such a process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article or device including the element.
[0129] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Thus, the present application 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
1. An image processing method, characterized in that: include: Acquire image configuration information, wherein the image configuration information includes a generation strategy and a verification strategy for a target image, wherein the generation strategy is used to satisfy the verification strategy; generating an initial image based on the generation strategy; Based on the verification strategy and the initial image, verify the generation strategy to obtain a verification result; When the verification result indicates that the generation strategy has passed the verification, the initial image is used as the target image.
2. The image processing method according to claim 1, characterized in that: The generation strategy is used to indicate that the target image includes multiple layers, the number of first elements under each layer included in the multiple layers, the colors of multiple second elements, the number of second elements with different colors, the colors of multiple third elements, and the number of third elements with different colors, the multiple second elements and the multiple third elements are respectively located in the multiple first elements, the number of the multiple second elements and the multiple third elements is equal, and the multiple third elements are used to fill the multiple second elements in a one-to-one correspondence; The generating an initial image based on the generating strategy comprises: For a first layer among the multiple layers, traverse from the second element in the first first element under the first layer, and fill the second element with the third elements of the first color among the multiple third elements until all the third elements of the first color are filled into the second element; Continue to use the third elements of the second color among the plurality of third elements to fill the second elements until all the plurality of second elements are filled with the third elements, thereby obtaining a first initial image.
3. The image processing method according to claim 2, characterized in that: For a target third element among the plurality of third elements, after obtaining the first initial image, the method further includes: Determining whether the target third element satisfies an intersection condition by a separating axis algorithm according to a first enclosing polygon corresponding to the target third element and a second enclosing polygon corresponding to the target first element where the target third element is located, wherein the intersection condition is used to indicate that the first enclosing polygon and the second enclosing polygon intersect; In the case where the target third element satisfies the intersection condition, determining any third element having a different color from the target third element from the first element in the layer above the layer where the target first element is located as a candidate third element corresponding to the target third element; The candidate third element corresponding to the target third element is exchanged with the target third element until all the third elements satisfying the intersection condition among the multiple third elements are exchanged with the candidate third elements corresponding to the third element satisfying the intersection condition, so as to obtain a second initial image.
4. The image processing method according to claim 2, characterized in that: The method further comprises: Determine the number of third elements of different colors under each layer; Based on the number of third elements of different colors under each layer, a fourth element of the same color is allocated to the third elements of the same color in each layer, and each of the plurality of fourth elements is used to be filled with a preset number of third elements of the same color when allowed to be used; The plurality of fourth elements are arranged based on the arrangement order of the colors of the plurality of third elements in the plurality of layers to obtain a third initial image.
5. The image processing method according to claim 4, characterized in that: The verification strategy includes difficulty coefficients corresponding to the plurality of third elements respectively and first difficulty coefficients and second difficulty coefficients corresponding to the plurality of fourth elements; The step of verifying the generation strategy based on the verification strategy and the initial image to obtain a verification result includes: Determine a difficulty weight corresponding to each third element based on the number of the layer where each third element is located and the difficulty coefficient corresponding to each third element; In a case where the plurality of fourth elements include permitted fourth elements and disallowed fourth elements, using the first difficulty coefficient as the difficulty weight corresponding to the permitted fourth element, and determining the difficulty weight corresponding to the disallowed fourth element based on the arrangement order of the disallowed fourth element in the plurality of fourth elements, the first difficulty coefficient, and the second difficulty coefficient; Based on the difficulty weight corresponding to each of the third elements, the difficulty weight corresponding to each of the fourth elements and the initial image, the generation strategy is verified to obtain the verification result.
6. The image processing method according to any one of claims 1 to 5, characterized in that: When the verification result indicates that the generation strategy has passed the verification, taking the initial image as the target image includes: When the verification result indicates that the generation strategy verification fails, adjusting the generation strategy to obtain an adjusted generation strategy; A new initial image is generated based on the adjusted generation strategy, and the new initial image is continuously verified to obtain a new verification result. When the new verification result indicates that the adjusted generation strategy has passed the verification, the new initial image is used as the target image.
7. An image processing device, characterized in that: include: An information acquisition module, used to acquire image configuration information, wherein the image configuration information includes a generation strategy and a verification strategy for a target image, wherein the generation strategy is used to satisfy the verification strategy; An image generation module, used to generate an initial image based on the generation strategy; An image verification module, used to verify the generation strategy based on the verification strategy and the initial image to obtain a verification result; The image determination module is used to use the initial image as the target image when the verification result indicates that the generation strategy has passed the verification.
8. The image processing device according to claim 7, characterized in that: The generation strategy is used to indicate that the target image includes multiple layers, the number of first elements under each layer included in the multiple layers, the colors of multiple second elements, the number of second elements with different colors, the colors of multiple third elements, and the number of third elements with different colors, the multiple second elements and the multiple third elements are respectively located in the multiple first elements, the number of the multiple second elements and the multiple third elements is equal, and the multiple third elements are used to fill the multiple second elements in a one-to-one correspondence; The image generation module is specifically used for: For a first layer among the multiple layers, traverse from the second element in the first first element under the first layer, and fill the second element with the third elements of the first color among the multiple third elements until all the third elements of the first color are filled into the second element; Continue to use the third elements of the second color among the plurality of third elements to fill the second elements until all the plurality of second elements are filled with the third elements, thereby obtaining a first initial image.
9. An electronic device, characterized in that: The device includes: a processor, a memory, and a system bus; The processor and the memory are connected via the system bus; The memory is used to store a program, wherein the program includes instructions, and when the instructions are executed by the processor, the processor executes the steps of the image processing method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a terminal device, the steps of the image processing method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Image collection method and device
CN113271414A
Sample automatic generation method and device, algorithm self-evolution method and device and electronic equipment
CN115965835A
Inspection code generation method and system, electronic equipment and storage medium
CN119376705A
Training method and apparatus for image generation model, and device and storage medium
WO2025007494A1