Ground surface vegetation generation method and device, electronic equipment and storage medium

By obtaining topographic height maps and natural language to extract key vegetation information, combined with vegetation masking technology, the problem of rigid vegetation patterns in the virtual environment is solved, and the customization and authenticity of vegetation are achieved.

CN119131191AActive Publication Date: 2024-12-13GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411116536.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-12-13
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

When the existing technology generates vegetation on the surface of the surface in a virtual environment, the vegetation shape is relatively rigid and cannot be customized, and lacks authenticity and flexibility.

Method used

By obtaining the topographic height map and the natural language input by users, vegetation key information is extracted, vegetation is generated and displayed based on the vegetation key information and terrain height map, and vegetation masking technology is used to improve generation efficiency and authenticity.

Benefits of technology

The customized generation of vegetation has been realized, the authenticity and flexibility of vegetation has been improved, and the generation efficiency and flexibility of post-adjustment have been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131191A_ABST
    Figure CN119131191A_ABST
Patent Text Reader

Abstract

The invention provides an earth surface vegetation generation method and device, electronic equipment and a storage medium, and relates to the technical field of image processing. The method comprises the following steps: acquiring a terrain height map, and determining azimuth information corresponding to each pixel region in the terrain height map; vegetation key information is extracted according to a natural language input by a user; and according to the vegetation key information and the azimuth information corresponding to each pixel region in the terrain height map, generating and displaying vegetation in the terrain height map. According to the method, the user only needs to input related information of the vegetation to be generated in a natural language mode, and then customized setting of the generated vegetation can be achieved according to the thought of the user. Wherein the generation position, the vegetation type, the vegetation density and other information of the to-be-generated vegetation can be extracted through the natural language, so that the shape, the density and other information of the generated vegetation can be controlled, and the flexibility and the authenticity of the generated vegetation are higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for generating surface vegetation. Background Art

[0002] In the virtual environment of some games, it is often necessary to generate vegetation on the surface of the virtual environment to make the virtual environment closer to the real natural environment.

[0003] Currently, when vegetation is generated on the surface, templates corresponding to different vegetation are created in advance. When vegetation is generated on the surface, it is achieved by calling the fixed template corresponding to the vegetation.

[0004] However, the method of generating vegetation with a fixed template will make the overall shape of the generated vegetation relatively rigid and unrealistic, and it is impossible to achieve customized generation of vegetation. Summary of the invention

[0005] The purpose of the present application is to provide a method, device, electronic device and storage medium for generating surface vegetation in order to address the deficiencies in the above-mentioned prior art, so as to realize customized generation of vegetation and improve the authenticity of the generated vegetation.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides a method for generating surface vegetation, comprising:

[0008] Obtaining a terrain height map, and determining the orientation information corresponding to each pixel area in the terrain height map;

[0009] Extracting vegetation key information according to the natural language input by the user, the vegetation key information is used to indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, the attribute information including: vegetation type and vegetation density;

[0010] Vegetation is generated and displayed in the terrain height map according to the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map.

[0011] In a second aspect, the embodiment of the present application further provides a surface vegetation generation device, including: an acquisition module, an analysis module and a generation module;

[0012] The acquisition module is used to acquire a terrain height map and determine the azimuth information corresponding to each pixel area in the terrain height map;

[0013] The analysis module is used to extract vegetation key information according to the natural language input by the user, and the vegetation key information is used to indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, and the attribute information includes: vegetation type and vegetation density;

[0014] The generating module is used to generate and display vegetation in the terrain height map according to the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to implement the surface vegetation generation method provided in the first aspect.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for generating surface vegetation as provided in the first aspect is executed.

[0017] The beneficial effects of this application are:

[0018] The present application provides a method, device, electronic device and storage medium for generating surface vegetation, including: obtaining a terrain height map, and determining the orientation information corresponding to each pixel area in the terrain height map; extracting vegetation key information based on natural language input by the user; generating and displaying vegetation in the terrain height map based on the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map. In this method, the user only needs to input the relevant information of the vegetation to be generated in the form of natural language, and can realize customized settings for the generated vegetation according to his own ideas. Among them, the generation location, vegetation type, vegetation density and other information of the vegetation to be generated can be extracted through natural language, so that the shape, density and other information of the generated vegetation can be controlled, so that the flexibility and authenticity of the generated vegetation are higher.

[0019] In the process of generating vegetation, a vegetation mask that best matches the vegetation to be generated is generated based on the key information of the vegetation, and the effect of the vegetation mask is improved through a series of enhancement processing methods. Vegetation is then generated based on the vegetation mask, so that the generated vegetation form is more natural and closer to the real vegetation. Generating vegetation by means of vegetation mask improves the efficiency of vegetation generation and makes the later vegetation adjustment more flexible. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 A schematic diagram of a process for generating surface vegetation provided in an embodiment of the present application;

[0022] Figure 2 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0023] Figure 3 A schematic diagram of the area division of a terrain height map provided in an embodiment of the present application;

[0024] Figure 4 A schematic diagram of a pixel region orientation definition provided in an embodiment of the present application;

[0025] Figure 5 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0026] Figure 6 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0027] Figure 7 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0028] Figure 8 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0029] Fig. 9 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0030] Fig.10 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0031] Fig.11 A schematic diagram of particle distribution provided in an embodiment of the present application;

[0032] Fig.12 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0033] Fig.13 A schematic diagram of an initial vegetation mask provided in an embodiment of the present application;

[0034] Fig.14 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0035] Fig.15 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0036] Fig.16 A schematic diagram of another vegetation mask provided in an embodiment of the present application;

[0037] Fig.17 A schematic diagram of a flow chart of another method for generating surface vegetation provided in an embodiment of the present application;

[0038] Fig.18 A schematic diagram of a surface vegetation generation device provided in an embodiment of the present application;

[0039] Fig.19 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0041] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0042] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0043] In the virtual environment of some games, it is often necessary to generate vegetation on the surface of the virtual environment to make the virtual environment closer to the real natural environment. In the related art, vegetation plots at different locations in the target surface area of ​​the virtual environment are generated by templates. In the above-mentioned related art, the overall form of the vegetation covered in the target surface area is relatively rigid and not realistic enough, and developers cannot realize the customized generation of vegetation according to their own ideas, resulting in the final generated vegetation being not stylized enough and the features not being distinct enough.

[0044] Based on this, this solution provides a method for generating surface vegetation. By parsing the natural language input by the user, the key information of vegetation can be obtained, and then the vegetation to be generated is generated and displayed in the terrain height map based on the key information of vegetation and the attribute information of each pixel area in the terrain height map, thereby realizing the generation of vegetation in the virtual environment. Through this method, the user only needs to input the relevant information of the vegetation to be generated in the form of natural language according to the idea, and the automatic generation of vegetation can be realized, thereby realizing the personalized generation of vegetation. In the process of generating vegetation, the vegetation mask that best matches the vegetation to be generated is first generated according to the key information of vegetation, and then the vegetation is generated based on the vegetation mask, so that the generated vegetation form is more natural and closer to the real vegetation.

[0045] Figure 1 A schematic diagram of a process flow of a method for generating surface vegetation provided in an embodiment of the present application; the execution subject of the method may be a computer device, such as Figure 1 As shown, the method may include:

[0046] S101, obtaining a terrain height map, and determining the orientation information corresponding to each pixel area in the terrain height map.

[0047] The virtual terrain of the game is usually generated by a terrain height map and landform data. The landform data may refer to the surface vegetation data. By overlaying the surface vegetation on the terrain height map, a virtual terrain of the game that is close to reality can be generated.

[0048] Terrain heightmaps can intuitively show the undulating characteristics of terrain; terrain heightmaps can be generated in a variety of ways, including but not limited to manual drawing using professional drawing software (such as Photoshop), extraction from real-world geographic data (such as SRTM (Shuttle Radar Topography Mission, joint measurement data) data), and automatic generation through program algorithms.

[0049] Optionally, since the generation of vegetation needs to be based on the terrain height map, the virtual terrain that ultimately contains vegetation is generated in combination with the terrain height map, so the vegetation should be based on the size layout of the terrain height map.

[0050] Since the terrain height map may be large in size, in order to facilitate the subsequent vegetation generation and improve the accuracy of vegetation generation, the terrain height map can be divided into regions first to determine the orientation information corresponding to different pixel regions in the terrain height map.

[0051] S102: Extract key vegetation information according to the natural language input by the user.

[0052] The vegetation key information is used to indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, and the attribute information includes: vegetation type and vegetation density.

[0053] In this embodiment, the user only needs to describe the relevant information of the vegetation to be generated in the form of natural language, and the key information of the vegetation can be extracted by parsing and analyzing the natural language.

[0054] Among them, by inputting in natural language, users can realize personalized input and control the density, orientation and other information of the vegetation to be generated, and are no longer limited to the fixed and rigid vegetation template generation method.

[0055] In one achievable manner, the natural language input by the user may contain a long string of characters, which may respectively indicate the relevant information of generating different vegetation at different positions in the terrain height map. In this case, multiple sets of vegetation key information can be extracted from the natural language by parsing it.

[0056] In another achievable manner, the natural language input by the user may also only contain a string, which only indicates relevant information for generating a specified vegetation at a specified position in the terrain height map. In this case, a set of key vegetation information can be extracted from the natural language by parsing it.

[0057] In this embodiment, any group of extracted vegetation key information is taken as an example to illustrate the solution. In actual applications, when there are multiple groups of vegetation key information, the methods of generating vegetation based on each group of vegetation key information are the same, with only differences in the location, vegetation type, vegetation shape, etc. of the final generated vegetation.

[0058] Optionally, the vegetation key information may indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, that is, the vegetation key information may be used to determine the position in the terrain height map where the vegetation is to be generated. The attribute information of the vegetation includes: vegetation type and vegetation density. The attribute information of the vegetation may be used to determine what vegetation to be generated and the distribution density of the vegetation.

[0059] Of course, in some embodiments, the attribute information of vegetation may also include: vegetation color, vegetation height, etc.

[0060] S103: Generate and display vegetation in the terrain height map according to the key information of the vegetation and the orientation information corresponding to each pixel area in the terrain height map.

[0061] Optionally, based on the extracted vegetation key information and the orientation information corresponding to each pixel area in the terrain height map, the generation position of the vegetation indicated by the vegetation key information in the terrain height map can be determined, and then the vegetation is generated and displayed in the terrain height map according to the generation position, thereby generating a virtual terrain picture.

[0062] In summary, the surface vegetation generation method provided in this embodiment includes: obtaining a terrain height map, and determining the orientation information corresponding to each pixel area in the terrain height map; extracting vegetation key information based on the natural language input by the user; generating and displaying vegetation in the terrain height map based on the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map. In this method, the user only needs to input the relevant information of the vegetation to be generated in the form of natural language, and can realize customized settings for the generated vegetation according to his own ideas. Among them, the generation location, vegetation type, vegetation density and other information of the vegetation to be generated can be extracted through natural language, so that the shape, density and other information of the generated vegetation can be controlled, so that the flexibility and authenticity of the generated vegetation are higher.

[0063] Figure 2 A flow chart of another method for generating surface vegetation provided in an embodiment of the present application; Optionally, in step S101, determining the orientation information corresponding to each pixel area in the terrain height map may include:

[0064] S201. Divide a terrain height map according to a preset area division method to determine at least one pixel area.

[0065] In some embodiments, the terrain height map may have a large resolution. If it is not divided, it is difficult to locate the exact position in the terrain height map to generate vegetation. Therefore, the entire terrain height map can be divided into multiple pixel regions, and the pixel range of each pixel region in the terrain height map does not overlap. After dividing the terrain height map into multiple pixel regions, a certain position can be quickly locked in the terrain height map.

[0066] Figure 3 A schematic diagram of the area division of a terrain height map provided in an embodiment of the present application, such as Figure 3 As shown, the terrain height map can be divided into 9 pixel areas according to the size of 9*9, namely pixel area 1, pixel area 2, pixel area 3, pixel area 4, pixel area 5, pixel area 6, pixel area 7, pixel area 8, and pixel area 9.

[0067] Of course, this is just one possible way of division. In practical applications, the division size can be adjusted according to the specific size of the terrain height map. When the size of the terrain height map is large, the division size can also be set larger, so that the division result is more refined.

[0068] S202: Determine the orientation information corresponding to each pixel area according to a preset orientation definition method.

[0069] According to the division result, the position information of each pixel area in the terrain height map can be determined, so that according to the position information and the preset orientation definition method, the orientation information corresponding to each pixel area can be determined respectively.

[0070] Figure 4 A schematic diagram of a pixel region orientation definition provided in an embodiment of the present application. Figure 3 Based on the pixel area division method, the orientation information of pixel area 1 can be defined as upper left (also called northwest), the orientation information of pixel area 2 as upper (also called north), the orientation information of pixel area 3 as upper right (also called northeast), the orientation information of pixel area 4 as left (also called west), the orientation information of pixel area 5 as center, the orientation information of pixel area 6 as right (also called east), the orientation information of pixel area 7 as lower left (also called southwest), the orientation information of pixel area 8 as lower (also called south), and the orientation information of pixel area 9 as lower right (also called southeast).

[0071] Of course, when the pixel area division method of the terrain height map changes, the corresponding orientation information definition can also be changed appropriately to accurately describe the position of the pixel area in the terrain height map.

[0072] Figure 5 A flowchart of another method for generating surface vegetation provided in an embodiment of the present application; Optionally, in step S102, extracting key vegetation information according to the natural language input by the user may include:

[0073] S501: parse the natural language to obtain multiple groups of query information.

[0074] Optionally, the input natural language may be segmented to divide the continuous text into a series of meaningful units, such as words, symbols or phrases, to obtain multiple groups of query information.

[0075] Each set of query information obtained here is still in the form of natural language, but the complete natural language input is divided into multiple sets of character strings.

[0076] S502: Match each group of query information with each standard information in a pre-created template library, and obtain the key vegetation information indicated by each group of query information according to the matching result.

[0077] Optionally, each set of query information can be matched with each standard information in a pre-created template library, which can store standard orientation information, standard vegetation density information, etc. By performing string matching between the query information and the standard information in the template library, key vegetation information can be extracted from the query information.

[0078] A set of query information can be matched to obtain a set of vegetation key information, and a set of vegetation key information indicates vegetation generation related information in a specified pixel area in the terrain height map.

[0079] For example, if the natural language input by the user is "Grow some trees in the upper left position, generate a lot of sunflowers in the middle position, and a normal amount of grass below", then after parsing and segmenting the natural language, three groups of query information can be obtained, namely "Grow some trees in the upper left position", "Grow a lot of sunflowers in the middle position", and "A normal amount of grass below". By matching each group of query information with the template library, three groups of vegetation key information can be obtained, namely "upper left, some trees", "middle, a lot of sunflowers in the middle", and "below, a normal amount of grass".

[0080] Figure 6 A schematic flow chart of another method for generating surface vegetation provided in an embodiment of the present application; optionally, the process of creating the template library may include:

[0081] S601. Generate at least one type of standard orientation description information corresponding to each orientation according to the orientation definition method of the terrain height map.

[0082] The data in the template library may include: orientation information describing orientation and vegetation density information describing density, and of course, vegetation color information describing color, etc.

[0083] In order to ensure the consistency of orientation, the orientation division method in the template library must be consistent with the terrain height map, so that the key vegetation information obtained after matching through the template library can accurately indicate the planting orientation of vegetation in the terrain height map. If the orientation definition in the template library is inconsistent with the orientation definition in the terrain height map, the same orientation information may represent different orientations, and the specific orientation cannot be determined.

[0084] According to the same orientation definition method as the terrain height map, standard orientation description information in the template library can be generated, wherein each orientation can correspond to multiple standard orientation description information. For example, "up and north" both describe the same orientation, and "upper right and northeast" both describe the same orientation.

[0085] S602: Generate at least one standard density description information corresponding to each density level according to the density level classification method of vegetation.

[0086] The density level of vegetation can be divided into sparse, medium, dense, etc. Each density level also corresponds to one or more standard density description information. For example, "a small amount, rare, a little" and so on all describe the density level as sparse; "medium, moderate, ordinary" and so on all describe the density level as medium; "a large amount, many, a lot" and so on all describe the density level as dense.

[0087] S603: Generate a template library according to at least one standard orientation description information corresponding to each orientation and at least one standard orientation description information corresponding to each density level.

[0088] Optionally, a template library may be generated according to the above-mentioned standard orientation description information and standard density description information.

[0089] Table 1 below shows the contents of the template library:

[0090] Table 1

[0091]

[0092] Figure 7 A flow chart of another method for generating surface vegetation provided in an embodiment of the present application; optionally, in step S103, generating and displaying vegetation in a terrain height map according to key vegetation information and orientation information corresponding to each pixel area in the terrain height map may include:

[0093] S701, determining a target pixel area corresponding to a position according to the position indicated by the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map.

[0094] Optionally, according to the position indicated by the vegetation key information, the orientation information indicated by the vegetation key information in the terrain height map can be determined, and according to the mapping relationship between the orientation information and the pixel area, the target pixel area indicated by the vegetation key information can be determined. Figure 3 and Figure 4 , for example: the azimuth information corresponding to pixel area 1 is upper left (or northwest).

[0095] Exemplarily, if the position indicated by the vegetation key information is the upper left, it can be determined that the vegetation key information indicates the upper left position in the terrain height map. Since the upper left position corresponds to pixel area 1, it can be determined that the target pixel area indicated by the vegetation key information is pixel area 1.

[0096] S702: Generate a corresponding vegetation mask in the target pixel area according to the attribute information indicated by the vegetation key information, and generate corresponding vegetation on the vegetation mask.

[0097] The type and density of vegetation can be determined based on the attribute information in the vegetation key information, and the vegetation density determines the area and shape of the vegetation mask, so that the vegetation mask corresponding to the vegetation key information can be generated in the determined target pixel area. Furthermore, the corresponding vegetation can be generated on the vegetation mask based on the vegetation type.

[0098] It is worth mentioning that generating vegetation mask first and then generating vegetation has the following advantages: First: Reduce the amount of calculation: By pre-generating vegetation mask, when generating vegetation later, detailed generation and rendering of vegetation can be performed only in the corresponding vegetation mask area, without performing indiscriminate calculations on the entire terrain. This greatly reduces the amount of calculation and improves rendering efficiency. Second: Optimize resource allocation: Under limited computing resources, give priority to processing terrain and vegetation in the vegetation mask area, which can ensure that the rendering effect of these areas is more refined, while avoiding wasting computing resources in non-vegetation areas. Third: Enhance the authenticity of vegetation distribution. The distribution of vegetation in nature is often affected by multiple factors such as terrain, climate, and soil. Through vegetation mask, the influence of these factors on vegetation distribution can be more accurately simulated, making the generated vegetation distribution closer to the natural state. Control vegetation density: Vegetation mask can control the density of vegetation by adjusting the mask value of different areas. Set a higher mask value in areas with dense vegetation, and set a lower mask value or completely transparent in areas with sparse or non-existent vegetation, so as to achieve a more realistic vegetation distribution effect. Fourth: Easy to edit and adjust later, flexible modification: If you need to edit or adjust the vegetation in the virtual terrain (such as changing the vegetation type, adjusting the vegetation distribution, etc.), the vegetation mask can be used more conveniently. You only need to modify the vegetation mask to quickly update the vegetation generation results without the need to perform complex recalculations on the entire terrain. Layered management.

[0099] Figure 8 A flow chart of another method for generating surface vegetation provided in an embodiment of the present application; Optionally, in step S702, generating a corresponding vegetation mask in a target pixel area according to the attribute information indicated by the vegetation key information, and generating corresponding vegetation on the vegetation mask may include:

[0100] S801: Generate an initial vegetation mask in a target pixel area of ​​a terrain height map according to vegetation density.

[0101] In some embodiments, the area and shape of the vegetation mask may be determined according to the vegetation density in the vegetation key information, thereby generating an initial vegetation mask within a target pixel area of ​​the terrain height map.

[0102] S802: Perform enhancement processing on the initial vegetation mask to generate a vegetation mask corresponding to the target pixel area.

[0103] This embodiment can also enhance the initial vegetation mask through some enhancement processing methods to improve the authenticity and detail of the distribution of the vegetation finally generated, so that the vegetation will not be too rigid and strong, and the intersection between the vegetation and the ground surface will be more natural.

[0104] A vegetation mask is generated by enhancing the initial vegetation mask.

[0105] S803: Generate corresponding vegetation on the vegetation mask according to the vegetation type.

[0106] According to the vegetation type, it can be determined what the vegetation to be generated is, for example, the vegetation can be trees, flowers, or plants; it can also be determined specifically what kind of trees or flowers, etc. Thus, the corresponding type of vegetation can be generated on the vegetation mask.

[0107] Fig. 9 A flow chart of another method for generating surface vegetation provided in an embodiment of the present application; Optionally, in step S801, generating an initial vegetation mask in a target pixel area of ​​a terrain height map according to vegetation density may include:

[0108] S901. Determine the area and shape of the initial vegetation mask according to the vegetation density.

[0109] Optionally, a DLA (Diffusion Limited Aggregation) algorithm may be used to perform calculations based on vegetation density to determine the area and shape of the initial vegetation mask to be generated.

[0110] S902: Generate an initial vegetation mask in the target pixel area according to the area and shape of the initial vegetation mask.

[0111] According to the determined area and shape of the initial vegetation mask, an initial vegetation mask matching the area and shape can be generated in the target pixel area.

[0112] Fig.10 A schematic flow chart of another method for generating surface vegetation provided in an embodiment of the present application; Optionally, in step S901, determining the area and shape of the initial vegetation mask according to the vegetation density may include:

[0113] S1001, taking vegetation density as input data and inputting it into a diffusion restricted agglomeration algorithm, performing calculations through the diffusion restricted agglomeration algorithm to determine the number of particles at each key point in the target pixel area.

[0114] The vegetation density can be used as input data of the DLA algorithm, so as to perform calculations based on the DLA algorithm to obtain the area and shape of the initial vegetation mask.

[0115] In many physical processes, the interactions between particles (such as electromagnetic forces, van der Waals forces, etc.) become significant when they are close to each other. When a particle approaches another particle or a group of particles, they may attract each other and eventually combine. In simulation, this natural phenomenon can be effectively simulated by stopping and marking particles when they are close to each other. This simulation method is often used to generate fractal structures or specific patterns that are prevalent in nature, such as snowflakes, corals, lightning, etc. By allowing particles to stop and mark when they are close to each other, simulations can produce complex and interesting patterns that are formed by similar principles to processes in nature.

[0116] Optionally, the center point of the target pixel area can be marked as fixed, and then a particle starting position is randomly selected in the target pixel area, and random walks are continued until the particle is close to other particles, stops at the current position and marks the current position, and determines the number of particles at the current position based on the vegetation density at the current position and the pre-created correspondence between vegetation density and particle number. The current position can be used as a key point.

[0117] The corresponding relationship between the created vegetation density and the vegetation quantity can be, for example: the number of particles corresponding to the vegetation density "small amount" is "100"; the number of particles corresponding to the vegetation density "medium" is "300"; the number of particles corresponding to the vegetation density "large amount" is "800".

[0118] S1002: Determine the area and shape of the initial vegetation mask according to the number of particles at each key point.

[0119] According to the number of particles at each key point, the area and shape of the initial vegetation mask can be determined, and simulation generation based on the area and shape of the initial vegetation mask can generate the corresponding initial vegetation mask.

[0120] Fig.11 A particle distribution diagram provided in an embodiment of the present application. Fig.11 A schematic diagram showing the particle distribution of the initial vegetation mask determined by vegetation density. The particle distribution determines the area and shape of the initial vegetation mask.

[0121] Fig.12 A schematic flow chart of another method for generating surface vegetation provided in an embodiment of the present application; Optionally, in step S902, generating an initial vegetation mask in a target pixel area according to the area and shape of the initial vegetation mask may include:

[0122] S1201: Generate a current vegetation mask according to the area and shape of the initial vegetation mask.

[0123] In some embodiments, according to the area and shape of the initial vegetation mask determined above, an appropriate vegetation mask may be generated first, and the current vegetation mask is not the final vegetation mask required.

[0124] S1202: Binarize and perform Gaussian blur processing on the current vegetation mask to obtain an initial vegetation mask.

[0125] It should be noted that the vegetation mask exists in the form of a picture, and the vegetation mask is also a vegetation mask image. Optionally, the current vegetation mask may be subjected to image binarization processing and Gaussian blur processing to obtain an initial vegetation mask.

[0126] Among them, image binarization is to set the grayscale value of the pixel on the image to 0 or 255, that is, the entire image presents an obvious black and white effect. In the vegetation mask image, the binarization process can help to clearly separate the vegetation area (usually white or black, depending on the threshold setting) from the non-vegetation area (usually the opposite color).

[0127] Gaussian blur is a commonly used image processing technique that softens and blurs the image by blurring the details of the image. In the vegetation mask image, Gaussian blur can be used to blur the edges of the vegetation mask, making the vegetation mask more natural.

[0128] Fig.13 A schematic diagram of an initial vegetation mask provided in an embodiment of the present application, Fig.13 Only the initial vegetation mask generated in pixel area 1 in the terrain height map is shown. Fig.13 As shown, the white area is the area where the initial vegetation mask is located, and the black area can be understood as the background area.

[0129] Fig.14 A schematic flow chart of another method for generating surface vegetation provided in an embodiment of the present application; Optionally, in step S802, the initial vegetation mask is enhanced to generate a vegetation mask corresponding to the target pixel area, which may include:

[0130] S1401. Process an initial vegetation mask according to a pre-generated noise image to generate a first processed vegetation mask.

[0131] Based on the initial vegetation mask generated above, image enhancement processing may be further performed to make the vegetation mask finally generated more realistic and natural.

[0132] Optionally, a noise image can be generated in advance, and the size of the noise image can be the same as the size of the target pixel area, that is, the size of the noise image and any pixel area is the same, so that the same noise image can be used to process the initial vegetation mask corresponding to each pixel area respectively.

[0133] After the initial vegetation mask is processed by the noise image, a first processed vegetation mask is obtained.

[0134] In nature, vegetation is often affected by various factors, such as illumination changes, shadows, occlusion, noise, etc. By processing the initial vegetation mask with a noise image, the interference factors in the actual environment can be simulated, making the processed vegetation mask more realistic.

[0135] S1402: Perform Gaussian blur processing on the vegetation mask after the first processing to generate a vegetation mask after the second processing.

[0136] Optionally, the vegetation mask after the first processing may be subjected to Gaussian blur processing again. This is because the vegetation mask after the first processing may become unnatural due to the processing of the noise image. The vegetation mask after the second processing may be made more natural through Gaussian blur processing.

[0137] S1403, extracting edge data corresponding to the target pixel area in the terrain height map, and processing the vegetation mask after the second processing according to the edge data to generate a vegetation mask corresponding to the target pixel area.

[0138] Next, the vegetation mask after the second processing may be calculated with the edge data extracted from the terrain height map to obtain a final vegetation mask.

[0139] Fig.15 A schematic flow chart of another method for generating surface vegetation provided in an embodiment of the present application; optionally, in step S1401, the process of generating a noise image may include:

[0140] S1501: Determine noise attribute parameters of each continuous image region in an initial noise image.

[0141] In this embodiment, a cyclic noise generation method may be adopted, and by adjusting the noise attribute parameters, different regions in the generated noise image may have different noise effects, thereby improving the application performance of the noise image.

[0142] Optionally, each continuous image region in the initial noise image may be determined, that is, the initial noise image is divided into regions to obtain continuous image regions, and different values ​​of noise attribute parameters are set for each continuous image region.

[0143] The noise attribute parameters may include but are not limited to: noise scaling, complexity, persistence and fractal dimension.

[0144] Optionally, the values ​​of the noise attribute parameters of each continuous image region may be set to be different, so that the noise effect generated by each continuous image region is different.

[0145] S1502 . Generate noise information of each continuous image region in sequence according to noise attribute parameters of each continuous image region; the noise attribute parameters of each continuous image region are not completely the same.

[0146] Based on the noise attribute parameters of each continuous image region, a Perlin noise algorithm may be used to sequentially generate noise information of each continuous image region.

[0147] S1503: Generate an intermediate noise image according to the noise information of each continuous image region.

[0148] Based on the noise information of each continuous image region, an intermediate noise image may be generated, wherein the generated intermediate noise image may be composed of dense small dots, and the intermediate noise image may contain different pixel points such as black, white, and gray.

[0149] S1504 , performing color conversion on the intermediate noise image according to the magnitude of each pixel value in the intermediate noise image and a preset threshold value to obtain a noise image, wherein the noise image includes: a black area and a white area.

[0150] Optionally, the intermediate noise image may be color-converted according to the magnitude of each pixel value in the intermediate noise image and preset threshold data to generate a black-and-white noise image.

[0151] The preset threshold may be 140. Through the above processing, pixels with values ​​greater than 140 may be set to white, and the remaining pixels may be set to black, thereby obtaining a black and white noise image.

[0152] Optionally, in step S1401, the initial vegetation mask is processed according to a pre-generated noise image to generate a first processed vegetation mask, which may include: subtracting pixels in the white area of ​​the initial vegetation mask from pixels in the black area of ​​the noise image that fall into the white area to generate the first processed vegetation mask.

[0153] In one feasible method, the white area in the initial vegetation mask can be superimposed with the noise image, and the so-called superposition means subtracting the pixels of the white area in the initial vegetation mask from the pixels of the black area in the noise image that falls into the white area, so that the white area in the initial vegetation mask is no longer as Fig.13 Shown is a whole piece.

[0154] Fig.16 A schematic diagram of another vegetation mask provided in an embodiment of the present application. Fig.16 The figure shows a schematic diagram of the vegetation mask after the second processing after Gaussian blurring of the vegetation mask after the first processing. Fig.13 The initial vegetation mask in the image is processed by the noise image and Gaussian blur. The white area in the initial vegetation mask has changed. The white area is no longer a whole piece, but a cotton-like shape. The vegetation mask is no longer rigid and stiff. The vegetation generated based on the vegetation mask is no longer a whole piece, which effectively simulates the growth state of vegetation in the real nature. For example, many vegetations may be partially sparse and partially dense, or flowers and plants may be planted among some trees, rather than the trees in a certain area growing exactly the same and with the same density, which creates an unrealistic feeling.

[0155] Fig.17 A schematic flow chart of another method for generating surface vegetation provided in an embodiment of the present application; Optionally, in step S1403, extracting edge data corresponding to a target pixel area in a terrain height map may include:

[0156] S1701, performing Gaussian blur processing on the terrain height map to generate a processed terrain height map.

[0157] Optionally, the acquired terrain height map may first be subjected to Gaussian blur processing to remove noise, and then an edge detection algorithm, such as the Canny algorithm, may be used to perform edge detection on the terrain height map to extract edge information and obtain edge data.

[0158] The edge detection process can be performed on each pixel area after the orientation division, or on the entire terrain height map. However, when calculating the edge data and the vegetation mask, the vegetation mask corresponding to the target pixel area is only calculated with the edge data corresponding to the target pixel area to ensure the accuracy of data calculation.

[0159] S1702: using an edge processing algorithm to perform edge calculation on a target pixel region in the processed terrain height map to obtain edge data corresponding to the target pixel region, where the edge data is used to indicate contour information of an object in the target pixel region.

[0160] Typically, the edge data obtained after edge detection processing on the terrain height map may include but is not limited to: Terrain edge strength: This indicates the significance of terrain height changes. In the terrain height map, areas with sharp height changes (such as cliffs or ridges) will appear as places with higher edge strength in the edge detection results.

[0161] Terrain edge direction: This provides information about the direction of terrain changes. For example, the direction of a valley or ridge can be identified by the edge direction.

[0162] Terrain Edge Location: This specifies where in the terrain heightmap there are significant changes in height. This is useful for identifying terrain features such as mountains, river valleys, slopes, etc.

[0163] For example, if we have a height map representing the terrain of a certain area, after processing it with the Canny algorithm, we can clearly see:

[0164] (1) The contours of mountains and valleys, because the height changes in these areas are relatively large, they will show higher edge strength in the edge detection results.

[0165] (2) The direction of the river. Since the banks of a river are often highly variable areas, they will be shown in the edge detection results.

[0166] (3) Man-made structures, such as roads and dams, will also appear in the edge detection results due to the height difference between these structures and the surrounding natural terrain.

[0167] In this embodiment, the edge data concerned is mainly the contour information of objects with large changes, such as mountains and valleys, that is, the contour information of the objects is extracted from the terrain height map.

[0168] The purpose of calculating the vegetation mask after the second processing with the corresponding edge data is to eliminate the interference of the edge data on the vegetation mask. If it is not calculated with the edge data, the generated vegetation mask will be interfered with, and the intersection between the edge of the vegetation and the ground surface will not be soft and natural enough, and the authenticity will be poor.

[0169] Optionally, in step S1403, processing the vegetation mask after the second processing according to the edge data to generate a vegetation mask corresponding to the target pixel area may include: performing a difference operation on the vegetation mask after the second processing and the edge data to obtain the vegetation mask corresponding to the target pixel area.

[0170] In some embodiments, the vegetation mask after the second processing may be minimized with respect to the corresponding edge data, which can be essentially understood as subtracting the vegetation mask after the second processing from the edge data image and the corresponding edge image to obtain the vegetation mask corresponding to the target pixel area.

[0171] Optionally, based on the above method steps, similar processing is performed on each pixel area in the terrain height map to obtain a vegetation mask corresponding to each pixel area. Of course, in some cases, the user may only need to generate vegetation in some pixel areas, so only the vegetation mask of the corresponding pixel area is generated.

[0172] Finally, through image rendering or art production techniques, vegetation can be generated and displayed on the generated vegetation mask according to the vegetation type indicated by the vegetation key information to obtain the final virtual terrain.

[0173] In summary, the surface vegetation generation method provided in this embodiment includes: obtaining a terrain height map, and determining the orientation information corresponding to each pixel area in the terrain height map; extracting vegetation key information based on the natural language input by the user; generating and displaying vegetation in the terrain height map based on the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map. In this method, the user only needs to input the relevant information of the vegetation to be generated in the form of natural language, and can realize customized settings for the generated vegetation according to his own ideas. Among them, the generation location, vegetation type, vegetation density and other information of the vegetation to be generated can be extracted through natural language, so that the shape, density and other information of the generated vegetation can be controlled, so that the flexibility and authenticity of the generated vegetation are higher.

[0174] In the process of generating vegetation, a vegetation mask that best matches the vegetation to be generated is generated based on the key information of the vegetation, and the effect of the vegetation mask is improved through a series of enhancement processing methods. Vegetation is then generated based on the vegetation mask, so that the generated vegetation form is more natural and closer to the real vegetation. Generating vegetation by means of vegetation mask improves the efficiency of vegetation generation and makes the later vegetation adjustment more flexible.

[0175] The following describes the devices, equipment, storage media, etc. used to execute the surface vegetation generation method provided in this application. The specific implementation process and technical effects are mentioned above and will not be repeated below.

[0176] Fig.18 The schematic diagram of a surface vegetation generation device provided in the embodiment of the present application, the functions implemented by the surface vegetation generation device correspond to the steps performed by the above method. The device can be understood as the above-mentioned computer device, such as Fig.18 As shown, the device may include: an acquisition module 180, an analysis module 181 and a generation module 182;

[0177] An acquisition module 180 is used to acquire a terrain height map and determine the azimuth information corresponding to each pixel area in the terrain height map;

[0178] The analysis module 181 is used to extract vegetation key information according to the natural language input by the user, and the vegetation key information is used to indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, and the attribute information includes: vegetation type and vegetation density;

[0179] The generating module 182 is used to generate and display vegetation in the terrain height map according to the key information of the vegetation and the orientation information corresponding to each pixel area in the terrain height map.

[0180] Optionally, the acquisition module 180 is specifically used to divide the terrain height map according to a preset area division method to determine at least one pixel area;

[0181] According to a preset orientation definition method, the orientation information corresponding to each pixel area is determined.

[0182] Optionally, the analysis module 181 is specifically used to parse the natural language to obtain multiple groups of query information;

[0183] Each group of query information is matched with each standard information in a pre-created template library, and the key vegetation information indicated by each group of query information is obtained according to the matching result.

[0184] Optionally, it also includes: creating a module;

[0185] A creation module is used to generate at least one standard orientation description information corresponding to each orientation according to the orientation definition method of the terrain height map;

[0186] According to the density classification method of vegetation, at least one standard density description information corresponding to each density level is generated;

[0187] A template library is generated according to at least one standard orientation description information corresponding to each orientation and at least one standard orientation description information corresponding to each density level.

[0188] Optionally, the generating module 182 is specifically used to determine the target pixel area corresponding to the position according to the position indicated by the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map;

[0189] According to the attribute information indicated by the vegetation key information, a corresponding vegetation mask is generated in the target pixel area, and corresponding vegetation is generated on the vegetation mask.

[0190] Optionally, the generating module 182 is specifically configured to generate an initial vegetation mask in a target pixel area of ​​the terrain height map according to the vegetation density;

[0191] Performing enhancement processing on the initial vegetation mask to generate a vegetation mask corresponding to the target pixel area;

[0192] Generate corresponding vegetation on the vegetation mask according to the vegetation type.

[0193] Optionally, the generating module 182 is specifically configured to determine the area and shape of the initial vegetation mask according to the vegetation density;

[0194] According to the area and shape of the initial vegetation mask, an initial vegetation mask is generated in the target pixel area.

[0195] Optionally, the generating module 182 is specifically used to input the vegetation density as input data into the diffusion restricted aggregation algorithm, and perform calculations through the diffusion restricted aggregation algorithm to determine the number of particles at each key point in the target pixel area;

[0196] According to the number of particles at each key point, the area and shape of the initial vegetation mask are determined.

[0197] Optionally, the generating module 182 is specifically configured to generate a current vegetation mask according to the area and shape of the initial vegetation mask;

[0198] The current vegetation mask is binarized and Gaussian blurred to obtain the initial vegetation mask.

[0199] Optionally, the generating module 182 is specifically configured to process the initial vegetation mask according to the pre-generated noise image to generate a first processed vegetation mask;

[0200] Performing Gaussian blur processing on the vegetation mask after the first processing to generate the vegetation mask after the second processing;

[0201] The edge data corresponding to the target pixel area in the terrain height map is extracted, and the vegetation mask after the second processing is processed according to the edge data to generate a vegetation mask corresponding to the target pixel area.

[0202] Optionally, the generating module 182 is further used to determine noise attribute parameters of each continuous image region in the initial noise image;

[0203] According to the noise attribute parameters of each continuous image region, the noise information of each continuous image region is generated in sequence; the noise attribute parameters of each continuous image region are not completely the same;

[0204] generating an intermediate noise image according to the noise information of each continuous image region;

[0205] According to the size of each pixel value in the intermediate noise image and a preset threshold, the intermediate noise image is color-converted to obtain a noise image, and the noise image includes: a black area and a white area.

[0206] Optionally, the generating module 182 is specifically configured to subtract pixels in the white area of ​​the initial vegetation mask from pixels in the black area of ​​the noise image that fall within the white area, to generate the vegetation mask after the first processing.

[0207] Optionally, the generating module 182 is specifically used to perform Gaussian blur processing on the terrain height map to generate a processed terrain height map;

[0208] The edge processing algorithm is used to perform edge calculation on the target pixel area in the processed terrain height map to obtain edge data corresponding to the target pixel area. The edge data is used to indicate the contour information of the object in the target pixel area.

[0209] Optionally, the generating module 182 is specifically configured to perform a difference operation between the vegetation mask after the second processing and the edge data to obtain a vegetation mask corresponding to the target pixel area.

[0210] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0211] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0212] The above modules can be connected or communicated with each other via a wired connection or a wireless connection. The wired connection may include a metal cable, an optical cable, a hybrid cable, etc., or any combination thereof. The wireless connection may include a connection in the form of a LAN, a WAN, Bluetooth, a ZigBee, or NFC, or any combination thereof. Two or more modules may be combined into a single module, and any one module may be divided into two or more units. Those skilled in the art will clearly understand that for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application.

[0213] Fig.19 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application includes: a processor 801, a storage medium 802 and a bus 803, wherein the storage medium 802 stores machine-readable instructions executable by the processor 801. When the electronic device runs a method for generating surface vegetation in an embodiment, the processor 801 communicates with the storage medium 802 via the bus 803, and the processor 801 executes the machine-readable instructions to perform the following steps:

[0214] Obtain a terrain height map and determine the orientation information corresponding to each pixel area in the terrain height map;

[0215] Extracting vegetation key information based on the natural language input by the user, the vegetation key information is used to indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, the attribute information includes: vegetation type and vegetation density;

[0216] Vegetation is generated and displayed in the terrain height map according to the key information of vegetation and the orientation information corresponding to each pixel area in the terrain height map.

[0217] In a feasible implementation manner, when the processor 801 determines the position information corresponding to each pixel area in the terrain height map, it is specifically used to: divide the terrain height map according to a preset area division method to determine at least one pixel area;

[0218] According to a preset orientation definition method, the orientation information corresponding to each pixel area is determined.

[0219] In a feasible implementation, when the processor 801 extracts the vegetation key information according to the natural language input by the user, it is specifically used to: parse the natural language to obtain multiple groups of query information;

[0220] Each group of query information is matched with each standard information in a pre-created template library, and the key vegetation information indicated by each group of query information is obtained according to the matching result.

[0221] In a feasible implementation, when executing the creation of the template library, the processor 801 is specifically used to: generate at least one standard orientation description information corresponding to each orientation according to the orientation definition method of the terrain height map;

[0222] According to the density classification method of vegetation, at least one standard density description information corresponding to each density level is generated;

[0223] A template library is generated according to at least one standard orientation description information corresponding to each orientation and at least one standard orientation description information corresponding to each density level.

[0224] In a feasible implementation, when the processor 801 generates and displays vegetation in a terrain height map according to the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map, it is specifically used to: determine the target pixel area corresponding to the position according to the position indicated by the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map;

[0225] According to the attribute information indicated by the vegetation key information, a corresponding vegetation mask is generated in the target pixel area, and corresponding vegetation is generated on the vegetation mask.

[0226] In a feasible implementation, the processor 801, when executing the process of generating a corresponding vegetation mask in a target pixel area according to the attribute information indicated by the vegetation key information and generating corresponding vegetation on the vegetation mask, is specifically used to: generate an initial vegetation mask in a target pixel area of ​​a terrain height map according to the vegetation density;

[0227] Performing enhancement processing on the initial vegetation mask to generate a vegetation mask corresponding to the target pixel area;

[0228] Generate corresponding vegetation on the vegetation mask according to the vegetation type.

[0229] In a feasible implementation, when the processor 801 generates the initial vegetation mask in the target pixel area of ​​the terrain height map according to the vegetation density, it is specifically used to: determine the area and shape of the initial vegetation mask according to the vegetation density;

[0230] According to the area and shape of the initial vegetation mask, an initial vegetation mask is generated in the target pixel area.

[0231] In a feasible implementation, when the processor 801 determines the area and shape of the initial vegetation mask according to the vegetation density, it is specifically used to: input the vegetation density as input data into the diffusion restricted aggregation algorithm, and calculate through the diffusion restricted aggregation algorithm to determine the number of particles at each key point in the target pixel area;

[0232] According to the number of particles at each key point, the area and shape of the initial vegetation mask are determined.

[0233] In a feasible implementation, when the processor 801 generates the initial vegetation mask in the target pixel area according to the area and shape of the initial vegetation mask, it is specifically used to: generate the current vegetation mask according to the area and shape of the initial vegetation mask;

[0234] The current vegetation mask is binarized and Gaussian blurred to obtain the initial vegetation mask.

[0235] In a feasible implementation manner, when the processor 801 performs enhancement processing on the initial vegetation mask to generate a vegetation mask corresponding to the target pixel area, it is specifically configured to:

[0236] Processing the initial vegetation mask according to the pre-generated noise image to generate a first processed vegetation mask;

[0237] Performing Gaussian blur processing on the vegetation mask after the first processing to generate the vegetation mask after the second processing;

[0238] The edge data corresponding to the target pixel area in the terrain height map is extracted, and the vegetation mask after the second processing is processed according to the edge data to generate a vegetation mask corresponding to the target pixel area.

[0239] In a feasible implementation, when executing the generation of the noise image, the processor 801 is specifically used to: determine the noise attribute parameters of each continuous image area in the initial noise image;

[0240] According to the noise attribute parameters of each continuous image region, the noise information of each continuous image region is generated in sequence; the noise attribute parameters of each continuous image region are not completely the same;

[0241] generating an intermediate noise image according to the noise information of each continuous image region;

[0242] According to the size of each pixel value in the intermediate noise image and a preset threshold, the intermediate noise image is color-converted to obtain a noise image, and the noise image includes: a black area and a white area.

[0243] In a feasible implementation, when the processor 801 processes the initial vegetation mask according to a pre-generated noise image to generate a first processed vegetation mask, it is specifically used to: subtract the pixels in the white area of ​​the initial vegetation mask from the pixels in the black area of ​​the noise image that fall into the white area to generate the first processed vegetation mask.

[0244] In a feasible implementation, when the processor 801 extracts edge data corresponding to the target pixel area in the terrain height map, it is specifically used to: perform Gaussian blur processing on the terrain height map to generate a processed terrain height map;

[0245] The edge processing algorithm is used to perform edge calculation on the target pixel area in the processed terrain height map to obtain edge data corresponding to the target pixel area. The edge data is used to indicate the contour information of the object in the target pixel area.

[0246] In a feasible implementation scheme, when the processor 801 processes the vegetation mask after the second processing according to the edge data to generate a vegetation mask corresponding to the target pixel area, it is specifically used to: perform a difference operation between the vegetation mask after the second processing and the edge data to obtain the vegetation mask corresponding to the target pixel area.

[0247] Among them, the storage medium 802 stores program code, and when the program code is executed by the processor 801, the processor 801 executes various steps in the surface vegetation generation method according to various exemplary embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0248] Processor 801 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DigitalSignal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.

[0249] Storage medium 802, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. Storage medium may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type storage medium, random access storage medium (Random Access Memory, RAM), static random access storage medium (Static Random Access Memory, SRAM), programmable read-only storage medium (Programmable Read Only Memory, PROM), read-only storage medium (Read Only Memory, ROM), electrically erasable programmable read-only storage medium (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic storage medium, disk, optical disk, etc. Storage medium is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The storage medium 802 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0250] Optionally, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor performs the following steps:

[0251] Obtain a terrain height map and determine the orientation information corresponding to each pixel area in the terrain height map;

[0252] Extracting vegetation key information based on the natural language input by the user, the vegetation key information is used to indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, the attribute information includes: vegetation type and vegetation density;

[0253] Vegetation is generated and displayed in the terrain height map according to the key information of vegetation and the orientation information corresponding to each pixel area in the terrain height map.

[0254] In a feasible implementation manner, when the processor 801 determines the position information corresponding to each pixel area in the terrain height map, it is specifically used to: divide the terrain height map according to a preset area division method to determine at least one pixel area;

[0255] According to a preset orientation definition method, the orientation information corresponding to each pixel area is determined.

[0256] In a feasible implementation, when the processor 801 extracts the vegetation key information according to the natural language input by the user, it is specifically used to: parse the natural language to obtain multiple groups of query information;

[0257] Each group of query information is matched with each standard information in a pre-created template library, and the key vegetation information indicated by each group of query information is obtained according to the matching result.

[0258] In a feasible implementation, when executing the creation of the template library, the processor 801 is specifically used to: generate at least one standard orientation description information corresponding to each orientation according to the orientation definition method of the terrain height map;

[0259] According to the density classification method of vegetation, at least one standard density description information corresponding to each density level is generated;

[0260] A template library is generated according to at least one standard orientation description information corresponding to each orientation and at least one standard orientation description information corresponding to each density level.

[0261] In a feasible implementation, when the processor 801 generates and displays vegetation in a terrain height map according to the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map, it is specifically used to: determine the target pixel area corresponding to the position according to the position indicated by the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map;

[0262] According to the attribute information indicated by the vegetation key information, a corresponding vegetation mask is generated in the target pixel area, and corresponding vegetation is generated on the vegetation mask.

[0263] In a feasible implementation, the processor 801, when executing the process of generating a corresponding vegetation mask in a target pixel area according to the attribute information indicated by the vegetation key information and generating corresponding vegetation on the vegetation mask, is specifically used to: generate an initial vegetation mask in a target pixel area of ​​a terrain height map according to the vegetation density;

[0264] Performing enhancement processing on the initial vegetation mask to generate a vegetation mask corresponding to the target pixel area;

[0265] Generate corresponding vegetation on the vegetation mask according to the vegetation type.

[0266] In a feasible implementation, when the processor 801 generates the initial vegetation mask in the target pixel area of ​​the terrain height map according to the vegetation density, it is specifically used to: determine the area and shape of the initial vegetation mask according to the vegetation density;

[0267] According to the area and shape of the initial vegetation mask, an initial vegetation mask is generated in the target pixel area.

[0268] In a feasible implementation, when the processor 801 determines the area and shape of the initial vegetation mask according to the vegetation density, it is specifically used to: input the vegetation density as input data into the diffusion restricted aggregation algorithm, and calculate through the diffusion restricted aggregation algorithm to determine the number of particles at each key point in the target pixel area;

[0269] According to the number of particles at each key point, the area and shape of the initial vegetation mask are determined.

[0270] In a feasible implementation, when the processor 801 generates the initial vegetation mask in the target pixel area according to the area and shape of the initial vegetation mask, it is specifically used to: generate the current vegetation mask according to the area and shape of the initial vegetation mask;

[0271] The current vegetation mask is binarized and Gaussian blurred to obtain the initial vegetation mask.

[0272] In a feasible implementation manner, when the processor 801 performs enhancement processing on the initial vegetation mask to generate a vegetation mask corresponding to the target pixel area, it is specifically configured to:

[0273] Processing the initial vegetation mask according to the pre-generated noise image to generate a first processed vegetation mask;

[0274] Performing Gaussian blur processing on the vegetation mask after the first processing to generate the vegetation mask after the second processing;

[0275] The edge data corresponding to the target pixel area in the terrain height map is extracted, and the vegetation mask after the second processing is processed according to the edge data to generate a vegetation mask corresponding to the target pixel area.

[0276] In a feasible implementation, when executing the generation of the noise image, the processor 801 is specifically used to: determine the noise attribute parameters of each continuous image area in the initial noise image;

[0277] According to the noise attribute parameters of each continuous image region, the noise information of each continuous image region is generated in sequence; the noise attribute parameters of each continuous image region are not completely the same;

[0278] generating an intermediate noise image according to the noise information of each continuous image region;

[0279] According to the size of each pixel value in the intermediate noise image and a preset threshold, the intermediate noise image is color-converted to obtain a noise image, and the noise image includes: a black area and a white area.

[0280] In a feasible implementation, when the processor 801 processes the initial vegetation mask according to a pre-generated noise image to generate a first processed vegetation mask, it is specifically used to: subtract the pixels in the white area of ​​the initial vegetation mask from the pixels in the black area of ​​the noise image that fall into the white area to generate the first processed vegetation mask.

[0281] In a feasible implementation, when the processor 801 extracts edge data corresponding to the target pixel area in the terrain height map, it is specifically used to: perform Gaussian blur processing on the terrain height map to generate a processed terrain height map;

[0282] The edge processing algorithm is used to perform edge calculation on the target pixel area in the processed terrain height map to obtain edge data corresponding to the target pixel area. The edge data is used to indicate the contour information of the object in the target pixel area.

[0283] In a feasible implementation scheme, when the processor 801 processes the vegetation mask after the second processing according to the edge data to generate a vegetation mask corresponding to the target pixel area, it is specifically used to: perform a difference operation between the vegetation mask after the second processing and the edge data to obtain the vegetation mask corresponding to the target pixel area.

[0284] In the embodiment of the present application, the computer program can also execute other machine-readable instructions when run by the processor to execute other methods described in the embodiment. For the specific execution method steps and principles, please refer to the description of the embodiment, which will not be repeated here.

[0285] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0286] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0287] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0288] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only storage medium (English: Read-Only Memory, referred to as: ROM), random access storage medium (English: Random Access Memory, referred to as: RAM), disk or optical disk and other media that can store program code.

Claims

1. A method for generating surface vegetation, characterized in that: include: Obtaining a terrain height map, and determining the orientation information corresponding to each pixel area in the terrain height map; Extracting vegetation key information according to the natural language input by the user, the vegetation key information is used to indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, the attribute information including: vegetation type and vegetation density; Vegetation is generated and displayed in the terrain height map according to the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map.

2. The method according to claim 1, characterized in that Determining the position information corresponding to each pixel area in the terrain height map includes: Divide the terrain height map according to a preset area division method to determine at least one pixel area; According to a preset orientation definition method, the orientation information corresponding to each pixel area is determined.

3. The method according to claim 1, characterized in that The key vegetation information is extracted based on the natural language input by the user, including: Parsing the natural language to obtain multiple groups of query information; Each group of query information is matched with each standard information in a pre-created template library, and the key vegetation information indicated by each group of query information is obtained according to the matching result.

4. The method according to claim 3, characterized in that The creation process of the template library includes: Generate at least one standard orientation description information corresponding to each orientation according to the orientation definition method of the terrain height map; According to the density classification method of vegetation, at least one standard density description information corresponding to each density level is generated; The template library is generated according to at least one standard orientation description information corresponding to each orientation and at least one standard orientation description information corresponding to each density level.

5. The method according to claim 1, characterized in that The generating and displaying vegetation in the terrain height map according to the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map comprises: Determine a target pixel area corresponding to the position according to the position indicated by the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map; According to the attribute information indicated by the vegetation key information, a corresponding vegetation mask is generated in the target pixel area, and corresponding vegetation is generated on the vegetation mask.

6. The method according to claim 5, characterized in that The step of generating a corresponding vegetation mask in the target pixel area according to the attribute information indicated by the vegetation key information, and generating corresponding vegetation on the vegetation mask, comprises: Generating an initial vegetation mask in the target pixel area of ​​the terrain height map according to the vegetation density; Performing enhancement processing on the initial vegetation mask to generate a vegetation mask corresponding to the target pixel area; According to the vegetation type, corresponding vegetation is generated on the vegetation mask.

7. The method according to claim 6, characterized in that Generating an initial vegetation mask in the target pixel area of ​​the terrain height map according to the vegetation density includes: Determining the area and shape of the initial vegetation mask according to the vegetation density; The initial vegetation mask is generated in the target pixel area according to the area and shape of the initial vegetation mask.

8. The method according to claim 7, characterized in that The step of determining the area and shape of the initial vegetation mask according to the vegetation density includes: The vegetation density is used as input data and input into a diffusion-limited aggregation algorithm, and the diffusion-limited aggregation algorithm is used to perform calculations to determine the number of particles at each key point in the target pixel area; The area and shape of the initial vegetation mask are determined according to the number of particles at each key point.

9. The method according to claim 7, characterized in that: Generating the initial vegetation mask in the target pixel area according to the area and shape of the initial vegetation mask includes: Generating a current vegetation mask according to the area and shape of the initial vegetation mask; The current vegetation mask is binarized and Gaussian blurred to obtain the initial vegetation mask.

10. The method according to claim 6, characterized in that The step of performing enhancement processing on the initial vegetation mask to generate a vegetation mask corresponding to the target pixel area includes: Processing the initial vegetation mask according to the pre-generated noise image to generate a first processed vegetation mask; Performing Gaussian blur processing on the vegetation mask after the first processing to generate a vegetation mask after the second processing; The edge data corresponding to the target pixel area in the terrain height map is extracted, and the vegetation mask after the second processing is processed according to the edge data to generate a vegetation mask corresponding to the target pixel area.

11. The method according to claim 10, characterized in that The generation process of the noise image includes: Determining noise attribute parameters of each continuous image region in the initial noise image; According to the noise attribute parameters of each continuous image region, the noise information of each continuous image region is generated in sequence; the noise attribute parameters of each continuous image region are not completely the same; generating an intermediate noise image according to the noise information of each continuous image region; According to the magnitude of each pixel value in the intermediate noise image and a preset threshold, the intermediate noise image is subjected to color conversion to obtain the noise image, wherein the noise image includes: a black area and a white area.

12. The method according to claim 10, characterized in that The processing of the initial vegetation mask according to the pre-generated noise image to generate a first processed vegetation mask includes: Subtract pixels in the white area of ​​the initial vegetation mask from pixels in the black area of ​​the noise image that fall into the white area to generate the first processed vegetation mask.

13. The method according to claim 10, characterized in that The extracting edge data corresponding to the target pixel area in the terrain height map includes: Performing Gaussian blur processing on the terrain height map to generate a processed terrain height map; An edge processing algorithm is used to perform edge calculation on the target pixel area in the processed terrain height map to obtain edge data corresponding to the target pixel area, where the edge data is used to indicate contour information of an object in the target pixel area.

14. The method according to claim 10, characterized in that The step of processing the vegetation mask after the second processing according to the edge data to generate the vegetation mask corresponding to the target pixel area includes: A difference operation is performed between the vegetation mask after the second processing and the edge data to obtain a vegetation mask corresponding to the target pixel area.

15. A surface vegetation generation device, characterized in that: include: Acquisition module, analysis module and generation module; The acquisition module is used to acquire a terrain height map and determine the azimuth information corresponding to each pixel area in the terrain height map; The analysis module is used to extract vegetation key information according to the natural language input by the user, and the vegetation key information is used to indicate the position of the vegetation to be generated in the terrain height map and the attribute information of the vegetation, and the attribute information includes: vegetation type and vegetation density; The generating module is used to generate and display vegetation in the terrain height map according to the vegetation key information and the orientation information corresponding to each pixel area in the terrain height map.

16. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the program instructions to implement the surface vegetation generation method as described in any one of claims 1 to 14.

17. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the method for generating surface vegetation according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Target vegetation model rendering display method and device, equipment and storage medium

    CN112862968A

  • Vegetation generation method and device in virtual scene and electronic equipment

    CN115518374A

  • Building scene generation method and device, electronic equipment and storage medium

    CN117351169A

  • Vegetation generation method and device for virtual scene

    CN117953161A

  • Vegetation generation method and device, electronic equipment and computer readable medium

    CN118247367A