Image generation method and device

By acquiring the initial grid image and determining the object resources and locations based on the object identification information, and automatically updating the image, the high cost problem of manually creating scene objects in the prior art is solved, and efficient and diversified image generation is achieved.

CN114266845BActive Publication Date: 2025-04-25ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111643669.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-04-25
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In the prior art, the creation of objects in the display scene requires manual addition or placement, resulting in high time and labor costs and lack of automated generation methods.

Method used

By obtaining the initial grid image, determining the object resource and location information based on the type and attribute information of the object identification, and automatically updating the initial image to generate the target image.

Benefits of technology

It realizes automatic placement of object resources, improves the creation efficiency of target images, and increases the diversity and flexibility of image generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114266845B_ABST
    Figure CN114266845B_ABST
Patent Text Reader

Abstract

The present application provides an image generation method and device, wherein the image generation method comprises: acquiring an initial grid image; determining an object resource corresponding to an object identifier and location information of the object resource based on an object type and object attribute information corresponding to an object identifier in the initial grid image; updating the initial grid image based on the object resource and the location information to generate a target image containing a target object corresponding to the object identifier.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image generation method and apparatus, a computing device, and a computer-readable storage medium. Background Art

[0002] With the development of computer technology, people have an increasing demand for the vividness and richness of scenes displayed in computers. In the traditional design process, the creation of objects in a display scene usually requires artists to manually add or place them. This process requires a huge amount of time and manpower. Therefore, it is urgent to provide a solution to the above problem. Summary of the invention

[0003] In view of this, the embodiments of the present application provide an image generation method and apparatus, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.

[0004] According to a first aspect of an embodiment of the present application, there is provided an image generating method, comprising:

[0005] Get the initial grid image;

[0006] Determine, according to the object type and object attribute information corresponding to the object identifier in the initial grid image, the object resource corresponding to the object identifier and the location information of the object resource;

[0007] The initial grid image is updated according to the object resource and the position information to generate a target image including the target object corresponding to the object identifier.

[0008] Optionally, the target object includes at least one of the following: a block object, a road object, a river object, and an obstacle object.

[0009] Optionally, when the target object is the block object, the object resource corresponding to the object identifier is determined in the following manner:

[0010] Determine a block template corresponding to the block object identifier according to the block type information and block attribute information of the block object identifier in the initial grid image;

[0011] Determine the element resource corresponding to the template element according to the element information of the template element contained in the block template;

[0012] The block template and the element resource are used as the object resources.

[0013] Optionally, the location information corresponding to the object resource is determined in the following manner:

[0014] Determine, according to the element information, template location information of the element resource in the block template;

[0015] Determining image position information of the block template in the initial grid image according to the block attribute information;

[0016] The template position information and the image position information are used as the position information.

[0017] Optionally, when the target object is the river channel object, the object resource corresponding to the object identifier is determined in the following manner:

[0018] Calculating a river channel centerline corresponding to the river channel object identifier according to the river channel information corresponding to the river channel object identifier in the initial grid image;

[0019] Calculating preset channel points on the center line of the channel to determine the channel component style corresponding to the channel object identifier;

[0020] The river channel components that match the river channel component style are screened, and the river channel components are used as the object resources.

[0021] Optionally, the location information corresponding to the object resource is determined in the following manner:

[0022] Calculate the placement reference point and placement direction corresponding to the river channel component based on the river channel centerline;

[0023] The placement reference point and the placement direction are used as the position information.

[0024] Optionally, when the target object is the obstacle object, the object resource corresponding to the object identifier is determined in the following manner:

[0025] Determining an obstacle sub-segment corresponding to the obstacle object identifier according to obstacle length information of the obstacle object identifier in the initial grid image and preset obstacle length information;

[0026] The obstacle resources corresponding to the obstacle sub-segment are screened in the preset obstacle model, and the obstacle resources are used as the object resources.

[0027] Optionally, the location information corresponding to the object resource is determined in the following manner:

[0028] An obstacle placement reference point is determined in the obstacle sub-segment according to a preset reference point rule, and the obstacle reference point is used as the position information.

[0029] Optionally, the initial grid image is created in the following manner:

[0030] Receive creation instructions submitted based on the configuration list;

[0031] An initial grid image is created according to the region information and object marking information corresponding to the creation instruction.

[0032] According to a second aspect of an embodiment of the present application, there is provided an image generating device, including:

[0033] An acquisition module, configured to acquire an initial grid image;

[0034] a determination module configured to determine an object resource corresponding to the object identifier and location information of the object resource according to an object type and object attribute information corresponding to the object identifier in the initial grid image;

[0035] The generating module is configured to update the initial grid image according to the object resource and the position information, and generate a target image including the target object corresponding to the object identifier.

[0036] According to a third aspect of an embodiment of the present application, a computing device is provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the image generation method when executing the computer instructions.

[0037] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer instructions, and when the computer instructions are executed by a processor, the steps of the image generating method are implemented.

[0038] In the image generation method provided in the embodiment of the present application, an initial grid image is obtained, and according to the object type and object attribute information corresponding to the object identifier in the initial grid image, the object resource corresponding to the object identifier and the location information of the object resource are determined; then the initial grid image is updated according to the object resource and the location information to generate a target image containing the target object corresponding to the object identifier. On the basis of determining the object resource and the location information of the object resource, the target image containing the target object is automatically created by automatically placing the object resource in the initial grid image according to the location information. The efficiency of creating the target image is improved. In addition, since the object resource has a corresponding relationship with the object information in the initial grid image, the object resources used in the target image can be replaced in batches by modifying the object information or the resource information of the object resource, thereby increasing the diversity and flexibility of creating the target image. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 is a structural block diagram of a computing device provided by an embodiment of the present application;

[0040] Figure 2 is a flow chart of an image generation method provided by an embodiment of the present application;

[0041] Figure 3 is a processing flow chart of an image generation method applied to a block object provided by an embodiment of the present application;

[0042] Figure 4 It is a structural schematic diagram of an image generating device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0043] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0044] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.

[0045] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0046] In the present application, an image generation method and apparatus, a computing device, and a computer-readable storage medium are provided, which are described in detail one by one in the following embodiments.

[0047] Figure 1 The structure block diagram of a computing device 100 according to an embodiment of the present application is shown. The components of the computing device 100 include but are not limited to a memory 110 and a processor 120. The processor 120 is connected to the memory 110 via a bus 130, and the database 150 is used to store data.

[0048] The computing device 100 also includes an access device 140 that enables the computing device 100 to communicate via one or more networks 160. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 140 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0049] In one embodiment of the present application, the above components of the computing device 100 and Figure 1 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 1 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.

[0050] The computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 100 may also be a mobile or stationary server.

[0051] The processor 120 may execute Figure 2 The steps in the image generation method shown. Figure 2 A flowchart of an image generation method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0052] Step 202: Acquire an initial grid image.

[0053] The initial grid image refers to an image containing a grid and object information. In practical applications, the initial grid image can be understood as a planning image of a scene. The initial grid image is used as a basic image to automatically generate a target image containing an object based on the marking information (planning information) therein. The object can be a building, road, person, animal, obstacle, plant, clothing, weapon, commodity, etc. The specific object can be determined according to the actual scene needs and is not limited here.

[0054] In specific implementation, the initial grid image can be obtained by receiving an initial grid image uploaded by a user, or by creating an initial grid image. The initial grid image can also be obtained from a preset image set, which is not limited here.

[0055] Considering that the initial grid image is a basic image, it may need to be modified from time to time. Therefore, in order to improve the modification efficiency and creation efficiency of the initial grid image, the initial grid image can be created by visual configuration. In the embodiment of the present application, it is created in the following way:

[0056] Receive creation instructions submitted based on the configuration list;

[0057] An initial grid image is created according to the region information and object marking information corresponding to the creation instruction.

[0058] The configuration list refers to a list used to configure information related to regions and objects in the initial grid image. Correspondingly, the creation instruction refers to an instruction used to create the initial grid image.

[0059] Specifically, the configuration list may include multiple configurable items, among which the configuration items of the area information may be configured such as the size information such as the image length and width, the cell information (the number of cells, the number of cell rows, the number of cell columns, the size information of the cell), etc. The configuration items of the object marking information may be configured such as: grid merging information, object location information, object function information, object identification information, object style information, object style information, object material information, object priority information, etc., which are not limited here.

[0060] In practical applications, the region information is usually used to create the image size and cells in the initial grid image. The object marking information is used to mark the objects to be created in the initial grid image. Specifically, the marking process can be performed in the image by text, color, wireframe, line, surface, etc., which are not limited here.

[0061] In summary, by creating the initial grid image according to the region information and object marking information corresponding to the creation instruction, the initial grid image is created in a visual configuration manner, thereby improving the creation efficiency of the initial grid image.

[0062] Step 204: Determine the object resource corresponding to the object identifier and the location information of the object resource according to the object type and object attribute information corresponding to the object identifier in the initial grid image.

[0063] Specifically, based on the above-mentioned acquisition of the initial grid image, considering that different objects have different object resources and resource placement locations that need to be matched, in order to ensure the correctness of generating the target image containing the target object, it is necessary to first determine the object resource and the location information of the object resource according to the object type and object attribute information of the target object in the initial grid image.

[0064] Among them, the object identifier refers to information that can uniquely identify an object. The object identifier can be an object name or an object code, etc., which is not limited here. The object type refers to the type to which the object belongs. The object type can classify objects with similar creation processes into one category according to actual creation requirements. For example, the object type can be classified according to object function, object shape, object type, etc., which is not limited here.

[0065] In practical applications, the types of target objects are various. When classified according to shape, the object type of the target object includes at least one of the following: region type and line type. The region type refers to an object type with a block or region shape, and the line type refers to an object type with a strip shape.

[0066] Further, in the case where the object grid image is a base image of a city block image, optionally, the target object includes at least one of the following: a block object, a mountain object, a road object, a river object, and an obstacle object. Among them, the block object and the mountain object can be understood as target objects of the area type. The river object and the obstacle object can be understood as target objects of the line type. The road object can be divided into the area type or the line type according to the width of the road, which is not limited here.

[0067] Among them, the block object can be understood as a building object or a building group object in the block (such as a park, residential area, commercial area, bank, university, amusement park, stadium, station, etc.); the mountain object can be understood as a landform (such as a mountain, desert, Gobi, snow mountain, etc.); the road object can be understood as a road in the block, and further, if it is a regional type of road object, it can be understood as a regional road in the block (such as a wide road); if it is a line type of road object, it can be understood as a strip of road in the block (such as a main road, secondary road, default road, ordinary road, etc.); the river object refers to the river in the block. Although the river is a line type object, it can be marked in the form of blocks in the object grid image; the obstacle object refers to the obstacles in the block (such as wooden fences, iron fences, water, stones, etc.).

[0068] In practical applications, since objects of the same type usually have commonalities when being processed, it is beneficial to create target objects after dividing the objects into different types. In addition, even the same object (such as a block object) has different individual objects (such as residential areas, commercial areas, banks, etc.). These different individuals of the same object can be processed based on a unified or similar processing flow, which greatly improves processing efficiency.

[0069] In specific implementation, when the target object is the block object of the area type, considering that a block usually contains multiple elements, such as buildings, green belts, roads in the block, sidewalks, etc., and the number of these elements may also be multiple, therefore, in order to improve the efficiency of creating blocks, multiple block templates corresponding to the block object can be created in advance, and the elements in the block are planned through the block templates, and then the object resources corresponding to these elements are determined. In the embodiment of the present application, the determination is made in the following manner:

[0070] Determine a block template corresponding to the block object identifier according to the block type information and block attribute information of the block object identifier in the initial grid image;

[0071] Determine the element resource corresponding to the template element according to the element information of the template element contained in the block template;

[0072] The block template and the element resource are used as the object resources.

[0073] Among them, the block object identification information refers to the information that uniquely identifies a block object. The block template refers to a pre-created design template for creating a block object. The block type information refers to the type of block. Specifically, the block type information can be divided according to the function of the block, such as residential type, commercial type, school type, hospital type, playground type, etc., which is not limited here. The block attribute information refers to the attribute information related to the block, such as: block size, block style, block style and other information, which is not limited here.

[0074] In actual applications, multiple block templates can be created in advance based on possible block type information and block attribute information. When creating a block object, the corresponding block template can be matched based on this information. In actual applications, there may be multiple preset block templates that match this information. Therefore, the corresponding block template can be selected according to preset screening rules (such as random or according to the arrangement order of preset block templates, etc.).

[0075] Template elements refer to the components included in the block template and are part of the block template. Specifically, the template elements that can be included in the block template include: buildings, green belts, roads within the block, sidewalks, etc., which are not limited here. Correspondingly, element information refers to information related to the template elements, such as element size, element category, element orientation and other information, which are not limited here. Element resources refer to the element models, prefabricated parts, maps and other resources corresponding to the template elements used to construct the template elements, which are not limited here.

[0076] In specific implementation, when the template element is a building element, the corresponding building model can be screened from the corresponding preset building models based on the building information such as the building style, building orientation, building size, building model path, etc. of the building element contained in the block template, and the building model can be used as the object resource.

[0077] When the template element is a green belt element, the corresponding vegetation prefab can be screened from the corresponding preset vegetation prefabs according to the vegetation information such as the vegetation type and vegetation model path of the green belt element contained in the block template, and the vegetation prefab can be used as an object resource.

[0078] When the template element is a road surface, the corresponding road texture can be selected from the corresponding preset road textures according to the road type, road area (road surface) and other road information of the road surface element contained in the block template, and the road texture can be used as an element resource.

[0079] In practical applications, all resources can be standardized, for example, with unified naming rules, templates named as function_style_size_style, and models named as category_component_size_style, so that the marks made in the initial grid image are meaningful, recognizable, and parseable. The program converts the names into attributes of different models according to keywords such as function, style, size, and style, and then compares the labels marked by the digital design drawings with the model attributes one by one, filtering layer by layer, and finally selects the models that meet the requirements. According to the preset distribution of the template, the art model resources are placed in the specified position, so as to achieve the purpose of automatically generating blocks as accurately as manual ones.

[0080] In summary, by comparing the information marked in the initial grid image with the template attributes, the template that meets the requirements is screened out. According to the preset distribution of the template, the corresponding template elements are matched, which improves the resource determination efficiency of the block object.

[0081] Furthermore, when the target object is the block object of the area type, the location information corresponding to the object resource is determined in the following manner:

[0082] Determine, according to the element information, template location information of the element resource in the block template;

[0083] Determining image position information of the block template in the initial grid image according to the block attribute information;

[0084] The template position information and the image position information are used as the position information.

[0085] Template location information refers to the location information of the element resource in the block template. The template location information may include coordinate information, orientation information, etc., which are not limited here. Correspondingly, the location information refers to the location information of the block template in the initial grid image. The location information may also include coordinate information, cell information, orientation information, etc., which are not limited here.

[0086] Specifically, when the template element is a building element, the template position information of the building model can be determined based on the building coordinates and other information of the building element contained in the block template. When the template element is a green belt element, the template position information of the vegetation prefabricated part can be determined based on the vegetation scattering method information (such as random scattering, preset density scattering, etc.) and green belt position information of the green belt element contained in the block template. When the template element is a road surface, the template position information corresponding to the road map can be determined based on the road position information of different road surfaces (such as straight road surfaces, corner road surfaces, etc.) in the road surface elements contained in the block template in the block template.

[0087] After determining the template position information of the element resource in the block template, the element resource can be placed based on the template position information. In addition, it is necessary to further determine the position information of the block template in the initial grid image in order to place the block template.

[0088] In summary, by determining the location information of the block template and element resources, the rationality and correctness of block object generation can be guaranteed, and the generation efficiency of block objects can be improved.

[0089] In addition, when the target object is a river channel object of a line type, in the embodiment of the present application, the object resource corresponding to the object identifier is determined in the following manner:

[0090] Calculating a river channel centerline corresponding to the river channel object identifier according to the river channel information corresponding to the river channel object identifier in the initial grid image;

[0091] Calculating preset channel points on the center line of the channel to determine the channel component style corresponding to the channel object identifier;

[0092] The river channel components that match the river channel component style are screened, and the river channel components are used as the object resources.

[0093] The river channel identification information refers to information that can uniquely identify a river channel object. Accordingly, the river channel information includes river channel location information, river channel width information, river channel style information, river channel component information, etc., which are not limited here.

[0094] Specifically, the centerline of a river channel refers to the line marking the center of the river channel. In practical applications, the centerline of the river channel can be obtained by evenly dividing the area where the river channel is located according to the width of the river channel. In practical applications, in order to simplify the creation of river channel objects, the width of the river channel object can also be uniformly set to the width of the cell in the initial grid image, and the edge line of the river channel is the edge line of the initial grid image. In this case, the centerline of the river channel is the center line of the grid where the grid river channel is located.

[0095] Calculating preset river points (such as intersections, corners, and endpoints) based on the centerline of the river can be understood as calculating the intersections, corners, and endpoints formed in the centerline of the river, and using the preset river points in the centerline of the river as target river points. Then, based on the type of the target river point, determine the special river positions (such as cross intersections, T-intersections, corners, and ends) corresponding to the river object identifier, and use the styles formed by these special river positions as river component styles. In addition, for the straight line positions in the centerline of the river other than these special positions, the corresponding straight line component styles can be used, and the straight line component styles are also used as river component styles.

[0096] In specific implementation, the center line of the river channel can be divided into at least one straight line segment, and then calculate whether the endpoints of these straight line segments overlap; if there are four straight line segments whose endpoints overlap, the overlapping endpoints are determined to be cross intersections; if there are three straight line segments whose endpoints overlap, the overlapping endpoints are determined to be T-intersections; if there are two straight line segments whose endpoints overlap, the overlapping endpoints are determined to be corner points; if there is a straight line segment with endpoints that do not overlap, the endpoint is determined to be the endpoint of the object line. Then, according to the types (such as cross intersections, T-intersections, corner points, endpoints, etc.) of these target river channel points (such as cross intersections, T-intersections, corner points, endpoints, etc.), determine the corresponding river channel style components (such as cross intersection component style, T-intersection component style, corner component style, endpoint component style, etc.). The determined river channel style components are used as the river channel style components corresponding to the river channel object identifier.

[0097] In addition, for the lines in the non-endpoint part of the center line of the river channel, the corresponding river channel style component is determined to be a straight line component style. Among them, the endpoint part can be understood as a line segment including the endpoint, and the length of the line segment can be determined according to the preset component size (for example, the endpoint is a cross type, and the preset length corresponding to the cross type is 5 meters. Then take the endpoint as the center point, and cut 5 meters of the 4 line segments belonging to the center point as the endpoint part). In addition, it is also determined according to the size of the cells in the initial grid image (for example, the endpoints and line segments belonging to the same cell are regarded as endpoint parts), which is not limited here.

[0098] Furthermore, the corresponding river channel component is selected according to the river channel component style. In specific implementation, the corresponding river channel component can be selected in the river channel resource library according to the attribute information of the river channel component style. Among them, the attribute information of the river channel component style (such as style information, name information and / or size information) is searched in the resource library to determine the river channel component that matches the river channel component style.

[0099] The river channel component refers to the model component that makes up the river channel. In actual applications, the attribute information of the river channel component style can be compared with the attribute information of the resources in the resource library, so as to filter out the river channel components with matching attribute information in the resource library. In addition, the resources in the resource library can be named according to the resource attributes using a unified naming rule, such as the naming rule: category_component_size_style. Then, the type, component, size, style and other information of the river channel component style are compared one by one with the resource attributes in the resource naming, filtered layer by layer, and finally the resources that meet the requirements are selected as the river channel components that match the river channel component style.

[0100] In summary, by determining the centerline of the river channel and performing calculations based on the centerline of the river channel, the river channel component style corresponding to the river channel object identifier is determined, and the river channel components matching the screened river channel style are used as object resources, thereby improving the efficiency of determining the river channel components and potentially improving the efficiency of creating target objects and target images.

[0101] Furthermore, when the target object is a river channel object of a line type, the location information corresponding to the object resource is determined in the following manner:

[0102] Calculate the placement reference point and placement direction corresponding to the river channel component based on the river channel centerline;

[0103] The placement reference point and the placement direction are used as the position information.

[0104] The placement reference point refers to the alignment point when placing the component in the initial grid image. Specifically, the placement reference point can be the center point of the line segment corresponding to the river channel component in the center line of the river channel. In addition, the placement reference point can also be the end point of the line segment corresponding to the river channel component in the center line of the river channel, etc., which is not limited here.

[0105] The placement direction can be understood as the direction information for placing the river channel component. In specific implementation, the offset angle and offset direction between the line segment corresponding to the center line of the river channel component and the center line of the river channel component can be calculated. The offset angle and offset direction are used as the placement direction of the river channel component.

[0106] In actual applications, the pre-created river channel components are usually placed with the front side facing downward in the resource library. This direction may be different from the actual placement method direction. Therefore, it is necessary to determine the placement direction of the river channel component so as to adjust the direction of the river channel component according to the placement direction so that the placement position of the river channel component coincides with the actual river channel position.

[0107] In summary, the position information of the river channel components is calculated based on the center line of the river channel, which reduces the marking information of the river channel objects and improves the automation level of creating river channel objects.

[0108] In addition to the above two types of objects, when the target object is an obstacle object, in the embodiment of the present application, the object resource corresponding to the object identifier is determined in the following manner:

[0109] Determining an obstacle sub-segment corresponding to the obstacle object identifier according to obstacle length information of the obstacle object identifier in the initial grid image and preset obstacle length information;

[0110] The obstacle resources corresponding to the obstacle sub-segment are screened in the preset obstacle model, and the obstacle resources are used as the object resources.

[0111] The obstacle length information refers to the side length information of the obstacle. The preset obstacle length information refers to the length information of the preset obstacle model (the agreed obstacle length is 6 meters, 12 meters, 18 meters, etc.). Correspondingly, the obstacle sub-segment refers to the obstacle segment obtained by dividing the obstacle according to the preset obstacle length.

[0112] In practical applications, since obstacle objects are also line-shaped and are usually set around block objects (they can be set outside the block object, or they can be indented and set inside the block object). Therefore, for the four sides of the obstacle, the corresponding obstacle sub-segments can be calculated separately. The number of obstacles of each size that can be placed on a single side is automatically calculated based on the obstacle length information, and the length of the remaining non-integer part (that is, the part that does not meet the preset obstacle length) matches some preset accessories (such as doors, etc.). If the remaining length cannot adapt to the length of the door, the number of obstacles of the shortest obstacle is reduced by 2, and the length of the reduced obstacle is merged into the remaining length to adapt to the door (the door length can also be 6, 12, and 18 meters, etc.). According to the calculated number of obstacles and obstacle sizes, the reference line is divided into segments of various lengths (i.e., obstacle sub-segments), and obstacle resources (such as obstacle models, obstacle prefabricated parts, etc.) with center points adapted to the corresponding sizes are obtained.

[0113] In summary, obstacle sub-segments are divided according to obstacle length information and preset obstacle length information, and then the corresponding obstacle resources are matched based on the obstacle sub-segments, so that fast obstacle resources can be matched according to obstacle characteristics, and the efficiency of creating obstacle objects is improved.

[0114] Furthermore, the location information corresponding to the object resource is determined in the following manner:

[0115] An obstacle placement reference point is determined in the obstacle sub-segment according to a preset reference point rule, and the obstacle reference point is used as the position information.

[0116] The preset reference point rule refers to a preset rule for selecting an obstacle reference point. Specifically, the preset reference point rule may be to select the endpoints on both sides of the obstacle sub-segment as the obstacle reference points. In addition, the preset reference point rule may also be to select at least two line segment points in the obstacle sub-segment as the obstacle reference points, etc., which is not limited here.

[0117] In addition, when the obstacle reference point is a point, for example, the obstacle reference point is the center point of the obstacle sub-segment. Since one point cannot determine the placement position of a two-dimensional or three-dimensional obstacle resource in the initial grid image. Therefore, it is also necessary to determine the placement direction of the obstacle resource based on the obstacle reference point. The placement direction may include: the offset angle and the offset direction between the obstacle sub-segment and the obstacle resource. In specific implementation, the offset angle can be calculated by overlapping an end point of the vertical segment perpendicular to the obstacle sub-segment and the vertical segment perpendicular to the obstacle resource, and then calculating the angle between the two. The offset direction can be determined based on the relative position direction between the two vertical segments. For example, if the vertical segment perpendicular to the obstacle sub-segment is located above the vertical segment perpendicular to the obstacle resource, the offset direction is upward.

[0118] Specifically, the obstacle placement reference point refers to the alignment point when placing the obstacle resource in the initial grid image. In practical applications, since the obstacle model is usually a relatively simple line, the obstacle model can be placed through the obstacle placement reference point.

[0119] In summary, by calculating the placement reference points as the location information of the obstacle resources, the placement efficiency of the obstacle resources is improved.

[0120] Step 206: updating the initial grid image according to the object resource and the position information to generate a target image including the target object corresponding to the object identifier.

[0121] Specifically, based on the object resources and the location information of the object resources obtained above, the object resources can be automatically placed in the initial grid image according to the location information, thereby generating a target image containing the target object, wherein the target object refers to the object corresponding to the object identifier.

[0122] The image generation method provided in the embodiment of the present application obtains an initial grid image, and determines the object resource corresponding to the object identifier and the location information of the object resource according to the object type and object attribute information corresponding to the object identifier in the initial grid image; then updates the initial grid image according to the object resource and the location information to generate a target image containing the target object corresponding to the object identifier. The target image containing the target object is automatically created by automatically placing the object resource in the initial grid image according to the location information on the basis of determining the object resource and the location information of the object resource. The efficiency of creating the target image is improved. In addition, since the object resource has a corresponding relationship with the object information in the initial grid image, the object resources used in the target image can be replaced in batches by modifying the object information or the resource information of the object resource, thereby increasing the diversity and flexibility of creating the target image.

[0123] The following combination Figure 3 , taking the application of the image generation method provided by this application to a block object as an example, the image generation method is further described. Figure 3 A processing flow chart of an image generation method applied to a block object provided by an embodiment of the present application is shown, which specifically includes the following steps:

[0124] Step 302: Obtain a pre-created initial grid image.

[0125] Step 304: Determine a block template corresponding to the block object identifier according to the block type information and block attribute information of the block object identifier in the initial grid image.

[0126] Step 306: When the template element of the block template is a building element, select a corresponding building model from the preset building models according to the building style, building orientation, building size and building model path of the building element contained in the block template, and use the building model as the object resource.

[0127] Step 308: When the template element of the block template is a green belt element, select the corresponding vegetation prefab from the preset vegetation prefabs according to the vegetation type and vegetation model path of the green belt element contained in the block template, and use the vegetation prefab as the object resource.

[0128] Step 310: When the template element of the block template is a road surface, a corresponding road texture is selected from preset road textures according to the road type and road lines of the road surface element contained in the block template, and the road texture is used as an element resource.

[0129] Step 312: Determine the template location information of the element resource in the block template.

[0130] Step 314: Determine the image position information of the block template in the initial grid image according to the block attribute information.

[0131] Step 316: placing the element resource in the block template according to the template position information, and placing the block template in the initial grid image according to the image position information, to generate a target image containing the target object corresponding to the object identifier.

[0132] The image generation method provided in the embodiment of the present application obtains an initial grid image, and determines the object resource corresponding to the object identifier and the location information of the object resource according to the object type and object attribute information corresponding to the object identifier in the initial grid image; then updates the initial grid image according to the object resource and the location information to generate a target image containing the target object corresponding to the object identifier. The target image containing the target object is automatically created by automatically placing the object resource in the initial grid image according to the location information on the basis of determining the object resource and the location information of the object resource. The efficiency of creating the target image is improved. In addition, since the object resource has a corresponding relationship with the object information in the initial grid image, the object resources used in the target image can be replaced in batches by modifying the object information or the resource information of the object resource, thereby increasing the diversity and flexibility of creating the target image.

[0133] Corresponding to the above method embodiment, the present application also provides an image generating device embodiment, Figure 4 FIG. 1 is a schematic diagram showing the structure of an image generating device provided by an embodiment of the present application. Figure 4As shown, the device comprises:

[0134] An acquisition module 402 is configured to acquire an initial grid image;

[0135] A determination module 404 is configured to determine an object resource corresponding to the object identifier and location information of the object resource according to an object type and object attribute information corresponding to the object identifier in the initial grid image;

[0136] The generating module 406 is configured to update the initial grid image according to the object resource and the position information, and generate a target image including the target object corresponding to the object identifier.

[0137] Optionally, the target object includes at least one of the following: a block object, a road object, a river object, and an obstacle object.

[0138] Optionally, when the target object is the block object, the determining module 404 is further configured to:

[0139] Determine a block template corresponding to the block object identifier according to the block type information and block attribute information of the block object identifier in the initial grid image;

[0140] Determine the element resource corresponding to the template element according to the element information of the template element contained in the block template;

[0141] The block template and the element resource are used as the object resources.

[0142] Optionally, the determining module 404 is further configured to:

[0143] Determine, according to the element information, template location information of the element resource in the block template;

[0144] Determining image position information of the block template in the initial grid image according to the block attribute information;

[0145] The template position information and the image position information are used as the position information.

[0146] Optionally, when the target object is the river channel object, the determining module 404 is further configured to:

[0147] Calculating a river channel centerline corresponding to the river channel object identifier according to the river channel information corresponding to the river channel object identifier in the initial grid image;

[0148] Calculating preset channel points on the center line of the channel to determine the channel component style corresponding to the channel object identifier;

[0149] The river channel components that match the river channel component style are screened, and the river channel components are used as the object resources.

[0150] Optionally, the determining module 404 is further configured to:

[0151] Calculate the placement reference point and placement direction corresponding to the river channel component based on the river channel centerline;

[0152] The placement reference point and the placement direction are used as the position information.

[0153] Optionally, when the target object is the obstacle object, the object resource corresponding to the object identifier is determined in the following manner:

[0154] Determining an obstacle sub-segment corresponding to the obstacle object identifier according to obstacle length information of the obstacle object identifier in the initial grid image and preset obstacle length information;

[0155] The obstacle resources corresponding to the obstacle sub-segment are screened in the preset obstacle model, and the obstacle resources are used as the object resources.

[0156] Optionally, the determining module 404 is further configured to:

[0157] An obstacle placement reference point is determined in the obstacle sub-segment according to a preset reference point rule, and the obstacle reference point is used as the position information.

[0158] Optionally, the initial grid image is created by running the following modules:

[0159] A receiving module, configured to receive a creation instruction submitted based on a configuration list;

[0160] The creation module is configured to create an initial grid image according to the area information and object marking information corresponding to the creation instruction.

[0161] The image generation device provided in the embodiment of the present application obtains an initial grid image, and determines the object resource corresponding to the object identifier and the location information of the object resource according to the object type and object attribute information corresponding to the object identifier in the initial grid image; then updates the initial grid image according to the object resource and the location information to generate a target image containing the target object corresponding to the object identifier. The target image containing the target object is automatically created by automatically placing the object resource in the initial grid image according to the location information on the basis of determining the object resource and the location information of the object resource. The efficiency of creating the target image is improved. In addition, since the object resource has a corresponding relationship with the object information in the initial grid image, the object resources used in the target image can be replaced in batches by modifying the object information or the resource information of the object resource, thereby increasing the diversity and flexibility of creating the target image.

[0162] The above is a schematic scheme of an image generating device of this embodiment. It should be noted that the technical scheme of the image generating device and the technical scheme of the above image generating method belong to the same concept, and the details not described in detail in the technical scheme of the image generating device can be referred to the description of the technical scheme of the above image generating method.

[0163] In one embodiment of the present application, a computing device is also provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the image generation method when executing the computer instructions.

[0164] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned image generation method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned image generation method.

[0165] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which implement the steps of the image generation method as described above when executed by a processor.

[0166] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned image generation method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned image generation method.

[0167] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0168] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0169] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0170] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0171] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.

Claims

1. An image generation method, characterized in that: include: Get the initial grid image; According to the object type and object attribute information corresponding to the object identifier in the initial grid image, determine the object resource corresponding to the object identifier and the location information of the object resource; wherein the target object corresponding to the object identifier includes: a block object, a river object, and an obstacle object; when the target object is a block object, the object resource includes a block template and an element resource, and the element resource is determined according to the element information of the template element contained in the block template; when the target object is a river object, the object resource includes a river component matching a river component style, and the river component style is determined by calculating the preset river points of the river object; when the target object is an obstacle object, the object resource includes an obstacle resource, and the obstacle resource corresponds to an obstacle sub-segment, and the obstacle sub-segment is determined based on the obstacle length information of the obstacle object; The initial grid image is updated according to the object resource and the position information to generate a target image including the target object corresponding to the object identifier.

2. The image generation method according to claim 1, characterized in that: When the target object is the block object, the object resource corresponding to the object identifier is determined in the following manner: Determine a block template corresponding to the block object identifier according to the block type information and block attribute information of the block object identifier in the initial grid image; Determine the element resource corresponding to the template element according to the element information of the template element contained in the block template; The block template and the element resource are used as the object resources.

3. The image generation method according to claim 2, characterized in that: The location information corresponding to the object resource is determined in the following manner: Determine, according to the element information, template location information of the element resource in the block template; Determining image position information of the block template in the initial grid image according to the block attribute information; The template position information and the image position information are used as the position information.

4. The image generation method according to claim 1, characterized in that: When the target object is the river channel object, the object resource corresponding to the object identifier is determined in the following manner: Calculating a river channel centerline corresponding to the river channel object identifier according to the river channel information corresponding to the river channel object identifier in the initial grid image; Calculating preset channel points on the center line of the channel to determine the channel component style corresponding to the channel object identifier; The river channel components that match the river channel component style are screened, and the river channel components are used as the object resources.

5. The image generation method according to claim 4, characterized in that: The location information corresponding to the object resource is determined in the following manner: Calculate the placement reference point and placement direction corresponding to the river channel component based on the river channel centerline; The placement reference point and the placement direction are used as the position information.

6. The image generation method according to claim 1, characterized in that: In the case where the target object is the obstacle object, the object resource corresponding to the object identifier is determined in the following manner: Determining an obstacle sub-segment corresponding to the obstacle object identifier according to obstacle length information of the obstacle object identifier in the initial grid image and preset obstacle length information; The obstacle resources corresponding to the obstacle sub-segment are screened in the preset obstacle model, and the obstacle resources are used as the object resources.

7. The image generation method according to claim 6, characterized in that: The location information corresponding to the object resource is determined in the following manner: An obstacle placement reference point is determined in the obstacle sub-segment according to a preset reference point rule, and the obstacle reference point is used as the position information.

8. The image generation method according to claim 1, characterized in that: The initial grid image is created as follows: Receive creation instructions submitted based on the configuration list; An initial grid image is created according to the region information and object marking information corresponding to the creation instruction.

9. An image generating device, characterized in that: include: An acquisition module, configured to acquire an initial grid image; A determination module is configured to determine the object resource corresponding to the object identifier and the location information of the object resource according to the object type and object attribute information corresponding to the object identifier in the initial grid image; wherein the target object corresponding to the object identifier includes: a block object, a river object, and an obstacle object; when the target object is a block object, the object resource includes a block template and an element resource, and the element resource is determined according to the element information of the template element contained in the block template; when the target object is a river object, the object resource includes a river component matching a river component style, and the river component style is determined by calculating the preset river points of the river object; when the target object is an obstacle object, the object resource includes an obstacle resource, and the obstacle resource corresponds to an obstacle sub-segment, and the obstacle sub-segment is determined based on the obstacle length information of the obstacle object; The generating module is configured to update the initial grid image according to the object resource and the position information, and generate a target image including the target object corresponding to the object identifier.

10. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the computer instructions, the steps of the method according to any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Pavement texture generation method and apparatus

    CN105894564A