Graphics processing method, device, equipment and medium
By automatically designing puzzle answers, the problem of time-consuming design of puzzle answers in the existing technology is solved, and the rapid generation of puzzle answers and the efficiency of development of puzzle games is achieved.
Patent Information
- Application Number
- CN202110091007.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-22
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-01-22
AI Technical Summary
The puzzle answers to existing jigsaw puzzles are usually designed manually by developers, which makes the design take longer and reduces the efficiency of game development.
By obtaining the target graphics and the target tiles sequence, combining them to form the group of objects to be matched, performing matching calculations, obtaining matching state parameters, and traversing them to generate the target state parameter group for splicing the target graphics, thereby realizing the automatic design of the puzzle answer.
The automatic design of puzzle answers is realized, which reduces the time-consuming design of puzzle answers and improves the development efficiency of puzzle games.
Smart Images

Figure CN114882255B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of graphics processing technology, and in particular to a graphics processing method, device, equipment and medium. Background Art
[0002] At present, jigsaw puzzle games often appear in various educational games as a kind of educational teaching aid.
[0003] After the user enters the jigsaw puzzle game, the game will give a puzzle question, and the user can solve the puzzle according to the puzzle question. After the user completes the puzzle, the puzzle pattern can be tested. If the puzzle pattern matches any pre-designed puzzle answer, it is determined that the user has solved the puzzle correctly. In general, the puzzle answers are usually designed manually by the developer, which takes a long time to design the puzzle answers, reducing the development efficiency of jigsaw puzzle games. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a graphics processing method, device, equipment and medium.
[0005] In a first aspect, the present disclosure provides a graphics processing method, comprising:
[0006] Acquire a target graphic and a target block sequence for assembling the target graphic, wherein each shape region in the target graphic and each block in the target block sequence are combined in pairs to form a plurality of to-be-matched object groups, wherein one to-be-matched object group includes a shape region and a block;
[0007] Perform matching calculation on the to-be-matched object group to obtain matching state parameters of the target matching object group, where the target matching object group is the to-be-matched object group that meets the preset matching conditions;
[0008] The matching state parameters are traversed to obtain at least one target state parameter group, which is used to splice the target block sequence into a target graphic. The target state parameter group includes multiple target matching state parameters, and one target matching state parameter corresponds to a target matching object group to which a block belongs.
[0009] In a second aspect, the present disclosure provides a graphics processing device, comprising:
[0010] An acquisition unit is configured to acquire a target graphic and a target block sequence for assembling the target graphic, wherein each shape region in the target graphic and each block in the target block sequence are combined in pairs to form a plurality of to-be-matched object groups, wherein one to-be-matched object group includes one shape region and one block;
[0011] A matching unit configured to perform matching calculation on the to-be-matched object group to obtain matching state parameters of a target matching object group, where the target matching object group is a to-be-matched object group that meets a preset matching condition;
[0012] The traversal unit is configured to traverse the matching state parameters to obtain at least one target state parameter group, the target state parameter group is used to splice the target block sequence into a target graphic, the target state parameter group includes multiple target matching state parameters, and one target matching state parameter corresponds to a target matching object group to which a block belongs.
[0013] In a third aspect, the present disclosure provides a graphics processing device, including:
[0014] processor;
[0015] A memory for storing executable instructions;
[0016] The processor is used to read executable instructions from the memory and execute the executable instructions to implement the graphics processing method described in the first aspect.
[0017] In a fourth aspect, the present disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor implements the graphics processing method described in the first aspect.
[0018] In a fifth aspect, the present disclosure provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the processor implements the graphics processing method described in the first aspect.
[0019] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has at least the following advantages:
[0020] The graphics processing method, apparatus, device and medium of the disclosed embodiments can, after acquiring a target graphic and a target puzzle sequence for splicing the target graphic, perform matching calculations on a plurality of to-be-matched object groups formed by pairwise combinations of each shape region in the target graphic and each puzzle in the target puzzle sequence, obtain matching state parameters of a plurality of target matching object groups that meet preset matching conditions, and traverse the matching state parameters to obtain at least one target state parameter group for splicing the target puzzle sequence into the target graphic, thereby realizing automatic design of puzzle answers to puzzle problems, reducing the time spent in designing puzzle answers, and improving the development efficiency of jigsaw games. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0022] Figure 1 A flowchart of a graphics processing method provided by an embodiment of the present disclosure;
[0023] Figure 2 A schematic diagram of a target graphic provided by an embodiment of the present disclosure;
[0024] Figure 3 A schematic diagram of a scene where a key point and a tile vertex coincide with each other provided by an embodiment of the present disclosure;
[0025] Figure 4 A schematic diagram of a puzzle rotation scene provided by an embodiment of the present disclosure;
[0026] Figure 5 A flowchart of another graphics processing method provided by an embodiment of the present disclosure;
[0027] Figure 6 A schematic diagram of a puzzle answer transformation result provided by an embodiment of the present disclosure;
[0028] Figure 7 A schematic diagram of the structure of a graphics processing device provided by an embodiment of the present disclosure;
[0029] Figure 8 A schematic diagram of the structure of a graphics processing device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0031] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0032] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0033] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0034] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0035] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0036] Currently, after a user enters a jigsaw puzzle game, a puzzle question will be given, and the user can solve the puzzle according to the puzzle question. After the user completes the puzzle, the puzzle pattern can be tested. If the puzzle pattern matches any pre-designed puzzle answer, it is determined that the user has solved the puzzle correctly. Generally, the puzzle answers of each jigsaw puzzle game are usually manually designed by its developer, which takes a long time to design the puzzle answers, reduces the development efficiency of jigsaw puzzle games, and usually cannot cover all the answers.
[0037] In order to solve the above-mentioned problems, the embodiments of the present disclosure provide a graphics processing method, device, equipment and medium capable of automatically designing puzzle answers to puzzle questions.
[0038] Below, the graphics processing method provided by the embodiment of the present disclosure is first described.
[0039] In some embodiments of the present disclosure, the graphics processing method may be executed by a graphics processing device. The graphics processing device may be a server, an electronic device, or other devices, which are not limited here. Among them, the server may be a cloud server or a server cluster or other devices with storage and computing functions. The electronic device may include a mobile phone, a tablet computer, a desktop computer, a laptop computer, a vehicle terminal, a wearable electronic device, an all-in-one machine, a smart home device, and other devices with communication functions, or may be a virtual machine or a device simulated by a simulator.
[0040] Figure 1A flowchart of a graphics processing method provided by an embodiment of the present disclosure is shown.
[0041] like Figure 1 As shown, the graphics processing method may include the following steps.
[0042] S110, obtaining a target graphic and a target block sequence for assembling the target graphic, combining each shape region in the target graphic with each block in the target block sequence in pairs to form a plurality of to-be-matched object groups, wherein one to-be-matched object group includes one shape region and one block.
[0043] In the embodiment of the present disclosure, the target graphic may include at least one shape region, wherein a shape region is a closed region surrounded by at least a portion of the outer contour of the target graphic.
[0044] Figure 2 A schematic diagram of a target graphic provided by an embodiment of the present disclosure is shown.
[0045] like Figure 2 As shown, the outer contour of the target graphic 200 can be enclosed into four closed areas, and one closed area constitutes a shape area. Figure 2 The target graphic 200 shown in FIG. 2 may include four shape areas, namely a diamond shape area 201 , a triangle shape area 202 , a square shape area 203 and an irregular shape area 204 .
[0046] In the embodiment of the present disclosure, the target puzzle sequence may be a puzzle sequence formed by arranging the puzzle pieces of the target puzzle in a preset sequence order.
[0047] The target puzzle may be any type of puzzle, for example, the target puzzle may be a four-piece puzzle, a five-piece puzzle, a seven-piece puzzle, a thirteen-piece puzzle, etc., without limitation herein.
[0048] In the embodiment of the present disclosure, optionally, the preset sequence order may be an order according to the area of the puzzle blocks from large to small, or the preset sequence order may be an order according to the area of the puzzle blocks from small to large, which is not limited here.
[0049] Optionally, if there are at least two blocks with the same block area in the target block sequence, the blocks with the same block area may be randomly sorted.
[0050] Taking the tangram as an example, the tangram can be composed of 7 pieces, and one piece can also correspond to one color. The 7 pieces can include two first triangular pieces, one second triangular piece, two third triangular pieces, a square piece and a parallelogram piece. Among them, the two first triangular pieces are pieces with the same attributes, and the two third triangular pieces are pieces with the same attributes. The piece areas of the first triangular piece, the second triangular piece and the third triangular piece decrease in sequence. The piece areas of the second triangular piece, the square piece and the parallelogram piece are the same.
[0051] Specifically, the same attributes may refer to the same characteristics of both the block shape and the block area, and the different attributes may refer to the different characteristics of at least one of the block shape and the block area.
[0052] If the preset sequence order is in descending order of the area of the puzzle pieces, then the puzzle piece sequence corresponding to the tangram puzzle arranged according to the preset sequence order may be: a first triangular puzzle piece of a first color, a first triangular puzzle piece of a second color, a second triangular puzzle piece of a third color, a second triangular puzzle piece of a fourth color, a parallelogram puzzle piece of a fifth color, a third triangular puzzle piece of a sixth color, and a third triangular puzzle piece of a seventh color.
[0053] The first color, the second color, the third color, the fourth color, the fifth color, the sixth color and the seventh color may be different random colors respectively, which are not limited here.
[0054] In the disclosed embodiment, when the matching status between the blocks and the shape regions is unknown, each block has the possibility of matching with each shape region. Therefore, each shape region in the target graphic and each block in the target block sequence can be combined in pairs, that is, each shape region is combined with each block respectively to form a plurality of object groups to be matched. Each object group to be matched can include a shape region and a block to realize pairwise matching detection between the blocks and the shape regions.
[0055] Continue with Figure 2 For example, if the target graphic 200 can be obtained by splicing the target block sequence corresponding to the tangram, it is necessary to combine the 7 blocks in the target block sequence with the 4 shape areas in the target graphic 200 in pairs, and obtain 49 groups of objects to be matched formed by combinations of different blocks and different shape areas, so as to realize pairwise matching detection between each block in the tangram and each shape area in the target graphic 200, thereby avoiding the problem of omissions in matching detection and improving the reliability of matching detection.
[0056] Continue to return Figure 1In S110, in the embodiment of the present disclosure, the graphics processing device can obtain a target image input by a user for obtaining a target graphic, so that the graphics processing device can extract the target graphic from the target image and obtain a target patch sequence for splicing the target graphic.
[0057] In some embodiments of the present invention, the target image may be an image including a target graphic. The graphics processing device may acquire the target image and directly perform edge detection on the target image to obtain the outer contour of the target graphic, and then use the outer contour of the target graphic to segment the target graphic from the target image.
[0058] In some embodiments, the graphics processing device may directly obtain the number of tiles for assembling the target graphics input by the user, and obtain a target tile sequence corresponding to the puzzle having the number of tiles from a preset tile image sequence.
[0059] In other embodiments, the graphics processing device can obtain a patch image input by the user, which includes multiple patches for splicing a target graphic, and perform edge detection on the patch image to obtain the outer contours of each patch, and then use the outer contours of each patch to segment the multiple patches from the patch image, so as to use the segmented patches to form a target patch sequence.
[0060] In one example, after segmenting multiple tiles from a tile image, the graphics processing device may determine the number of tiles obtained by segmentation, and then obtain a target tile sequence corresponding to a puzzle having the number of tiles from a preset tile image sequence.
[0061] In another example, if the graphics processing device obtains multiple target puzzle sequences corresponding to puzzle pieces with the number of puzzle pieces, the similarity between each puzzle piece segmented from the puzzle image and each puzzle piece in the target puzzle sequence can be further calculated to select a target puzzle sequence that meets a preset similarity condition from the multiple target puzzle sequences, and then use the target puzzle sequence that meets the preset similarity condition as the target puzzle sequence finally obtained by the graphics processing device.
[0062] Among them, the preset similarity conditions may include that the blocks in the target block sequence correspond one-to-one with the blocks segmented from the block image, the shape similarity between each block segmented from the block image and the corresponding block in the target block sequence is greater than or equal to a first preset similarity, and the area similarity between each block segmented from the block image and the corresponding block in the target block sequence is greater than or equal to a second preset similarity.
[0063] It should be noted that the first preset similarity and the second preset similarity can be preset as needed. For example, the first preset similarity and the second preset similarity can be 90%, 95%, etc. respectively.
[0064] Therefore, in the embodiment of the present disclosure, the graphics processing device can directly extract the target graphics from the target image including the target graphics, and flexibly obtain the target mosaic sequence, thereby improving the efficiency of obtaining the target graphics and the target mosaic sequence.
[0065] In some embodiments of the present invention, the target image may be an image including a jigsaw pattern formed by splicing puzzle pieces. The graphics processing device may obtain a target image including a jigsaw pattern formed by splicing puzzle pieces obtained by a user through photography, or the graphics processing device may obtain a target image including a jigsaw pattern formed by splicing puzzle pieces drawn by a user, without limitation. After the graphics processing device obtains the target image, it may perform binarization processing on the target image to obtain a binarized black-and-white image, and then perform edge detection on the black-and-white image to obtain the outer contour of the target graphic, and use the outer contour of the target graphic to segment the target graphic from the target image.
[0066] In some embodiments, the graphics processing device may directly obtain the number of tiles pre-entered by the user for assembling the target graphic, and obtain the target tile sequence corresponding to the puzzle having the number of tiles from a preset tile image sequence.
[0067] In other embodiments, the graphics processing device may directly obtain a mosaic image including multiple mosaic objects obtained by the user through photography or a mosaic image including multiple mosaics drawn by the user, which is not limited here. After the image processing device obtains the mosaic image, it may perform edge detection on the mosaic image to obtain the outer contour of each mosaic, and use the outer contour of each mosaic to segment the multiple mosaics from the mosaic image, so as to use the segmented mosaics to form a target mosaic sequence.
[0068] The specific process of the graphics processing device using the segmented blocks to form the target block sequence has been described above and will not be repeated here.
[0069] Therefore, in the embodiment of the present disclosure, the graphics processing device can extract the target graphics from the target image including the puzzle pattern formed by the puzzle pieces, and flexibly obtain the target puzzle sequence, further improving the flexibility of obtaining the target graphics and the target puzzle sequence.
[0070] return Figure 1 S120 in which a matching calculation is performed on the to-be-matched object group to obtain a matching state parameter of a target matching object group, where the target matching object group is a to-be-matched object group that meets a preset matching condition.
[0071] In the embodiment of the present disclosure, for each group of objects to be matched, the graphics processing device can perform matching calculations on the shape areas and blocks in the group of objects to be matched. If it is determined that the matching calculation results meet the preset matching conditions, the group of objects to be matched is used as the target matching object group, and the matching state parameters of the target matching object group are obtained and recorded. Otherwise, the matching state parameters of the group of objects to be matched are not recorded.
[0072] Optionally, the matching calculation result may include a first overlap ratio between the shape region and the block in the object group to be matched, and the preset matching condition may include that the first overlap ratio between the shape region and the block in the object group to be matched is greater than or equal to a first overlap ratio threshold.
[0073] The first overlap ratio refers to the ratio of the overlap area between the shape area in the to-be-matched object group and the block to the block.
[0074] Specifically, the graphics processing device can first determine the overlapping area between the shape area and the block in the object group to be matched, then calculate the first region area of the overlapping area between the shape area and the block, and then calculate the ratio of the first region area to the block area of the block. The ratio is the proportion of the overlapping area between the shape area and the block relative to the block. Therefore, the ratio is the first overlap rate between the shape area and the block in the object group to be matched.
[0075] It should be noted that the first overlap rate threshold can be set as needed. For example, the first overlap rate threshold can be 90%, 95%, 97%, etc., which is not limited here.
[0076] S130, traverse the matching state parameters to obtain at least one target state parameter group, the target state parameter group is used to splice the target block sequence into a target graphic, the target state parameter group includes multiple target matching state parameters, and one target matching state parameter corresponds to a target matching object group to which a block belongs.
[0077] In the disclosed embodiment, the graphics processing device may traverse each matching state parameter to obtain at least one set of target matching state parameters that can enable the target block sequence to be spliced into a target graphic, and each set of target matching state parameters may constitute a target state parameter group.
[0078] The number of target matching state parameters in each target state parameter group is the same as the number of blocks in the target block sequence, and one target matching state parameter corresponds to the target matching object group to which a block in the target block sequence belongs.
[0079] Continuing with the example of the tangram puzzle, each target state parameter group may include 7 target matching state parameters, and the 7 target matching state parameters correspond one-to-one to the 7 puzzle pieces, that is, the 7 target matching state parameters are matching state parameters in the target matching object groups to which the 7 different puzzle pieces belong.
[0080] In the disclosed embodiment, each puzzle piece in the target puzzle piece sequence can be spliced based on the corresponding target matching state parameters in the target state parameter group to obtain the target figure. Therefore, a target state parameter group can be a puzzle answer corresponding to a target figure as a puzzle problem.
[0081] In some embodiments of the present disclosure, the matching state parameters may include geometric parameters corresponding to the overlapping area between the tiles of the target matching object group and the shape area.
[0082] Wherein, every two target matching state parameters in the target state parameter group satisfy a preset splicing condition.
[0083] Optionally, the preset stitching condition may include that a second overlap rate between two tiles determined according to the geometric parameter is less than or equal to a second overlap rate threshold.
[0084] The second overlap ratio refers to the maximum proportion of the overlap area between two blocks relative to each of the two blocks.
[0085] In some embodiments, the geometric parameters may include a first vertex position such as a first vertex coordinate, wherein the first vertex position may be a position of each region vertex of an overlapping region between the tile and the shape region within the target graphic.
[0086] In these embodiments, in the process of determining the second overlap rate between two blocks based on geometric parameters, the graphics processing device may first calculate the second region area of the overlapping region between the two blocks based on the first vertex position of the overlapping region between each block and the corresponding shape region, and then calculate the ratio of the second region area to the block area of each block, each ratio being the proportion of the overlapping region between the two blocks relative to the corresponding block, and then the maximum of the two proportions may be used as the second overlap rate between the two blocks.
[0087] In other embodiments, the geometric parameters may also include the placement position and placement angle of the mosaic block in the target graphic. In this case, the placement position and placement angle of the mosaic block in the target graphic may be used to characterize the regional position and regional angle of the overlapping region.
[0088] In these embodiments, in the process of determining the second overlap rate between two puzzle pieces based on geometric parameters, the graphics processing device may first calculate the second region area of the overlapping region between the two puzzle pieces based on the placement position and placement angle of each puzzle piece in the target graphic, and then calculate the ratio of the second region area to the puzzle piece area of each puzzle piece, each ratio being the proportion of the overlapping region between the two puzzle pieces relative to the corresponding puzzle piece, and then, the maximum of the two proportions may be used as the second overlap rate between the two puzzle pieces.
[0089] It should be noted that the second overlap rate threshold can be set as needed. For example, the second overlap rate threshold can be 5%, 10%, 20%, etc., which is not limited here.
[0090] Furthermore, S130 may specifically include:
[0091] According to the sequence order of the target block sequence, the matching state parameters corresponding to the target matching object group to which each block belongs are sequentially traversed in depth first to obtain the target state parameter group.
[0092] Specifically, the matching state parameters corresponding to all target matching object groups to which each block belongs can be divided into a state parameter group to be traversed, that is, each block corresponds to a state parameter group to be traversed, and a state parameter group to be traversed can include all matching state parameters involved in the corresponding block.
[0093] The graphics processing device can sort the state parameter groups to be traversed corresponding to each puzzle block according to the sequence order of the target puzzle block sequence to obtain the sorted state parameter groups to be traversed, and then perform a depth-first traversal on each matching state parameter in the sorted state parameter groups to be traversed to query the target state parameter group in which every two matching state parameters meet the preset splicing conditions.
[0094] Furthermore, the process of the graphics processing device performing depth-first traversal on each matching state parameter in the sorted state parameter groups to be traversed may be as follows: the graphics processing device first selects a matching state parameter from the first group of state parameter groups to be traversed, and then selects a matching state parameter from the second group, and then determines the second overlap rate between the puzzle blocks corresponding to the two geometric parameters according to the geometric parameters in the two matching state parameters, if the second overlap rate is less than or equal to the second overlap rate threshold, the graphics processing device selects a matching state parameter from the third group, and performs pairwise processing on the three selected matching state parameters, determines the second overlap rate between the puzzle blocks corresponding to the two geometric parameters according to the geometric parameters in every two matching state parameters, if the second overlap rate between the two puzzle blocks is less than or equal to the second overlap rate threshold, the graphics processing device selects a matching state parameter from the fourth group, and so on, until the graphics processing device selects a matching state parameter from the last group, and when it is determined according to the geometric parameters in all the selected matching state parameters that the second overlap rate between every two puzzle blocks in the target puzzle block sequence is less than or equal to the second overlap rate threshold, all the selected matching state parameters are divided into a target state parameter group.
[0095] It should be noted that, in the process of the graphics processing device performing depth-first traversal on each matching state parameter in the sorted to-be-traversed state parameter group, in order to avoid duplication of traversal results, the traversal path of the graphics processing device is different each time.
[0096] In the disclosed embodiment, after obtaining the target graphic and the target puzzle sequence for splicing the target graphic, matching calculations can be performed on multiple to-be-matched object groups formed by pairwise combinations of each shape area in the target graphic and each puzzle in the target puzzle sequence, to obtain multiple matching state parameters of target matching object groups that meet preset matching conditions, and the matching state parameters are traversed to obtain at least one target state parameter group for splicing the target puzzle sequence into the target graphic, thereby realizing automatic design of puzzle answers to jigsaw puzzle questions, reducing the time spent in designing puzzle answers, and improving the development efficiency of jigsaw puzzle games.
[0097] In another embodiment of the present disclosure, in order to improve the reliability of matching calculation, each key point of the target graphic and each block vertex of each block can be used to perform matching calculation on the to-be-matched object group to obtain matching state parameters of the target matching object group.
[0098] In some embodiments of the present disclosure, before S120, the graphics processing method may further include:
[0099] Key point detection is performed on the target graphic to obtain multiple key points, each of which is located on at least one shape area.
[0100] Specifically, the graphics processing device may use a preset key point detection algorithm to perform key point detection on the target graphics to obtain a plurality of key points.
[0101] In order to avoid the existence of noise key points in the key points, the graphics processing device can also calculate the key point distance between every two key points based on the key point positions of the key points, such as the key point coordinates, and then cluster the multiple key points, and cluster the multiple key points whose key point distances are less than a preset distance threshold into a key point cluster to obtain at least one key point cluster, and then calculate the cluster center position of each key point cluster such as the cluster center coordinates based on the key point positions of each key point in each key point cluster, and then use the pixel point corresponding to the cluster center position as the key point finally obtained by key point detection of the target graphic, thereby removing the noise key points obtained in the process of key point detection of the target graphic.
[0102] In these embodiments, optionally, S120 may specifically include:
[0103] For the shape area corresponding to each key point, each block is matched with each shape area where the key point is located in turn according to the sequence order of the target block sequence to obtain the matching state parameters.
[0104] Specifically, the graphics processing device can perform pairwise matching calculations on each shape area corresponding to each key point and each puzzle block according to a preset key point detection order. In the process of performing pairwise matching calculations on each shape area corresponding to each key point and each puzzle block, each puzzle block can be matched with the group of objects to be matched belonging to each shape area where the key point is located in turn according to the sequence order of the target puzzle block sequence.
[0105] Optionally, the key point detection order can be the order of the key point positions from high to low in the target graphic. If there are at least two key point positions with the same height, the key point detection order can be further the order of the key point positions from left to right in the target graphic.
[0106] Furthermore, matching calculation is performed on each block with each shape region where the key point is located to obtain matching state parameters, which may specifically include:
[0107] For each vertex of each block, when the vertex of the block coincides with the key point, the block corresponding to the vertex of the block is matched with each shape area corresponding to the key point to obtain matching state parameters.
[0108] Specifically, in the process of performing matching calculations on the group of objects to be matched to which each block and each shape area where the key point is located belongs, the graphics processing device can start with a preset initial vertex corresponding to the block for each block, and in accordance with the preset vertex order corresponding to the block, sequentially overlap each vertex of the block with the key point respectively, and in the case where each vertex of the block coincides with the key point, perform matching calculations on the group of objects to be matched to which the block corresponding to the block vertex and the shape area corresponding to the key point belong respectively, so as to obtain matching state parameters.
[0109] It should be noted that the preset vertex order corresponding to each puzzle block can be preset as needed, and is not limited here. For example, the preset vertex order can be clockwise or counterclockwise. The preset initial vertex corresponding to each puzzle block can be preset as needed, and is not limited here.
[0110] Optionally, performing matching calculations on the blocks corresponding to the block vertices and each shape region corresponding to the key points to obtain matching state parameters may specifically include:
[0111] Rotate the block corresponding to the vertex of the block with the vertex of the block as the rotation center;
[0112] In the process of rotating the blocks corresponding to the block vertices, whenever the rotation angle reaches a preset angle, matching calculations are performed on the blocks corresponding to the block vertices and each shape area having an overlapping area therewith to obtain matching state parameters of the target matching object group that meets the preset matching conditions.
[0113] Specifically, when a vertex of a block coincides with a key point, the graphics processing device can rotate the block at a preset angle with the vertex as the rotation center, and during the process of rotating the block, each time the block is rotated by the preset angle, a matching calculation is performed on the block and the object to be matched that belongs to the shape area that has an overlapping area with the block to obtain matching state parameters.
[0114] Optionally, each block may correspond to a preset initial angle, and when a vertex of a block coincides with a key point, the graphics processing device may first place the block according to the preset initial angle, and then rotate the block one circle in a preset rotation direction starting from the preset initial angle.
[0115] It should be noted that the preset initial angle can be the initial angle of the angle between the side adjacent to the right of the vertex of the puzzle and the horizontal positive direction, or it can be defined as the initial angle of other angles, which is not limited here. The preset rotation direction can be clockwise or counterclockwise, which is not limited here.
[0116] Figure 3A schematic diagram of a scene in which key points and tile vertices coincide with each other is shown in an embodiment of the present disclosure. Figure 4 A schematic diagram of a puzzle rotation scene provided by an embodiment of the present disclosure is shown.
[0117] like Figure 3 As shown, when the key point 301 coincides with the vertex 303 of the tile 302, the preset initial angle may be 45°, and the horizontal positive direction may be the horizontal rightward direction in the figure. The graphics processing device may calculate the first area of the overlapping area between the tile 302 and the shape area 304 corresponding to the key point 301, and then calculate the ratio of the first area to the tile area of the tile 302. The ratio is the proportion of the overlapping area between the shape area 304 and the tile 302 relative to the tile 302. Therefore, the ratio is the first overlap rate between the shape area 304 and the tile 302. If the first overlap rate threshold is 95%, Figure 3 If the first overlapping rate shown is less than 95%, the to-be-matched object to which the patch 302 and the shape region 304 belong is not taken as the target to-be-matched object, and the geometric parameters corresponding to the overlapping region between the patch 302 and the shape region 304 are not obtained.
[0118] like Figure 4 As shown in FIG. 1 , in the process of rotating the block 302 counterclockwise from 45° with the block vertex 303 as the rotation center, if the preset angle is 45°, when the block 302 is rotated 45° so that the block angle (the angle between the side adjacent to the right of the block vertex and the horizontal positive direction) reaches 90°, as shown in FIG. Figure 4 As shown in the block 302 indicated by the solid line, the graphics processing device can calculate the first area of the overlapping area between the block 302 and the shape area 304 corresponding to the key point 301, and then calculate the ratio of the first area to the block area of the block 302. The ratio is the proportion of the overlapping area between the shape area 304 and the block 302 relative to the block 302. Therefore, the ratio is the first overlap rate between the shape area 304 and the block 302. If the first overlap rate threshold is 95%, Figure 4 If the first overlapping rate shown is less than 95%, the to-be-matched object to which the patch 302 and the shape region 304 belong is not taken as the target to-be-matched object, and the geometric parameters corresponding to the overlapping region between the patch 302 and the shape region 304 are not obtained.
[0119] Further, the graphics processing device can determine the first key point according to the key point detection order, select the first block according to the sequence order of the target block sequence, select the first block vertex according to the first preset vertex order of the block, and overlap the first block vertex with the first key point, rotate the first block with the first block vertex as the rotation center, and in the process of rotating the first block, each time the first block is rotated by a preset angle, perform matching calculation on the first block and the object to be matched that has an overlapping area with the first block, so as to obtain matching state parameters. Then, the graphics processing device can overlap the second vertex of the first block with the first key point, repeat the above operation, until the last vertex of the first block overlaps with the first key point, and after repeating the above operation, complete the matching calculation of the shape area corresponding to the first block and the key point. Then, the graphics processing device can repeat the above operation on the second, third, and last blocks according to the sequence order of the target block sequence. Finally, the graphics processing device can repeat the above operation on the second, third, and last key points according to the key point detection order to obtain matching state parameters.
[0120] In some embodiments of the present disclosure, the preset angle may be any pre-set angle, such as 5°, 15°, 45°, etc.
[0121] Optionally, when the puzzle is a tangram puzzle, the preset angle may be 45° to reduce the amount of matching calculation and improve the matching calculation speed.
[0122] In other embodiments of the present disclosure, the preset angle may also be the greatest common factor of the outer contour angles of the target graphic at various key points.
[0123] Specifically, the outer contour angle may be the angle of the outer contour at the key point on the side of the non-shape region.
[0124] In the embodiment of the present disclosure, since the preset angle is the greatest common divisor of the angles of each outer contour, it is possible to reduce the amount of matching calculations while avoiding omissions in matching calculations, thereby ensuring the reliability of matching calculations.
[0125] In yet another embodiment of the present disclosure, in order to avoid missing the answer to the puzzle, the embodiment of the present disclosure further provides a graphics processing method.
[0126] Figure 5 A flowchart of another graphics processing method provided by an embodiment of the present disclosure is shown.
[0127] like Figure 5 As shown, the graphics processing method may include the following steps.
[0128] S510, obtaining a target graphic and a target block sequence for assembling the target graphic, combining each shape region in the target graphic with each block in the target block sequence in pairs to form a plurality of to-be-matched object groups, wherein one to-be-matched object group includes one shape region and one block.
[0129] S520: Perform matching calculation on the to-be-matched object group to obtain matching state parameters of the target matching object group, where the target matching object group is the to-be-matched object group that meets a preset matching condition.
[0130] S530, traverse the matching state parameters to obtain at least one target state parameter group, the target state parameter group is used to splice the target block sequence into a target graphic, the target state parameter group includes multiple target matching state parameters, and one target matching state parameter corresponds to a target matching object group to which a block belongs.
[0131] Among them, S510-S530 and Figure 2 The S210-S230 shown in FIG. 1 are similar and will not be described in detail here.
[0132] S540 . For each target state parameter group, target matching state parameters corresponding to tiles with the same attributes in the target state parameter group are exchanged in pairs to obtain at least one exchanged target state parameter group.
[0133] In the disclosed embodiment, the graphics processing device can exchange target matching state parameters corresponding to puzzle pieces with the same attributes in each target state parameter group in pairs to obtain exchanged target state parameter groups, so as to avoid the incomplete target state parameter groups obtained by traversal due to the omission of traversal paths during the traversal process, thereby covering all puzzle answers and avoiding the omission of puzzle answers.
[0134] Specifically, the same attributes refer to the same block shape and block area, and the different attributes refer to different at least one of the block shape and block area.
[0135] For each target state parameter group, the target matching state parameters corresponding to the tiles with the same attributes in the target state parameter group can be combined in pairs to form at least one matching state parameter group to be exchanged. The graphics processing device can exchange the two target matching state parameters in each matching state parameter group to be exchanged in each target state parameter group, so as to achieve the pairwise exchange of the target matching state parameters corresponding to the tiles with the same attributes in each target state parameter group.
[0136] Continuing with the example of the tangram puzzle, the graphics processing device may exchange the target matching state parameters corresponding to every two triangle pieces with the same attributes in each target state parameter group, to obtain an exchanged target state parameter group.
[0137] Figure 6 A schematic diagram showing a puzzle answer transformation result provided by an embodiment of the present disclosure is shown.
[0138] like Figure 6 As shown, the graphics processing device can exchange the target matching state parameters corresponding to the tiles with the same attributes in a set of target state parameter groups corresponding to the first puzzle answer 601. Specifically, the graphics processing device can exchange the target matching state parameters corresponding to the first tile 602 and the second tile 603 with the same attributes in the first puzzle answer 601, and obtain the target state parameter group corresponding to the second puzzle answer 606. The graphics processing device can exchange the target matching state parameters corresponding to the third tile 604 and the fourth tile 605 with the same attributes in the first puzzle answer 601, and obtain the target state parameter group corresponding to the third puzzle answer 607. The graphics processing device can exchange the target matching state parameters corresponding to the first tile 602 and the second tile 603 in the first puzzle answer 601, and exchange the target matching state parameters corresponding to the third tile 604 and the fourth tile 605 in the first puzzle answer 601, and obtain the target state parameter group corresponding to the fourth puzzle answer 608. In another embodiment of the present disclosure, in order to avoid duplication of puzzle answers, the embodiment of the present disclosure also provides a graphics processing method.
[0139] In some embodiments of the present disclosure, Figure 1 After S130 shown, the graphics processing method may further include:
[0140] When it is determined that there is at least one group of state parameter groups to be deduplicated in the target state parameter group, deduplication processing is performed on each group of state parameter groups to be deduplicated to obtain a target state parameter group after deduplication, and every two target state parameter groups in each group of state parameter groups to be deduplicated meet a preset repetition condition.
[0141] In some other embodiments of the present disclosure, Figure 5 After S540, the graphics processing method may further include:
[0142] When it is determined that there is at least one group of state parameter groups to be deduplicated in the target state parameter group, deduplication processing is performed on each group of state parameter groups to be deduplicated to obtain a target state parameter group after deduplication, and every two target state parameter groups in each group of state parameter groups to be deduplicated meet a preset repetition condition.
[0143] In the embodiment of the present disclosure, the graphics processing device can first group the target state parameter groups, group every two target state parameter groups that meet the preset repetition condition, and obtain at least one group of state parameter groups to be deduplicated, and then retain one target state parameter group in each group of state parameter groups to be deduplicated, so as to perform deduplication processing on each group of state parameter groups to be deduplicated, and obtain the target state parameter groups after deduplication.
[0144] Optionally, the matching state parameters may include geometric parameters corresponding to the overlapping area between the blocks of the target state parameter group and the shape area, which have been described above and will not be repeated here.
[0145] Optionally, the preset repetition condition may include that a third overlap rate between every two identical tiles determined according to the geometric parameter is greater than or equal to a third overlap rate threshold.
[0146] The two identical blocks refer to two blocks with the same attributes. The third overlap ratio refers to the maximum proportion of the overlap area between the two identical blocks relative to each of the two blocks.
[0147] In some embodiments, the geometric parameter may include a first vertex position, wherein the first vertex position may be a position of each region vertex of an overlapping region between the tile and the shape region within the target graphic.
[0148] In other embodiments, the geometric parameters may also include the placement position and placement angle of the puzzle piece within the target graphic.
[0149] Among them, the method for determining the third overlap ratio according to the geometric parameters is similar to the method for determining the second overlap ratio according to the geometric parameters, and will not be described in detail here.
[0150] It should be noted that the third overlap rate threshold can be set as needed. For example, the third overlap rate threshold can be 50%, 70%, 90%, 95%, etc., and is not limited here.
[0151] Specifically, for every two target state parameter groups, the graphics processing device can determine the third overlap rate between every two puzzle pieces with the same attributes based on the geometric parameters in the target matching state parameters corresponding to every two puzzle pieces with the same attributes, and then compare each third overlap rate with the third overlap rate threshold in turn. If the comparison result is that each third overlap rate is greater than or equal to the third overlap rate threshold, it can be determined that the two target state parameter groups meet the preset repetition condition.
[0152] Optionally, when the graphics processing device determines that a preset number of third overlap rates are all greater than or equal to a third overlap rate threshold, it may determine that the comparison result is that each third overlap rate is greater than or equal to the third overlap rate threshold.
[0153] The difference between the preset number and the number of tiles in the target tile sequence may be 1.
[0154] Continuing with the example of the tangram puzzle, when the graphics processing device determines that the third overlap rates corresponding to the six puzzle pieces are all greater than or equal to the third overlap rate threshold, it can be determined that the comparison result is that the third overlap rates corresponding to the seven puzzle pieces are all greater than or equal to the third overlap rate threshold.
[0155] Therefore, in the embodiment of the present disclosure, if the graphics processing device obtains multiple duplicate puzzle answers, it can perform deduplication processing on the obtained puzzle answers to avoid generating duplicate puzzle answers.
[0156] The present disclosure also provides a graphics processing device. Figure 6 Provide explanation.
[0157] In some embodiments of the present disclosure, the graphics processing apparatus may be a graphics processing device. The graphics processing device may be a server, an electronic device, or other devices, which are not limited here. Among them, the server may be a cloud server or a server cluster or other devices with storage and computing functions. The electronic device may include a mobile phone, a tablet computer, a desktop computer, a laptop computer, a vehicle terminal, a wearable electronic device, an all-in-one machine, a smart home device, and other devices with communication functions, or may be a virtual machine or a device simulated by a simulator.
[0158] Figure 7 A schematic diagram of the structure of a graphics processing device provided by an embodiment of the present disclosure is shown.
[0159] like Figure 7 As shown, the graphics processing device 700 may include an acquisition unit 710 , a matching unit 720 and a traversal unit 730 .
[0160] The acquisition unit 710 can be configured to acquire a target graphic and a target block sequence for assembling the target graphic. Each shape region in the target graphic and each block in the target block sequence are combined in pairs to form multiple object groups to be matched. One object group to be matched includes a shape region and a block.
[0161] The matching unit 720 may be configured to perform matching calculation on the to-be-matched object group to obtain matching state parameters of the target matching object group, where the target matching object group is the to-be-matched object group that meets a preset matching condition.
[0162] The traversal unit 730 can be configured to traverse the matching state parameters to obtain at least one target state parameter group, where the target state parameter group is used to splice the target block sequence into a target graphic. The target state parameter group includes multiple target matching state parameters, and one target matching state parameter corresponds to a target matching object group to which a block belongs.
[0163] In the disclosed embodiment, after obtaining the target graphic and the target puzzle sequence for splicing the target graphic, matching calculations can be performed on multiple to-be-matched object groups formed by pairwise combinations of each shape area in the target graphic and each puzzle in the target puzzle sequence, to obtain multiple matching state parameters of target matching object groups that meet preset matching conditions, and the matching state parameters are traversed to obtain at least one target state parameter group for splicing the target puzzle sequence into the target graphic, thereby realizing automatic design of puzzle answers to jigsaw puzzle questions, reducing the time spent in designing puzzle answers, and improving the development efficiency of jigsaw puzzle games.
[0164] In some embodiments of the present disclosure, the preset matching condition may include that a first overlap rate between the shape region and the patch in the to-be-matched object group is greater than or equal to a first overlap rate threshold.
[0165] In some embodiments of the present disclosure, the graphics processing device 700 may further include a detection unit, which may be configured to perform key point detection on the target graphics to obtain a plurality of key points, each of which is located on at least one shape region.
[0166] Accordingly, the matching unit 720 may be further configured to perform matching calculations on each block with each shape region where the key point is located in sequence according to the sequence order of the target block sequence for the shape region corresponding to each key point, so as to obtain matching state parameters.
[0167] In some embodiments of the present disclosure, the matching unit 720 can be further configured to, for each vertex of each block, when the block vertex coincides with a key point, perform matching calculations on the block corresponding to the block vertex with each shape area corresponding to the key point to obtain matching state parameters.
[0168] In some embodiments of the present disclosure, the matching unit 720 may include a first matching sub-unit and a second matching sub-unit.
[0169] The first matching subunit may be configured to rotate the block corresponding to the vertex of the block with the vertex of the block as the rotation center.
[0170] The second matching subunit can be configured to perform matching calculations on the puzzle block corresponding to the puzzle block vertex and each shape area having an overlapping area therewith, respectively, whenever the rotation angle reaches a preset angle during the process of rotating the puzzle block corresponding to the puzzle block vertex, so as to obtain matching state parameters of the target matching object group that meets the preset matching conditions.
[0171] In some embodiments of the present disclosure, the preset angle may be the greatest common factor of the outer contour angles of the target graphic at various key points.
[0172] In some embodiments of the present disclosure, the matching state parameter may include a geometric parameter corresponding to an overlapping area between the patch and the shape area.
[0173] Accordingly, every two target matching state parameters in the target state parameter group may satisfy a preset splicing condition, and the preset splicing condition may include that a second overlap rate between two blocks determined according to the geometric parameters is less than or equal to a second overlap rate threshold.
[0174] In some embodiments of the present disclosure, the graphics processing device 700 may further include an exchange unit, which may be configured to, for each target state parameter group, exchange target matching state parameters corresponding to blocks with the same attributes in the target state parameter group in pairs to obtain at least one exchanged target state parameter group.
[0175] In some embodiments of the present disclosure, the graphics processing device 700 may further include a deduplication unit, which may be configured to, when it is determined that there is at least one state parameter group to be deduplicated in the target state parameter group, perform deduplication processing on each state parameter group to be deduplicated, to obtain a target state parameter group after deduplication, wherein every two target state parameter groups in each state parameter group to be deduplicated meet a preset repetition condition;
[0176] The matching state parameters include geometric parameters corresponding to the overlapping area between the blocks of the target state parameter group and the shape area, and the preset repetition condition includes that the third overlap rate between every two identical blocks determined according to the geometric parameters is greater than or equal to a third overlap rate threshold.
[0177] It should be noted that Figure 7 The graphics processing device 700 shown may execute Figures 1 to 6 The various steps in the method embodiment shown in the figure are implemented Figures 1 to 6 The various processes and effects in the method embodiment shown are not described in detail here.
[0178] The embodiment of the present disclosure also provides a graphics processing device, which may include a processor and a memory, wherein the memory may be used to store executable instructions. The processor may be used to read the executable instructions from the memory and execute the executable instructions to implement the graphics processing method in the above embodiment.
[0179] Figure 8 A schematic diagram of the structure of a graphics processing device provided by an embodiment of the present disclosure is shown. Figure 8 , which shows a structural schematic diagram of a graphics processing device 800 suitable for implementing the embodiments of the present disclosure.
[0180] The graphics processing device 800 in the embodiment of the present disclosure may be a server, an electronic device, or other devices, which are not limited here. The server may be a cloud server or a server cluster or other devices with storage and computing functions. The electronic device may include a mobile phone, a tablet computer, a desktop computer, a laptop computer, a vehicle terminal, a wearable electronic device, an all-in-one machine, a smart home device or other devices with communication functions, or may be a virtual machine or a device simulated by a simulator.
[0181] It should be noted that Figure 8 The illustrated graphics processing device 800 is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0182] like Figure 8 As shown, the graphics processing device 800 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803 to implement the graphics processing method in the above-mentioned embodiment. In the RAM 803, various programs and data required for the operation of the graphics processing device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0183] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication devices 809 may allow the graphics processing device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The graphics processing apparatus 800 is shown with various devices, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.
[0184] The embodiments of the present disclosure further provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the graphics processing method in the above embodiments.
[0185] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer software program.
[0186] The embodiments of the present disclosure further provide a computer program product, which may include a computer program. When the computer program is executed by a processor, the processor implements the graphics processing method in the above embodiments.
[0187] For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart to implement the graphics processing method in the above embodiment. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above functions defined in the graphics processing method of the embodiment of the present disclosure are executed.
[0188] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0189] In some embodiments, the client and server may communicate using any currently known or future developed network protocol such as HTTP, and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0190] The computer-readable medium may be included in the graphics processing device; or may exist independently without being assembled into the graphics processing device.
[0191] The computer-readable medium carries one or more programs. When the one or more programs are executed by the graphics processing device, the graphics processing device executes:
[0192] A target graphic and a target mosaic sequence for splicing the target graphic are obtained, each shape region in the target graphic and each mosaic in the target mosaic sequence are combined in pairs to form a plurality of to-be-matched object groups, one to-be-matched object group includes a shape region and a mosaic; a matching calculation is performed on the to-be-matched object group to obtain a matching state parameter of the target matching object group, the target matching object group is a to-be-matched object group that satisfies a preset matching condition; the matching state parameters are traversed to obtain at least one target state parameter group, the target state parameter group is used to splice the target mosaic sequence into a target graphic, the target state parameter group includes a plurality of target matching state parameters, one target matching state parameter corresponds to the target matching object group to which a mosaic belongs.
[0193] In embodiments of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0194] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0195] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0196] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0197] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0198] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0199] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0200] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A graphics processing method, characterized in that: include: Acquire a target graphic and a target block sequence for splicing the target graphic, wherein each shape region in the target graphic and each block in the target block sequence are combined in pairs to form a plurality of to-be-matched object groups, wherein one to-be-matched object group includes a shape region and a block; Performing matching calculation on the to-be-matched object group to obtain matching state parameters of the target matching object group, the target matching object group being a to-be-matched object group that satisfies a preset matching condition, wherein the matching state parameters are obtained by matching each of the puzzle blocks with each shape region where a key point is located in sequence order of the target puzzle block sequence, and the key point is obtained by performing key point detection on the target graphic; The matching state parameters are traversed to obtain at least one target state parameter group, wherein the target state parameter group is used to splice the target block sequence into the target graphic, and the target state parameter group includes multiple target matching state parameters, and one target matching state parameter corresponds to a target matching object group to which a block belongs.
2. The method according to claim 1, characterized in that The preset matching condition includes that a first overlap rate between the shape region and the patch in the to-be-matched object group is greater than or equal to a first overlap rate threshold.
3. The method according to claim 1, characterized in that Before performing matching calculation on the to-be-matched object group to obtain the matching state parameters of the target matching object group, the method further includes: Performing key point detection on the target graphic to obtain a plurality of key points, each of which is located on at least one shape region; The performing of matching calculation on the to-be-matched object group to obtain the matching state parameters of the target matching object group includes: For each shape region corresponding to the key point, each of the blocks is matched with each shape region where the key point is located in turn according to the sequence order of the target block sequence to obtain the matching state parameter.
4. The method according to claim 3, characterized in that: The matching calculation of each of the blocks with each of the shape regions where the key points are located to obtain the matching state parameters includes: For each vertex of each of the blocks, when the vertex of the block coincides with the key point, a matching calculation is performed on the block corresponding to the vertex of the block and each shape area corresponding to the key point to obtain the matching state parameter.
5. The method according to claim 4, characterized in that The matching calculation of the blocks corresponding to the block vertices with each shape area corresponding to the key points to obtain the matching state parameters includes: Rotate the block corresponding to the vertex of the block with the vertex of the block as the rotation center; In the process of rotating the puzzle block corresponding to the puzzle block vertex, whenever the rotation angle reaches a preset angle, matching calculations are performed on the puzzle block corresponding to the puzzle block vertex and each shape area having an overlapping area therewith to obtain the matching state parameters of the target matching object group that meets the preset matching conditions.
6. The method according to claim 5, characterized in that The preset angle is the greatest common factor of the outer contour angles of the target figure at each of the key points.
7. The method according to claim 1, characterized in that The matching state parameters include geometric parameters corresponding to the overlapping area between the blocks and the shape area in the target matching object group; Wherein, every two of the target matching state parameters in the target state parameter group satisfy a preset splicing condition, and the preset splicing condition includes that a second overlap rate between two mosaic blocks determined according to the geometric parameters is less than or equal to a second overlap rate threshold.
8. The method according to claim 1, characterized in that After traversing the matching state parameters to obtain at least one target state parameter group, the method further includes: For each of the target state parameter groups, target matching state parameters corresponding to the tiles with the same attributes in the target state parameter group are exchanged in pairs to obtain at least one exchanged target state parameter group.
9. The method according to claim 1 or 8, characterized in that: The method further comprises: When it is determined that there is at least one group of state parameter groups to be deduplicated in the target state parameter groups, deduplication processing is performed on each group of the state parameter groups to be deduplicated to obtain a target state parameter group after deduplication, and a preset repetition condition is satisfied between every two target state parameter groups in each group of the state parameter groups to be deduplicated; Among them, the matching state parameters include geometric parameters corresponding to the overlapping area between the blocks and the shape area of the target state parameter group, and the preset repetition condition includes that the third overlap rate between every two blocks with the same attributes determined according to the geometric parameters is greater than or equal to a third overlap rate threshold.
10. A graphics processing device, characterized in that: include: An acquisition unit is configured to acquire a target graphic and a target mosaic sequence for mosaicking the target graphic, wherein each shape region in the target graphic and each mosaic in the target mosaic sequence are combined in pairs to form a plurality of to-be-matched object groups, wherein one to-be-matched object group includes a shape region and a mosaic; A matching unit, configured to perform matching calculation on the to-be-matched object group to obtain matching state parameters of a target matching object group, wherein the target matching object group is a to-be-matched object group that satisfies a preset matching condition, wherein the matching state parameters are obtained by matching each of the blocks with each shape region where a key point is located in sequence order of the target block sequence, and the key point is obtained by performing key point detection on the target graphic; A traversal unit is configured to traverse the matching state parameters to obtain at least one target state parameter group, wherein the target state parameter group is used to splice the target block sequence into the target graphic, and the target state parameter group includes multiple target matching state parameters, and one target matching state parameter corresponds to a target matching object group to which a block belongs.
11. A graphics processing device, characterized in that: include: processor; A memory for storing executable instructions; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the graphics processing method described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the graphics processing method according to any one of claims 1 to 9.
13. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the processor is enabled to implement the graphics processing method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method for achieving interactive tangram game based on intelligent toy
CN107185227A
Image data processing method and device and storage medium
CN110058829A