Automatic detection method of continuous similar sub-block modules in puzzles based on color art
Through the automatic detection method of puzzles based on color art, grid processing and k-means algorithm are used to automatically form sub-block modules with similar features, which solves the problem of time-consuming and labor-consuming construction of puzzle modules, and achieves the effect of quickly generating puzzle sub-blocks and improving user satisfaction.
Patent Information
- Application Number
- CN202211110646.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-13
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2042-09-13
AI Technical Summary
The establishment of existing puzzle modules mainly relies on manual operations, which are time-consuming and labor-intensive, and it is difficult to ensure work efficiency and output quantity, and it is difficult to quickly generate a large number of images and convert them into puzzle sub-blocks.
The puzzle automatic detection method based on color art is adopted, and the puzzle outline is obtained through grid processing and Canny detection algorithm, and the puzzle outline sub-blocks are filtered by non-image edge puzzle outlines. The k-means method is used to extract feature colors and establish 19 types of four-connection connection models, and sub-block modules with similar features are automatically detected and formed.
It realizes the rapid generation of a large number of puzzle sub-blocks to meet the requirements of different numbers of feature-like adjacency sub-block modules, simplifies the image processing process of puzzle games, and improves work efficiency and user satisfaction.
Smart Images

Figure CN115375670B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an automatic detection method for puzzle modules in a puzzle, and in particular to an automatic detection method for continuous similar sub-block modules in a puzzle based on image color art. Background Art
[0002] Jigsaw puzzles are a popular intellectual game, often used for both education and entertainment. Jigsaw puzzles often feature natural scenery, buildings, and familiar motifs. To solve the puzzle, players first identify the number of pieces with straight lines on one and two sides, then combine the four sides of the image. Players also categorize what they consider to be adjacent pieces. To reduce puzzle difficulty and enhance player experience and satisfaction, game companies combine four adjacent pieces with distinct image content and two non-adjacent pieces with significantly different content into a puzzle module. These pieces, along with the remaining pieces, form a puzzle column.
[0003] Due to factors such as the variability, complexity, and uncertainty of image content, the current assembly of puzzle modules is mainly done manually, which is not only time-consuming and labor-intensive, but also difficult to guarantee work efficiency and output quantity. It is also difficult to convert a large number of images into puzzle pieces and generate puzzle games in a short period of time. Summary of the Invention
[0004] In order to solve the problem of how to automatically assemble sub-block modules with similar features and adjacent to each other in the background art, the present invention provides an automatic detection method for continuous similar sub-block modules in a puzzle based on color art.
[0005] The technical solution adopted by the present invention to solve the technical problem includes the following steps:
[0006] 1) Gridding the puzzle image to obtain all corresponding initial puzzle sub-blocks, and using the Canny detection algorithm to obtain and mark the content contour lines of the puzzle image; based on the contour marking lines of the puzzle image and all the initial puzzle sub-blocks, obtain all corresponding puzzle contour sub-blocks;
[0007] 2) Filtering all puzzle contour sub-blocks to obtain non-image edge puzzle contour sub-blocks, and then classifying all non-image edge puzzle contour sub-blocks according to the number of contour lines to obtain multiple categories of non-edge puzzle sub-blocks;
[0008] 3) performing puzzle sub-block module detection on various non-edge puzzle sub-blocks using a continuous similar sub-block automatic detection method to obtain at least one puzzle sub-block module;
[0009] 4) Selecting a preset number of puzzle sub-block modules, removing the selected puzzle sub-block modules from all puzzle contour sub-blocks not on the edge of the image to obtain a remaining puzzle contour sub-block set, then filtering the two puzzle contour sub-blocks corresponding to the selected puzzle sub-block module from the remaining puzzle contour sub-block set, forming each puzzle requirement module from each selected puzzle sub-block module and the corresponding two puzzle contour sub-blocks, and forming a continuous similar sub-block module from the initial puzzle sub-blocks corresponding to each puzzle requirement module.
[0010] In the above 2), the multiple types of non-edge puzzle sub-blocks include puzzle sub-blocks without contour marking lines, puzzle sub-blocks with a single contour marking line, and puzzle sub-blocks with multiple contour marking lines.
[0011] Said 3) is specifically:
[0012] 3.1) Extracting the characteristic colors of each puzzle outline sub-block within each type of non-edge puzzle sub-block, then calculating the color difference between two puzzle outline sub-blocks within each type of non-edge puzzle sub-block, and classifying each puzzle outline sub-block within each type of non-edge puzzle sub-block based on the color difference, thereby obtaining puzzle sub-block groups of different color difference classes within each type of non-edge puzzle sub-block;
[0013] 3.2) Establishing 19 types of four-connected connection models, and then using the 19 types of four-connected connection models to respectively assemble four adjacent puzzle sub-blocks of different color difference classes in each type of non-edge puzzle sub-block, to obtain at least one puzzle sub-block module.
[0014] The above 3.1) is specifically:
[0015] When the category of the non-edge puzzle sub-block is the puzzle sub-block without outline marking lines, the k-means method is used to extract the main color of each puzzle sub-block without outline marking lines. The main color with the largest pixel ratio in each puzzle sub-block without outline marking lines is used as the corresponding feature color. The color difference between each puzzle sub-block without outline marking lines is then calculated. Two puzzle sub-blocks without outline marking lines with a color difference less than or equal to the color difference threshold are classified into one category, and groups of puzzle sub-blocks without outline marking lines of different color difference categories are obtained.
[0016] When the category of the non-edge puzzle sub-block is a single contour marker line puzzle sub-block, the k-means method is used to extract the main color of each single contour marker line puzzle sub-block, and the two main colors of each single contour marker line puzzle sub-block are obtained and used as the corresponding two feature colors respectively. Then, the color difference between each pair of single contour marker line puzzle sub-blocks is calculated, and two single contour marker line puzzle sub-blocks with a color difference less than or equal to the color difference threshold are classified into one category, thereby obtaining single contour marker line puzzle sub-block groups of different color difference categories;
[0017] When the category of the non-edge puzzle sub-block is a multiple contour marker line puzzle sub-block, the k-means method is used to extract the main color of each multiple contour marker line puzzle sub-block, and the three main colors of each multiple contour marker line puzzle sub-block are obtained and used as the corresponding three feature colors respectively. Then, the color difference between each pair of multiple contour marker line puzzle sub-blocks is calculated, and two multiple contour marker line puzzle sub-blocks with a color difference less than or equal to a color difference threshold are classified into one category, thereby obtaining multiple contour marker line puzzle sub-block groups of different color difference categories;
[0018] The color difference threshold is 6.5.
[0019] In the above 4), the main color of each puzzle outline sub-block in the remaining puzzle outline sub-block set is extracted by using the k-means method to obtain two main colors of each puzzle outline sub-block and use them as two feature colors respectively. According to the position and feature color of the puzzle outline sub-block in each puzzle sub-block module, two puzzle outline sub-blocks that are not adjacent to the four puzzle outline sub-blocks in the current puzzle sub-block module in position and whose color difference is greater than the color difference threshold are selected from the remaining puzzle outline sub-block set, and the two puzzle outline sub-blocks are combined with the current puzzle sub-block module to form a puzzle requirement module.
[0020] The color difference threshold is 6.5.
[0021] The beneficial effects of the present invention are mainly manifested in:
[0022] 1) The specially constructed continuous similar sub-block automatic detection method of the present invention successfully detects, screens, and constructs feature-similar adjacent sub-block modules by subdividing the image content, and ensures that the content relationship of the constructed puzzle sub-blocks is reasonable.
[0023] 2) This invention can rapidly process large numbers of images into puzzle pieces, generating modules that meet the needs of varying numbers of similarly characterized, adjacent sub-pieces. For example, a 64-piece puzzle requires three modules, a 100-piece puzzle requires five modules, and a 144-piece puzzle requires eight modules. Generating a 64-piece puzzle from a 2048 × 2048 image, containing three modules with similarly characterized, adjacent sub-pieces, takes only about 10 seconds.
[0024] 3) The method of the present invention is simple and easy to apply, and can quickly process puzzle sub-pieces that meet the requirements and adjacent sub-piece modules with similar features. In addition, the processing model maintenance does not require the staff to have professional knowledge and experience in computer image processing, and has great application potential in the image processing of jigsaw puzzle games. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a flow chart of the method of the present invention.
[0026] Figure 2 It is a schematic diagram for supplementing the process of the method of the present invention.
[0027] Figure 3 It is a schematic diagram of the pretreatment involved in the method of the present invention.
[0028] Figure 4 It is a schematic diagram of the target processing result of the present invention.
[0029] Figure 5 It is a schematic diagram of a scheme for assembling four adjacent puzzle pieces of the present invention.
[0030] Figure 6 Schematic diagram of an image to be processed in Example 1 of the present invention.
[0031] Figure 7 Schematic diagram of adjacent sub-block modules with similar features of 64 puzzle pieces after image detection processing in Example 1 of the present invention.
[0032] Figure 8 1 is a schematic diagram of adjacent sub-block modules with similar features of 100 puzzle pieces after image detection processing in Example 1 of the present invention. DETAILED DESCRIPTION
[0033] In order to more clearly illustrate the purpose and technical solutions of the present invention, the present invention is further described in detail below with reference to the accompanying drawings.
[0034] like Figure 1 As shown, the present invention includes the following steps:
[0035] 1) The puzzle image of this embodiment is as follows Figure 3 As shown in (a), the puzzle image is gridded to obtain all the corresponding initial puzzle sub-blocks, that is, multiple square blocks of the same size, such as Figure 3 As shown in (b), the Canny detection algorithm is used to obtain and mark the content contour line of the puzzle image, as shown in Figure 3 As shown in (c); according to the contour marking line of the puzzle image and all the initial puzzle sub-blocks, all corresponding puzzle contour sub-blocks are obtained;
[0036] 2) Filtering non-image-edge puzzle contour sub-blocks from all puzzle contour sub-blocks, i.e., removing puzzle contour sub-blocks on the edge lines around the image, and then classifying all non-image-edge puzzle contour sub-blocks according to the number of contour lines to obtain multiple categories of non-edge puzzle sub-blocks;
[0037] 2) The multiple types of non-edge puzzle sub-blocks include puzzle sub-blocks without contour marker lines, puzzle sub-blocks with a single contour marker line, and puzzle sub-blocks with multiple contour marker lines. Specifically, a puzzle contour sub-block without a contour marker line is considered a puzzle sub-block without contour marker lines; a puzzle contour sub-block with only one contour marker line is considered a puzzle sub-block with a single contour marker line; and a puzzle contour sub-block with two or more contour marker lines is considered a puzzle sub-block with multiple contour marker lines.
[0038] 3) performing puzzle sub-block module detection on various non-edge puzzle sub-blocks using a continuous similar sub-block automatic detection method to obtain at least one puzzle sub-block module;
[0039] 3) Specifically:
[0040] 3.1) Performing feature color extraction on each non-image edge puzzle outline sub-block within each non-edge puzzle sub-block, then calculating the color difference between two non-image edge puzzle outline sub-blocks within each non-edge puzzle sub-block, and classifying the non-image edge puzzle outline sub-blocks within each non-edge puzzle sub-block based on the color difference to obtain puzzle sub-block groups of different color difference classes within each non-edge puzzle sub-block;
[0041] 3.1) Specifically:
[0042] like Figure 2 As shown in the figure, when the category of the non-edge puzzle sub-block is the puzzle sub-block without contour marking line, the k-means method is used to extract the main color of each puzzle sub-block without contour marking line, mainly extracting two main colors, and taking the main color with the largest pixel proportion in each puzzle sub-block without contour marking line as the characteristic color of the current puzzle sub-block without contour marking line. Then, the color difference (ΔE) between each puzzle sub-block without contour marking line is calculated, and two puzzle sub-blocks without contour marking line with a color difference less than or equal to the color difference threshold (i.e., ΔE1≤6.5) are classified into one category, and puzzle sub-block groups without contour marking line of different color difference categories are obtained.
[0043] When the category of the non-edge puzzle sub-block is a single contour marker line puzzle sub-block, the k-means method is used to extract the main color of each single contour marker line puzzle sub-block, and the two main colors of each single contour marker line puzzle sub-block are obtained and used as two characteristic colors respectively. Then, the color difference (ΔE) between each pair of single contour marker line puzzle sub-blocks is calculated. Since each single contour marker line puzzle sub-block has two characteristic colors, there are four values of the color difference between two single contour marker line puzzle sub-blocks. There is a color difference between two single contour marker line puzzle sub-blocks that is less than or equal to the color difference threshold (i.e., ΔE1≤6.5). Therefore, the two single contour marker line puzzle sub-blocks with a color difference less than or equal to the color difference threshold are classified into one category, and single contour marker line puzzle sub-block groups of different color difference categories are obtained.
[0044] When the category of the non-edge puzzle sub-block is a multiple contour marker line puzzle sub-block, the k-means method is used to extract the main color of each multiple contour marker line puzzle sub-block, and the three main colors of each multiple contour marker line puzzle sub-block are obtained and used as the three characteristic colors respectively. Then, the color difference (ΔE) between each pair of multiple contour marker line puzzle sub-blocks is calculated. Since each multiple contour marker line puzzle sub-block has three characteristic colors, there are nine values of color difference between two single contour marker line puzzle sub-blocks. If the color difference between two single contour marker line puzzle sub-blocks is less than or equal to the color difference threshold (i.e., ΔE1≤6.5), the two multiple contour marker line puzzle sub-blocks with a color difference less than or equal to the color difference threshold are classified into one category to obtain multiple contour marker line puzzle sub-block groups of different color difference categories; the color difference threshold is 6.5.
[0045] 3.2) Establish 19 types of four-connected connection models, the specific models are as follows Figure 5 As shown, 19 types of four-connected connection models are then used to form adjacent 4 puzzle blocks for each type of non-edge puzzle block, including puzzle blocks of different color difference classes (i.e., puzzle blocks without contour marking lines, puzzle blocks with a single contour marking line, and puzzle blocks with multiple contour marking lines of different color difference classes). Figure 4 In a specific implementation, the puzzle sub-block groups without contour marking lines are processed first, followed by the puzzle sub-block groups with a single contour marking line, and finally the puzzle sub-block groups with multiple contour marking lines.
[0046] 4) Selecting a preset number of puzzle sub-block modules, removing the selected puzzle sub-block modules from all puzzle contour sub-blocks not on the edge of the image to obtain a remaining puzzle contour sub-block set, then filtering the two puzzle contour sub-blocks corresponding to the selected puzzle sub-block module from the remaining puzzle contour sub-block set, forming each puzzle requirement module from each selected puzzle sub-block module and the corresponding two puzzle contour sub-blocks, and forming a continuous similar sub-block module from the initial puzzle sub-blocks corresponding to each puzzle requirement module.
[0047] 4), the k-means method is used to extract the main color of each puzzle outline sub-block in the remaining puzzle outline sub-block set, and the two main colors of each puzzle outline sub-block are obtained and used as the two feature colors respectively. According to the position and feature color of the puzzle outline sub-block in each puzzle sub-block module, two puzzle outline sub-blocks that are not adjacent to the four puzzle outline sub-blocks in the current puzzle sub-block module and whose color difference is greater than the color difference threshold (i.e., ΔE1>6.5) are selected from the remaining puzzle outline sub-block set and are placed at the head and tail of the current puzzle sub-block module respectively to form a puzzle requirement module with the current puzzle sub-block module. Specific embodiment:
[0049] The present invention adopts Figure 6 The cartoon image shown is pixel-stylized; Figure 7 As shown in (a), (b), (c) and (d), after the detection processing of the image, a 64-piece puzzle feature similar adjacent sub-block module is generated; Figure 8 As shown in (a), (b), (c), (d), (e) and (f), the image is detected and processed to generate a puzzle feature similarity adjacent sub-block module of 100 puzzle pieces.
[0050] As can be seen from the above embodiments, the method of the present invention can generate any number of puzzle sub-blocks and establish a corresponding number of adjacent sub-block modules with similar puzzle features therein, which has great application potential in affecting the difficulty of puzzle games and improving the satisfaction of game users.
[0051] The above specific embodiments are used to illustrate the present invention rather than to limit the present invention. Any modifications and changes made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.
Claims
1. A method for automatically detecting consecutive similar sub-block modules in a puzzle based on color art, characterized in that: The following steps are involved: 1) Gridding the puzzle image to obtain all corresponding initial puzzle sub-blocks. At the same time, the Canny detection algorithm is used to obtain and mark the content contour lines of the puzzle image. Based on the contour marking lines of the puzzle image and all the initial puzzle sub-blocks, all corresponding puzzle contour sub-blocks are obtained. 2) Filtering all jigsaw contour sub-blocks to obtain non-image edge jigsaw contour sub-blocks, and then classifying all non-image edge jigsaw contour sub-blocks according to the number of contour lines to obtain multiple categories of non-edge jigsaw sub-blocks; 3) performing puzzle sub-block module detection on various non-edge puzzle sub-blocks using a continuous similar sub-block automatic detection method to obtain at least one puzzle sub-block module; Said 3) is specifically: 3.1) Extracting the characteristic colors of each puzzle outline sub-block within each type of non-edge puzzle sub-block, then calculating the color difference between two puzzle outline sub-blocks within each type of non-edge puzzle sub-block, and classifying each puzzle outline sub-block within each type of non-edge puzzle sub-block based on the color difference, thereby obtaining puzzle sub-block groups with different color difference classes within each type of non-edge puzzle sub-block; The above 3.1) is specifically: When the category of the non-edge puzzle sub-block is the puzzle sub-block without outline marking lines, the k-means method is used to extract the main color of each puzzle sub-block without outline marking lines. The main color with the largest pixel ratio in each puzzle sub-block without outline marking lines is used as the corresponding feature color. The color difference between each puzzle sub-block without outline marking lines is then calculated. Two puzzle sub-blocks without outline marking lines with a color difference less than or equal to the color difference threshold are classified into one category, and groups of puzzle sub-blocks without outline marking lines of different color difference categories are obtained. When the category of the non-edge puzzle sub-block is a single contour marker line puzzle sub-block, the k-means method is used to extract the main color of each single contour marker line puzzle sub-block, and the two main colors of each single contour marker line puzzle sub-block are obtained and used as the corresponding two feature colors respectively. Then, the color difference between each pair of single contour marker line puzzle sub-blocks is calculated, and two single contour marker line puzzle sub-blocks with a color difference less than or equal to the color difference threshold are classified into one category, thereby obtaining single contour marker line puzzle sub-block groups of different color difference categories; When the category of the non-edge puzzle sub-block is a multiple contour marker line puzzle sub-block, the k-means method is used to extract the main color of each multiple contour marker line puzzle sub-block, and the three main colors of each multiple contour marker line puzzle sub-block are obtained and used as the corresponding three feature colors respectively. Then, the color difference between each pair of multiple contour marker line puzzle sub-blocks is calculated, and two multiple contour marker line puzzle sub-blocks with a color difference less than or equal to a color difference threshold are classified into one category, thereby obtaining multiple contour marker line puzzle sub-block groups of different color difference categories; 3.2) Establishing 19 types of four-connectivity models, and then using the 19 types of four-connectivity models to assemble four adjacent puzzle blocks of different color difference classes in each type of non-edge puzzle block, to obtain at least one puzzle block module; 4) Selecting a preset number of puzzle sub-block modules, removing the selected puzzle sub-block modules from all puzzle contour sub-blocks not on the edge of the image to obtain a remaining puzzle contour sub-block set, then filtering the two puzzle contour sub-blocks corresponding to the selected puzzle sub-block module from the remaining puzzle contour sub-block set, forming each puzzle requirement module from each selected puzzle sub-block module and the corresponding two puzzle contour sub-blocks, and forming a continuous similar sub-block module from the initial puzzle sub-blocks corresponding to each puzzle requirement module.
2. The automatic detection method of continuous similar sub-block modules in a puzzle based on color art according to claim 1, characterized in that: In the above 2), the multiple types of non-edge puzzle sub-blocks include puzzle sub-blocks without contour marking lines, puzzle sub-blocks with a single contour marking line, and puzzle sub-blocks with multiple contour marking lines.
3. The automatic detection method of continuous similar sub-block modules in a puzzle based on color art according to claim 1, characterized in that: The color difference threshold is 6.
5.
4. The automatic detection method of continuous similar sub-block modules in a puzzle based on color art according to claim 1, characterized in that: In the above 4), the main color of each puzzle outline sub-block in the remaining puzzle outline sub-block set is extracted by using the k-means method to obtain two main colors of each puzzle outline sub-block and use them as two feature colors respectively. According to the position and feature color of the puzzle outline sub-block in each puzzle sub-block module, two puzzle outline sub-blocks that are not adjacent to the four puzzle outline sub-blocks in the current puzzle sub-block module in position and whose color difference is greater than the color difference threshold are selected from the remaining puzzle outline sub-block set, and the two puzzle outline sub-blocks are combined with the current puzzle sub-block module to form a puzzle requirement module.
Citation Information
Patent Citations
Number-placement puzzle having separated block group
JP2010029338A
Generating Polyomino Video Game Pieces and Puzzle Pieces from Digital Photos to Create Photominoes
US20080182635A1