CN117132693A - Scene rendering method and device - Google Patents

Scene rendering method and device Download PDF

Info

Publication number
CN117132693A
CN117132693A CN202310865198.9A CN202310865198A CN117132693A CN 117132693 A CN117132693 A CN 117132693A CN 202310865198 A CN202310865198 A CN 202310865198A CN 117132693 A CN117132693 A CN 117132693A
Authority
CN
China
Prior art keywords
rendered
mask
scene
image
region
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310865198.9A
Other languages
Chinese (zh)
Inventor
史少桦
杨林
黄衫
邹浩
李阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Kingsoft Digital Network Technology Co Ltd
Original Assignee
Zhuhai Kingsoft Digital Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Kingsoft Digital Network Technology Co Ltd filed Critical Zhuhai Kingsoft Digital Network Technology Co Ltd
Priority to CN202310865198.9A priority Critical patent/CN117132693A/en
Publication of CN117132693A publication Critical patent/CN117132693A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a scene rendering method and a scene rendering device, wherein the method comprises the following steps: receiving a scene rendering instruction, wherein the scene rendering instruction comprises a scene image to be rendered, and the scene image to be rendered comprises an object to be rendered; determining a mask image corresponding to an object to be rendered, wherein the mask image comprises at least one mask region; dividing a mask region in the mask image to obtain a mask region division map, wherein the mask region in the mask region division map is divided into at least two sub-regions; and determining the position information of each subarea in the mask area segmentation map, and rendering the object to be rendered in the virtual scene according to the position information of each subarea. By generating the mask image, classifying objects in the scene image to be rendered, so that scene layout is conveniently carried out on the objects to be rendered; determining sub-regions according to the mask segmentation map, and improving layout efficiency; and determining the position information of rendering in the virtual scene according to the position information of the subareas, and improving the layout strictness and accuracy of the object to be rendered.

Description

Scene rendering method and device
Technical Field
The application relates to the technical field of computers, in particular to a scene rendering method. The application also relates to a scene rendering device, a computing device and a computer readable storage medium.
Background
The game scene is built, and is an important working step in the implementation process of MMORPG (massive multiplayer network role playing) games. In the game scene construction process, art staff needs to restore the layout mode of the original scene picture as much as possible. At present, for scene elements which are not accurately arranged in a game scene, art staff can only lay out scene details by virtue of own experience, so that the method is time-consuming and labor-consuming, and the problems of inaccurate and inaccurate layout easily exist.
Disclosure of Invention
In view of this, the embodiment of the application provides a scene rendering method. The present application is also directed to a scene rendering device, a computing apparatus, and a computer-readable storage medium, which solve the above-mentioned problems occurring in the prior art.
According to a first aspect of an embodiment of the present application, there is provided a scene rendering method, including:
receiving a scene rendering instruction, wherein the scene rendering instruction comprises a scene image to be rendered, and the scene image to be rendered comprises an object to be rendered;
determining a mask image corresponding to an object to be rendered, wherein the mask image comprises at least one mask region;
dividing a mask region in the mask image to obtain a mask region division map, wherein the mask region in the mask region division map is divided into at least two sub-regions;
And determining the position information of each subarea in the mask area segmentation map, and rendering the object to be rendered in the virtual scene according to the position information of each subarea.
According to a second aspect of an embodiment of the present application, there is provided a scene rendering device including:
the device comprises a receiving module configured to receive a scene rendering instruction, wherein the scene rendering instruction comprises a scene image to be rendered, and the scene image to be rendered comprises an object to be rendered;
a first determining module configured to determine a mask image corresponding to an object to be rendered, wherein the mask image includes at least one mask region;
the segmentation module is configured to segment a mask region in the mask image to obtain a mask region segmentation map, wherein the mask region in the mask region segmentation map is segmented into at least two sub-regions;
the second determining module is configured to determine the position information of each subarea in the mask area segmentation map and render the object to be rendered in the virtual scene according to the position information of each subarea.
According to a third aspect of embodiments of the present application, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the scene rendering method when executing the computer instructions.
According to a fourth aspect of embodiments of the present application, there is provided a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the scene rendering method.
The scene rendering method provided by the application receives a scene rendering instruction, wherein the scene rendering instruction comprises a scene image to be rendered, and the scene image to be rendered comprises an object to be rendered; determining a mask image corresponding to an object to be rendered, wherein the mask image comprises at least one mask region; dividing a mask region in the mask image to obtain a mask region division map, wherein the mask region in the mask region division map is divided into at least two sub-regions; and determining the position information of each subarea in the mask area segmentation map, and rendering the object to be rendered in the virtual scene according to the position information of each subarea.
According to the embodiment of the application, the mask image corresponding to the object to be rendered in the scene image to be rendered is determined by receiving the scene image to be rendered included in the scene rendering instruction, and the object to be rendered and other objects in the scene image to be rendered can be classified by generating the mask image, so that scene layout and rendering are conveniently carried out on the object to be rendered; the mask region in the mask image is segmented to obtain a mask region segmentation map, at least two sub-regions for determining rendering positions can be obtained according to the mask segmentation map, and the layout efficiency of the object to be rendered is improved; by determining the position information of each subarea in the mask area segmentation map and rendering the object to be rendered in the virtual scene according to the position information of each subarea, the position information of rendering the object to be rendered in the virtual scene can be determined according to the position information of each subarea, the labor cost is reduced, and the rigor and accuracy of the layout of the object to be rendered are improved.
Drawings
FIG. 1 is a flow chart of a scene rendering method according to an embodiment of the present application;
FIG. 2a is a schematic diagram of a scene image to be rendered according to a scene rendering method according to an embodiment of the present application;
FIG. 2b is a schematic diagram of a mask image of a scene rendering method according to an embodiment of the present application;
fig. 3 is a schematic diagram of a mask area of a scene rendering method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a target sub-region of a scene rendering method according to an embodiment of the present application;
fig. 5a is a schematic diagram of a material to be rendered according to a scene rendering method according to an embodiment of the present application;
FIG. 5b is a schematic diagram of a material to be rendered according to another scene rendering method according to an embodiment of the present application;
FIG. 5c is a schematic diagram of a material to be rendered according to another embodiment of the present application;
FIG. 6 is a process flow diagram of a scene rendering method for game scene construction according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a scene rendering device according to an embodiment of the present application;
FIG. 8 is a block diagram of a computing device according to one embodiment of the application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. The present application may be embodied in many other forms than those herein described, and those skilled in the art will readily appreciate that the present application may be similarly embodied without departing from the spirit or essential characteristics thereof, and therefore the present application is not limited to the specific embodiments disclosed below.
The terminology used in the one or more embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the application. As used in one or more embodiments of the application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that, although the terms first, second, etc. may be used in one or more embodiments of the application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first may also be referred to as a second, and similarly, a second may also be referred to as a first, without departing from the scope of one or more embodiments of the application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region, and provide corresponding operation entries for the user to select authorization or rejection.
First, terms related to one or more embodiments of the present application will be explained.
Mask (masking) picture: also known as an "image mask," is a device that uses selected images, graphics, or objects to mask all or part of the processed image to control the image processing area or process.
With the continuous development of computer technology, the conversion of real scenes in the real world into scene modeling in the virtual world, such as virtual reality technology and game scene building, is gradually enabled.
Currently, game scene establishment is an important working step in the implementation process of MMORPG (massively multiplayer network role playing) games. The game scene building is to map photos, images or original scenes showing the real scenes in the real world to the virtual world, so that the real scenes are restored in the virtual world, and virtual world scenes with layout and content similar to those of the real scenes are built.
In the game scene construction process, art staff needs to restore the layout mode of the original scene picture as much as possible. At present, for the core part in a game scene, the layout can be realized through strict game materials; however, for scenes except the core part in the game scene, the art staff can only lay out scene details by virtue of own experience, which is time-consuming and labor-consuming, and the problems of inaccurate layout and inaccuracy are easy to exist.
Based on this, an embodiment of the present application provides a scene rendering method, which receives a scene rendering instruction, where the scene rendering instruction includes a scene image to be rendered, and the scene image to be rendered includes an object to be rendered; determining a mask image corresponding to an object to be rendered, wherein the mask image comprises at least one mask region; dividing a mask region in the mask image to obtain a mask region division map, wherein the mask region in the mask region division map is divided into at least two sub-regions; and determining the position information of each subarea in the mask area segmentation map, and rendering the object to be rendered in the virtual scene according to the position information of each subarea.
In this way, by receiving the scene image to be rendered included in the scene rendering instruction, determining the mask image corresponding to the object to be rendered in the scene image to be rendered, and classifying the object to be rendered and other objects in the scene image to be rendered by generating the mask image, so that scene layout and rendering are conveniently carried out on the object to be rendered; the mask region in the mask image is segmented to obtain a mask region segmentation map, at least two sub-regions for determining rendering positions can be obtained according to the mask segmentation map, and the layout efficiency of the object to be rendered is improved; by determining the position information of each subarea in the mask area segmentation map and rendering the object to be rendered in the virtual scene according to the position information of each subarea, the position information of rendering the object to be rendered in the virtual scene can be determined according to the position information of each subarea, the labor cost is reduced, and the rigor and accuracy of the layout of the object to be rendered are improved.
In the present application, a scene rendering method is provided, and the present application relates to a scene rendering apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
Fig. 1 shows a flowchart of a scene rendering method according to an embodiment of the present application, which specifically includes the following steps:
step 102: receiving a scene rendering instruction, wherein the scene rendering instruction comprises a scene image to be rendered, and the scene image to be rendered comprises an object to be rendered.
In practical application, the method can perform layout rendering on the object to be rendered in the scene image to be rendered in the virtual scene by receiving a scene rendering instruction.
Specifically, the scene rendering instruction may be understood as an instruction for performing layout rendering on an object to be rendered in an image of a scene to be rendered in a virtual scene; the scene image to be rendered can be understood as an image, a photo or a scene original picture in the real world, and the scene image to be rendered can be a two-dimensional static image; the object to be rendered is an object in the scene image to be rendered, which can generally include different types of objects, and the object to be rendered is an object to be rendered in the virtual scene determined from various types of objects.
Illustratively, the scene image to be rendered is a scenery map in the real world, the scene image to be rendered includes trees, grass, flowers and stones, and the trees are objects to be rendered in the virtual scene when the trees are determined to be the objects to be rendered in the scene image to be rendered.
By receiving the scene rendering instruction, the scene image to be rendered and the object to be rendered can be determined, so that the follow-up determination of the layout of the object to be rendered in the virtual scene according to the layout of the object to be rendered in the scene image to be rendered is facilitated, and the object to be rendered is rendered at the corresponding position in the virtual scene.
Step 104: and determining a mask image corresponding to the object to be rendered, wherein the mask image comprises at least one mask area.
In practical application, receiving a scene rendering instruction can determine a mask image corresponding to an object to be rendered according to the scene image to be rendered and the object to be rendered.
Specifically, the Mask image, that is, the Mask image, may be classified by classifying the object to be rendered and other objects in the scene image to be rendered, labeling pixels of the object to be rendered as one class, and labeling pixels of other objects except the object to be rendered as another class, so as to distinguish the object to be rendered from other objects in the scene image to be rendered, so that the processing is convenient only for the region corresponding to the object to be rendered. Since the objects to be rendered may be distributed at more than one location in the scene image to be rendered, there may be more than one mask area corresponding to the objects to be rendered in the mask image generated from the scene image to be rendered, i.e. the mask image may comprise at least one mask area.
Through determining the mask image corresponding to the object to be rendered, the accuracy of the layout of the object to be rendered can be improved, inaccuracy of rendering positions caused by manual layout is avoided, labor cost can be reduced, the rendering efficiency of the object to be rendered is improved, and therefore virtual scene building efficiency is improved.
Optionally, determining a mask image corresponding to the object to be rendered may include the following steps:
determining a target classification of an object to be rendered;
and according to the target classification, classifying and labeling each pixel in the scene image to be rendered, and obtaining a mask image corresponding to the object to be rendered.
In the actual implementation process, the target classification of the object to be rendered can be determined, and each pixel in the scene image to be rendered is classified and marked according to the target classification of the object to be rendered, so that a mask image corresponding to the object to be rendered is obtained.
Specifically, the object classification may be understood as a type of an object to be rendered, and the types of the material contents which may become the object to be rendered may be divided in advance according to different material contents included in a real scene, for example, the material contents may be distinguished by type identifiers according to different material contents such as "stone", "flower", "grass", "building", "tree", "person" and the like in the real scene. In the scene image to be rendered, the pixel information corresponding to different types of objects is also different, the pixel information of the object to be rendered can be determined in advance according to the target classification of the object to be rendered, the scene image to be rendered is traversed by pixels based on the pixel information of the object to be rendered, and the pixels included in the scene image to be rendered are classified and marked.
It should be noted that, each pixel in the scene image to be rendered has corresponding pixel information according to the corresponding type, and the pixel information corresponding to different types of objects is different, for example, the pixel information corresponding to the objects "stone", "flower", "grass", "building", "tree" and "person" are different, so that the type of the object to be rendered, that is, the target classification, is determined, and each pixel in the scene image to be rendered can be classified and marked according to the pixel information corresponding to the target classification, so as to obtain the mask image corresponding to the object to be rendered.
The method comprises the steps of determining target classification of an object to be rendered, classifying and labeling each pixel in an image of a scene to be rendered according to the target classification, obtaining a mask image corresponding to the object to be rendered, and rapidly determining the position information of the material to be rendered by classifying and labeling the pixels of the image, so that the material to be rendered is convenient to process, the scene construction efficiency is improved, and meanwhile, the position information of the material to be rendered is determined according to the mask image, so that the layout accuracy and the accuracy can be improved.
Further, determining a target classification of an object to be rendered, there are at least two implementations:
An optional implementation manner is that receiving object information to be rendered input by a user, analyzing the object information to be rendered to determine an object to be rendered, and further obtaining target classification of the object to be rendered according to the object to be rendered.
Specifically, the received object information to be rendered may be information in the form of text, language, etc., or may be a selection operation performed by the user on each selectable object displayed on the interactive interface through a selection control on the interactive interface.
Through the implementation mode, the user can autonomously select the object to be rendered according to actual requirements and conditions, and can determine the object to be rendered only by simple input operation or selection operation, so that the requirement on the technical threshold of the user is low, and the user can operate conveniently.
For example, if the object to be rendered is a "tree," the user may input the text "tree," and the system may be able to input text information into the text recognition model based on the received text information, extract text feature information, and thereby determine that the object to be rendered is classified as a "tree.
Another alternative implementation manner is to receive a target class identifier of an object to be rendered input by a user, and determine a target classification of the object to be rendered according to the target class identifier.
Specifically, the scene rendering instruction may further include a target class identifier, and the target classification of the object to be rendered may be determined according to the target class identifier.
Optionally, classifying and labeling each pixel in the scene image to be rendered according to the target classification to obtain a mask image corresponding to the object to be rendered, which can be realized at least in the following two ways:
an alternative implementation manner is that the target classification and the scene image to be rendered are input into an image segmentation model, and a mask image of the object to be rendered output by the image segmentation model is obtained.
Specifically, through an image segmentation model, classifying pixels in a scene image to be rendered to obtain a mask image, specifically, labeling whether each pixel in the scene image to be rendered is a pixel of target classification by utilizing a branching technology image segmentation algorithm in a deep learning technology, so as to realize classification of objects to be rendered.
Another alternative implementation may include the steps of:
identifying pixel values for each pixel in the scene image to be rendered;
judging whether the pixel value of each pixel is consistent with the target pixel value corresponding to the target classification;
and classifying and labeling each pixel in the scene image to be rendered according to the judging result, and obtaining a mask image corresponding to the object to be rendered.
In practical application, each pixel in the scene image to be rendered can have different pixel values according to the type of the corresponding object, wherein the pixel consistent with the target pixel value corresponding to the target classification can be determined as the pixel corresponding to the object to be rendered, and the pixel corresponding to the object to be rendered and the pixels of other objects can be marked differently.
Specifically, in one or more embodiments, the pixel value of each pixel in the scene image to be rendered is identified, and the pixel value of each pixel in the scene image to be rendered may be calculated through an image point operation or through a method of extracting features from pixel information.
After the pixel values of the pixels are identified, whether the pixel values of the pixels are consistent with the target pixel values or not can be judged according to the target pixel values corresponding to the target classification acquired in advance, classification labeling is carried out on the pixels in the scene image to be rendered according to the judgment result, and a mask image corresponding to the object to be rendered is obtained.
By identifying the pixel value of each pixel in the scene image to be rendered, judging whether the pixel value of each pixel is consistent with the target pixel value corresponding to the target classification based on the target classification, and classifying and labeling each pixel in the scene image to be rendered according to the judgment result to obtain a mask image corresponding to the object to be rendered, the efficiency of determining the layout position of the object to be rendered can be improved; and according to the mask image, the position information of the object to be rendered in the virtual scene is acquired, so that the accuracy of the position information can be improved, and the layout accuracy in the virtual scene construction are improved.
Further, in order to distinguish the object to be rendered from other objects in the scene image to be rendered, more accurate layout information of the object to be rendered is obtained, so that the position information of the object to be rendered in the virtual scene is conveniently obtained according to the position information of the object to be rendered in the scene image to be rendered.
Optionally, in one or more embodiments of the present application, classifying and labeling each pixel in the scene image to be rendered according to the determination result to obtain a mask image corresponding to the object to be rendered, which may include the following steps:
if the pixel value of the pixel to be classified is consistent with the target pixel value, marking the pixel to be classified as a first type, wherein the pixel to be classified is any pixel in the scene image to be rendered;
and taking the region corresponding to the pixel marked as the first type in each pixel as a mask region, and obtaining a mask image corresponding to the object to be rendered.
Specifically, the first type may be understood as a type corresponding to a pixel of the object to be rendered. The mask area may be understood to include only the area corresponding to the pixels of the first type.
In practical application, since the position of the object to be rendered in the scene image to be rendered can be at least one, at least one mask area can be obtained correspondingly, and the mask image corresponding to the object to be rendered can be obtained according to the at least one mask area.
To better distinguish between objects to be rendered and other objects, one label may be set for a first type of pixel and another label may be set for other types of pixels, thereby enabling classification of objects to be rendered and other objects.
For example, the pixel of the object to be rendered may be marked as 1, the pixels of other objects may be marked as 0, and classification marking may be performed according to the characteristics of the object to be rendered, for example, the object to be rendered is a tree, and then the pixel of the object to be rendered may be marked as green, and the pixels of the other objects may be marked as black, so as to obtain the position information of the area where the object to be rendered is located; pixels of the object to be rendered can be marked only through the unique identification or the label, and pixels of other objects are not marked.
The pixels to be classified, which are consistent with the target pixel value, are marked as the first type, and the areas corresponding to the pixels marked as the first type in each pixel are used as mask areas, so that mask images corresponding to the objects to be rendered are obtained, classification of the objects to be rendered and other objects in the scene images to be rendered can be realized, the efficiency of determining the layout information of the objects to be rendered is improved, and the accuracy of the layout of the objects to be rendered is improved.
Fig. 2a is a schematic diagram of a to-be-rendered scene image of a scene rendering method according to an embodiment of the present application, as shown in fig. 2a and fig. 2 b. Fig. 2a shows a photograph taken of a natural landscape in a real scene, where the material content in the photograph may be restored in the virtual scene by constructing the virtual scene with the photograph as an image of the scene to be rendered. And classifying and labeling each pixel in the scene image to be rendered according to the determined object classification of the material to be rendered as a tree, and obtaining a mask image corresponding to the tree of the object to be rendered.
Fig. 2b is a schematic diagram of a mask image of a scene rendering method according to an embodiment of the present application.
Wherein, the pixels corresponding to the tree are marked as one color, and the pixels corresponding to other objects are marked as another color, so as to obtain a mask image corresponding to the object to be rendered "tree", and in the example of fig. 2b, the mask image includes 4 mask areas, and the mask areas can reflect the layout situation of the object to be rendered "tree" in the image to be rendered.
Step 106: and dividing the mask region in the mask image to obtain a mask region division map, wherein the mask region in the mask region division map is divided into at least two sub-regions.
In practical application, a mask image corresponding to an object to be rendered is determined, a mask region in the mask image can be segmented, and the mask region is segmented into at least two sub-regions, so that a mask region segmentation map is obtained.
Specifically, the mask area can be understood as an area where the object to be rendered is located, and the shape of the area is determined according to the actual distribution situation of the object to be rendered, and can be an irregular shape, or can be a polygonal shape, a circular shape, an elliptic shape and the like, which is not limited in the application; the mask region division map may be understood as an image obtained by dividing a mask region in a mask image into at least two sub-regions based on the mask image.
In an alternative implementation, the mask region may be randomly segmented according to the location coordinates corresponding to the mask region. In this way, the efficiency of determining the position information of the object to be rendered can be improved.
In another alternative implementation, a regular-shape region including a mask region, such as a quadrilateral region or a circular region, may be generated according to the position of the mask region, and then the regular-shape region is divided into at least two sub-regions by average or random division, so as to obtain a mask region division map.
By adjusting the mask area into the area with regular shape and average division of the area, the uniformity of rendering of the image to be rendered can be improved on the basis of improving the efficiency of determining the position information of the object to be rendered, and a better layout effect is achieved.
By dividing the mask region in the mask image to obtain a mask region division map, the efficiency of determining the layout position of the image to be rendered can be improved, and the labor cost can be reduced.
It should be noted that, in the process of determining the mask image corresponding to the object to be rendered, each pixel in the scene image to be rendered may be classified and labeled, that is, each pixel in the scene image to be rendered needs to be traversed according to the pixel, and whether each pixel is of a type corresponding to the image to be rendered is determined. In the actual implementation process, the original image size of the scene image to be rendered is often larger, the number of pixels contained in the original image is often larger, if the original image is directly input, the calculated amount is larger, and the processing performance of the system is often affected to a certain extent.
In addition, in the actual application process, a plurality of mask images can be obtained by inputting a plurality of images to be rendered at a time. Therefore, in order to improve the efficiency of classifying pixels and improve the processing performance, in one or more embodiments of the present application, before determining the mask image corresponding to the object to be rendered, the method may further include:
And adjusting the specification of the scene image to be rendered according to a preset adjustment rule to obtain an updated scene image to be rendered.
Specifically, the preset adjustment rule may be understood as a preset rule for adjusting the specification of the image to be rendered.
Further, the preset adjustment rule may be set according to actual requirements, and in an alternative embodiment of the present application, each scene image to be rendered corresponds to a default processing specification, that is, when the preset adjustment rule is the default adjustment rule, the specification of the scene image to be rendered may be adjusted to the default specification.
For example, the specification of the to-be-rendered scene image is 512mm×512mm, and the default specification is 64mm×64mm, and after the specification of the to-be-rendered scene image is adjusted according to the default adjustment rule, the specification of the to-be-rendered scene image is 64mm×64mm.
It should be noted that, according to the scene image to be rendered obtained by the default specification, the mask region in the mask image may be segmented by a segmentation method corresponding to the default specification. For example, when the specification of the scene image to be rendered is a default specification of 64mm by 64mm, the default division manner of the mask region may be to divide the mask region into squares of 3mm by 3mm, that is, divide the mask region into at least two sub-regions with fixed side lengths.
In order to keep the specification of the sub-region obtained by segmentation as consistent as possible with the specification of the object to be rendered, in another alternative embodiment of the present application, the specification of the image to be rendered may be adjusted according to the type of the object to be rendered.
In addition to dividing the mask region into squares, the mask region may be divided into circular lattices with a fixed radius, rectangular lattices with a fixed length and width, or the like.
The specification of the scene image to be rendered can be further adjusted according to the type of the object to be rendered and the corresponding adjustment parameters of the type of the object to be rendered on the basis of the default specification.
For example, when the scene image to be rendered is "building", since the size of the building is larger in the real scene, it is desirable that the sub-area obtained after segmentation can be larger, and the scene image to be rendered can be further adjusted to 48mm by 48mm based on the adjustment parameter 0.75 corresponding to the building, where the scene image to be rendered is adjusted to the default specification 64mm by 64 mm.
When the mask area is divided into subareas with fixed side lengths according to a default dividing mode, the more the updated scene image specification to be rendered is, the more the subareas are obtained by dividing; the smaller the updated scene image specification to be rendered, the fewer the segmented sub-regions. If the objects to be rendered are rendered according to the positions of the subareas, the more the subareas are, the more the objects to be rendered need to be rendered in the virtual scene, the finer the rendering of the virtual scene is, and the larger the performance requirements on the devices such as a CPU (central processing unit), a GPU (graphics processing unit) and the like of the computer are.
Therefore, in still another alternative embodiment of the present application, the specification of the scene image to be rendered may be adaptively adjusted according to the processing performance of the computer in the actual implementation process, so as to improve the processing efficiency of the system.
For example, a 4-gear performance mode may be preset, where each gear mode corresponds to a specification of a scene image to be rendered, and when the specification is 32×32, the performance priority mode is set; when the specification is 48 x 48, the balance mode is adopted; when the specification is 64 x 64, the method is a precision priority mode; and the specification is 128 x 128, and the image quality is the optimal image quality mode.
In practical application, when determining the mask image corresponding to the object to be rendered, the scene image to be rendered may be carried in the scene rendering instruction, or may be the scene image to be rendered after the specification is adjusted according to the preset adjustment rule.
The adjusted scene image specification to be rendered can be represented by a parameter nor_size, the sub-region specification obtained by segmentation can be represented by pad_size, and the mask image is obtained after classifying the object to be rendered according to the scene image to be rendered, so that the mask image specification can be consistent with the scene image specification nor_size to be rendered after the adjustment of the scene image to be rendered is completed.
Accordingly, the mask region of the mask image is divided to obtain a mask region division map, which may include the steps of:
determining a segmentation strategy of the mask image according to a preset adjustment rule;
and dividing the mask region of the mask image according to the division strategy to obtain a mask region division map.
In the actual implementation process, the segmentation strategy of the mask image can be determined according to a preset adjustment rule, and the mask region of the mask image is segmented according to the segmentation strategy to obtain a mask region segmentation map.
In particular, the segmentation policy may be understood as a policy of segmenting the mask region, and may specifically include uniform segmentation, random segmentation, and the number of sub-regions obtained by segmentation, sub-region specifications, and the like.
Each preset adjustment rule corresponds to different segmentation strategies. Illustratively, when the preset adjustment rule is a default adjustment rule, the default division policy corresponds to a grid dividing the mask region into pad_size=3 when the default adjustment rule is nor_size=64.
The preset adjustment rule is that when the nor_size is determined according to the object to be rendered, a target parameter set mask_parameter of the object to be rendered is obtained, for example, when the object to be rendered is building, a parameter 0.75 included in the target parameter set mask_parameter corresponds to the nor_size, that is, the nor_size=48 corresponding to the building, and a parameter 1 included in the target parameter set mask_parameter corresponds to the pad_size, that is, the pad_size=3. Specifically, the target parameter set mask_parameter may be understood as a parameter set according to the size and specification proportion of each material content in the real scene and expert experience, and the target parameter set mask_parameter may be used for adjusting the specification of the mask picture corresponding to the object to be rendered, defining the division manner of the mask region, reserving or discarding the sub-region obtained after division, and so on.
The target parameter set may be understood as a parameter set for an object to be rendered, and may include a parameter for adjusting a specification of a scene image and/or a mask image to be rendered, a parameter for adjusting a specification of a sub-region obtained by dividing a mask region, a parameter for adjusting a proportional threshold value for selecting a reserved or discarded sub-region, and the like.
In the above two dividing modes, the mask image and the specification of the sub-region obtained after dividing the mask image can be set through experience of a technician, so that the specification of the sub-region obtained by dividing accords with the size of the object to be rendered as much as possible.
When the preset adjustment rule is to adaptively adjust the specification of the scene image to be rendered according to the processing performance of the computer, the pad_size is adaptively adjusted according to the nor_size because the nor_size is dynamically adjusted in order to ensure that the segmented sub-region can be in accordance with the size of the object to be rendered as much as possible.
It should be noted that, the scene image to be rendered may also adaptively adjust the nor_size according to other situations in the actual implementation process, for example, situations such as the beauty of the virtual scene, the neatness of the picture, or the rendering efficiency, and the method is not limited to dynamic adjustment according to the processing performance of the computer.
Determining a segmentation strategy of the mask image according to a preset adjustment rule; according to the segmentation strategy, the mask region of the mask image is segmented to obtain a mask region segmentation map, so that the determination efficiency of the rendering position of the object to be rendered can be improved, and meanwhile, the size of the segmented sub-region can be enabled to be in accordance with the actual size of the object to be rendered as much as possible, so that the construction precision and accuracy of the virtual scene are improved.
Dividing the mask region of the mask image according to the division policy to obtain a mask region division map may include the steps of:
determining target segmentation parameters of a mask region of the mask image according to a segmentation strategy;
dividing a target mask area into at least two sub-areas according to the target dividing parameter, wherein the target mask area is any mask area included in the mask image;
when the mask image includes each mask region, a mask region division map is obtained.
Specifically, the target segmentation parameter may be understood as a parameter required for segmenting the target mask region according to a segmentation policy, and may specifically be a parameter for defining a side length, an area, or a shape of the segmented sub-region. The target mask area is any one mask area included in the mask image. The mask region division map is understood to be an image obtained after division of each mask region included in the mask image.
In the actual implementation process, when the segmentation strategy is random segmentation, the mask region can be randomly divided into at least two sub-regions according to the mask region.
In the case of uniform segmentation of the segmentation strategy, since the mask region is often an irregular region, it takes a lot of calculation cost to calculate the segmentation parameters for the irregular region and segment, so in order to improve the segmentation efficiency, a regular region bbox including the mask region may be determined first, the segmentation target segmentation parameters may be calculated for the regular region bbox, and the regular region bbox may be segmented according to the target segmentation parameters.
In practical application, the method for determining the position of the rule area can be at least realized by the following two implementation modes.
In an alternative embodiment, the mask image may be output through the image segmentation model, and the location information of the bbox corresponding to each mask region output by the image segmentation model may be obtained at the same time.
In another alternative embodiment, the location information of the bbox may be obtained by calculation according to the maximum width and the maximum length of the location information of the mask area.
As shown in fig. 3, fig. 3 is a schematic diagram of a mask area of a scene rendering method according to an embodiment of the present application. In fig. 3, each mask region corresponds to a block containing the mask region, and the irregular mask region is converted into a regular quadrilateral region. The box is the bbox corresponding to the mask area.
In one or more embodiments of the present application, in the case where the segmentation policy is to uniformly segment the mask region, determining the target segmentation parameter of the mask region of the mask image according to the segmentation policy may include the steps of:
when the division policy is the first division policy, the default division parameter is set as the target division parameter.
Specifically, the first segmentation policy may be understood as a policy that the segmentation parameters can be directly obtained without calculating according to parameters such as a scene image specification to be rendered, a mask image specification, and a mask region specification, and default segmentation parameters may be preset according to different image specifications, and the image specification and the default segmentation parameters are correspondingly stored in a segmentation parameter relation table. Specifically, the image specification may be a specification of a mask area, may be an adjusted specification of a scene image to be rendered, may be a specification of a mask image, and the like. The default segmentation parameters may be parameters queried from a preset segmentation parameter relationship table. The target segmentation parameter may be understood as a segmentation parameter that segments the target mask region.
Segmentation of bbox by default segmentation strategy, there are at least two cases:
Regardless of the specific type of object to be rendered, a unified default segmentation parameter is set, for example, under a default specification of nor_size=64, default pad_size=3, and then bbox is divided into at least two sub-areas with a specification of 3*3 according to pad_size=3;
according to the type of the object to be rendered, a target parameter set mask_parameter of the object to be rendered is obtained, according to parameters in the mask_parameter for adjusting default pad_size, the pad_size corresponding to the object to be rendered is obtained, and the bbox is segmented according to the pad_size corresponding to the object to be rendered.
Under the condition that the segmentation strategy is the first segmentation strategy, the preset default segmentation parameter is used as the target segmentation parameter, so that the segmentation parameter can be rapidly determined according to experience accumulated by professionals in actual work, and the segmentation efficiency is improved.
In one or more embodiments of the present application, in the case where the segmentation policy is to uniformly segment the mask region, determining the target segmentation parameter of the mask region of the mask image according to the segmentation policy may further include the steps of:
determining a specification of a mask area in the case that the division policy is the second division policy;
and determining target segmentation parameters based on the updated specification of the scene image to be rendered and the specification of the mask region.
Specifically, the second segmentation policy may be understood as a policy requiring calculation of segmentation parameters according to a scene image specification to be rendered, a mask image specification, and/or a mask region specification.
In practical application, the specification of the image of the scene to be rendered or the specification of the mask image can be dynamically adjusted according to specific conditions, such as the picture neatness, the reduction degree and the performance of the real scene, etc., if the specification obtained after the dynamic adjustment is not provided with the default segmentation parameters in the segmentation parameter relation table in advance, the segmentation parameters suitable for the current conditions can be calculated according to the image specification and the mask region specification after the dynamic adjustment, so that the size of the segmented sub-region can be more in line with the size of the actual material to be rendered.
In the actual implementation process, in order to make the size of the sub-region obtained by segmentation more conform to the size of the material to be rendered, under the condition that the segmentation strategy is the second segmentation strategy, the target segmentation parameter can be determined according to the updated specification of the scene image to be rendered and the specification of the mask region.
Specifically, determining the target segmentation parameter according to the updated specification of the scene image to be rendered and the specification of the mask region may include:
And determining the side length (paddingsize) corresponding to each subarea after dividing the circumscribed area bbox into at least two subareas according to the ratio between the updated specification of the scene image to be rendered and the specification of the circumscribed area (bbox) of the mask area, thereby determining the target dividing parameter according to the side length of the subarea. The target segmentation parameter may be represented by pad_size, and the side length of the bbox sub-region may be represented by pad_size.
Illustratively, according to the ratio between the updated specification of the scene image to be rendered and the specification of the bbox corresponding to the mask region, determining the side length paddingsize of the bbox sub-region corresponding to the target mask region can be calculated by the following method:
BoxSize=(BoxX*BoxY)
FullSize=ImgX*ImgY
Radio=squt(BoxSize/FullSize)
paddingsize=Radio*Norsize
wherein, box size is the area of the target mask area corresponding to bbox, box X is the length of bbox in the x-axis direction, and box Y is the length of bbox in the y-axis direction; fullSize is the actual area of the mask image, imgX is the length of the mask image in the x-axis direction, imgY is the length of the mask image in the y-axis direction; radio is the side length ratio of bbox and mask image. The paddingsize is the side length of the segmented sub-region, and the Norsize is the side length of the updated scene image to be rendered.
When dividing each mask region, different Radio and padding size may be calculated according to different target mask regions; the median of Radio may be taken, and a unified padding size may be calculated, so as to determine the segmentation parameters corresponding to each mask region in the mask image. The mask region is segmented by using the uniform segmentation parameters, so that the mask image segmentation efficiency can be improved.
Further, in order to improve the accuracy of the layout position of the object to be rendered in the virtual scene, it is also required to ensure that the sub-region obtained by segmentation according to bbox occupies as much part of the mask region as possible, and in a more strict case, the sub-region should be completely contained inside the mask region.
To achieve the above effects, in one or more embodiments of the present application, the dividing the mask region of the mask image to obtain the mask region division map may further include:
determining the first pixel number marked as a first type in each pixel point included in the target subarea, wherein the target subarea is any one of at least two subareas;
based on the first number of pixels, it is determined whether the target sub-region is reserved.
Specifically, the first type may be understood as a pixel type corresponding to the object to be rendered, and the first pixel number may be understood as a number of pixel points marked as the first type in the target sub-area.
In practical application, after classifying and labeling the scene image to be rendered according to pixels, the pixel types corresponding to the object to be rendered are different from the pixel types corresponding to other objects, for example, when the object to be rendered is a tree, the pixel points of the first type obtained after classifying and labeling are marked green, and the pixel points of the other types are marked black. Since the regular region bbox including the mask region includes both the first type of pixel points and other types of pixel points, there is a region including both the first type of pixel points and other types of pixel points among at least two sub-regions obtained according to the uniform division policy.
Specifically, determining the number of first pixels marked as the first type in each pixel point included in the target sub-region can be achieved by traversing marking labels of each pixel point in the target sub-region, and counting the number of the first type pixel points.
Determining whether to reserve the target sub-region based on the first number of pixels may be accomplished by at least two implementations:
in an alternative embodiment, it may be determined whether the proportion of the first number of pixels to the total number of pixels included in the target sub-region reaches a preset threshold. The preset threshold may be stored in a threshold parameter, which may be set by the actual application or by specific requirements, which the present application does not limit. For example, the default threshold may be 0.8, which indicates that, in the target sub-area, as long as the first pixel number is 80% or more of the total number of the pixels included in the target sub-area, the target sub-area is determined to be a legal area, and may be reserved, otherwise, the target sub-area is determined to be illegal and discarded.
In more stringent cases, threshold may also be set to 1, thereby ensuring that the sub-region is completely within the mask region.
In another alternative embodiment, it may be determined whether the ratio between the first number of pixels and the other number of pixels than the first number of pixels in the target sub-area reaches a preset threshold. And reserving the target subarea under the condition that the preset threshold is reached, otherwise discarding the target subarea.
It should be noted that, in the rendering process, the objects to be rendered with different label types may have different requirements on rendering precision. For example, for a building or a key landmark waiting for a rendering object, the requirement on the accuracy of the layout position in a virtual scene is often high, while for a tree, grass or stone waiting for a rendering object, the requirement on the accuracy of the layout position in the virtual scene is not very high, so long as natural distribution can be simulated, and the effect of beautiful pictures can be achieved. Therefore, for the objects to be rendered of different labels, the ratio threshold value of the first pixel number to the total number of pixels in the target subarea, or the ratio threshold value between the first pixel number and the other pixel numbers except the first pixel number can be properly adjusted according to the labels of the objects to be rendered.
For a building, for example, when the target subarea is reserved or discarded through the parameter threshold, the threshold is generally set to 0.8, while for trees, grasses and stones, in the case that the mask area is relatively small and the number of target subareas capable of being used for determining the rendering position is not large, the value of the threshold can be properly reduced, the condition limit that the target subarea falls inside the mask area as much as possible is relaxed, and the rendering density is increased through reducing the proportion threshold, so that the natural distribution of the object to be rendered is better simulated.
By determining the first pixel number marked as the first type in each pixel point included in the target sub-region, determining whether to reserve the target sub-region according to the first pixel number, discarding the sub-region with less pixels containing the mask image in the sub-region obtained by segmentation, and reserving only the target sub-region with the first pixel number meeting the requirement, the sub-region obtained by segmentation according to bbox is ensured to occupy more parts of the mask region as much as possible, and the accuracy of the layout position of the object to be rendered in the virtual scene can be improved.
Fig. 4 is a schematic diagram of a target sub-region of a scene rendering method according to an embodiment of the present application. According to the target subarea obtained by one or more embodiments of the present application, as many parts as possible in the mask area can be occupied, so that the layout position of the object to be rendered is ensured to fall inside the mask area as much as possible, and the layout stringency of virtual scene building is improved.
After the target sub-regions are segmented to obtain the mask region segmentation map for rendering the object to be rendered, the staff may select to fully reserve the sub-regions corresponding to each mask region or discard a part of the sub-regions according to actual situations such as computer performance, picture art designing, etc. in actual application.
By way of example, after obtaining 10 target subregions corresponding to the target mask region by segmentation, the art staff empirically determines that if 10 objects to be rendered are rendered at corresponding positions in the virtual scene, the image content is oversaturated and viewing is affected, and then a certain number of target subregions can be selected and discarded according to actual situations. For another example, according to the current running performance of the computer, the technician determines that if 10 objects to be rendered are rendered at the corresponding positions of the virtual scene, the computer load is too high, and can choose to discard a certain number of target subregions according to the actual requirements.
Specifically, discarding the target sub-region, which may be selected by the worker by receiving a selection operation of the worker on the target sub-region; the number of the target subregions to be discarded may be specified according to a preset parameter, and the target subregions of the preset number may be discarded randomly, specifically, the parameter for discarding the target subregions randomly may be keep_percentage, and when keep_percentage=100, it means that all the target subregions obtained by segmentation may be reserved.
The sub-areas obtained by segmentation are discarded according to the specific conditions in the actual realization process, so that the running performance of a computer can be ensured, the virtual scene construction efficiency is improved, the visual effect of the virtual scene can be optimized on the basis of ensuring the high reduction degree of the real scene, and the virtual scene construction effect is improved.
Step 108: and determining the position information of each subarea in the mask area segmentation map, and rendering the object to be rendered in the virtual scene according to the position information of each subarea.
In practical application, the mask area in the mask image is segmented to obtain a mask area segmentation map, and the position information of the sub-areas in each mask area in the mask area segmentation map can be determined, so that the position information of the object to be rendered in the virtual scene can be obtained according to the sub-area position information, and the object to be rendered is rendered.
Specifically, the position information of each sub-region in the mask region division map is two-dimensional coordinate information, and the obtained two-dimensional coordinate information may be stored by a file, for example, in a word document or an example table. The scene image to be rendered, the object to be rendered, the mask image and the sub-region position information can be stored through a json file, so that the associated scene image to be rendered can be checked and the object to be rendered can be determined by acquiring the position information of each sub-region. A virtual scene may be understood as a virtual world built up according to real world layout content in an image of a scene to be rendered, which may specifically include a game scene, a virtual reality scene, and the like.
The method comprises the steps of determining the position information of each subarea in the mask area segmentation map, rendering an object to be rendered in a virtual scene according to the position information of each subarea, and determining the layout position of the object to be rendered in the image of the scene to be rendered according to the mask area, so that the layout position of the object to be rendered in the virtual scene is determined according to the layout position, the real-world material content and the material layout can be restored in the virtual world, the virtual scene construction efficiency is improved, and the accuracy and the precision of the virtual scene layout are improved.
Optionally, in one or more embodiments of the present application, determining the location information of each sub-region in the mask region segmentation map may include the following steps:
determining two-dimensional coordinate information corresponding to a target sub-region, wherein the target sub-region is any one of at least two sub-regions;
and projecting the two-dimensional coordinate information into the virtual scene to obtain three-dimensional coordinate information corresponding to the target subarea.
Specifically, the two-dimensional coordinate information may be understood as position information corresponding to a two-dimensional point in the target sub-area, and the three-dimensional coordinate information may be understood as position information corresponding to a three-dimensional point in the virtual scene.
Optionally, determining the two-dimensional coordinate information corresponding to the target sub-region may be implemented by at least two embodiments as follows:
an alternative implementation manner is to determine a two-dimensional point in the target subarea according to a unified preset determination rule, and acquire two-dimensional coordinate information of the point. For example, it is prescribed that the center point of the target sub-region is determined as a two-dimensional point, the two-dimensional coordinate information of the center point is acquired, or it is prescribed that the upper left vertex of the target sub-region is determined as a two-dimensional point, and the two-dimensional coordinate information of the upper left vertex of the target sub-region is acquired.
In another alternative embodiment, a random function is called, a point is randomly determined as a two-dimensional point in each target subarea, and two-dimensional coordinate information of the randomly determined two-dimensional point is acquired. The random determination of two-dimensional coordinate information within the target sub-area may also be achieved by setting a parameter that can be used to randomly generate two-dimensional coordinates of a point within the area, which may be, for example, enable_random_pos.
By randomly determining the points in the target subarea, the obtained two-dimensional coordinate information can be positioned at any position in the target subarea, so that the rendering freedom degree can be improved, and the reduction degree of the real scene can be improved.
In practical application, after the two-dimensional coordinate information corresponding to the target sub-region is obtained, the three-dimensional coordinate information corresponding to the target sub-region can be obtained by projecting the two-dimensional coordinate information into the virtual scene, so that the object to be rendered is rendered at the corresponding position in the virtual scene.
Specifically, the two-dimensional coordinate information is projected into the virtual scene, and the three-dimensional coordinate information corresponding to the target sub-region is obtained, which can be realized at least by any one of the following two embodiments:
in an alternative embodiment, the two-dimensional coordinates may be projected to a three-dimensional space corresponding to the virtual scene by using a three-dimensional ray pickup technology, so as to obtain three-dimensional coordinate information corresponding to the target sub-region.
In another alternative embodiment, the projection of the two-dimensional coordinates into the three-dimensional space to obtain the three-dimensional coordinates may be performed by a coordinate rotation algorithm, or other algorithm capable of performing the projection of the two-dimensional coordinates into the three-dimensional space to obtain the corresponding three-dimensional coordinate information.
The two-dimensional coordinate information corresponding to the target sub-region is determined, the two-dimensional coordinate information is projected into the virtual scene to obtain the three-dimensional coordinate information corresponding to the target sub-region, the layout information of the object to be rendered in the image of the scene to be rendered can be determined according to the segmented sub-region, the layout position of the object to be rendered in the three-dimensional virtual scene is determined according to the layout information of the object to be rendered in the two-dimensional image, the object to be rendered can be rendered in a more accurate position in the virtual scene, and the accuracy of the layout in the scene building process are improved.
On the basis of determining three-dimensional coordinate information of an object to be rendered in a virtual scene according to the target subregion, the object to be rendered in the virtual scene can be rendered according to the three-dimensional coordinate information.
Optionally, in one or more embodiments of the present application, rendering an object to be rendered in a virtual scene according to position information of each sub-region may include the steps of:
determining a target rendering material corresponding to an object to be rendered in the virtual scene;
rendering the target rendering material at a location indicated by the three-dimensional coordinate information in the virtual scene.
Specifically, the target rendering material may be understood as a material rendered in a virtual scene, consistent with the type of the object to be rendered.
In practical application, determining the target rendering material corresponding to the object to be rendered in the virtual scene can be realized by any one of at least two implementations:
in an alternative embodiment, the object to be rendered in the scene image to be rendered may be cut through the mask area position corresponding to the object to be rendered in the mask image to obtain the material content corresponding to the object to be rendered, and the target rendering material capable of being used for rendering in the virtual scene is obtained according to the processing of the material content obtained through cutting.
In another alternative embodiment, the material with the highest similarity with the object to be rendered can be searched in a pre-created material library and used as the target rendering material.
Specifically, the materials in the material library can be obtained by modeling the material content which possibly appears in the virtual scene in advance by modeling staff; the modeled materials in other virtual scenes can also be collected; the method can also be obtained by shooting objects in the real world, for example, pictures of trees in the real scene are shot through an orthogonal camera, the shot pictures are stored in a material library, and the material library is created.
5 a-5 c, FIG. 5a shows a schematic diagram of a material to be rendered according to a scene rendering method according to an embodiment of the present application; fig. 5b is a schematic diagram of a material to be rendered according to another scene rendering method according to an embodiment of the present application; fig. 5c is a schematic diagram of a material to be rendered according to another scene rendering method according to an embodiment of the present application. Fig. 5a to 5c may be modeling pictures designed in advance by an art staff for trees of different shapes, or may be material pictures which are more similar to the shapes of trees in the real world after photographing the trees in the real world by an orthogonal camera and performing image processing.
In the actual implementation process, based on a pre-created material library, the picture of the object to be rendered in the scene image to be rendered can be intercepted according to the position of the mask area in the mask image, and the material in the material picture with the highest similarity to the picture of the object to be rendered is determined as the target rendering material.
Specifically, retrieving a material picture with highest similarity to an object picture to be rendered from a material library, respectively extracting visual characteristics of the object picture to be rendered and each material picture in the material library by a traditional computer visual characteristic extraction method, and determining the material with highest similarity to the object picture to be rendered by a mean value hash (AHash), a difference value hash (DHash) or a perceived hash (WHAsh) and the like calculation algorithm; and the image features of each image can be extracted through a neural network by a deep learning method to perform feature vector comparison, so that the material with the highest similarity with the image of the object to be rendered is determined.
On the basis of determining the target rendering materials, the target rendering materials can be rendered at the positions indicated by the three-dimensional coordinate information in the virtual scene, so that the virtual scene is built.
According to the method, the target rendering material is determined according to the object to be rendered in the scene picture to be rendered, the three-dimensional coordinate information corresponding to the target rendering material in the three-dimensional space of the virtual scene is obtained according to the position information of the object to be rendered in the scene picture to be rendered, and the target rendering material is rendered at the position indicated by the three-dimensional coordinate information in the virtual scene, so that the virtual scene can be quickly built according to any real world picture, photo, original scene picture and the like, the virtual scene building efficiency is improved, and the accuracy of layout in the virtual scene are improved.
According to the embodiment of the application, the mask image corresponding to the object to be rendered in the scene image to be rendered is determined by receiving the scene image to be rendered included in the scene rendering instruction, and the object to be rendered and other objects in the scene image to be rendered can be classified by generating the mask image, so that scene layout and rendering are conveniently carried out on the object to be rendered; the mask region in the mask image is segmented to obtain a mask region segmentation map, at least two sub-regions for determining rendering positions can be obtained according to the mask segmentation map, and the layout efficiency of the object to be rendered is improved; by determining the position information of each subarea in the mask area segmentation map and rendering the object to be rendered in the virtual scene according to the position information of each subarea, the position information of rendering the object to be rendered in the virtual scene can be determined according to the position information of each subarea, the labor cost is reduced, and the rigor and accuracy of the layout of the object to be rendered are improved.
The application of the scene rendering method provided by the application in game scene construction is taken as an example, and the scene rendering method is further described below with reference to fig. 6. Fig. 6 shows a process flow chart of a scene rendering method applied to game scene construction, which specifically includes the following steps:
step 602: a game scene rendering instruction is received, wherein the game scene rendering instruction includes a two-dimensional scene image and a text information "tree".
In particular, a two-dimensional scene image may be understood as a photograph, picture or original drawing of a scene in the real world, which may be used for modeling a game scene, the two-dimensional scene image comprising a tree of objects to be rendered.
Step 604: and adjusting the specification of the two-dimensional scene image according to the parameter nor_size=64 to obtain an updated two-dimensional scene image.
Step 606: the text information tree is input into the text recognition model, and the target rendering type of the object to be rendered is output as the tree.
Step 608: and inputting the target rendering type tree and the updated two-dimensional scene image into an image segmentation model to obtain a mask image corresponding to the tree, wherein the mask image comprises at least one mask region.
Step 610: and determining the position information of each mask region corresponding to the mask frame in the mask image, and calculating the segmentation parameters corresponding to the mask image according to the proportional relation between the size of the mask frame and the size of the updated two-dimensional scene image.
Step 612: dividing each mask frame into at least two squares according to the dividing parameters, judging the proportion of the first pixel quantity of the first type pixels corresponding to the tree to the pixel quantity in each square, and reserving or discarding each square.
Step 614: according to the actual building requirement and the computer performance, setting a discarding parameter, and randomly discarding a preset number of squares in a target mask area, wherein the target mask area is any one of at least one mask area.
Step 616: and calling a random function to randomly determine two-dimensional coordinate information in each square according to the two-dimensional position information of each square in the target mask area.
Step 618: and projecting the two-dimensional coordinate information into a three-dimensional space corresponding to the game scene through a three-dimensional ray pickup technology to obtain the three-dimensional coordinate information.
Step 620: and obtaining a picture of the object tree to be rendered according to the mask image and the two-dimensional scene image, and determining the target game material with the highest similarity with the object tree to be rendered in a preset game material library through an image similarity algorithm.
Step 622: in the game scene, the target game material is rendered at the position indicated by the three-dimensional coordinate information.
According to the embodiment of the application, the mask image corresponding to the object to be rendered in the scene image to be rendered is determined by receiving the scene image to be rendered included in the scene rendering instruction, and the object to be rendered and other objects in the scene image to be rendered can be classified by generating the mask image, so that scene layout and rendering are conveniently carried out on the object to be rendered; the mask region in the mask image is segmented to obtain a mask region segmentation map, at least two sub-regions for determining rendering positions can be obtained according to the mask segmentation map, and the layout efficiency of the object to be rendered is improved; by determining the position information of each subarea in the mask area segmentation map and rendering the object to be rendered in the virtual scene according to the position information of each subarea, the position information of rendering the object to be rendered in the virtual scene can be determined according to the position information of each subarea, the labor cost is reduced, and the rigor and accuracy of the layout of the object to be rendered are improved.
Corresponding to the method embodiment, the present application further provides an embodiment of a scene rendering device, and fig. 3 shows a schematic structural diagram of the scene rendering device according to an embodiment of the present application. As shown in fig. 3, the apparatus includes:
The receiving module 702: configured to receive a scene rendering instruction, wherein the scene rendering instruction comprises a scene image to be rendered, the scene image to be rendered comprising an object to be rendered;
the first determination module 704: configured to determine a mask image corresponding to an object to be rendered, wherein the mask image comprises at least one mask region;
segmentation module 706: the method comprises the steps of dividing a mask region in a mask image to obtain a mask region division map, wherein the mask region in the mask region division map is divided into at least two sub-regions;
the second determination module 708: the method comprises the steps of determining position information of each subarea in a mask area segmentation map, and rendering an object to be rendered in a virtual scene according to the position information of each subarea.
Optionally, the first determining module 704 is further configured to:
determining a target classification of an object to be rendered;
and according to the target classification, classifying and labeling each pixel in the scene image to be rendered, and obtaining a mask image corresponding to the object to be rendered.
Optionally, the first determining module 704 is further configured to:
identifying pixel values for each pixel in the scene image to be rendered;
judging whether the pixel value of each pixel is consistent with the target pixel value corresponding to the target classification;
And classifying and labeling each pixel in the scene image to be rendered according to the judging result, and obtaining a mask image corresponding to the object to be rendered.
Optionally, the first determining module 704 is further configured to:
if the pixel value of the pixel to be classified is consistent with the target pixel value, marking the pixel to be classified as a first type, wherein the pixel to be classified is any pixel in the scene image to be rendered;
and taking the region corresponding to the pixel marked as the first type in each pixel as a mask region, and obtaining a mask image corresponding to the object to be rendered.
Optionally, the scene rendering device further comprises an adjustment module configured to:
according to a preset adjustment rule, adjusting the specification of the scene image to be rendered to obtain an updated scene image to be rendered;
accordingly, the segmentation module 706 is further configured to:
determining a segmentation strategy of the mask image according to a preset adjustment rule;
and dividing the mask region of the mask image according to the division strategy to obtain a mask region division map.
Optionally, the segmentation module 706 is further configured to:
determining target segmentation parameters of a mask region of the mask image according to a segmentation strategy;
dividing a target mask area into at least two sub-areas according to the target dividing parameter, wherein the target mask area is any mask area included in the mask image;
When the mask image includes each mask region, a mask region division map is obtained.
Optionally, the segmentation module 706 is further configured to:
when the division policy is the first division policy, the default division parameter is set as the target division parameter.
Optionally, the segmentation module 706 is further configured to:
determining a specification of a mask area in the case that the division policy is the second division policy;
and determining target segmentation parameters based on the updated specification of the scene image to be rendered and the specification of the mask region.
Optionally, the scene rendering device further comprises a third determining module configured to:
determining the first pixel number marked as a first type in each pixel point included in the target subarea, wherein the target subarea is any one of at least two subareas;
based on the first number of pixels, it is determined whether the target sub-region is reserved.
Optionally, the second determining module 708 is further configured to:
determining two-dimensional coordinate information corresponding to a target sub-region, wherein the target sub-region is any one of at least two sub-regions;
and projecting the two-dimensional coordinate information into the virtual scene to obtain three-dimensional coordinate information corresponding to the target subarea.
Optionally, the second determining module 708 is further configured to:
determining a target rendering material corresponding to an object to be rendered in the virtual scene;
rendering the target rendering material at a location indicated by the three-dimensional coordinate information in the virtual scene.
According to the embodiment of the application, the mask image corresponding to the object to be rendered in the scene image to be rendered is determined by receiving the scene image to be rendered included in the scene rendering instruction, and the object to be rendered and other objects in the scene image to be rendered can be classified by generating the mask image, so that scene layout and rendering are conveniently carried out on the object to be rendered; the mask region in the mask image is segmented to obtain a mask region segmentation map, at least two sub-regions for determining rendering positions can be obtained according to the mask segmentation map, and the layout efficiency of the object to be rendered is improved; by determining the position information of each subarea in the mask area segmentation map and rendering the object to be rendered in the virtual scene according to the position information of each subarea, the position information of rendering the object to be rendered in the virtual scene can be determined according to the position information of each subarea, the labor cost is reduced, and the rigor and accuracy of the layout of the object to be rendered are improved.
The above is a schematic solution of a scene rendering device of the present embodiment. It should be noted that, the technical solution of the scene rendering device and the technical solution of the scene rendering method belong to the same concept, and details of the technical solution of the scene rendering device, which are not described in detail, can be referred to the description of the technical solution of the scene rendering method.
FIG. 8 illustrates a block diagram of a computing device provided in accordance with an embodiment of the present application. The components of computing device 800 include, but are not limited to, memory 810 and processor 820. Processor 820 is coupled to memory 810 through bus 830 and database 850 is used to hold data.
Computing device 800 also includes access device 840, access device 840 enabling computing device 800 to communicate via one or more networks 860. Examples of such networks include public switched telephone networks (PSTN, public Switched Telephone Network), local area networks (LAN, local Area Network), wide area networks (WAN, wide Area Network), personal area networks (PAN, personal Area Network), or combinations of communication networks such as the internet. Access device 840 may include one or more of any type of network interface, wired or wireless, such as a network interface card (NIC, network interface controller), such as an IEEE802.11 wireless local area network (WLAN, wireless Local Area Network) wireless interface, a worldwide interoperability for microwave access (Wi-MAX, worldwide Interoperability for Microwave Access) interface, an ethernet interface, a universal serial bus (USB, universal Serial Bus) interface, a cellular network interface, a bluetooth interface, a near field communication (NFC, near Field Communication) interface, and so forth.
In one embodiment of the application, the above-described components of computing device 800, as well as other components not shown in FIG. 8, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device illustrated in FIG. 8 is for exemplary purposes only and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 800 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smart phone), wearable computing device (e.g., smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or personal computer (PC, personal Computer). Computing device 800 may also be a mobile or stationary server.
Wherein processor 820 performs the steps of the scene rendering method when executing the computer instructions.
The foregoing is a schematic illustration of a computing device of this embodiment. It should be noted that, the technical solution of the computing device and the technical solution of the above-mentioned scene rendering method belong to the same concept, and details of the technical solution of the computing device, which are not described in detail, can be referred to the description of the technical solution of the above-mentioned scene rendering method.
An embodiment of the present application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of a scene rendering method as described above.
The above is an exemplary version of a computer-readable storage medium of the present embodiment. It should be noted that, the technical solution of the storage medium and the technical solution of the above-mentioned scene rendering method belong to the same concept, and details of the technical solution of the storage medium, which are not described in detail, can be referred to the description of the technical solution of the above-mentioned scene rendering method.
The foregoing describes certain embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The computer instructions include computer program code that may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the content of the computer readable medium can be appropriately increased or decreased according to requirements of law and patent practice in different areas, for example, in some jurisdictions, the computer readable medium does not include electric carrier signals and telecommunication signals according to law and patent practice.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all required for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The preferred embodiments of the application disclosed above are intended only to assist in the explanation of the application. Alternative embodiments are not intended to be exhaustive or to limit the application to the precise form disclosed. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and the practical application, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and the full scope and equivalents thereof.

Claims (14)

1. A method of scene rendering, comprising:
receiving a scene rendering instruction, wherein the scene rendering instruction comprises a scene image to be rendered, and the scene image to be rendered comprises an object to be rendered;
determining a mask image corresponding to the object to be rendered, wherein the mask image comprises at least one mask area;
dividing a mask region in the mask image to obtain a mask region division map, wherein the mask region in the mask region division map is divided into at least two sub-regions;
and determining the position information of each sub-region in the mask region segmentation map, and rendering the object to be rendered in the virtual scene according to the position information of each sub-region.
2. The method of claim 1, wherein the determining a mask image corresponding to the object to be rendered comprises:
determining a target classification of the object to be rendered;
and according to the target classification, classifying and labeling each pixel in the scene image to be rendered, and obtaining a mask image corresponding to the object to be rendered.
3. The method according to claim 2, wherein the classifying and labeling each pixel in the scene image to be rendered according to the target classification to obtain the mask image corresponding to the object to be rendered includes:
Identifying pixel values of pixels in the scene image to be rendered;
judging whether the pixel value of each pixel is consistent with the target pixel value corresponding to the target classification;
and classifying and labeling each pixel in the scene image to be rendered according to the judging result to obtain a mask image corresponding to the object to be rendered.
4. The method according to claim 3, wherein the classifying and labeling each pixel in the scene image to be rendered according to the determination result to obtain the mask image corresponding to the object to be rendered includes:
if the pixel value of the pixel to be classified is consistent with the target pixel value, marking the pixel to be classified as a first type Wherein the pixel to be classified is any pixel in the scene image to be rendered;
and taking the region, which corresponds to the first type of pixel, in each pixel as a mask region, and obtaining a mask image corresponding to the object to be rendered.
5. The method according to any one of claims 1-4, wherein before determining the mask image corresponding to the object to be rendered, further comprises:
according to a preset adjustment rule, adjusting the specification of the scene image to be rendered to obtain an updated scene image to be rendered;
Correspondingly, the dividing the mask area of the mask image to obtain a mask area division map includes:
determining a segmentation strategy of the mask image according to the preset adjustment rule;
and dividing the mask region of the mask image according to the division strategy to obtain a mask region division map.
6. The method according to claim 5, wherein the dividing the mask region of the mask image according to the division policy to obtain a mask region division map includes:
determining target segmentation parameters of a mask region of the mask image according to the segmentation strategy;
dividing a target mask area into at least two sub-areas according to the target dividing parameter, wherein the target mask area is any mask area included in the mask image;
and obtaining the mask region division map when each mask region included in the mask image is divided.
7. The method of claim 6, wherein determining the target segmentation parameters for the mask region of the mask image according to the segmentation policy comprises:
and taking the set default segmentation parameter as the target segmentation parameter when the segmentation strategy is the first segmentation strategy.
8. The method of claim 6, wherein determining the target segmentation parameters for the mask region of the mask image according to the segmentation policy comprises:
determining a specification of the mask region in the case that the segmentation strategy is a second segmentation strategy;
and determining the target segmentation parameters based on the updated specification of the scene image to be rendered and the specification of the mask area.
9. The method according to claim 1, wherein the dividing the mask region of the mask image to obtain a mask region division map further comprises:
determining the first pixel number marked as a first type in each pixel point included in a target subarea, wherein the target subarea is any one of the at least two subareas;
and determining whether to reserve the target subarea according to the first pixel number.
10. The method according to claim 1, wherein determining the location information of each sub-region in the mask region segmentation map comprises:
determining two-dimensional coordinate information corresponding to a target sub-region, wherein the target sub-region is any one of the at least two sub-regions;
And projecting the two-dimensional coordinate information into the virtual scene to obtain three-dimensional coordinate information corresponding to the target subarea.
11. The method of claim 10, wherein the rendering the object to be rendered in the virtual scene according to the position information of each sub-region comprises:
determining a target rendering material corresponding to the object to be rendered in the virtual scene;
rendering the target rendering material at a location indicated by the three-dimensional coordinate information in the virtual scene.
12. A scene rendering device, comprising:
a receiving module configured to receive a scene rendering instruction, wherein the scene rendering instruction includes a scene image to be rendered, the scene image to be rendered including an object to be rendered;
a first determining module configured to determine a mask image corresponding to the object to be rendered, wherein the mask image includes at least one mask region;
a segmentation module configured to segment a mask region in the mask image to obtain a mask region segmentation map, wherein the mask region in the mask region segmentation map is segmented into at least two sub-regions;
And the second determining module is configured to determine the position information of each subarea in the mask area segmentation graph and render the object to be rendered in the virtual scene according to the position information of each subarea.
13. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor, when executing the computer instructions, performs the steps of the method of any one of claims 1-11.
14. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the method of any one of claims 1-11.
CN202310865198.9A 2023-07-13 2023-07-13 Scene rendering method and device Pending CN117132693A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310865198.9A CN117132693A (en) 2023-07-13 2023-07-13 Scene rendering method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310865198.9A CN117132693A (en) 2023-07-13 2023-07-13 Scene rendering method and device

Publications (1)

Publication Number Publication Date
CN117132693A true CN117132693A (en) 2023-11-28

Family

ID=88851735

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310865198.9A Pending CN117132693A (en) 2023-07-13 2023-07-13 Scene rendering method and device

Country Status (1)

Country Link
CN (1) CN117132693A (en)

Similar Documents

Publication Publication Date Title
CN106778928B (en) Image processing method and device
CN107516319B (en) High-precision simple interactive matting method, storage device and terminal
CN107993216B (en) Image fusion method and equipment, storage medium and terminal thereof
CN110889855B (en) Certificate photo matting method and system based on end-to-end convolution neural network
CN107771336B (en) Feature detection and masking in images based on color distribution
EP1826723B1 (en) Object-level image editing
Mavridaki et al. A comprehensive aesthetic quality assessment method for natural images using basic rules of photography
CN107771391B (en) Method and apparatus for determining exposure time of image frame
US11308655B2 (en) Image synthesis method and apparatus
CN112669447A (en) Model head portrait creating method and device, electronic equipment and storage medium
KR20140004230A (en) Image processing device, information generation device, image processing method, information generation method, control program, and recording medium
CN111489322B (en) Method and device for adding sky filter to static picture
JP5811416B2 (en) Image processing apparatus, image processing method, and program
CN111127309B (en) Portrait style migration model training method, portrait style migration method and device
KR20190043925A (en) Method, system and non-transitory computer-readable recording medium for providing hair styling simulation service
CN112562056A (en) Control method, device, medium and equipment for virtual light in virtual studio
CN113870401A (en) Expression generation method, device, equipment, medium and computer program product
CN105580050A (en) Providing control points in images
CN110969641A (en) Image processing method and device
CN111833234A (en) Image display method, image processing apparatus, and computer-readable storage medium
CN111754431A (en) Image area replacement method, device, equipment and storage medium
CN113705579B (en) Automatic image labeling method driven by visual saliency
EP1826724B1 (en) Object-level image editing using tiles of image data
CN108257086A (en) A kind of method and device of distant view photograph processing
CN117132693A (en) Scene rendering method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination