A method and device for displaying objects in a three-dimensional scene
By identifying and setting the boundary depth value of objects in three-dimensional scenes, the problem of confusing relationship between virtual characters and object occlusion in AR games is solved, which improves the game experience and reality, and is suitable for dynamic occlusion effects in dynamic scenes.
Patent Information
- Application Number
- CN202010630908.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-03
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2040-07-03
AI Technical Summary
In existing AR games, virtual characters and objects in animation scenes are prone to interspersion, resulting in confusion in the occlusion relationship, mainly due to insufficient depth value calculation ability.
By obtaining three-dimensional scene images, identifying objects that form occlusion relationships with virtual characters, determining their boundaries based on the color value of the object, and setting the depth value within the boundaries to determine the occlusion display relationship between virtual characters and objects, and using the intervention selection model to determine the color The value changes to the point, and the depth value is dynamically adjusted to maintain the occlusion relationship.
It effectively solves the phenomenon of virtual characters and objects interspersed, improves the sense of reality and user experience in AR games, and maintains the effectiveness of depth values in dynamic scenarios to ensure the accuracy of the occlusion relationship.
Smart Images

Figure CN111784847B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a method and device for displaying objects in a three-dimensional scene. Background Art
[0002] The biggest feature of AR (augmented reality) games in the existing technology is that virtual game characters are displayed in real environments through mobile phones, game consoles and other media using augmented reality technology. AR games have achieved an optimized combination of games and AR technology in three aspects: location services, image recognition, and data processing, allowing virtual images that originally only appeared in electronic devices to be combined with the real environment. The major breakthroughs in the gameplay and form of AR games have brought players a brand new gaming experience.
[0003] However, there is a problem in AR games of the prior art: the AR characters and objects in the animation scene may intersect. This is due to the fact that the current technology is not able to calculate the depth values of the AR characters and the depth values of the scene objects. It is difficult for the prior art to solve this problem under the current computing power limitations. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present application provides a method and device for displaying objects in a three-dimensional scene.
[0005] Specifically, this application provides the following technical solutions:
[0006] A method for displaying an object in a three-dimensional scene comprises the following steps:
[0007] S101, acquiring a three-dimensional scene image and identifying objects in the three-dimensional scene image that form an occlusion relationship with the virtual character;
[0008] S102, determining the boundary of the object according to the color value of the object;
[0009] S103: Setting a depth value of the object within the boundary to determine an occlusion display relationship between the virtual character and the object.
[0010] Preferably, for the above method, step S102 of determining the boundary of the object according to the color value of the object specifically includes:
[0011] Acquire the color values of the pixels of the object, and select and judge the color values of the pixels of the object to obtain the pixels whose color values suddenly change;
[0012] The pixel points with sudden changes in color value are connected to form the boundary of the object.
[0013] Preferably, for the above method, selecting and judging the color values of the pixels of the object to obtain the pixels with sudden color value changes specifically includes:
[0014] The color values of the multiple pixel points of the object are input into the intervention selection model, so that when the intervention selection model determines that the change range of the color value of the pixel point exceeds the set first threshold range, the pixel point is regarded as a pixel point with a sudden color value change.
[0015] Preferably, for the above method, the step S103 of setting the depth value of the object within the boundary to determine the occlusion display relationship between the virtual character and the object specifically includes:
[0016] Get the depth value of the virtual character in the three-dimensional scene;
[0017] The depth value of the area within the boundary is set to be greater than the depth value of the virtual character, so that the virtual character is blocked by the object.
[0018] Preferably, for the above method, the step S103 of setting the depth value of the object within the boundary to determine the occlusion display relationship between the virtual character and the object specifically includes:
[0019] Get the depth value of the virtual character in the three-dimensional scene;
[0020] The depth value of the area within the boundary is set to be smaller than the depth value of the virtual character, so that the object is blocked by the virtual character.
[0021] Preferably, for the above method, the method further comprises the following steps:
[0022] The image of the object with the set depth value is superimposed on the corresponding position in the three-dimensional scene.
[0023] Preferably, for the above method, the method further comprises: under dynamic conditions, achieving the occlusion of the virtual character by the object, specifically comprising:
[0024] During the process of the object performing an action in the three-dimensional scene, determining whether a change in a color value of the object in two adjacent action frames exceeds a second threshold;
[0025] If not, maintaining the occlusion relationship between the object and the virtual character in the current action frame;
[0026] If so, continue to execute steps S102 - S103 until the occlusion relationship between the object and the virtual character in the current action frame is re-determined.
[0027] Preferably, for the above method, the intervention selection model is at least one of a Heckman selection model, a dual instrumental variable model, and an intervention effect model.
[0028] A device for displaying an object in a three-dimensional scene, the device comprising:
[0029] An object recognition unit is configured to acquire a three-dimensional scene image and recognize an object in the three-dimensional scene image that forms an occlusion relationship with the virtual character;
[0030] a boundary recognition unit, configured to determine a boundary of the object according to a color value of the object;
[0031] and a depth setting unit configured to set a depth value of the object within the boundary to determine an occlusion display relationship between the virtual character and the object.
[0032] A computing device comprises a memory, a processor and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above methods when executing the instructions.
[0033] A computer-readable storage medium stores computer instructions, wherein the instructions, when executed by a processor, implement the steps of any of the methods described in the above paragraphs.
[0034] The beneficial effects of this application include:
[0035] The present application provides a method and device for displaying objects in a three-dimensional scene. By setting the depth value of the object in the three-dimensional scene, the problem of interlacing and disordered occlusion between virtual characters and real objects in the three-dimensional scene is solved. Moreover, the method and device provided by the present application are aimed at scene images with relatively obvious color performance. Even if the image is dynamic, as long as the color value of the object does not change, the set depth value is still valid, and the occlusion relationship between the virtual character and the object will continue to be maintained, and dynamic occlusion can be achieved. The method and device provided by the present application are simple to operate, have significant effects, and have broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a flowchart of a method for displaying objects in a three-dimensional scene provided in Embodiment 1 of the present application;
[0037] Figure 2 is a flowchart of a method for displaying objects in a three-dimensional scene provided in Embodiment 2 of the present application;
[0038] Figure 3 It is a unit module diagram of a device for displaying objects in a three-dimensional scene provided in Embodiment 3 of the present application;
[0039] Figure 4This is a structural block diagram of the computing device provided in Example 4 of the present application. DETAILED DESCRIPTION
[0040] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0041] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0042] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0043] First, the terms involved in one or more embodiments of the present application are explained.
[0044] AR (Augmented Reality): Augmented reality is a technology that calculates the position and angle of camera images in real time and adds corresponding images. The goal of this technology is to overlay the virtual world on the real world on the screen and interact with it.
[0045] Heckman selection model: The first step of the Heckman model selection process generates an inverse Mills number, which is a new variable generated by eliminating the selection bias of the selection process and is an endogenous variable. The Heckman model solves two problems: eliminating selection bias and solving the endogenous problem in the second step caused by omitted variables.
[0046] Double instrumental variable model (2SLS): It is a general term for a class of estimation methods, which is the two-stage least squares method and also the instrumental variable in the instrumental variable method (IV). The instrumental variable method finds the exogenous variables that affect the endogenous variables, regresses them together with other existing exogenous variables, and obtains the estimated value of the endogenous variables. This is used as the instrumental variable method and put into the original regression equation for regression.
[0047] Intervention effect model (treatreg): The intervention effect model generates an inverse Mills ratio for all samples, and in the second step, not only the endogenous variable inverse Mills ratio generated in the first step is introduced, but also the dependent variable in the first step is introduced as an explanatory variable. The intervention model introduces the selection variable into the second step of the regression, which is equivalent to a control variable, effectively eliminating the selection bias.
[0048] The specific implementation of the present application is described below in conjunction with the accompanying drawings and examples.
[0049] Embodiment 1
[0050] like Figure 1 As shown, this embodiment provides a method for displaying objects in a three-dimensional scene, including the following steps S101 to S103.
[0051] S101: Acquire a three-dimensional scene image and identify objects in the three-dimensional scene image that form an occlusion relationship with a virtual character.
[0052] Three-dimensional scene image, in this embodiment, AR scene is taken as an example. AR technology realizes the combination of virtual and real. Therefore, in order to achieve the visual effect of real human eyes in image acquisition, two (simulating human eyes) or more cameras are generally used to acquire images; there are also cases of studying single images, but many assumptions need to be made about the scene, such as shape from shading (SFS), using the light and dark changes on the surface of an object in a single image to restore the normal direction of each point on its surface and then obtain its relative height, using optical assistance, etc., which has great limitations. At present, depth cameras have been widely used to obtain three-dimensional scene images, such as kinect cameras.
[0053] Virtual characters refer to virtual animation effects superimposed on real scenes in AR, such as cartoon characters, simulated characters, etc.
[0054] In AR scenes, the sense of reality is a key factor in determining the effect of AR technology. To achieve the sense of reality between real objects and virtual characters in AR scenes, it is necessary to correctly display the occlusion relationship between the two to give people a sense of visual reality. For example, in the real world, a child with a height of about 100 cm stands in front of the school gate. If the human eye looks from the front, the child will block the school gate. If in the AR scene, under the same circumstances, the human eye sees the child behind the gate, or the two are displayed interlaced, then the occlusion relationship is wrong, resulting in an unrealistic visual effect.
[0055] The goal of virtual-real occlusion is to preserve the line-of-sight rules in real scenes when creating AR scenes, which means that virtual objects behind real objects should be "occluded" or hidden behind the real objects.
[0056] The principle of occlusion relationship is that within the frustum of the virtual camera, the occlusion relationship is formed due to the distance from the camera. For example, in an AR scene, from the position of the camera, if a person stands behind a wooden box, the wooden box will occlude the person because the wooden box is close to the camera and the person is far from the camera. By displaying the correct occlusion relationship, a realistic visual effect close to the real world can be achieved.
[0057] Optionally, the means of performing three-dimensional scene image recognition in this process is semi-automatic image recognition with manual intervention. For example, after obtaining a three-dimensional scene image, the outline of the object in the image is manually determined; the outline is not a precise outline, and only distinguishes the object from other virtual characters or other objects that do not have an occlusion relationship in the three-dimensional scene.
[0058] Optionally, the means for performing three-dimensional scene image recognition in this process can also be automatic recognition through software, or recognition through manual intervention.
[0059] S102: Determine a boundary of the object according to the color value of the object.
[0060] The color value refers to the RGB grayscale value of the image.
[0061] Optionally, when the determined boundary of the object is incomplete, the edge of the object may be supplemented by manual operation so that the entire object is selected.
[0062] Specifically, the specific process of this step includes: obtaining the color value of the pixel point of the object, and selecting and judging the color value of the pixel point of the object to obtain the pixel point with a sudden change in color value; connecting the pixel points with a sudden change in color value to form the boundary of the object. The principle is: continuous pixel mutation comparison strategy. For example, the surface color of a desktop changes under light, but the color change has a regularity, that is, the color value change between a pixel point and all the pixel points around it will not be too large, and the difference in color value between each pixel point will remain within a certain range. Therefore, the color value of the desktop can be continuously searched through the intervention selection model to identify the shape of the table.
[0063] S103: Setting a depth value of the object within the boundary to determine an occlusion display relationship between the virtual character and the object.
[0064] In 3D computer graphics and computer vision, a depth map is an image or image channel that contains information about the distance from the surface of scene objects to the viewpoint, and is used to simulate or reconstruct the 3D shape of scene objects. In a 3D image, objects or people with high depth values will occlude objects or people with low depth values.
[0065] Furthermore, a depth value of the virtual character is obtained.
[0066] Optionally, when the object blocks the virtual character, the depth value of the area within the boundary is set to be greater than the depth value of the virtual character, so that the virtual character is blocked by the object.
[0067] Optionally, when the virtual character blocks the object, the depth value of the area within the boundary is set to be smaller than the depth value of the virtual character, so that the object is blocked by the virtual character.
[0068] For example, in a specific scenario, a virtual dinosaur appears in a room, and is located behind a seat in the room (i.e., the real seat is close to the camera, and the virtual dinosaur is far from the camera). However, since the depth value is not accurate enough, the effect presented on the screen is that both the image of the virtual dinosaur and the image of the real seat are displayed, giving a feeling of unreality. Therefore, through the method provided in this embodiment, the depth value of the real object is set to be greater than the depth value of the virtual dinosaur, thereby achieving correct occlusion of the virtual dinosaur by the real object, making the AR effect more realistic and credible.
[0069] A method for displaying objects in a three-dimensional scene provided in this embodiment can solve the problem of interlacing between virtual characters in an AR scene and objects in an animation scene; and this method is simple to operate, has good effects, and can effectively improve the gaming experience of users in AR games.
[0070] Embodiment 2
[0071] like Figure 2 As shown, this embodiment provides a method for displaying objects in a three-dimensional scene, including the following steps S201 to S206.
[0072] S201: Acquire a three-dimensional scene image and identify objects in the three-dimensional scene image that form an occlusion relationship with the virtual character.
[0073] Optionally, the means of performing three-dimensional scene image recognition in this process is semi-automatic image recognition with manual intervention. For example, after obtaining a three-dimensional scene image, the outline of the object in the image is manually determined; the outline is not a precise outline, and only distinguishes the object from other virtual characters or other objects that do not have an occlusion relationship in the three-dimensional scene.
[0074] Optionally, the means for performing three-dimensional scene image recognition in this process can also be automatic recognition through software, or recognition can be performed through manual intervention.
[0075] For example, in a specific application scenario of the present embodiment, the three-dimensional scene image of AR should show a virtual character singing behind a desk in a classroom, but the image obtained through the camera does not achieve the effect of the desk blocking the virtual character; then, by manually intervening and identifying the scene image, the approximate outline of the real object of the "desk" is selected.
[0076] In this process, the contours of real objects in the image are roughly identified through manual intervention, which is simple to operate. In addition, the contour range of the object is given in advance, which can increase the accuracy of object boundary recognition in subsequent operations and greatly reduce the difficulty of the model execution process.
[0077] S202, obtaining color values of the pixel points of the object, and selecting and judging the color values of the pixel points of the object to obtain pixel points with sudden changes in color values; and connecting the pixel points with sudden changes in color values to form a boundary of the object.
[0078] Specifically, the principle of this step is: continuous pixel mutation comparison strategy. For example, the surface color of a desktop changes under light, but the color change has a regular pattern. Through the intervention selection model, the color value of the desktop can be continuously searched to identify the shape of the table.
[0079] Furthermore, in this process, an appropriate intervention selection model can be selected for pre-training before being put into use. The purpose of the training is to enable the intervention selection model to more accurately identify the pixel points with a sudden change in the color value of the object through a continuous change in the color value of the pixel points of the object through a sufficient number of trainings (manually clicking on the boundary part multiple times to train the current picture, and telling the model which are the correct boundary points and which are the wrong boundary points) so as to obtain the boundary of the object. In addition, during the training process, the intervention selection model can memorize the first threshold value of the color value change range of the object.
[0080] Optionally, the intervention selection model is selected from at least one of a Heckman selection model, a dual instrumental variable model, and an intervention effect model.
[0081] Furthermore, the selecting and judging the color values of the pixel points of the object to obtain the pixel points with sudden color value changes specifically includes:
[0082] The color values of the multiple pixel points of the object are input into the intervention selection model, so that when the intervention selection model determines that the change range of the color value of the pixel point exceeds the set first threshold range, the pixel point is regarded as a pixel point with a sudden color value change.
[0083] For example, in a specific application scenario of the present embodiment, the approximate outline of the real object of the "lectern" has been obtained through step S201; then a program is used to input multiple color values of the "lectern" object into the intervention selection model (the model has been pre-trained and has the ability to obtain pixel points with sudden changes in color values by continuously comparing the color values of pixel points); the intervention selection model identifies multiple pixel points with sudden changes in color values and connects them to obtain the boundary of the "lectern"; further, it is found that the boundary is not complete, for example, there is a gap, so the gap position is manually identified and selected again using the intervention selection model until the boundary of the "lectern" is completely selected.
[0084] Furthermore, the operation of inputting the color values of the plurality of pixel points of the object into the intervention selection model can be initiated by manually inputting instructions, which include but are not limited to: clicking with a mouse or keyboard, and can also be generated according to other interactive methods, such as voice commands.
[0085] In this process, it is easy to implement by identifying and judging the color value of the object; and for objects that have not been completely identified, the color value of the "gap" position can be identified again. Through multiple identifications, the boundary of the object can be obtained more accurately.
[0086] S203: Setting a depth value of the object within the boundary to determine an occlusion display relationship between the virtual character and the object.
[0087] Furthermore, a depth value of the virtual character is obtained.
[0088] Optionally, when the object blocks the virtual character, the depth value of the area within the boundary is set to be greater than the depth value of the virtual character, so that the virtual character is blocked by the object.
[0089] Optionally, when the virtual character blocks the object, the depth value of the area within the boundary is set to be smaller than the depth value of the virtual character, so that the object is blocked by the virtual character.
[0090] For example, in a specific application scenario of this embodiment, the real object "lectern" has been identified as a boundary through step S202, and then the depth value of the area inside the boundary is set to be greater than the depth value of the virtual character. For example, the depth value of the virtual character is 0.5, and the depth value of the area inside the boundary is set to 1.
[0091] In this process, the occlusion relationship between the object and the virtual character can be adjusted by setting the depth value of the object, which is convenient for personnel to operate in actual applications.
[0092] S204: superimpose the image of the object after the depth value is set on a corresponding position in the three-dimensional scene.
[0093] For example, in a specific application scenario of the present embodiment, the lecture table with the depth value set is superimposed on the corresponding position in the three-dimensional scene.
[0094] S205, practical application in dynamic scenes: during the process of the object performing an action in the three-dimensional scene, determining whether a change in a color value of the object in two adjacent action frames exceeds a second threshold;
[0095] If not, execute step S206;
[0096] If so, continue to execute steps S202 to S203 until the occlusion relationship between the object and the virtual character in the current action frame is re-determined.
[0097] The second threshold is the range of color value variation, and there are many factors in the external environment that may affect it, such as the light of the three-dimensional scene, the color of the virtual character, the change of the camera angle, etc.
[0098] For example, in a specific application scenario of the present embodiment, due to changes in external lighting, the second threshold in the scene changes. Therefore, when the virtual character walks behind the desk, the virtual character and the desk are displayed interspersed. Therefore, it is necessary to continue to execute steps S202 to S203 for the scene and reset the depth value of the desk until the occlusion relationship between the virtual character and the desk in the current action frame is re-determined.
[0099] In this process, it is only necessary to simply judge the changes in the color values in the scene. It is easy to operate and has practical application value. Under normal circumstances, even if the angle of the camera changes, the color value of the object will not change significantly, which makes it easy to track and judge the color value of the object under dynamic conditions.
[0100] S206: Maintain the occlusion relationship between the object and the virtual character in the current action frame.
[0101] For example, in a specific application scenario of this embodiment, the virtual character walks behind the desk. Since the colors of the virtual character and the real desk do not change, the set depth value is still valid, and the occlusion relationship between the object and the virtual character in the current action frame is maintained. Even when the virtual character is walking, the desk can still dynamically occlude it.
[0102] A method for displaying objects in a three-dimensional scene provided by this embodiment can solve the problem of interlacing between virtual characters in AR scenes and objects in animation scenes; and this method is simple to operate and has good effects, and can effectively improve the gaming experience of users in AR games; at the same time, the method provided by this embodiment can also be applied to dynamic scenes. When the color value of an object in a three-dimensional scene does not change, the depth value set therein is still valid, and the effect of dynamic occlusion can be achieved.
[0103] Embodiment 3
[0104] This embodiment provides a device for displaying objects in a three-dimensional scene. Figure 3 , the device comprises:
[0105] The object recognition unit 301 is configured to acquire a three-dimensional scene image and recognize an object in the three-dimensional scene image that forms an occlusion relationship with the virtual character.
[0106] A boundary recognition unit 302 is configured to determine a boundary of the object according to a color value of the object;
[0107] The depth setting unit 303 is configured to set the depth value of the object within the boundary to determine the occlusion display relationship between the virtual character and the object.
[0108] Optionally, the boundary identification unit 302 includes:
[0109] The boundary determination unit is configured to obtain the color values of the pixel points of the object, select and judge the color values of the pixel points of the object, obtain the pixel points with sudden color value changes; and connect the pixel points with sudden color value changes to form the boundary of the object.
[0110] Optionally, the boundary determination unit includes:
[0111] The mutation point selection unit is configured to input the color values of the multiple pixel points of the object into the intervention selection model, so that when the intervention selection model determines that the change range of the color value of the pixel point exceeds the set first threshold range, the pixel point is regarded as a pixel point with a sudden color value change.
[0112] Optionally, the device for displaying objects in a three-dimensional scene further includes: an overlapping unit and a dynamic occlusion unit.
[0113] The overlapping unit is configured to overlap the image of the object after the depth value is set at a corresponding position in the three-dimensional scene.
[0114] The dynamic occlusion unit is configured to: realize the occlusion of the virtual character by the object under dynamic conditions, specifically including:
[0115] During the process of the object performing an action in the three-dimensional scene, determining whether a change in a color value of the object in two adjacent action frames exceeds a second threshold;
[0116] If not, maintaining the occlusion relationship between the object and the virtual character in the current action frame;
[0117] If so, the operation in the boundary recognition unit is continued until the occlusion relationship between the object and the virtual character in the current action frame is re-determined.
[0118] This embodiment provides a device for displaying objects in a three-dimensional scene, which can solve the problem of interlacing between virtual characters in AR scenes and objects in animation scenes. In addition, this device is simple to operate and has good effects, and can effectively improve the gaming experience of users in AR games. At the same time, the device provided by this embodiment can also be applied to dynamic scenes. When the color value of an object in a three-dimensional scene does not change, the depth value set is still valid, which can achieve the effect of dynamic occlusion.
[0119] Embodiment 4
[0120] Figure 4The structural block diagram of the computing device 400 of the fourth embodiment of the present application is shown. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and the database 450 is used to store data.
[0121] The computing device 400 also includes an access device 410 that enables the computing device 400 to communicate via one or more networks 460. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 410 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0122] In one embodiment of the present specification, the above components of the computing device 400 and Figure 4 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 4 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0123] Computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. Computing device 400 may also be a mobile or stationary server.
[0124] The processor 420 may execute the steps in the method for displaying an object in a three-dimensional scene described in any of the above embodiments. The method includes:
[0125] S101, acquiring a three-dimensional scene image and identifying objects in the three-dimensional scene image that form an occlusion relationship with the virtual character;
[0126] S102, determining the boundary of the object according to the color value of the object;
[0127] S103: Setting a depth value of the object within the boundary to determine an occlusion display relationship between the virtual character and the object.
[0128] The specific contents of the steps included in the above method have been described in the above embodiments, and therefore will not be repeated in this embodiment.
[0129] Embodiment 5
[0130] The present application also provides a computer-readable storage medium storing computer instructions, wherein the instructions, when executed by a processor, implement the steps of a method for displaying objects in a three-dimensional scene.
[0131] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the method for displaying objects in a three-dimensional scene described above are of the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the method for displaying objects in a three-dimensional scene described above.
[0132] The method comprises:
[0133] S101, acquiring a three-dimensional scene image and identifying objects in the three-dimensional scene image that form an occlusion relationship with the virtual character;
[0134] S102, determining the boundary of the object according to the color value of the object;
[0135] S103: Setting a depth value of the object within the boundary to determine an occlusion display relationship between the virtual character and the object.
[0136] The specific contents of the method for displaying objects in a three-dimensional scene have been provided in the above embodiments and will not be repeated here.
[0137] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0138] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0139] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0140] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is limited only by the claims and their full scope and equivalents.
Claims
1. A method for displaying an object in a three-dimensional scene, characterized in that: The following steps are involved: S101, acquiring a three-dimensional scene image and identifying objects in the three-dimensional scene image that form an occlusion relationship with the virtual character; S102, determining the boundary of the object according to the color value of the object, including: determining the boundary of the object according to a change in the color value of the object; S103, setting the depth value of the object within the boundary to determine the occlusion display relationship between the virtual character and the object; the setting of the boundary value of the object within the boundary includes: setting the depth value of the object within the boundary in the depth map of the three-dimensional scene image; Overlay the image of the object after setting the depth value on the corresponding position in the three-dimensional scene; During the process of the virtual character performing an action in a three-dimensional scene, determine whether the change in the color value of the object in two adjacent action frames exceeds a second threshold; if not, maintain the occlusion relationship between the object in the current action frame and the virtual character; if so, continue to execute steps S102-S103 until the occlusion relationship between the object in the current action frame and the virtual character is re-determined.
2. The method according to claim 1, characterized in that Step S102 of determining the boundary of the object according to the color value of the object specifically includes: Acquire the color values of the pixels of the object, and select and judge the color values of the pixels of the object to obtain the pixels whose color values suddenly change; The pixel points with sudden changes in color value are connected to form the boundary of the object.
3. The method according to claim 2, characterized in that The selecting and judging the color values of the pixel points of the object to obtain the pixel points with sudden color value changes specifically includes: The color values of the multiple pixel points of the object are input into the intervention selection model, so that when the intervention selection model determines that the change range of the color value of the pixel point exceeds the set first threshold range, the pixel point is regarded as a pixel point with a sudden color value change.
4. The method according to claim 1, characterized in that: The step S103 of setting the depth value of the object within the boundary to determine the occlusion display relationship between the virtual character and the object specifically includes: Get the depth value of the virtual character in the three-dimensional scene; The depth value of the area within the boundary is set to be greater than the depth value of the virtual character, so that the virtual character is blocked by the object.
5. The method according to claim 1, characterized in that The step S103 of setting the depth value of the object within the boundary to determine the occlusion display relationship between the virtual character and the object specifically includes: Get the depth value of the virtual character in the three-dimensional scene; The depth value of the area within the boundary is set to be smaller than the depth value of the virtual character, so that the object is blocked by the virtual character.
6. The method according to claim 3, characterized in that The intervention selection model is at least one of a Heckman selection model, a dual instrumental variable model, and an intervention effect model.
7. A device for displaying objects in a three-dimensional scene, characterized in that: The device comprises: An object recognition unit is configured to acquire a three-dimensional scene image and recognize an object in the three-dimensional scene image that forms an occlusion relationship with the virtual character; A boundary recognition unit is configured to determine the boundary of the object according to the color value of the object; the boundary recognition unit is further configured to determine the boundary of the object according to the change of the color value of the object; A depth setting unit is configured to set the depth value of the object within the boundary to determine the occlusion display relationship between the virtual character and the object; the setting of the boundary value of the object within the boundary includes: setting the depth value of the object within the boundary in the depth map of the three-dimensional scene image; An overlapping unit, configured to overlay the image of the object after the depth value is set on a corresponding position in the three-dimensional scene; The dynamic occlusion unit is configured to: realize the occlusion of the virtual character by the object under dynamic conditions, specifically including: in the process of the virtual character performing an action in the three-dimensional scene, determining whether the change in the color value of the object in two adjacent action frames exceeds a second threshold; if not, maintaining the occlusion relationship between the object and the virtual character in the current action frame; if so, continuing the operation in the boundary recognition unit until the occlusion relationship between the object and the virtual character in the current action frame is re-determined.
8. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the instructions, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The method comprises computer instructions which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
DIBR (Depth Image Based Rendering) system suitable for 3D (Three-Dimensional) television
CN102547338A
Rendering method for enhancing reality scene, processing module and reality enhancement glasses
CN106056663A
Virtual-real occlusion real-time processing method based on multi-view image
CN106803286A
Three-dimensional bullet screen method and system based on virtual reality
CN108616730A
Virtual-real occlusion interaction method and system under AR environment
CN109471521A
