A map generation method and device, computer equipment and a storage medium

By acquiring map path transformation probabilities and iterative processing, and combining user sketches and skeleton diagrams to optimize map generation, the problem of time-consuming and laborious manual drawing of complex game maps is solved, and high-quality and beautiful maps are generated automatically.

CN116212395BActive Publication Date: 2025-11-28DOUYIN VISION CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310149671.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-10
Publication Date
2025-11-28
Estimated Expiration
2043-02-10

AI Technical Summary

Technical Problem

In existing technologies, manually drawing complex game maps is time-consuming, labor-intensive, and requires specialized knowledge, resulting in high labor costs.

Method used

By obtaining the map path transformation probability, an initial map path is generated, and an intermediate map path is determined based on the proportion of neighboring pixels. The process is iterative to generate the target map, and the map path transformation probability is optimized by combining the user-drawn path sketch and skeleton diagram.

Benefits of technology

It automatically generates smooth and beautiful maps randomly, reducing production costs and improving map quality and aesthetics, while possessing both randomness and beauty.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116212395B_ABST
    Figure CN116212395B_ABST
Patent Text Reader

Abstract

The present disclosure provides a map generation method and device, computer equipment and a storage medium, wherein the method comprises: obtaining a map path conversion probability of each pixel point in a preset geographical range; generating an initial map path based on the map path conversion probability; for each pixel point in the preset geographical range, determining whether the pixel point belongs to a pixel point in an intermediate map path based on a proportion of each neighborhood pixel point of the pixel point that belongs to the pixel point in the initial map path, to obtain the intermediate map path; taking the intermediate map path as an updated initial map path, repeating the step of determining the intermediate map path until a preset iteration number is reached, and generating a target map based on the intermediate map path after the last iteration.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, and in particular, to a map generation method and device, a computer device, and a storage medium. BACKGROUND

[0002] At present, a corresponding game map is usually designed for a game scene, and more and more rich gameplays are provided for players based on the game map. In the related art, the game map is mainly drawn by manual work. In the case that the game map is large and the scene is complex, this manual drawing of the game map is time-consuming and laborious. In order to improve the accuracy of the drawn game map, the staff drawing the game map usually needs to have certain professional knowledge, which further increases the labor cost of drawing the game map. SUMMARY

[0003] The present disclosure provides at least a map generation method and device, a computer device, and a storage medium.

[0004] In a first aspect, the present disclosure provides a map generation method, which includes: obtaining a map path conversion probability of each pixel point in a preset geographical range; the map path conversion probability is used to indicate a probability of the pixel point being converted from a non-map path pixel point to a map path pixel point; generating an initial map path based on the map path conversion probability; for each pixel point in the preset geographical range, determining whether the pixel point belongs to a pixel point in an intermediate map path based on a proportion of the pixel point in each neighborhood pixel point belonging to the pixel point in the initial map path, to obtain the intermediate map path; taking the intermediate map path as an updated initial map path, repeating the step of determining the intermediate map path until a preset iteration number is reached, and generating a target map based on the intermediate map path after the last iteration.

[0005] In an optional implementation, the generating of the target map based on the intermediate map path after the last iteration includes: if there are multiple map path parts that are not connected in the intermediate map path, starting multiple agent threads; determining a current to-be-connected map path part from the multiple map path parts, and for each agent thread, randomly selecting a pixel point from the current to-be-connected map path part as a starting pixel point and randomly generating a candidate path from the starting pixel point to other map path parts; taking a shortest path in each candidate path generated by the multiple agent threads as a path of the target map; repeating the step of determining the current to-be-connected map path part from the multiple map path parts until the connection between the multiple map path parts is completed, to obtain the path of the target map.

[0006] In an alternative embodiment, before generating the initial map path based on the map path transition probability, the method further comprises: obtaining a path sketch drawn by a user; generating a skeleton map based on the path sketch; the skeleton map matches the style of the path sketch, and the skeleton map does not contain any pixel point belonging to the path sketch; and determining the map path transition probability based on the path sketch and the skeleton map.

[0007] In an alternative embodiment, the determining the map path transition probability based on the path sketch and the skeleton map comprises: determining the map path transition probability of each pixel point other than the path sketch and the skeleton map belonging to the initial map path based on the obtained path width weight and the Manhattan distance of each pixel point other than the path sketch and the skeleton map to the path sketch; setting the map path transition probability of each pixel point in the path sketch to 1; and setting the map path transition probability of each pixel point in the skeleton map to 0.

[0008] In an alternative embodiment, the determining the map path transition probability of each pixel point other than the path sketch and the skeleton map belonging to the initial map path comprises: determining the map path transition probability of each pixel point under each path width weight based on the obtained multiple path width weights and the Manhattan distance of each pixel point to the path sketch; and the generating the initial map path based on the map path transition probability comprises: generating multiple initial map paths based on the map path transition probability corresponding to each path width weight; and after obtaining the path of the target map corresponding to each of the multiple initial map paths, the method further comprises: displaying the paths of the multiple target maps and determining the path of the target map selected by the user from the paths of the multiple target maps.

[0009] In an alternative embodiment, after generating the target map, the method further comprises: in response to receiving modification information of the path sketch input by the user, updating the target map based on the modified path part indicated by the modification information.

[0010] In an alternative embodiment, the updating the target map based on the modified path portion indicated by the modification information comprises: determining an updated path sketch based on the modified path portion indicated by the modification information, and generating an updated skeleton map based on the updated path sketch; determining an associated geographical range corresponding to the modified path portion; updating the map path transition probability based on the updated path sketch, the updated skeleton map, and the associated geographical range; wherein the map path transition probability of each pixel point in the path of the target map before the update and outside the associated geographical range is set to 1, and the map path transition probability of each pixel point not in the path of the target map before the update is set to 0; generating an updated initial map path based on the updated map path transition probability, and generating an updated target map based on the updated initial map path.

[0011] In an alternative embodiment, the updating the map path transition probability based on the updated path sketch, the updated skeleton map, and the associated geographical range comprises: determining an updated map path transition probability corresponding to each target pixel point in the preset geographical range and inside the associated geographical range based on the path width weight and the Manhattan distance of each target pixel point to the updated path sketch; setting the map path transition probability of each pixel point in the updated path sketch inside the associated geographical range to 1; and setting the map path transition probability of each pixel point in the updated skeleton map inside the associated geographical range to 0.

[0012] In an alternative embodiment, the generating an updated target map based on the updated initial map path comprises: for each pixel point in the associated geographical range, determining whether the pixel point belongs to the intermediate map path based on the proportion of the neighborhood pixel points belonging to the pixel points in the initial map path, to obtain an updated intermediate map path; taking the updated intermediate map path as the updated initial map path, and repeating the step of determining the updated intermediate map path until a preset iteration number is reached; wherein in each iteration process, the neighborhood pixel points not in the associated geographical range and belonging to the path of the target map before the update are taken as the pixel points belonging to the initial map path, and the neighborhood pixel points not in the associated geographical range and not belonging to the path of the target map before the update are taken as the pixel points not belonging to the initial map path; updating the target map based on the result of the last iteration.

[0013] In an optional implementation, the generating the target map based on the intermediate map path after the last iteration comprises: filling each map decoration element in each connected region in the preset geographical range randomly according to the selection probability of each map decoration element to obtain the target map including the map decoration elements and the intermediate map path.

[0014] In a second aspect, the embodiments of the present disclosure further provide a map generation method, which comprises: obtaining a path sketch drawn by a user; generating a target map based on the path sketch; receiving modification information of the path sketch made by the user; and updating the target map based on a path portion indicated by the modification information to be modified.

[0015] In an optional implementation, the method further comprises: determining an associated geographical range containing the modified path portion selected by the user, wherein a target map portion located outside the associated geographical range is not updated; and the updating the target map based on the path portion indicated by the modification information to be modified comprises: updating the target map based on the path portion indicated by the modification information to be modified and the associated geographical range.

[0016] In an optional implementation, the updating the target map based on the path portion indicated by the modification information to be modified is implemented by adopting the implementation of the first aspect.

[0017] In a third aspect, the embodiments of the present disclosure further provide a map generation apparatus, which comprises: a first obtaining unit configured to obtain a map path conversion probability of each pixel point in a preset geographical range, wherein the map path conversion probability is used to indicate a probability of the pixel point being converted from a non-map path pixel point to a map path pixel point; a first generating unit configured to generate an initial map path based on the map path conversion probability; a determining unit configured to determine, for each pixel point in the preset geographical range, whether the pixel point belongs to a pixel point in an intermediate map path based on a proportion of each neighborhood pixel point of the pixel point belonging to the pixel point in the initial map path to obtain the intermediate map path; and a second generating unit configured to repeat the step of determining the intermediate map path by taking the intermediate map path as an updated initial map path until a preset iteration number is reached, and generate a target map based on the intermediate map path after the last iteration.

[0018] In a fourth aspect, the embodiments of the present disclosure further provide a map generation apparatus, comprising: a second acquisition unit configured to acquire a path sketch drawn by a user; a third generation unit configured to generate a target map based on the path sketch; a receiving unit configured to receive modification information of the path sketch input by the user; and an updating unit configured to update the target map based on a path portion indicated by the modification information.

[0019] In a fifth aspect, the embodiments of the present disclosure further provide a computer device, comprising: a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the computer device is running, the processor and the memory communicate through the bus, the machine readable instructions are executed by the processor to perform the steps of the first aspect or any possible implementation manner of the first aspect, or perform the steps of the second aspect or any possible implementation manner of the second aspect.

[0020] In a sixth aspect, the embodiments of the present disclosure further provide a computer readable storage medium, the computer readable storage medium stores a computer program, when the computer program is run by a processor, the steps of the first aspect or any possible implementation manner of the first aspect are executed, or the steps of the second aspect or any possible implementation manner of the second aspect are executed.

[0021] In the embodiments of the present disclosure, the initial map path can be obtained by converting each pixel point in a preset range from a non-map path pixel point to a map path pixel point according to a map path conversion probability. Then, whether each pixel point in a preset geographical range belongs to the intermediate map path can be determined based on the proportion of the pixel point belonging to the initial map path in each neighborhood pixel point corresponding to the pixel point, so as to obtain the intermediate map path. Subsequently, the process of determining the intermediate map path can be iteratively processed, and the target map can be generated based on the intermediate map path after the last iteration.

[0022] In the above embodiments, the initial map path can be generated by the obtained map path conversion probability, and then the pixel points in the initial map path can be denoised based on the proportion of each neighboring pixel point corresponding to each pixel point in the preset geographical range belonging to the initial map path, so that a more accurate intermediate map path is obtained. Then, the obtained intermediate map path can be taken as an updated initial map path to repeat the process of obtaining the intermediate map path, so that the intermediate map path can be iteratively processed to smooth the intermediate map path, and thus the last iterated intermediate map path is more smooth and beautiful, and the quality and beauty of the target map are improved. That is, the disclosed embodiments can automatically and randomly generate a smooth and beautiful map, which not only reduces the labor cost of making the map, but also makes the generated map have randomness and beauty.

[0023] In order to make the above-mentioned purposes, features and advantages of the present disclosure more obvious and easy to understand, the following preferred embodiments are specifically described below, and the accompanying drawings are described in detail as follows. BRIEF DESCRIPTION OF DRAWINGS

[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the embodiments. The drawings herein are incorporated into the specification and form a part of the specification, which show the embodiments consistent with the present disclosure, and are used to illustrate the technical solutions of the present disclosure together with the specification. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor.

[0025] Figure 1 A flowchart of a map generation method provided by an embodiment of the present disclosure is shown;

[0026] Figure 2 A drawing method schematic diagram of a user-drawn path sketch obtained by an embodiment of the present disclosure is shown;

[0027] Figure 3 A flowchart of a map generation method provided by an embodiment of the present disclosure is shown;

[0028] Figure 4 A flowchart of a map generation method provided by an embodiment of the present disclosure is shown;

[0029] Figure 5 A flowchart of a map generation method provided by an embodiment of the present disclosure is shown;

[0030] Figure 6A schematic diagram of a map generation apparatus provided by an embodiment of the present disclosure is shown.

[0031] Figure 7 A schematic diagram of another map generation apparatus provided by an embodiment of the present disclosure is shown.

[0032] Figure 8 A schematic diagram of a computer device provided by an embodiment of the present disclosure is shown.

[0033] Figure 9 A schematic diagram of another computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0034] In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure and not all the embodiments. The components of the embodiments of the present disclosure described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the claimed present disclosure, but only represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present disclosure.

[0035] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0036] The term "and / or" herein is only used to describe an association relationship, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B and C can mean including any one or more elements selected from the set consisting of A, B and C.

[0037] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type of personal information involved in the present disclosure, the use range, the use scenario, etc. should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.

[0038] It is found through research that a corresponding game map is usually designed for a game scene, and more and more rich game play is provided for players based on the game map. In the related art, the game map is mainly drawn manually. In the case that the game map is large and the scene is complex, this manual drawing of the game map is time-consuming and laborious. In order to improve the accuracy of the drawn game map, the staff drawing the game map usually needs to have certain professional knowledge, further increasing the labor cost of drawing the game map.

[0039] Based on the above research, the present disclosure provides a map generation method, device, computer equipment and storage medium. In the embodiment of the present disclosure, the map path conversion probability can be obtained to convert each pixel point in the preset range from a non-map path pixel point to a map path pixel point according to the map path conversion probability, thereby obtaining an initial map path. Then, based on the proportion of each neighborhood pixel point belonging to the pixel point in the initial map path corresponding to each pixel point in the preset geographical range, it can be determined whether the pixel point belongs to the pixel point in the intermediate map path, thereby obtaining the intermediate map path. Next, the process of determining the intermediate map path can be iteratively processed, and the target map can be generated based on the intermediate map path after the last iteration.

[0040] In the above embodiment, the initial map path can be generated by obtaining the map path conversion probability, and then the pixel points in the initial map path can be denoised based on the proportion of each neighborhood pixel point belonging to the initial map path corresponding to each pixel point in the preset geographical range. The more accurate intermediate map path is obtained after processing. Then, the obtained intermediate map path can be used as the updated initial map path to repeat the process of obtaining the intermediate map path, so that the intermediate map path can be iteratively processed to achieve smoothing of the intermediate map path, and the intermediate map path after the last iteration is more smooth and beautiful, thereby improving the quality and beauty of the target map. That is, the embodiment of the present disclosure can automatically and randomly generate a smooth and beautiful map, which not only reduces the labor cost of making the map, but also makes the map made have randomness and beauty.

[0041] In order to facilitate the understanding of the present embodiment, first, a map generation method disclosed by the present embodiment is introduced in detail. The execution subject of the map generation method provided by the present embodiment is generally a computer equipment with certain computing capability.

[0042] Referring to Figure 1 Fig. 1 shows a flowchart of a map generation method provided by the present embodiment, and the method comprises steps S101-S107, wherein:

[0043] S101: Obtain a map path conversion probability of each pixel point in a preset geographical range; the map path conversion probability is used to indicate a probability of the pixel point being converted from a non-map path pixel point to a map path pixel point.

[0044] Here, the preset geographical range can indicate a geographical range where the target map is located, where the preset geographical range can correspond to width information and height information (for example, the width information can be represented by W, and the height information can be represented by H), at this time, the preset geographical range can be set to correspond to the width information W of 50 pixels and the height information H of 50 pixels. Alternatively, the preset geographical range can be set to correspond to the width information W of 50 pixels and the height information H of 100 pixels, and the like. The present disclosure does not make specific limitations on the preset geographical range, and the actual needs are used as the criterion.

[0045] In the embodiments of the present disclosure, before the target map is generated in the preset geographical range, each pixel point in the preset geographical range can be a non-map path pixel point, at this time, the non-map path pixel point can indicate an impassable object in the map, for example, the non-map path pixel point can indicate a rock, or water, and the like.

[0046] In the embodiments of the present disclosure, the map path pixel point can indicate a passable object in the map, for example, the map path pixel point can indicate a floor.

[0047] Here, the objects indicated by the non-map path pixel point and the map path pixel point are associated with the application scenario of the generated map, therefore, the present disclosure does not make specific limitations on the object type of the objects indicated by the non-map path pixel point and the map path pixel point, and the implementation is used as the criterion.

[0048] In the embodiments of the present disclosure, the map path conversion probabilities of the pixel points in the preset geographical range can be the same or different.

[0049] For example, in one possible implementation, if an initial map path is automatically generated, the map path conversion probability can be set in advance, and the map path conversion probabilities of the pixel points in the preset geographical range are all set to the preset map path conversion probability. For example, the map path conversion probability can be set to 0.5 in advance.

[0050] Alternatively, in another possible implementation, the map path conversion probabilities of the pixel points in the preset geographical range can be calculated according to a preset probability calculation rule. In specific implementation, the preset probability calculation rule can classify the pixel points in the preset geographical range to obtain pixel points of multiple categories, and set a corresponding map path conversion probability for each category of pixel points.

[0051] For example, the user can draw a path sketch by himself / herself, in which case, the pixels in the preset geographical range can be classified according to the preset absolute map path (for example, the path corresponding to the path sketch drawn by the user) and the absolute non-map path (for example, the path corresponding to the skeleton map), and the map path conversion probability of each category of pixels can be set. At this time, the map path conversion probability of the plurality of pixels in the preset geographical range corresponding to the absolute map path can be set to 1; the map path conversion probability of the plurality of pixels in the preset geographical range corresponding to the absolute non-map path can be set to 0; and the map path conversion probability of the pixels in the preset geographical range other than the pixels corresponding to the absolute map path and the absolute non-map path can be determined according to the distance information between the pixel and the absolute map path. The distance information between the pixel and the absolute map path can indicate the Manhattan distance between the pixel and the pixel in the absolute map path closest to the pixel.

[0052] S103: generating an initial map path based on the map path conversion probability.

[0053] In the embodiments of the present disclosure, after obtaining the map path conversion probability of each pixel in the preset geographical range, the conversion from the non-map path pixel to the map path pixel of each pixel in the preset geographical range can be performed according to the map path conversion probability, and the initial map path is obtained after the conversion. At this time, the initial map path indicates the path formed by the map path pixels in the preset geographical range.

[0054] S105: determining whether the pixel belongs to the pixel in the intermediate map path based on the proportion of the pixel in the initial map path among the neighborhood pixels of the pixel, to obtain the intermediate map path.

[0055] In the embodiments of the present disclosure, the neighborhood pixels of a pixel can indicate the pixels in the eight-neighborhood corresponding to the pixel, and the number of the neighborhood pixels of the pixel is 8.

[0056] In the embodiments of the present disclosure, the proportion of the pixel in the initial map path among the neighborhood pixels of the pixel is the ratio between the number of the pixels in the initial map path among the neighborhood pixels of the pixel and the total number of the neighborhood pixels. When the total number of the neighborhood pixels is a constant value (here, 8), obtaining the proportion is equivalent to obtaining the number of the pixels in the initial map path among the neighborhood pixels of the pixel.

[0057] In the embodiments of the present disclosure, a proportion of the pixel points belonging to the pixel points in the initial map path in each neighborhood pixel point of the pixel points in the preset geographical range can be preset, and in a case where it is determined that the proportion of the pixel points belonging to the pixel points in the initial map path in each neighborhood pixel point of the pixel points in the preset geographical range is greater than or equal to the preset proportion, it is determined that the pixel points in the preset geographical range belong to the pixel points in the intermediate map path.

[0058] The preset proportion can be 100%, 62.5%, 50%, or the like, and the present disclosure does not make a specific limitation on the preset proportion, and the actual needs can be met as the standard.

[0059] For example, in a case where the neighborhood pixel point is an eight-neighborhood pixel point, the preset proportion is 62.5%, that is, the number threshold of the pixel points belonging to the pixel points in the initial map path in each neighborhood pixel point of the pixel point is 5, and in this case, if it is determined that the number of the pixel points belonging to the pixel points in the initial map path in the eight neighborhood pixel points corresponding to the pixel points in the preset geographical range is greater than or equal to 5 (that is, 8*62.5%), it is indicated that the pixel points in the preset geographical range belong to the pixel points in the intermediate map path.

[0060] S107: Taking the intermediate map path as an updated initial map path, repeating the step of determining the intermediate map path until a preset iteration number is reached, and generating a target map based on the intermediate map path after the last iteration.

[0061] In the embodiments of the present disclosure, after obtaining the intermediate map path, the intermediate map path can be taken as an updated initial map path, that is, the intermediate map path is taken as the initial map path to execute the step S105 again.

[0062] In the embodiments of the present disclosure, the preset iteration number can indicate the number of times of repeating the step of determining the intermediate map path described in S105, for example, the preset iteration number can be 3, 5, 10, or the like.

[0063] In the embodiments of the present disclosure, after the number of times of repeating the step of determining the intermediate map path described in S105 reaches the preset iteration number, the map path pixel points in the preset geographical range can be determined based on the intermediate map path after the last iteration, and a target map containing a target map path is obtained.

[0064] In the embodiments of the present disclosure, the initial map path can be obtained by converting each pixel point in a preset range from a non-map path pixel point to a map path pixel point according to the map path conversion probability. Then, whether each pixel point in a preset geographical range belongs to the intermediate map path can be determined based on the proportion of the pixel points belonging to the initial map path in each neighborhood pixel point corresponding to the pixel point, so as to obtain the intermediate map path. Subsequently, the process of determining the intermediate map path can be iteratively processed, and the target map can be generated based on the intermediate map path after the last iteration.

[0065] In the above embodiments, the initial map path can be generated based on the obtained map path conversion probability. Then, the pixel points in the initial map path can be denoised based on the proportion of the pixel points belonging to the initial map path in each neighborhood pixel point corresponding to each pixel point in a preset geographical range, so as to obtain a more accurate intermediate map path. Subsequently, the obtained intermediate map path can be used as an updated initial map path to repeat the process of obtaining the intermediate map path, so that the intermediate map path can be iteratively processed to smooth the intermediate map path, and thus the intermediate map path after the last iteration is more smooth and beautiful, thereby improving the quality and beauty of the target map. That is, the embodiments of the present disclosure can automatically and randomly generate a smooth and beautiful map, which not only reduces the labor cost of making a map, but also makes the generated map have randomness and beauty.

[0066] In an optional embodiment, before generating the initial map path based on the map path conversion probability, the embodiments of the present disclosure specifically further include the following steps:

[0067] Step S21: obtaining a path sketch drawn by a user;

[0068] Step S22: generating a skeleton map based on the path sketch; the style of the skeleton map matches the path sketch, and the skeleton map does not contain any pixel point belonging to the path sketch;

[0069] Step S23: determining the map path conversion probability based on the path sketch and the skeleton map.

[0070] In the embodiments of the present disclosure, the path sketch can be obtained by obtaining at least one path drawn by a user based on a brush. At this time, the path sketch can indicate the shape of the intermediate map path after the last iteration.

[0071] Here, to better determine the topological structure of the path sketch drawn by the user, the brush size can be preset, thereby more accurately determining whether the paths contained in the obtained path sketch are connected. The preset brush size can be S, where S is an integer greater than 1; for example, S can be 2 or 3, etc.

[0072] For example, such as Figure 2 As shown in (a), the pre-set brush size is 1*1 pixels. In this case, path 1 and path 2 can be displayed as shown in [image 1]. Figure 2 Given the shape shown in (a), it is impossible to accurately determine whether path 1 and path 2 are connected; as Figure 2 As shown in (b), the pre-set brush size is 2*2 pixels. At this point, it can be determined that path 1 and path 2 are connected; as shown in (b). Figure 2 As shown in (c), this is a schematic diagram of path 3 and path 4 drawn when the brush size is 2*2 pixels. At this time, it can be determined that path 3 and path 4 are in an unconnected state.

[0073] In this embodiment of the disclosure, after obtaining the path sketch, the skeleton diagram can be determined based on the region in the path sketch other than the at least one path. Specifically, the skeleton can be extracted from the region in the path sketch other than the at least one path to obtain the skeleton diagram. The skeleton extraction algorithm can be the Zhang-Suen Thinning Algorithm, or any other skeleton extraction method. This disclosure does not specifically limit the method, but only those methods that can be implemented are permitted.

[0074] For example, in the path sketch drawn by the user, such as Figure 3 In the case shown in (a), the skeleton diagram generated based on the path sketch can be as follows: Figure 3 As shown in (b).

[0075] In this embodiment of the disclosure, after obtaining the path sketch and the skeleton diagram, the map path transformation probability can be determined based on the path sketch and the skeleton diagram.

[0076] Specifically, based on the obtained path width weight and the Manhattan distance from each pixel in the preset geographical area (excluding the path sketch and skeleton map) to the path sketch, the map path conversion probability of each pixel (excluding the path sketch and skeleton map) belonging to the initial map path is determined, and the map path conversion probability of each pixel in the path sketch is set to 1, and the map path conversion probability of each pixel in the skeleton map is set to 0.

[0077] In the embodiments of the present disclosure, the path width weight can indicate a weight for adjusting the path width in the map, and the smaller the path width weight is, the smaller the width of the path in the map can be adjusted.

[0078] In the embodiments of the present disclosure, the map path transition probability of each pixel point belonging to the initial map path can be determined by the following formula (1).

[0079]

[0080] Here, SVW i,j indicates the map path transition probability corresponding to the pixel point at the i-th row and the j-th column in the preset geographical range; P i,j indicates the pixel point at the i-th row and the j-th column in the preset geographical range, where 1≤i≤W and 1≤i≤H, W is the width information corresponding to the preset geographical range, and H is the height information corresponding to the preset geographical range; PW indicates the obtained road width weight; UDF(P i,j ) indicates the Manhattan distance of P i,j to the path sketch; “P i,j == pixel point in the path sketch” indicates the pixel point in the path sketch in the preset geographical range; and “P i,j == pixel point in the skeleton map” indicates the pixel point in the skeleton map in the preset geographical range.

[0081] In the embodiments of the present disclosure, after the map path transition probability of each pixel point in the preset geographical range is determined according to the above formula (1), the initial map path can be generated based on the map path transition probability, and the steps in S105 and S107 described above can be performed based on the initial map path to generate the target map.

[0082] Specifically, in the case that the preset proportion is 62.5% and the neighborhood pixel points are eight neighborhood pixel points, the steps in S105 and S107 described above can be as shown in the following formula (2).

[0083]

[0084] Here, t+1 indicates the current iteration number, where t starts from 0, and at this time, then represents the steps in S105 described above, that is, the first iteration; is used to indicate the pixel point type of the pixel point at the i-th row and the j-th column in the target map generated based on the intermediate map path under the current iteration number (1≤i≤W and 1≤j≤H), and at this time, the pixel point type can be a non-map path pixel point or a map path pixel point.

[0085] Herein, indicates the pixel type of the pixel point located at the i-th row and the j-th column in the target map generated based on the intermediate map path in the next iteration number; represents the number of the pixel points belonging to the pixel points in the initial map path (or the updated initial map path) in each neighborhood pixel point of the pixel point located at the i-th row and the j-th column in the preset geographical range.

[0086] At this time, according to formula (2), when P i,j is the pixel point in the path sketch, the pixel point can be determined as the map path pixel point, and at this time, the pixel point belongs to the pixel point in the intermediate map path; when P i,j is the pixel point in the skeleton map, the pixel point can be determined as the non-map path pixel point, and at this time, the pixel point does not belong to the pixel point in the intermediate map path.

[0087] According to formula (2), in the present embodiment, the pixel point P can be determined as the map path pixel point by taking the pixel point P as a constraint condition to determine whether the other pixel points in the preset geographical range, which do not belong to the pixel points in the path sketch and the skeleton map, belong to the pixel points in the intermediate map path. At this time, when it is determined that the pixel point satisfies the condition of P , it is determined that the pixel point is the map path pixel point, that is, the pixel point belongs to the pixel point in the intermediate map path; when it is determined that the pixel point does not satisfy the condition of P

[0088] As an equivalent alternative, a threshold value of the neighborhood pixel point being the non-map path pixel point can also be set, and at this time, when the proportion or number of the neighborhood pixel points belonging to the non-map path pixel points exceeds the threshold value, the pixel point can be taken as the non-map path pixel point. For example, the threshold value can be set as 8 (total number of neighborhood pixel points) - 5 (threshold value corresponding to the above map path pixel point) = 3, and for each pixel point in the preset geographical range, if the proportion or number of the neighborhood pixel points belonging to the non-initial map path pixel points exceeds the threshold value (at this time, the number threshold value is 3, and the proportion threshold value is 37.5%), the pixel point does not belong to the pixel point in the intermediate map path in the above iteration process.

[0089] In the above embodiment, the path sketch drawn by the user can be acquired to generate the skeleton map, the path conversion probability of each pixel point in the preset geographical range can be determined based on the path sketch and the skeleton map, so that the initial map path generated based on the path conversion probability is more in line with the drawing requirements of the user.

[0090] Furthermore, the method of generating target maps based on user-drawn path sketches, compared to manually drawing target maps, reduces the requirements for map-drawing personnel, shortens the time required to generate target maps, and thus saves time and manpower costs.

[0091] In this embodiment, the path sketch may include at least one path and at least one map element, such as a map entrance (or map start point), map end point, treasure chest, or character element. The character element can indicate level enemies or a guide character. After generating the target map based on the intermediate map path from the last iteration, element identifiers corresponding to each map element can be displayed at their respective positions, making the target map richer and more practical.

[0092] In an optional implementation, regarding the above: determining the map path transformation probability of each pixel other than the path sketch and skeleton map belonging to the initial map path specifically includes the following process:

[0093] Based on the acquired multiple path width weights and the Manhattan distance of each pixel to the path sketch, the map path conversion probability of each pixel is determined under each path width weight.

[0094] In this embodiment of the disclosure, multiple path width weights can be obtained simultaneously, and the map path conversion probability of each pixel within a preset geographical range can be calculated according to the above formula (1).

[0095] Then, multiple initial map paths can be generated based on the map path conversion probabilities corresponding to the multiple path width weights.

[0096] For example, such as Figure 3 As shown, there are three path width weights: PW1 = 0.3, PW1 = 0.6, and PW1 = 0.9. At this point, the map path conversion probabilities corresponding to these three path width weights can be determined. Based on these map path conversion probabilities, a heatmap within a preset geographical area can be generated as follows. Figure 3 As shown in (c) in the figure.

[0097] Then, based on these three path width weights, an initial map path corresponding to each path width weight can be generated, resulting in, as shown below. Figure 3 The multiple initial map paths are shown in (d).

[0098] In this embodiment of the disclosure, it is possible to Figure 3Each initial map path shown in (d) is processed according to the steps in S105 and S107 described above, to obtain a target map path corresponding to each initial map path shown in (d) as shown in (e). Figure 3 Each initial map path shown in (d) is processed according to the steps in S105 and S107 described above, to obtain a target map path corresponding to each initial map path shown in (d) as shown in (e).

[0099] In the embodiments of the present disclosure, the target map paths corresponding to the plurality of initial map paths can be displayed, and the map path selected by the user from the plurality of target map paths can be determined in response to the selection operation of the user on the plurality of target map paths.

[0100] At this time, the target map can be generated based on the selected map path.

[0101] As described above, the embodiments of the present disclosure can obtain a plurality of path width weights at the same time, so that the target map paths corresponding to the path width weights (i.e., a plurality of target map paths) can be generated. Then, the plurality of target map paths can be displayed, and the map path selected by the user from the plurality of target map paths can be determined, so that the target map can be generated based on the selected map path. In the above embodiments, the effect diagram of the plurality of target map paths can be displayed for the user at the same time, so as to reduce the number of times of adjusting the path width weight and generating the target map path by the user, thereby improving the efficiency of obtaining the target map.

[0102] Meanwhile, in the case that the path width corresponding to the displayed plurality of target map paths cannot meet the demand of the user, the value of the path width weight for adjusting the target map path next time can be determined more quickly and more accurately based on the path width weight corresponding to each displayed target map path, so that the next path width weight can be obtained more quickly, thereby further improving the efficiency of obtaining the target map meeting the demand of the user.

[0103] In an optional embodiment, after the target map is generated, the embodiments of the present disclosure can also update the target map based on the path part indicated by the modification information of the user on the path sketch in response to receiving the modification information of the user on the path sketch.

[0104] In the embodiments of the present disclosure, the modification information of the user on the path sketch can be understood as the modification information of the path sketch obtained after the user changes at least part of the area in the path sketch, or the path sketch redrawn by the user, and the modification information of the user on the path sketch can be determined based on the path sketch redrawn by the user at this time.

[0105] In the embodiments of the present disclosure, the modification information of the path sketch can indicate the path part in the path sketch that is modified, and at this time, the modified path part can be one or more.

[0106] Then, the target map can be updated based on the modified path part indicated by the modification information, and the updating can be specifically described as the following steps:

[0107] Step S31: determining an updated path sketch based on the modified path part indicated by the modification information, and generating an updated skeleton map based on the updated path sketch; and determining an associated geographic range corresponding to the modified path part;

[0108] Step S32: updating the map path conversion probability based on the updated path sketch, the updated skeleton map, and the associated geographic range; wherein the map path conversion probability of each pixel point in the path in the target map before updating and located outside the associated geographic range is set to 1, and the map path conversion probability of each pixel point not in the path in the target map before updating is set to 0;

[0109] Step S33: generating an updated initial map path based on the updated map path conversion probability, and generating an updated target map based on the updated initial map path.

[0110] In the embodiments of the present disclosure, in the case that the updated path sketch is determined based on the modified path part indicated by the modification information, the modified path part can indicate the part after modification in the acquired path sketch drawn by the user, and at this time, the path sketch after modification can be determined as the updated path sketch. Alternatively, in the case that the modified path part is determined based on the path sketch redrawn by the user, the redrawn path sketch can be determined as the updated path sketch.

[0111] In the embodiments of the present disclosure, after the updated path sketch is determined, the updated skeleton map can be generated based on the updated path sketch, and at this time, the updated skeleton map can be generated based on the updated path sketch in the same way as the skeleton map is generated based on the path sketch in step S22, that is, the skeleton extraction can be performed on the region in the updated path sketch except at least one path to obtain the updated skeleton map, and the skeleton extraction algorithm can be Zhang-Suen Thining Algorithm or any other skeleton extraction method, and the present disclosure is not limited to specific details.

[0112] In the embodiments of the present disclosure, the associated geographic range can also be determined based on the path portion indicated by the modification information.

[0113] In a possible implementation, the associated geographic range can be a range that is previously circled by the user for the path portion where the modification occurs when the modification is made to the path sketch. In this case, the range can be determined as the associated geographic range.

[0114] In another possible implementation, a minimum circular area or a minimum rectangular area (or any other arbitrary shape area) covering the path portion where the modification occurs can also be automatically circled as the automatically circled range, and the automatically circled range can be determined as the associated geographic range. The present disclosure does not make specific limitations on the determination manner of the associated geographic range, and the determination manner can be implemented as appropriate.

[0115] In the embodiments of the present disclosure, after obtaining the updated path sketch, the updated skeleton map, and the associated geographic range, the map path conversion probability can be updated.

[0116] Specifically, first, the updated map path conversion probability corresponding to each target pixel point in the associated geographic range can be determined based on the path width weight and the Manhattan distance of each target pixel point in the associated geographic range from the updated path sketch.

[0117] Meanwhile, the map path conversion probability of each pixel point in the updated path sketch in the associated geographic range can be set to 1, and the map path conversion probability of each pixel point in the updated skeleton map in the associated geographic range can be set to 0.

[0118] In this case, after obtaining the updated map path conversion probability in the above manner, the updated initial map path can be generated based on the updated map path conversion probability, and the updated target map can be generated based on the updated initial map path.

[0119] In this case, the process of generating the updated target map based on the updated initial map path can include the following steps:

[0120] Step S41: For each pixel point in the associated geographic range, it is determined whether the pixel point belongs to the pixel point in the intermediate map path based on the proportion of the neighborhood pixel points of the pixel point that belong to the pixel points in the initial map path, so as to obtain the updated intermediate map path.

[0121] Step S42: repeat the step of determining the updated intermediate map path with the updated intermediate map path as an updated initial map path until a preset iteration number is reached.

[0122] wherein, in each iteration, a neighbor pixel point not located in the associated geographical range and belonging to the path of the target map before the update is regarded as a pixel point belonging to the initial map path, and a neighbor pixel point not located in the associated geographical range and not belonging to the path of the target map before the update is regarded as a pixel point not belonging to the initial map path.

[0123] Step S43: update the target map based on the result of the last iteration.

[0124] Here, the neighbor pixel point can refer to the eight neighbor pixel points as described above.

[0125] Here, the proportion of the neighbor pixel points belonging to the pixel points in the initial map path is the same as the proportion set in advance, for example, the proportion can be 100%, 62.5%, 50%, etc.

[0126] In the above embodiment, the update (or modification) of the target map can be realized by obtaining the path sketch updated by the user, so that the generated target map can be adjusted conveniently and quickly, and the quality of the obtained target map is improved.

[0127] In an optional embodiment, S107: generating the target map based on the intermediate map path after the last iteration, specifically includes the following steps:

[0128] Step S51: if there are multiple map path parts not connected in the intermediate map path, start multiple agent threads;

[0129] Step S52: determine a current to-be-connected map path part from the multiple map path parts, for each agent thread, randomly select a pixel point from the current to-be-connected map path part as a starting pixel point, and randomly generate a candidate path from the starting pixel point to other map path parts; and the shortest path in the candidate paths generated by the multiple agent threads is taken as the path of the target map.

[0130] Step S53: repeat the step of determining the current to-be-connected map path part from the multiple map path parts until the connection between the multiple map path parts is completed, and the path of the target map is obtained.

[0131] In the embodiments of the present disclosure, the agent thread can be used to connect the two unconnected map path parts. At this time, the number of the started agent threads can be 10, or 15, etc., and the present disclosure does not make specific limitation on the number of the started agent threads.

[0132] In the embodiments of the present disclosure, after starting the plurality of agent threads, the two map path parts to be connected can be determined first. Assuming that the two map path parts are and and the current map path part to be connected is and the other map path part reached is Then, the starting pixel point of each agent thread can be determined from the current map path part to be connected . Next, the candidate path from the starting pixel point to the first pixel point belonging to the other map path part can be generated based on the plurality of started agent threads respectively, to obtain a plurality of candidate paths corresponding to the plurality of agent threads.

[0133] At this time, the shortest path in the plurality of candidate paths can be taken as the path of the target map, so as to connect the two map path parts to be connected.

[0134] In the embodiments of the present disclosure, the process described in steps S51 and S52 can be repeatedly executed until the connection between the plurality of map path parts existing in the intermediate map path is connected, to obtain the path of the target map.

[0135] In the above embodiments, when it is detected that the plurality of map path parts existing in the intermediate map path are unconnected, the connection between the plurality of map path parts can be realized by starting the plurality of agent threads, so as to make the path of the target map more complete, and further improve the quality of the target map.

[0136] In an optional embodiment, in the case that the path sketch drawn by the user is not obtained before the initial map path is generated based on the map path transition probability, the preset map path transition probability can be obtained, and the initial map path is generated based on the map path transition probability.

[0137] For example, in the case that the preset map path transition probability is 0.5, the initial map path generated according to the map path transition probability can be as shown in (a) of FIG. 10. Figure 4

[0138] Then, the initial map path can be iteratively processed according to the steps in S105 to S107, and at this time, the intermediate map path after the last iteration can be as shown in (b) of FIG. 10. Figure 4 ​​

[0139] From Figure 4 As can be seen from (b), there are multiple unconnected map path portions in the intermediate map path, at this time, the unconnected multiple map paths contained in the intermediate map path shown in (b) can be connected according to the steps described in steps S51 to S53, and after connection, the target map path shown in (c) can be obtained. Figure 4 Figure 4 As can be seen from (b), there are multiple unconnected map path portions in the intermediate map path, at this time, the unconnected multiple map paths contained in the intermediate map path shown in (b) can be connected according to the steps described in steps S51 to S53, and after connection, the target map path shown in (c) can be obtained.

[0140] In the embodiments of the present disclosure, after obtaining the intermediate map path without unconnected map path portions, the target map can be generated based on the intermediate map path.

[0141] In this process, according to the selection probability corresponding to each map decoration element, each map decoration element can be randomly filled in each connected region within the preset geographical range, and a target map including the map decoration elements and the intermediate map path can be obtained.

[0142] In the embodiments of the present disclosure, the obtained target map can be enriched in content by map decoration elements, for example, the map decoration elements can be at least one of the following: trees, forests, lakes, caves, wormholes, black ground, carpets, walls, mountains, animal bodies, etc.

[0143] In the embodiments of the present disclosure, the same selection probability can be set for different types of map decoration elements, or different selection probabilities can be set, and each map decoration element can be randomly filled in the preset geographical range based on the map decoration element. For example, in the case of map decoration elements being lakes and caves, the selection probability corresponding to the lakes and caves can be set to 25%, or the selection probability corresponding to the lakes can be set to 25% and the selection probability corresponding to the caves can be set to 50%.

[0144] In the embodiments of the present disclosure, different types of map decoration elements can correspond to different regions filled in the preset geographical range.

[0145] For example, in the case of a single connected region corresponding to a map decoration element (for example, the map decoration element is a cave or a lake), the map decoration element corresponding to the single connected region can be filled into each connected region corresponding to a non-map path pixel point in the preset geographical range, as shown in (d). Figure 4

[0146] For another example, in the case of a wall as a map decoration element, the filling region of the wall in the preset geographical range can be determined according to the shooting angle of the virtual camera. At this time, in the case of​​Figure 4 After adding the wall in the target map shown in (d), a target map as shown in (e) can be obtained. Figure 4

[0147] For example, in the case that the map decoration element is a black ground, the map decoration element can be filled into the area where the map path pixel points in the preset range according to the selection probability. At this time, the size of the black ground can be determined based on the breadth-first search method. At this time, after adding the black ground in the target map as shown in (e), a target map as shown in (f) can be obtained. Figure 4 Figure 4

[0148] In the embodiments of the present disclosure, at least one sub-decoration matching the application scenario of the target map can also be preset, and the at least one sub-decoration can be randomly filled into the area where the map path pixel points in the preset range according to the selection probability corresponding to the sub-decoration. For example, the sub-decoration can be a road sign, or can be a flower, grass, or a mural on a wall, etc. At this time, after adding the at least one sub-decoration in the target map as shown in (f), a target map as shown in (g) can be obtained. Figure 4 Figure 4

[0149] In the embodiments of the present disclosure, after filling each sub-decoration into the preset geographical range, it can be detected by a local detection algorithm whether the sub-decoration blocks the path in the target map, and in the case that it is determined that the sub-decoration blocks the path in the target map, the sub-decoration is removed.

[0150] In the embodiments of the present disclosure, after generating the target map, a geometric map corresponding to the target map can be created based on the Marching squares algorithm, so that the geometric shape corresponding to the target map can be obtained. For example, after creating a geometric map corresponding to the target map as shown in (g), a geometric shape of the target map as shown in (h) can be obtained. Figure 4 Figure 5

[0151] Referring to FIG. 5, a flowchart of another map generation method provided by the embodiments of the present disclosure is shown, and at this time, the map generation method can be applied in a map editor, and at this time, the method comprises steps S501-S507, wherein: Figure 6 S501: Obtain a path sketch drawn by a user;

[0152] S503: Generate a target map based on the path sketch;

[0153]

[0154] ​​​​​​​​Step S505: receiving modification information of the path sketch by the user;

[0155] Step S507: updating the target map based on the modified path part indicated by the modification information.

[0156] Here, the path sketch drawn by the user can contain a passable path in the map, which can be a straight path, a curved path, a right-angle path, etc. The shape of the path contained in the path sketch is not specifically limited in the disclosure, and can be determined according to actual needs.

[0157] In the embodiment of the disclosure, the target map can be generated based on the path sketch drawn by the user according to the map generation method described in S101-S107 above, which will not be described in detail here.

[0158] In the embodiment of the disclosure, if the user is not satisfied with the target map, the modification information of the path sketch by the user can be received, and the target map can be updated based on the modified path part indicated by the modification information, so that the secondary editing of the target map can be realized to obtain a target map that is more in line with the user's needs.

[0159] In specific implementation, the associated geographic range containing the modified path part selected by the user can be determined first, wherein the part of the target map outside the associated geographic range is not updated.

[0160] The associated geographic range containing the modified path part selected by the user can be a range predefined by the user for the modified path part, in which case the predefined range can be understood as a range selected by the user for the path sketch. Alternatively, it can also be an automatically selected range based on the smallest circular area or the smallest rectangular area (or any other arbitrary shape area) covering the modified path part, in which case the modified path part can be a modified path part obtained after the user modifies at least part of the path in the path sketch by clicking (or selecting). The disclosure does not specifically limit the determination method of the associated geographic range, and can be determined as appropriate.

[0161] Then, the target map can be updated based on the modified path part indicated by the modification information and the associated geographic range.

[0162] Here, the target map is updated based on the modified path part indicated by the modification information, which is realized by the method described in steps S31-S43 above, which will not be described in detail here.

[0163] In the above-mentioned embodiments, the corresponding target map can be automatically generated by obtaining the path sketch drawn by the user, thereby saving time cost and labor cost. Meanwhile, in the case that the generated target map does not meet the user's demand, the user can also update the path sketch, at this time, the path part indicated by the modification information can be updated by receiving the update information (i.e. modification information) of the path sketch from the user, thereby realizing the update of the target map. In this way, the target map can be updated (i.e. the path part to be updated) in a targeted manner, thereby saving resources and improving efficiency.

[0164] Those skilled in the art can understand that, in the above-mentioned method of the specific embodiments, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process, and the specific execution order of each step should be determined according to its function and possible internal logic.

[0165] Based on the same inventive concept, the disclosure embodiments also provide a map generation device corresponding to the map generation method. Since the principle of solving problems of the device in the disclosure embodiments is similar to the above-mentioned map generation method of the disclosure embodiments, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described here.

[0166] Referring to Figure 7 As shown in FIG. 1, a schematic diagram of a map generation device provided by the disclosure embodiments is shown, the device comprises: an acquisition unit 61, a first generation unit 62, a determination unit 63, a second generation unit 64; wherein,

[0167] The first acquisition unit 61 is configured to acquire a map path conversion probability of each pixel point in a preset geographical range; the map path conversion probability is used to indicate a probability of converting the pixel point from a non-map path pixel point to a map path pixel point;

[0168] The first generation unit 62 is configured to generate an initial map path based on the map path conversion probability;

[0169] The determination unit 63 is configured to, for each pixel point in the preset geographical range, determine whether the pixel point belongs to a pixel point in an intermediate map path based on a proportion of each neighborhood pixel point of the pixel point belonging to a pixel point in the initial map path, to obtain the intermediate map path;

[0170] The second generation unit 64 is configured to repeat the step of determining the intermediate map path by taking the intermediate map path as an updated initial map path until a preset iteration number is reached, and generate a target map based on the intermediate map path after the last iteration.

[0171] In the embodiments of the present disclosure, the initial map path can be obtained by converting each pixel point in a preset range from a non-map path pixel point to a map path pixel point according to the map path conversion probability. Then, whether each pixel point in a preset geographical range belongs to the intermediate map path can be determined based on the proportion of the pixel points belonging to the initial map path in each neighborhood pixel point corresponding to the pixel point, so as to obtain the intermediate map path. Subsequently, the process of determining the intermediate map path can be iteratively processed, and the target map can be generated based on the intermediate map path after the last iteration.

[0172] In the above embodiments, the initial map path can be generated based on the obtained map path conversion probability. Then, the pixel points in the initial map path can be denoised based on the proportion of the pixel points belonging to the initial map path in each neighborhood pixel point corresponding to each pixel point in a preset geographical range, so as to obtain a more accurate intermediate map path. Subsequently, the obtained intermediate map path can be used as an updated initial map path to repeatedly execute the process of obtaining the intermediate map path, so that the intermediate map path can be iteratively processed to smooth the intermediate map path, and thus the intermediate map path after the last iteration is more smooth and beautiful, thereby improving the quality and aesthetic degree of the target map. That is, the embodiments of the present disclosure can automatically and randomly generate a smooth and beautiful map, which not only reduces the labor cost of making the map, but also makes the generated map have randomness and beauty.

[0173] In a possible implementation, the second generation unit 64 is further configured to: if there are multiple map path parts that are not connected in the intermediate map path, start multiple agent threads; determine a current to-be-connected map path part from the multiple map path parts, randomly select a pixel point as a starting pixel point from the current to-be-connected map path part for each agent thread, and randomly generate a candidate path from the starting pixel point to other map path parts; take the shortest path in the candidate paths generated by the multiple agent threads as the path of the target map; and repeat the step of determining the current to-be-connected map path part from the multiple map path parts until the connection between the multiple map path parts is completed, so as to obtain the path of the target map.

[0174] In a possible implementation, the apparatus is further configured to: obtain a path sketch drawn by a user; generate a skeleton map based on the path sketch; the style of the skeleton map matches the path sketch, and the skeleton map does not contain any pixel point belonging to the path sketch; and determine the map path conversion probability based on the path sketch and the skeleton map.

[0175] In an alternative implementation, the apparatus is further configured to determine, based on the obtained path width weight and Manhattan distances of each pixel point in the preset geographical range except the path sketch and the skeleton map to the path sketch, a map path conversion probability of each pixel point in the preset geographical range except the path sketch and the skeleton map to belong to the initial map path, and set the map path conversion probability of each pixel point in the path sketch to 1 and the map path conversion probability of each pixel point in the skeleton map to 0.

[0176] In a possible implementation, the apparatus is further configured to: determine, based on the obtained path width weight and Manhattan distances of each pixel point to the path sketch, a map path conversion probability of each pixel point under each path width weight; and generate the initial map path based on the map path conversion probability, including generating a plurality of initial map paths based on the map path conversion probabilities corresponding to the plurality of path width weights, respectively. After obtaining the paths of the target map corresponding to the plurality of initial map paths, respectively, the method further includes: displaying the paths of the plurality of target maps, and determining a path of a target map selected by a user from the paths of the plurality of target maps.

[0177] In a possible implementation, after generating the target map, the apparatus is further configured to: in response to receiving modification information of the path sketch, update the target map based on a modified path portion indicated by the modification information.

[0178] In a possible implementation, the apparatus is further configured to: determine an updated path sketch based on the modification information of the path sketch, and generate an updated skeleton map based on the updated path sketch; determine an associated geographical range corresponding to the modified path portion; update the map path conversion probability based on the updated path sketch, the updated skeleton map, and the associated geographical range; set the map path conversion probability of each pixel point in the path of the target map before the update and outside the associated geographical range to 1, and set the map path conversion probability of each pixel point not in the path of the target map before the update to 0; generate an updated initial map path based on the updated map path conversion probability, and generate an updated target map based on the updated initial map path.

[0179] In a possible implementation, the apparatus is further configured to: determine, based on the path width weight and a Manhattan distance from each target pixel point located in the associated geographical range to the updated path sketch, a corresponding updated map path conversion probability of each target pixel point in the associated geographical range; and set the map path conversion probability of each pixel point in the updated path sketch in the associated geographical range to 1, and set the map path conversion probability of each pixel point in the updated skeleton map in the associated geographical range to 0.

[0180] In a possible implementation, the apparatus is further configured to: for each pixel point in the associated geographical range, determine whether the pixel point belongs to the intermediate map path based on a proportion of neighborhood pixel points of the pixel point that belong to the pixel points in the initial map path, to obtain an updated intermediate map path; repeat the step of determining the updated intermediate map path by taking the updated intermediate map path as an updated initial map path until a preset iteration number is reached; and update the target map based on a result of the last iteration.

[0181] In a possible implementation, the second generation unit 64 is further configured to: fill each map decoration element in each connected region in the preset geographical range with each map decoration element according to the selection probability corresponding to the map decoration element, to obtain the target map including the map decoration elements and the intermediate map path.

[0182] Referring to FIG. 7, Figure 1 FIG. 7 shows a schematic diagram of another map generation apparatus provided by an embodiment of the present disclosure, which includes a second acquisition unit 71, a third generation unit 72, a receiving unit 73, and an updating unit 74.

[0183] The second acquisition unit 71 is configured to acquire a path sketch drawn by a user.

[0184] The third generation unit 72 is configured to generate a target map based on the path sketch.

[0185] The receiving unit 73 is configured to receive modification information of the path sketch input by the user.

[0186] The update unit 74 is used to update the target map based on the modified path portion indicated by the modification information.

[0187] In the above implementation, a corresponding target map can be automatically generated by acquiring the user-drawn path sketch, thereby saving time and manpower costs. Furthermore, if the generated target map does not meet the user's needs, the user can update the path sketch. In this case, the system can update the modified portion of the path indicated by the user's update information (i.e., modification information) to update the target map. This implementation allows for targeted updates to the target map (i.e., updates to modified path portions), thus saving resources and improving efficiency.

[0188] In one possible implementation, the device is further configured to: determine the associated geographic range of the user-selected path portion containing the modified portion, wherein the target map portion located outside the associated geographic range is not updated; the updating of the target map based on the modified path portion indicated by the modification information includes: updating the target map based on the modified path portion indicated by the modification information and the associated geographic range.

[0189] In one possible implementation, updating the target map based on the modified path portion indicated by the modification information is achieved using the method described above.

[0190] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0191] Corresponding to Figure 8 In the map generation method described in this disclosure, a computer device 800 is also provided, such as... Figure 5 The diagram shown is a structural schematic of a computer device 800 provided in an embodiment of this disclosure, including:

[0192] The system includes a processor 81, a memory 82, and a bus 83. The memory 82 stores execution instructions and includes main memory 821 and external memory 822. The main memory 821, also called internal memory, temporarily stores the computational data in the processor 81, as well as data exchanged with external memory such as a hard disk. The processor 81 exchanges data with the external memory 822 through the main memory 821. When the computer device 800 is running, the processor 81 communicates with the memory 82 through the bus 83, causing the processor 81 to execute the following instructions:

[0193] acquire a map path conversion probability of each pixel point in a preset geographical range; the map path conversion probability is used to indicate a probability of the pixel point being converted from a non-map path pixel point to a map path pixel point;

[0194] generate an initial map path based on the map path conversion probability;

[0195] For each pixel point in the preset geographical range, determine whether the pixel point belongs to a pixel point in an intermediate map path based on a proportion of each neighborhood pixel point of the pixel point belonging to a pixel point in the initial map path, to obtain the intermediate map path.

[0196] repeat the step of determining the intermediate map path by taking the intermediate map path as an updated initial map path until a preset iteration number is reached, and generate a target map based on the intermediate map path after the last iteration.

[0197] Corresponding to the map generation method in Figure 9 , the embodiment of the disclosure also provides another computer device 900, as shown in ​ , a structural schematic diagram of the computer device 900 provided by the embodiment of the disclosure, which comprises:

[0198] a processor 91, a memory 92, and a bus 93; the memory 92 is used to store execution instructions, including an internal memory 921 and an external memory 922; the internal memory 921 is also called an internal memory, and is used to temporarily store operation data in the processor 91 and exchange data with the external memory 922 such as a hard disk; the processor 91 exchanges data with the external memory 922 through the internal memory 921; when the computer device 900 is running, the processor 91 and the memory 92 communicate through the bus 93, so that the processor 91 executes the following instructions:

[0199] acquire a path sketch drawn by a user;

[0200] generate a target map based on the path sketch;

[0201] receive modification information of the user for the path sketch;

[0202] update the target map based on a path part indicated by the modification information to be modified.

[0203] The embodiment of the disclosure also provides a computer readable storage medium, which stores a computer program, and the computer program is run by a processor to execute the steps of the map generation method described in the method embodiment.

[0204] The embodiment of the present disclosure further provides a computer program product carrying program codes, the program codes comprising instructions for executing the steps of the map generation method described in the above method embodiments, which can be specifically referred to the above method embodiments and will not be repeated here.

[0205] The computer program product can be specifically implemented by means of hardware, software or combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium. In another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) or the like.

[0206] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system and device can refer to the corresponding process in the above method embodiments, which will not be repeated here. In several embodiments provided by the present disclosure, it should be understood that the disclosed system, device and method can be implemented by other means. The above-described device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interface, device or unit, which can be electrical, mechanical or other forms.

[0207] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment.

[0208] In addition, each functional unit in each embodiment of the present disclosure can be integrated into one processing unit, or each unit can exist physically, or two or more units can be integrated into one unit.

[0209] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a nonvolatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present disclosure essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0210] Finally, it should be noted that: the above-described embodiments are only specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, and not to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can make modifications or easily think of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present disclosure, or make equivalent replacements to some of the technical features. The modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A map generation method, characterized in that, include: Obtain the map path conversion probability of each pixel within a preset geographical range; the map path conversion probability is used to indicate the probability that the pixel is converted from a non-map path pixel to a map path pixel; An initial map path is generated based on the map path conversion probability; For each pixel within the preset geographical range, based on the proportion of pixels in each of the pixel's neighboring pixels that belong to the pixels in the initial map path, it is determined whether the pixel belongs to the pixels in the intermediate map path, so as to obtain the intermediate map path. The intermediate map path is used as the updated initial map path, and the step of determining the intermediate map path is repeated until a preset number of iterations is reached. Based on the intermediate map path after the last iteration, the target map is generated.

2. The method according to claim 1, characterized in that, The process of generating the target map based on the intermediate map path after the last iteration includes: If there are multiple disconnected map path segments in the intermediate map path, start multiple agent threads; The current map path to be connected is determined from the plurality of map path parts. For each agent thread, a pixel is randomly selected from the current map path to be connected as the starting pixel, and a candidate path from the starting pixel to other map path parts is randomly generated. The shortest path among the candidate paths generated by the plurality of agent threads is taken as the path of the target map. Repeat the step of determining the current map path segment to be connected from the plurality of map path segments until the connection between the plurality of map path segments is completed, and the path of the target map is obtained.

3. The method according to claim 1, characterized in that, Before generating the initial map path based on the map path transformation probability, the method further includes: Obtain the path sketch drawn by the user; Based on the path sketch, a skeleton diagram is generated; the style of the skeleton diagram matches the path sketch, and the skeleton diagram does not contain any pixels belonging to the path sketch. Based on the path sketch and the skeleton diagram, the map path transformation probability is determined.

4. The method according to claim 3, characterized in that, Determining the map path transition probability based on the path sketch and the skeleton diagram includes: Based on the obtained path width weight and the Manhattan distance from each pixel in the preset geographical area (excluding the path sketch and skeleton map) to the path sketch, the map path transformation probability of each pixel (excluding the path sketch and skeleton map) belonging to the initial map path is determined, and the map path transformation probability of each pixel in the path sketch is set to 1, and the map path transformation probability of each pixel in the skeleton map is set to 0.

5. The method according to claim 4, characterized in that, The step of determining the map path transformation probability of each pixel other than the path sketch and skeleton map belonging to the initial map path includes: based on the acquired multiple path width weights and the Manhattan distance of each pixel to the path sketch, determining the map path transformation probability of each pixel under each path width weight. The step of generating an initial map path based on the map path conversion probability includes: generating multiple initial map paths based on the map path conversion probabilities corresponding to multiple path width weights respectively; After obtaining the paths of the target maps corresponding to the multiple initial map paths, the method further includes: displaying the paths of the multiple target maps, and determining the path of the target map selected by the user from the multiple paths of the target maps.

6. The method according to any one of claims 3 to 5, characterized in that, After generating the target map, the process also includes: In response to receiving modification information from the user regarding the path sketch, the target map is updated based on the modified portion of the path indicated by the modification information.

7. The method according to claim 6, characterized in that, Updating the target map based on the modified path portion indicated by the modification information includes: Based on the modified path portion indicated by the modification information, an updated path sketch is determined, and an updated skeleton map is generated based on the updated path sketch; and the associated geographical range corresponding to the modified path portion is determined. Based on the updated path sketch, the updated skeleton map, and the associated geographic range, the map path conversion probability is updated; wherein, the map path conversion probability of each pixel located in the path of the target map before the update, outside the associated geographic range, is set to 1, and the map path conversion probability of each pixel not located in the path of the target map before the update is set to 0. Based on the updated map path transformation probabilities, an updated initial map path is generated, and based on the updated initial map path, an updated target map is generated.

8. The method according to claim 7, characterized in that, The step of updating the map path conversion probability based on the updated path sketch, the updated skeleton map, and the associated geographic range includes: Based on the path width weight and the Manhattan distance of each target pixel within the associated geographical range (excluding the updated path sketch and the updated skeleton map) to the updated path sketch, the updated map path conversion probability corresponding to each target pixel is determined. In addition, the map path conversion probability of each pixel in the updated path sketch within the associated geographic range is set to 1; and the map path conversion probability of each pixel in the updated skeleton map within the associated geographic range is set to 0.

9. The method according to claim 7 or 8, characterized in that, The step of generating an updated target map based on the updated initial map path includes: For each pixel within the associated geographic range, based on the proportion of pixels in each of the pixel's neighboring pixels that belong to the pixels in the initial map path, it is determined whether the pixel belongs to the pixels in the intermediate map path, so as to obtain the updated intermediate map path. The updated intermediate map path is used as the updated initial map path, and the step of determining the updated intermediate map path is repeated until a preset number of iterations is reached; wherein, in each iteration, the neighboring pixels of the path that is not located within the associated geographical range and belongs to the target map before the update are regarded as pixels belonging to the initial map path, and the neighboring pixels of the path that is not located within the associated geographical range and does not belong to the target map before the update are regarded as pixels not belonging to the initial map path. The target map is updated based on the results of the last iteration.

10. The method according to claim 1, characterized in that, The process of generating the target map based on the intermediate map path after the last iteration includes: Based on the selection probability of each map decoration element, each map decoration element is randomly filled into each connected area within the preset geographical range to obtain a target map including each map decoration element and the intermediate map path.

11. A map generation method, characterized in that, include: Obtain the path sketch drawn by the user; Based on the path sketch, generate the target map; Receive user modification information regarding the path sketch obtained through user changes or redrawing of the path sketch; The target map is updated based on the modified path portion indicated by the modification information.

12. The method according to claim 11, characterized in that, The method further includes: Determine the associated geographic range of the user-selected portion of the path that includes the modification, wherein the target map portion located outside the associated geographic range is not updated; Updating the target map based on the modified path portion indicated by the modification information includes: updating the target map based on the modified path portion indicated by the modification information and the associated geographical range.

13. The method according to claim 11 or 12, characterized in that, The updating of the target map based on the modified path portion indicated by the modification information is implemented using the method described in any one of claims 7 to 9.

14. A map generation apparatus, characterized in that, include: The first acquisition unit is used to acquire the map path conversion probability of each pixel within a preset geographical range; the map path conversion probability is used to indicate the probability that the pixel is converted from a non-map path pixel to a map path pixel; The first generation unit is used to generate an initial map path based on the map path conversion probability; The determining unit is used to determine whether a pixel belongs to an intermediate map path for each pixel within the preset geographical range, based on the proportion of pixels in the initial map path among the pixels in each of the pixel's neighboring pixels, so as to obtain the intermediate map path. The second generation unit is used to repeatedly execute the step of determining the intermediate map path as the updated initial map path until a preset number of iterations is reached, and generate the target map based on the intermediate map path after the last iteration.

15. A map generation apparatus, characterized in that, include: The second acquisition unit is used to acquire the path sketch drawn by the user; The third generation unit is used to generate a target map based on the path sketch; The receiving unit is configured to receive user modification information regarding the path sketch obtained through user alteration or redrawing of the path sketch; An update unit is used to update the target map based on the modified path portion indicated by the modification information.

16. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they perform the steps of the map generation method as described in any one of claims 1 to 10, or perform the steps of the map generation method as described in any one of claims 11 to 13.

17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the map generation method as described in any one of claims 1 to 10, or performs the steps of the map generation method as described in any one of claims 11 to 13.

Citation Information

Patent Citations

  • Map bidirectional updating adaptation device based on SLAM and scheduling system

    CN115034987A