WO2023138467A1 - 虚拟物体的生成方法、装置、设备及存储介质 - Google Patents
虚拟物体的生成方法、装置、设备及存储介质 Download PDFInfo
- Publication number
- WO2023138467A1 WO2023138467A1 PCT/CN2023/071876 CN2023071876W WO2023138467A1 WO 2023138467 A1 WO2023138467 A1 WO 2023138467A1 CN 2023071876 W CN2023071876 W CN 2023071876W WO 2023138467 A1 WO2023138467 A1 WO 2023138467A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- virtual object
- reference line
- rendered
- frame
- bounding box
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 238000012545 processing Methods 0.000 claims abstract description 26
- 238000004590 computer program Methods 0.000 claims description 15
- 238000001514 detection method Methods 0.000 claims description 11
- 230000008569 process Effects 0.000 claims description 10
- 238000003384 imaging method Methods 0.000 claims description 8
- 238000010586 diagram Methods 0.000 description 16
- 230000006870 function Effects 0.000 description 9
- 238000004891 communication Methods 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 6
- 239000013598 vector Substances 0.000 description 3
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 241000196324 Embryophyta Species 0.000 description 1
- 241000283973 Oryctolagus cuniculus Species 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
- G06T19/20—Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
Definitions
- the present disclosure relates to the field of augmented reality technology, for example, to a method, device, device and storage medium for generating a virtual object.
- the present disclosure provides a method, device, device, and storage medium for generating virtual objects, which can avoid overlapping of virtual objects, ensure smooth generation of virtual objects, and improve user experience.
- the present disclosure provides a method for generating a virtual object, including:
- a virtual object is generated within the processed virtual object frame.
- the present disclosure also provides a device for generating a virtual object, including:
- the virtual object frame acquisition module is configured to obtain the virtual object frame to be mounted
- a reference line generating module configured to generate a reference line based on the virtual object frame
- a positional relationship determining module configured to determine the positional relationship between the reference line and the rendered virtual object
- a virtual object frame processing module configured to process the virtual object frame according to the positional relationship
- the virtual object generation module is configured to generate a virtual object within the processed virtual object frame.
- the present disclosure also provides an electronic device, the electronic device comprising:
- a storage device configured to store one or more programs
- the one or more processing devices When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the above-mentioned method for generating a virtual object.
- the present disclosure discloses a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the aforementioned method for generating a virtual object is realized.
- the present disclosure further provides a computer program product, including a computer program carried on a non-transitory computer readable medium, the computer program including program codes for realizing the above-mentioned method for generating a virtual object.
- FIG. 1 is a flowchart of a method for generating a virtual object provided by an embodiment of the present disclosure
- Fig. 2 is an example diagram of an acquired virtual object frame provided by an embodiment of the present disclosure
- FIG. 3 is a schematic diagram of a pinhole camera imaging principle provided by an embodiment of the present disclosure
- Fig. 4 is an example diagram of performing triangular meshing on the surface of a rendered virtual object provided by an embodiment of the present disclosure
- Fig. 5 is an example diagram of generating a virtual object provided by an embodiment of the present disclosure.
- Fig. 6 is a schematic structural diagram of a device for generating a virtual object provided by an embodiment of the present disclosure
- Fig. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
- the term “comprise” and its variations are open-ended, ie “including but not limited to”.
- the term “based on” is “based at least in part on”.
- the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; the term “some embodiments” means “at least some implementations” Examples”.
- the relevant definitions of other terms will be given in the description below.
- FIG. 1 is a flow chart of a method for generating a virtual object provided by an embodiment of the present disclosure. This embodiment is applicable to the case of generating a virtual object in a three-dimensional space.
- the method can be executed by a device for generating a virtual object.
- the device can be composed of hardware and/or software, and generally can be integrated into a device with a function of generating a virtual object.
- the device can be an electronic device such as a server, a mobile terminal, or a server cluster. As shown in Figure 1, the method includes the following steps:
- the virtual object frame is hung on the recognized object in the three-dimensional space, and is used to place the virtual object, and the virtual object frame may include multiple.
- the virtual object can be a virtual object corresponding to any theme, for example: "Spring Festival" theme, then the virtual object can be: virtual couplets, virtual lanterns, virtual New Year pictures, etc., which are not limited here.
- the manner of acquiring the virtual object frame to be mounted may be: performing object detection on the current screen; determining the virtual object frame according to the detected object.
- the object detection module in the terminal device detects the objects in the screen according to a certain frequency, obtains the detection frame and semantic information corresponding to the object, and determines the virtual object frame according to the detection frame and semantic information.
- FIG. 2 is an example diagram of an acquired virtual object frame provided by an embodiment of the present disclosure. As shown in FIG. 2 , objects detected in the screen include sky, buildings, and plants, and virtual object frames are generated on these objects.
- the size of the virtual object frame can be determined according to the detection frame of the object, and the category of the virtual object frame can be determined according to the semantic information.
- the size of the virtual object frame can be smaller than or equal to the detection frame of the object, or the detection frame of the object can be split to obtain multiple virtual object frames.
- the category of the virtual object frame is used to determine the category of the internal virtual object, and the category may include static virtual objects and dynamic virtual objects. Exemplarily, taking the theme of "Spring Festival" as an example, the static virtual object may be "Couple", and the dynamic virtual object may be "rotating lantern".
- the virtual object frame is determined according to the detected object, so that the virtual object placed in the virtual object frame fits the real scene more closely.
- the reference line may be a ray emitted from the virtual object frame, and the reference line based on the virtual object frame may be generated according to the camera imaging principle.
- the camera imaging principle may be a pinhole camera imaging principle.
- FIG. 3 is a pinhole camera imaging principle diagram provided by an embodiment of the present disclosure. As shown in FIG. 3 , the light reflected by an object in a three-dimensional space enters the pinhole camera, and the pinhole camera projects the captured image on the pixel plane, and each pixel point on the pixel plane can generate a reference line directed to the three-dimensional space against the light.
- the obtained virtual object frame is located in the pixel plane, and set pixel points can be selected on the virtual object frame, and reference lines to the three-dimensional space are generated from these set pixel points against the light direction, and the direction vectors of these reference lines can be obtained according to the inverse transformation principle of the pinhole camera.
- the virtual object frame includes vertex information and center point information of the virtual object frame, and the number of vertices is multiple.
- a manner of generating a reference line based on the virtual object frame may be: generating multiple reference lines corresponding to multiple vertices and center points respectively.
- the virtual object frame may be a parallelogram, and the virtual object frame includes four vertices.
- five reference lines emitted from the four vertices and the centerline of the virtual object frame are respectively generated according to the camera imaging principle, and the direction vectors of the five reference lines can be obtained according to the inverse transformation principle of the pinhole camera.
- multiple reference lines corresponding to multiple vertices and center points are generated, which can reduce the amount of calculation.
- a reference line generation component (rayCast component) can be added to the camera, and the component is set to generate reference lines emitted from the four vertices and the center point of the virtual object frame according to the imaging principle of the camera.
- the rendered virtual object can be understood as a virtual object on an object that has been displayed and mounted in a three-dimensional space, and the virtual object is a three-dimensional (3 Dimension, 3D) object. Positional relationships include intersect and do not want to intersect.
- Determining the positional relationship between the reference line and the rendered virtual object includes: determining the distances between the multiple reference lines corresponding to the multiple vertices and the center point respectively and the rendered virtual object; if the distance is less than or equal to the set value, the reference line intersects the rendered virtual object; if the distance is greater than the set value, the reference line does not intersect the rendered virtual object.
- the positional relationship between the reference line and the rendered virtual object includes the positional relationship between the reference line corresponding to the four vertices and the rendered virtual object, and the positional relationship between the reference line corresponding to the center point and the rendered virtual object.
- the set value can be 0.
- the distance between the reference line and the rendered virtual object can be understood as the shortest distance between multiple points on the surface of the rendered object and the reference line. If the shortest distance is greater than 0, it indicates that the reference line does not intersect the rendered object. If the shortest distance is less than or equal to 0, the reference line intersects the rendered object. In this implementation, the positional relationship is determined based on the distance between the reference line and the rendered virtual object, and it is possible to quickly and accurately determine whether the reference line intersects the rendered virtual object.
- S140 Process the virtual object frame according to the positional relationship.
- the method of processing the virtual object frame according to the positional relationship may be: if the reference line corresponding to the center point intersects the rendered virtual object, delete the virtual object frame or lower the transparency; if the reference line corresponding to the center point does not intersect with the rendered virtual object, and the reference line corresponding to vertices exceeding a set number intersects the rendered virtual object, delete the virtual object frame or lower the transparency.
- the number of settings can be set to 2 or 3.
- the reference line corresponding to the center point intersects the rendered virtual object, it indicates that the virtual object in the virtual object frame will completely overlap the rendered virtual object, so the virtual object frame needs to be deleted or its transparency lowered.
- the reference line corresponding to more than the set number of vertices intersects the rendered virtual object, it means that the virtual object in the virtual object frame will overlap with the rendered virtual object to a large extent, so the virtual object frame needs to be deleted or its transparency should be lowered.
- the accuracy of virtual object frame processing can be improved.
- the method for determining the positional relationship between the reference line and the rendered virtual object may be: performing triangular meshing on the surface of the rendered virtual object to obtain multiple triangular faces; separately determining the intersection of the reference line and the multiple triangular faces; if the reference line intersects with any triangular face, then the reference line intersects the rendered virtual object.
- the rendered virtual object is a three-dimensional object, and performing triangular meshing on the surface of the rendered virtual object can be understood as dividing the surface of the rendered virtual object into multiple triangular planes.
- FIG. 4 is an example diagram of triangular meshing the surface of a rendered virtual object provided by an embodiment of the present disclosure.
- the virtual object is a three-dimensional rabbit, and the surface of the object is divided into multiple triangular planes.
- the manner of determining the intersection between the reference line and multiple triangular faces can be realized by using the principle of intersection between a straight line and a triangular face, which is not limited here.
- the manner of determining the positional relationship between the reference line and the rendered virtual object may be: obtaining the bounding box of the rendered virtual object; determining the intersection between the reference line and the bounding box; if the reference line intersects the bounding box, then the reference line intersects the rendered virtual object.
- the shape of the bounding box is a cuboid, which can be understood as the smallest circumscribed cuboid of the rendered virtual object.
- the cuboid contains three pairs of parallel planes, which are front and rear parallel planes, left and right parallel planes, and up and down parallel planes.
- the process of determining the intersection of the reference line and the bounding box may be: obtaining three line segments obtained by intersecting the reference line with three pairs of parallel surfaces corresponding to the bounding box; if the three line segments all meet the following conditions, the reference line intersects the bounding box: part or all of the line segment falls into the bounding box.
- the three pairs of parallel planes corresponding to the bounding box can be understood as the plane on which the three pairs of parallel planes corresponding to the bounding box extend to the entire space, including the front and rear parallel planes extending to the entire space, the left and right parallel planes extending to the entire space, and the upper and lower parallel planes extending to the entire space.
- the reference line intersects the pair of parallel faces to obtain one line segment, thus obtaining three line segments.
- the coordinates of the two endpoints of the line segment formed after the intersection of the reference line and the parallel planes can be obtained, and according to the coordinates of the two end points, it can be determined whether part or all of the line segment falls into the bounding box.
- the intersection of the reference line and the rendered virtual object is performed based on the intersection of the reference line and the bounding box, which can improve the efficiency of determining the positional relationship.
- the reference line intersects the rendered virtual object, it means that the virtual object in the virtual object frame intersected by the reference line will partially or completely overlap with the rendered virtual object. Therefore, the virtual object frame needs to be deleted or its transparency needs to be lowered, and there is no need to render the virtual object in the processed virtual object frame.
- FIG. 5 is an example diagram of generating a virtual object provided by an embodiment of the present disclosure. As shown in FIG. 5 , a "virtual New Year picture" and a “virtual rotating lantern" are generated.
- the technical solution of the embodiment of the present disclosure acquires a virtual object frame to be mounted; generates a reference line based on the virtual object frame; determines the positional relationship between the reference line and the rendered virtual object; processes the virtual object frame according to the positional relationship; and generates a virtual object in the processed virtual object frame.
- the virtual object generation method provided by the embodiments of the present disclosure processes the virtual object frame according to the positional relationship between the reference line and the rendered virtual object, which can prevent overlapping of virtual objects, and can realize gradual addition of virtual objects without clearing the screen of the virtual objects, can ensure smooth generation of virtual objects, and improve user experience.
- Fig. 6 is a schematic structural diagram of a device for generating a virtual object provided by an embodiment of the present disclosure. As shown in Fig. 6 , the device includes:
- the virtual object frame acquisition module 210 is configured to obtain a virtual object frame to be mounted;
- the reference line generation module 220 is configured to generate a reference line based on the virtual object frame;
- the positional relationship determination module 230 is configured to determine the positional relationship between the reference line and the rendered virtual object;
- the virtual object frame processing module 240 is configured to process the virtual object frame according to the positional relationship;
- the virtual object generation module 250 is configured to generate a virtual object in the processed virtual object frame.
- the virtual object frame acquisition module 210 is set to:
- the virtual object frame includes vertex information and center point information of the virtual object frame, and the number of vertices is multiple; the reference line generation module 220 is configured to: generate multiple reference lines corresponding to the multiple vertices and the center points respectively.
- the location relationship determining module 230 is set to:
- the virtual object frame processing module 240 is set to:
- the location relationship determining module 230 is set to:
- the location relationship determining module 230 is set to:
- the location relationship determination module 230 is configured to determine the intersection of the reference line and the bounding box in the following manner:
- the above-mentioned device can execute the methods provided by all the foregoing embodiments of the present disclosure, and has corresponding functional modules and effects for executing the above-mentioned methods.
- the above-mentioned device can execute the methods provided by all the foregoing embodiments of the present disclosure, and has corresponding functional modules and effects for executing the above-mentioned methods.
- FIG. 7 it shows a schematic structural diagram of an electronic device 300 suitable for implementing the embodiments of the present disclosure.
- Electronic devices in embodiments of the present disclosure may include, but are not limited to, devices such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, PDA), flat Tablet computer (Portable Android Device, PAD), portable multimedia player (Portable Media Player, PMP), vehicle-mounted terminal (such as vehicle-mounted navigation terminal), etc., and fixed terminals such as digital TV (Television, TV), desktop computer, etc., or various forms of servers, such as independent servers or server clusters.
- PDA Personal Digital Assistant
- PMP portable multimedia player
- vehicle-mounted terminal such as vehicle-mounted navigation terminal
- fixed terminals such as digital TV (Television, TV), desktop computer, etc.
- servers such as independent servers or server clusters.
- the electronic device 300 shown in FIG. 7 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure.
- the electronic device 300 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 301, which may perform various appropriate actions and processes according to a program stored in a read-only storage device (Read-Only Memory, ROM) 302 or a program loaded from a storage device 308 into a random access storage device (Random Access Memory, RAM) 303.
- ROM Read-Only Memory
- RAM Random Access Memory
- the processing device 301, ROM 302, and RAM 303 are connected to each other through a bus 304.
- An input/output (Input/Output, I/O) interface 305 is also connected to the bus 304 .
- the following devices can be connected to the I/O interface 305: an input device 306 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (Liquid Crystal Display, LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 309.
- the communication means 309 may allow the electronic device 300 to perform wireless or wired communication with other devices to exchange data.
- FIG. 7 shows electronic device 300 having various means, it is not a requirement to implement or possess all of the means shown. More or fewer means may alternatively be implemented or provided.
- embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program comprising program code for performing a word recommendation method.
- the computer program may be downloaded and installed from a network via communication means 309, or from storage means 308, or from ROM 302.
- the processing device 301 When the computer program is executed by the processing device 301, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
- the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
- a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof.
- Examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, RAM, ROM, Erasable Programmable Read-Only Memory (EPROM or flash memory), fiber optics, portable Compact Disc Read-Only Memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
- a computer-readable storage medium may be any tangible medium that contains or stores a program that can be executed by instructions system, device or device or in combination with it.
- a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
- a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
- the program code contained on the computer readable medium can be transmitted by any appropriate medium, including but not limited to: electric wire, optical cable, radio frequency (Radio Frequency, RF), etc., or any suitable combination of the above.
- the client and the server can communicate using any currently known or future-developed network protocols such as HyperText Transfer Protocol (HyperText Transfer Protocol, HTTP), and can be interconnected with any form or medium of digital data communication (for example, a communication network).
- HTTP HyperText Transfer Protocol
- Examples of communication networks include local area networks (Local Area Networks, LANs), wide area networks (Wide Area Networks, WANs), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
- the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
- the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device: acquires a virtual object frame to be mounted; generates a reference line based on the virtual object frame; determines a positional relationship between the reference line and the rendered virtual object; processes the virtual object frame according to the positional relationship; and generates a virtual object in the processed virtual object frame.
- Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and conventional procedural programming languages—such as the “C” language or similar programming languages.
- the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
- the remote computer can be connected to the user computer through any kind of network, including a LAN or WAN, or it can be connected to an external computer (eg via the Internet using an Internet Service Provider).
- each block in the flowchart or block diagram can represent a module, program segment, or part of code, the module, program segment, Or a portion of code that contains one or more executable instructions for implementing specified logical functions.
- the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
- the units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of the unit does not constitute a limitation of the unit itself in one case.
- exemplary types of hardware logic components include: Field Programmable Gate Array (Field Programmable Gate Array, FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Parts (ASSP), System on Chip (System on Chip, SOC), Complex Programmable Logic Device (Complex Programming log ic device, CPLD) and so on.
- a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
- a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
- a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Examples of a machine-readable storage medium would include one or more wire-based electrical connections, a portable computer disk, hard disk, RAM, ROM, EPROM, or flash memory, optical fiber, CD-ROM, optical storage, magnetic storage, or any suitable combination of the foregoing.
- the embodiments of the present disclosure disclose a method for generating a virtual object, including:
- a virtual object is generated within the processed virtual object frame.
- obtaining the virtual object frame to be mounted includes:
- the virtual object frame includes vertex information and center point information of the virtual object frame, and the number of vertices is multiple; generating a reference line based on the virtual object frame includes:
- a plurality of reference lines respectively corresponding to the plurality of vertices and the center point are generated.
- the positional relationship includes intersecting and non-intersecting
- determining the positional relationship between the reference line and the rendered virtual object includes:
- the reference line intersects the rendered virtual object; if the distance is greater than the set value, the reference line does not intersect the rendered virtual object.
- processing the virtual object frame according to the positional relationship includes:
- determining the positional relationship between the reference line and the rendered virtual object includes:
- the reference line intersects any triangular surface, the reference line intersects the rendered virtual object.
- determining the positional relationship between the reference line and the rendered virtual object includes:
- the bounding box is a cuboid
- determining the intersection of the reference line and the bounding box includes:
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Architecture (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Processing Or Creating Images (AREA)
Abstract
本公开提供了一种虚拟物体的生成方法、装置、设备及存储介质。虚拟物体的生成方法包括:获取待挂载的虚拟物体框;基于所述虚拟物体框生成参考线;确定所述参考线与已渲染虚拟物体的位置关系;根据所述位置关系对所述虚拟物体框进行处理;在处理后的虚拟物体框内生成虚拟物体。
Description
本申请要求在2022年01月21日提交中国专利局、申请号为202210073858.5的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
本公开涉及增强现实技术领域,例如涉及一种虚拟物体的生成方法、装置、设备及存储介质。
在现实场景中生成虚拟物体时,在根据算法返回的虚拟物体框直接生成虚拟物体的情况下,有可能产生虚拟物体的重叠现象。另外,对当前画面内的虚拟物体更新时,如果选择对虚拟物体进行清屏处理,再生成新的虚拟物体,有可能造成虚拟物体生成的画面的不连贯,从而影响用户体验。
本公开提供一种虚拟物体的生成方法、装置、设备及存储介质,即可以避免虚拟物体的重叠,又可以保证虚拟物体生成的顺滑,提高用户体验。
第一方面,本公开提供了一种虚拟物体的生成方法,包括:
获取待挂载的虚拟物体框;
基于所述虚拟物体框生成参考线;
确定所述参考线与已渲染虚拟物体的位置关系;
根据所述位置关系对所述虚拟物体框进行处理;
在处理后的虚拟物体框内生成虚拟物体。
第二方面,本公开还提供了一种虚拟物体的生成装置,包括:
虚拟物体框获取模块,设置为获取待挂载的虚拟物体框;
参考线生成模块,设置为基于所述虚拟物体框生成参考线;
位置关系确定模块,设置为确定所述参考线与已渲染虚拟物体的位置关系;
虚拟物体框处理模块,设置为根据所述位置关系对所述虚拟物体框进行处理;
虚拟物体生成模块,设置为在处理后的虚拟物体框内生成虚拟物体。
第三方面,本公开还提供了一种电子设备,所述电子设备包括:
一个或多个处理装置;
存储装置,设置为存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理装置执行,使得所述一个或多个处理装置实现上述的虚拟物体的生成方法。
第四方面,本公开公开了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现上述的虚拟物体的生成方法。
第五方面,本公开还提供了一种计算机程序产品,包括承载在非暂态计算机可读介质上的计算机程序,所述计算机程序包含用于实现上述的虚拟物体的生成方法的程序代码。
图1是本公开实施例提供的一种虚拟物体的生成方法的流程图;
图2是本公开实施例提供的一种获取到的虚拟物体框的示例图;
图3是本公开实施例提供的一种针孔相机成像原理图;
图4是本公开实施例提供的一种对已渲染虚拟物体的表面进行三角形网格化的示例图;
图5是本公开实施例提供的一种生成虚拟物体的示例图;
图6是本公开实施例提供的一种虚拟物体的生成装置的结构示意图;
图7是本公开实施例提供的一种电子设备的结构示意图。
下面将参照附图描述本公开的实施例。虽然附图中显示了本公开的一些实施例,然而本公开可以通过多种形式来实现,提供这些实施例是为了理解本公开。本公开的附图及实施例仅用于示例性作用。
本公开的方法实施方式中记载的多个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施
例”。其他术语的相关定义将在下文描述中给出。
本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
图1是本公开实施例提供的一种虚拟物体的生成方法的流程图,本实施例可适用于在三维空间的画面中生成虚拟物体的情况,该方法可以由虚拟物体的生成装置来执行,该装置可由硬件和/或软件组成,并一般可集成在具有虚拟物体的生成功能的设备中,该设备可以是服务器、移动终端或服务器集群等电子设备。如图1所示,该方法包括如下步骤:
S110,获取待挂载的虚拟物体框。
虚拟物体框悬挂于在三维空间中识别到的物体上,用于放置虚拟物体,虚拟物体框可以包括多个。本实施例中,虚拟物体可以是任意主题对应的虚拟物体,例如:“春节”主题,则虚拟物体可以是:虚拟对联、虚拟灯笼、虚拟年画等,此处不做限定。
获取待挂载的虚拟物体框的方式可以是:对当前画面进行物体检测;根据检测到的物体确定虚拟物体框。
本实施例中,终端设备对当前三维空间进行拍摄的过程中,终端设备中的物体检测模块按照一定的频率对画面中的物体进行检测,获得物体对应的检测框以及语义信息,根据检测框和语义信息确定虚拟物体框。示例性的,图2是本公开实施例提供的一种获取到的虚拟物体框的示例图,如图2所示,画面中检测到的物体包括天空、建筑物及植物,在这些物体上生成虚拟物体框。
可以根据物体的检测框确定虚拟物体框的尺寸,根据语义信息确定虚拟物体框的类别。虚拟物体框的尺寸可以小于或者等于物体的检测框,或者将物体的检测框进行拆分,获得多个虚拟物体框。虚拟物体框的类别用于确定内部虚拟物体的类别,类别可以包括静态虚拟物体和动态虚拟物体。示例性的,以“春节”主题为例,静态虚拟物体可以是“对联”,动态虚拟物体可以是“旋转的灯笼”。本实施例中,根据检测到的物体确定虚拟物体框,使得放置于虚拟物体框中的虚拟物体与现实场景更贴合。
S120,基于虚拟物体框生成参考线。
参考线可以是从虚拟物体框发射出的射线,可以根据相机成像原理生成基于虚拟物体框的参考线。相机成像原理可以是针孔相机成像原理,示例性的,图3是本公开实施例提供的一种针孔相机成像原理图,如图3所示,三维空间的物体反射的光进入针孔相机,由针孔相机将采集的图像投影于像素平面上,像素平面上的每个像素点可以逆着光线生成一条射向三维空间的参考线。本实施例中,获取的虚拟物体框位于像素平面中,可以在虚拟物体框上选择设定像素点,从这些设定像素点逆着光线方向生成射向三维空间的参考线,根据针孔相机的逆变换原理,可以获取到这些参考线的方向向量。
虚拟物体框包含虚拟物体框的顶点信息及中心点信息,且顶点数量为多个。基于虚拟物体框生成参考线的方式可以是:生成多个顶点和中心点分别对应的多条参考线。
本实施例中,虚拟物体框可以是平行四边形,则虚拟物体框包含四个顶点。本应用场景下,按照相机成像原理分别生成从虚拟物体框的四个顶点和中心线发射的五条参考线,根据针孔相机的逆变换原理可以获得五条参考线的方向向量。本实施例中,生成多个顶点和中心点分别对应的多条参考线,可以减少计算量。
本实施例中,可以通过在相机中添加参考线生成组件(rayCast组件),该组件设置为根据相机成像原理生成从虚拟物体框的四个顶点及中心点射出的参考线。
S130,确定参考线与已渲染虚拟物体的位置关系。
已渲染虚拟物体可以理解为在已经显示并挂载于三维空间的物体上的虚拟物体,虚拟物体为三维(3 Dimension,3D)物体。位置关系包括相交及不想交。
确定参考线与已渲染虚拟物体的位置关系,包括:确定多个顶点和中心点分别对应的多条参考线分别与已渲染虚拟物体的距离;若距离小于或等于设定值,则参考线与已渲染虚拟物体相交;若距离大于设定值,则参考线与已渲染虚拟物体不相交。
参考线与已渲染虚拟物体的位置关系包括四个顶点对应的参考线与已渲染虚拟物体的位置关系以及中心点对应的参考线与已渲染虚拟物体的位置关系。
设定值可以是0。参考线与已渲染虚拟物体的距离可以理解为已渲染物体表面多个点与参考线的距离中的最短距离,若该最短距离大于0,则表明参考线与已渲染物体不相交,若该最短距离小于或等于0,则该参考线与已渲染物体相交。本实施中,基于参考线与已渲染虚拟物体的距离来确定位置关系,可以快速准确的确定出参考线与已渲染物体是否相交。
S140,根据位置关系对虚拟物体框进行处理。
处理的方式可以是删除或者调低透明度。
根据位置关系对虚拟物体框进行处理的方式可以是:若中心点对应的参考线与已渲染虚拟物体相交,则将虚拟物体框删除或者调低透明度;若中心点对应的参考线与已渲染虚拟物体不相交,且超过设定数量的顶点对应的参考线与已渲染虚拟物体相交,则将虚拟物体框删除或者调低透明度。
设定数量可以设置2或者3。本实施例中,若中心点对应的参考线与已渲染虚拟物体相交,则表明虚拟物体框内的虚拟物体会与该已渲染虚拟物体完全重叠,因此需要将该虚拟物体框删除或者调低透明度。若超过设定数量的顶点对应的参考线与已渲染虚拟物体相交,则表明虚拟物体框内的虚拟物体会与该已渲染虚拟物体重叠部分较大,因此也需要将该虚拟物体框删除或者调低透明度。可以提高虚拟物体框处理的准确性。
确定参考线与已渲染虚拟物体的位置关系的方式可以是:对已渲染虚拟物体的表面进行三角形网格化,获得多个三角面;分别确定参考线与多个三角面的相交情况;若参考线与任意三角面相交,则参考线与已渲染虚拟物体相交。
已渲染虚拟物体为三维物体,对已渲染虚拟物体的表面进行三角形网格化可以理解为将已渲染虚拟物体的表面划分为多个三角平面。示例性,图4是本公开实施例提供的一种对已渲染虚拟物体的表面进行三角形网格化的示例图,如图4所示,虚拟物体为一只三维的兔子,将该物体的表面划分为多个三角形平面。确定参考线与多个三角面的相交情况的方式可以采用直线与三角面相交原理实现,此处不做限定。
本实施例中,在获得多个三角面后,确定多个顶点和中心点分别对应的多条参考线分别与每个三角面的相交情况,若参考线与任意一个三角面相交,则表明该参考线与已渲染虚拟物体相交。本实施例中,通过对已渲染虚拟物体表面三角网格化来确定参考线与已渲染虚拟物体的相交情况,可以提高准确性。
确定参考线与已渲染虚拟物体的位置关系的方式可以是:获取已渲染虚拟物体的包围盒;确定参考线与包围盒的相交情况;若参考线与包围盒相交,则参考线与已渲染虚拟物体相交。
包围盒的形状为长方体,可以理解为已渲染虚拟物体的最小外接长方体。长方体包含三对平行面,分别为前后平行面、左右平行面及上下平行面。
确定参考线与包围盒的相交情况的过程可以是:获取参考线与包围盒对应的三对平行面相交获得的三条线段;若三个线段均满足如下条件,则参考线与包围盒相交:线段的部分或者全部落入包围盒内。
包围盒对应的三对平行面可以理解为包围盒对应的三对平行面延伸至整个空间的平面,包含前后平行面延伸至整个空间、左右平行面延伸至整个空间及上下平行面延伸至整个空间。对于每对平行面,参考线与该对平行面相交获得一条线段,从而获得三条线段。本实施例中,根据参考线的方向向量以及每对平行面的空间函数,可以得到参考线与平行面相交后形成的线段的两个端点的坐标,根据该两个端点的坐标可以确定该线段部分或者全部是否落入包围盒内。本实施例,基于参考线与包围盒的相交情况进行参考线与已渲染虚拟物体的相交情况,可以提高确定位置关系的效率。
本实施例中,若参考线与已渲染虚拟物体相交,则表明在该参考线相交的虚拟物体框内的虚拟物体会与已渲染虚拟物体发生部分或者全部重叠,因此,需要将该虚体物体框删除或者调低透明度,无需在处理的虚拟物体框内渲染渲染虚拟物体。
S150,在处理后的虚拟物体框内生成虚拟物体。
将与已渲染虚拟物体发生碰撞的虚拟物体框删除或者调低透明度后,首先将剩余的虚拟物体框挂载于三维空间中对应的物体上,然后获取剩余虚拟物体框对应的素材,将素材渲染于剩余的虚拟物体框内,从而生成虚拟物体。示例性的,图5是本公开实施例提供的一种生成虚拟物体的示例图,如图5所示,生成“虚拟年画”及“虚拟旋转的灯笼”。
本公开实施例的技术方案,获取待挂载的虚拟物体框;基于虚拟物体框生成参考线;确定参考线与已渲染虚拟物体的位置关系;根据位置关系对虚拟物体框进行处理;在处理后的虚拟物体框内生成虚拟物体。本公开实施例提供的虚拟物体的生成方法,根据参考线与已渲染虚拟物体的位置关系对虚拟物体框进行处理,可以防止虚拟物体的重叠,而且可以实现虚拟物体的逐步新增,无需对虚拟物体清屏处理,可以保证虚拟物体生成的顺滑,提高用户体验。
图6是本公开实施例提供的一种虚拟物体的生成装置的结构示意图,如图6所示,该装置包括:
虚拟物体框获取模块210,设置为获取待挂载的虚拟物体框;参考线生成模块220,设置为基于所述虚拟物体框生成参考线;位置关系确定模块230,设置为确定所述参考线与已渲染虚拟物体的位置关系;虚拟物体框处理模块240,设置为根据所述位置关系对所述虚拟物体框进行处理;虚拟物体生成模块250,设置为在处理后的虚拟物体框内生成虚拟物体。
一实施例中,虚拟物体框获取模块210,设置为:
对当前画面进行物体检测;根据检测到的物体确定虚拟物体框。
一实施例中,所述虚拟物体框包含所述虚拟物体框的顶点信息及中心点信息,且顶点数量为多个;参考线生成模块220,设置为:生成多个顶点和所述中心点分别对应的多条参考线。
一实施例中,位置关系确定模块230,设置为:
确定所述多个顶点和所述中心点分别对应的多条参考线分别与所述已渲染虚拟物体的距离;若所述距离小于或等于设定值,则所述参考线与已渲染虚拟物体相交;若所述距离大于所述设定值,则所述参考线与已渲染虚拟物体不相交。
一实施例中,虚拟物体框处理模块240,设置为:
若所述中心点对应的参考线与所述已渲染虚拟物体相交,则将所述虚拟物体框删除或者调低透明度;若所述中心点对应的参考线与所述已渲染虚拟物体不相交,且超过设定数量的所述顶点对应的参考线与所述已渲染虚拟物体相交,则将所述虚拟物体框删除或者调低透明度。
一实施例中,位置关系确定模块230,设置为:
对所述已渲染虚拟物体的表面进行三角形网格化,获得多个三角面;确定所述参考线与所述多个三角面的相交情况;若所述参考线与任意三角面相交,则所述参考线与所述已渲染虚拟物体相交。
一实施例中,位置关系确定模块230,设置为:
获取所述已渲染虚拟物体的包围盒;确定所述参考线与所述包围盒的相交情况;若所述参考线与所述包围盒相交,则所述参考线与所述已渲染虚拟物体相交。
一实施例中,位置关系确定模块230设置为通过如下方式确定所述参考线与所述包围盒的相交情况:
获取所述参考线与所述包围盒对应的三对平行面相交获得的三条线段;若所述三个线段均满足如下条件,则所述参考线与所述包围盒相交:线段的部分或者全部落入所述包围盒内。
上述装置可执行本公开前述所有实施例所提供的方法,具备执行上述方法相应的功能模块和效果。未在本实施例中详尽描述的技术细节,可参见本公开前述所有实施例所提供的方法。
下面参考图7,其示出了适于用来实现本公开实施例的电子设备300的结构示意图。本公开实施例中的电子设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(Personal Digital Assistant,PDA)、平
板电脑(Portable Android Device,PAD)、便携式多媒体播放器(Portable Media Player,PMP)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字电视(Television,TV)、台式计算机等等的固定终端,或者多种形式的服务器,如独立服务器或者服务器集群。图7示出的电子设备300仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图7所示,电子设备300可以包括处理装置(例如中央处理器、图形处理器等)301,其可以根据存储在只读存储装置(Read-Only Memory,ROM)302中的程序或者从存储装置308加载到随机访问存储装置(Random Access Memory,RAM)303中的程序而执行多种适当的动作和处理。在RAM 303中,还存储有电子设备300操作所需的多种程序和数据。处理装置301、ROM 302以及RAM 303通过总线304彼此相连。输入/输出(Input/Output,I/O)接口305也连接至总线304。
通常,以下装置可以连接至I/O接口305:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置306;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置307;包括例如磁带、硬盘等的存储装置308;以及通信装置309。通信装置309可以允许电子设备300与其他设备进行无线或有线通信以交换数据。虽然图7示出了具有多种装置的电子设备300,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行词语的推荐方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置309从网络上被下载和安装,或者从存储装置308被安装,或者从ROM 302被安装。在该计算机程序被处理装置301执行时,执行本公开实施例的方法中限定的上述功能。
本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、RAM、ROM、可擦式可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行
系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如超文本传输协议(HyperText Transfer Protocol,HTTP)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取待挂载的虚拟物体框;基于所述虚拟物体框生成参考线;确定所述参考线与已渲染虚拟物体的位置关系;根据所述位置关系对所述虚拟物体框进行处理;在处理后的虚拟物体框内生成虚拟物体。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括LAN或WAN—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开多种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、
或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在一种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Parts,ASSP)、片上系统(System on Chip,SOC)、复杂可编程逻辑设备(Complex Programming logic device,CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、RAM、ROM、EPROM或快闪存储器、光纤、CD-ROM、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开实施例的一个或多个实施例,本公开实施例公开了一种虚拟物体的生成方法,包括:
获取待挂载的虚拟物体框;
基于所述虚拟物体框生成参考线;
确定所述参考线与已渲染虚拟物体的位置关系;
根据所述位置关系对所述虚拟物体框进行处理;
在处理后的虚拟物体框内生成虚拟物体。
根据本公开实施例的一个或多个实施例,获取待挂载的虚拟物体框,包括:
对当前画面进行物体检测;
根据检测到的物体确定虚拟物体框。
根据本公开实施例的一个或多个实施例,所述虚拟物体框包含所述虚拟物体框的顶点信息及中心点信息,且顶点数量为多个;基于所述虚拟物体框生成参考线,包括:
生成多个顶点和所述中心点分别对应的多条参考线。
根据本公开实施例的一个或多个实施例,所述位置关系包括相交及不相交,确定所述参考线与已渲染虚拟物体的位置关系,包括:
确定所述多个顶点和所述中心点分别对应的多条参考线分别与所述已渲染虚拟物体的距离;
若所述距离小于或等于设定值,则所述参考线与已渲染虚拟物体相交;若所述距离大于所述设定值,则所述参考线与已渲染虚拟物体不相交。
根据本公开实施例的一个或多个实施例,根据所述位置关系对所述虚拟物体框进行处理,包括:
若所述中心点对应的参考线与所述已渲染虚拟物体相交,则将所述虚拟物体框删除或者调低透明度;
若所述中心点对应的参考线与所述已渲染虚拟物体不相交,且超过设定数量的所述顶点对应的参考线与所述已渲染虚拟物体相交,则将所述虚拟物体框删除或者调低透明度。
根据本公开实施例的一个或多个实施例,确定所述参考线与已渲染虚拟物体的位置关系,包括:
对所述已渲染虚拟物体的表面进行三角形网格化,获得多个三角面;
分别确定所述参考线与所述多个三角面的相交情况;
若所述参考线与任意三角面相交,则所述参考线与所述已渲染虚拟物体相交。
根据本公开实施例的一个或多个实施例,确定所述参考线与已渲染虚拟物体的位置关系,包括:
获取所述已渲染虚拟物体的包围盒;
确定所述参考线与所述包围盒的相交情况;
若所述参考线与所述包围盒相交,则所述参考线与所述已渲染虚拟物体相交。
根据本公开实施例的一个或多个实施例,所述包围盒为长方体,确定所述参考线与所述包围盒的相交情况,包括:
获取所述参考线与所述包围盒对应的三对平行面相交获得的三条线段;
若所述三条线段均满足如下条件,则所述参考线与所述包围盒相交:
线段的部分或者全部落入所述包围盒内。
Claims (19)
- 一种虚拟物体的生成方法,包括:获取待挂载的虚拟物体框;基于所述虚拟物体框生成参考线;确定所述参考线与已渲染虚拟物体的位置关系;根据所述位置关系对所述虚拟物体框进行处理;在处理后的虚拟物体框内生成虚拟物体。
- 根据权利要求1所述的方法,其中,所述获取待挂载的虚拟物体框,包括:对当前画面进行物体检测;根据检测到的物体确定所述虚拟物体框。
- 根据权利要求1所述的方法,其中,所述虚拟物体框包含所述虚拟物体框的顶点信息及中心点信息,且顶点数量为多个;所述基于所述虚拟物体框生成参考线,包括:生成多个顶点和所述中心点分别对应的多条参考线。
- 根据权利要求3所述的方法,其中,所述位置关系包括相交及不相交,所述确定所述参考线与已渲染虚拟物体的位置关系,包括:确定所述多个顶点和所述中心点分别对应的多条参考线分别与所述已渲染虚拟物体的距离;在所述距离小于或等于设定值的情况下,所述距离对应的参考线与所述已渲染虚拟物体相交;在所述距离大于设定值的情况下,所述距离对应的参考线与所述已渲染虚拟物体不相交。
- 根据权利要求4所述的方法,其中,所述根据所述位置关系对所述虚拟物体框进行处理,包括:在所述中心点对应的参考线与所述已渲染虚拟物体相交的情况下,将所述虚拟物体框删除或者调低透明度;在所述中心点对应的参考线与所述已渲染虚拟物体不相交,且超过设定数量的顶点对应的参考线与所述已渲染虚拟物体相交的情况下,将所述虚拟物体框删除或者调低透明度。
- 根据权利要求4所述的方法,其中,所述确定所述参考线与已渲染虚拟物体的位置关系,包括:对所述已渲染虚拟物体的表面进行三角形网格化,获得多个三角面;确定所述参考线与所述多个三角面的相交情况;在所述参考线与一三角面相交的情况下,所述参考线与所述已渲染虚拟物体相交。
- 根据权利要求4所述的方法,其中,所述确定所述参考线与已渲染虚拟物体的位置关系,包括:获取所述已渲染虚拟物体的包围盒;确定所述参考线与所述包围盒的相交情况;在所述参考线与所述包围盒相交的情况下,所述参考线与所述已渲染虚拟物体相交。
- 根据权利要求7所述的方法,其中,所述包围盒为长方体,确定所述参考线与所述包围盒的相交情况,包括:获取所述参考线与所述包围盒对应的三对平行面相交获得的三条线段;在所述三条线段均满足如下条件的情况下,所述参考线与所述包围盒相交:每条线段的部分或者全部落入所述包围盒内。
- 一种虚拟物体的生成装置,包括:虚拟物体框获取模块,设置为获取待挂载的虚拟物体框;参考线生成模块,设置为按照相机成像原理生成从所述虚拟物体框发射的参考线;参考线生成模块,设置为基于所述虚拟物体框生成参考线;位置关系确定模块,设置为确定所述参考线与已渲染虚拟物体的位置关系;虚拟物体框处理模块,设置为根据所述位置关系对所述虚拟物体框进行处理;虚拟物体生成模块,设置为在处理后的虚拟物体框内生成虚拟物体。
- 根据权利要求9所述的装置,其中,所述虚拟物体框获取模块设置为:对当前画面进行物体检测;根据检测到的物体确定所述虚拟物体框。
- 根据权利要求9所述的装置,其中,所述虚拟物体框包含所述虚拟物体框的顶点信息及中心点信息,且顶点数量为多个;所述参考线生成模块设置为:生成多个顶点和所述中心点分别对应的多条参考线。
- 根据权利要求11所述的装置,其中,所述位置关系包括相交及不相交;所述位置关系确定模块设置为:确定所述多个顶点和所述中心点分别对应的多条参考线分别与所述已渲染虚拟物体的距离;在所述距离小于或等于设定值的情况下,所述距离对应的参考线与所述已渲染虚拟物体相交;在所述距离大于设定值的情况下,所述距离对应的参考线与所述已渲染虚拟物体不相交。
- 根据权利要求12所述的装置,其中,所述虚拟物体框处理模块设置为:在所述中心点对应的参考线与所述已渲染虚拟物体相交的情况下,将所述虚拟物体框删除或者调低透明度;在所述中心点对应的参考线与所述已渲染虚拟物体不相交,且超过设定数量的顶点对应的参考线与所述已渲染虚拟物体相交的情况下,将所述虚拟物体框删除或者调低透明度。
- 根据权利要求12所述的装置,其中,所述位置关系确定模块设置为:对所述已渲染虚拟物体的表面进行三角形网格化,获得多个三角面;确定所述参考线与所述多个三角面的相交情况;在所述参考线与一三角面相交的情况下,所述参考线与所述已渲染虚拟物体相交。
- 根据权利要求12所述的装置,其中,所述位置关系确定模块设置为:获取所述已渲染虚拟物体的包围盒;确定所述参考线与所述包围盒的相交情况;在所述参考线与所述包围盒相交的情况下,所述参考线与所述已渲染虚拟物体相交。
- 根据权利要求15所述的装置,其中,所述包围盒为长方体,所述位置关系确定模块设置为通过如下方式确定所述参考线与所述包围盒的相交情况:获取所述参考线与所述包围盒对应的三对平行面相交获得的三条线段;在所述三条线段均满足如下条件的情况下,所述参考线与所述包围盒相交:每条线段的部分或者全部落入所述包围盒内。
- 一种电子设备,包括:至少一个处理装置;存储装置,设置为存储至少一个程序;当所述至少一个程序被所述至少一个处理装置执行,使得所述至少一个处理装置实现如权利要求1-8中任一所述的虚拟物体的生成方法。
- 一种计算机可读介质,存储有计算机程序,所述程序被处理装置执行时实现如权利要求1-8中任一所述的虚拟物体的生成方法。
- 一种计算机程序产品,包括承载在非暂态计算机可读介质上的计算机程序,所述计算机程序包含用于执行如权利要求1-8中任一所述的虚拟物体的生成方法的程序代码。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210073858.5A CN114419299A (zh) | 2022-01-21 | 2022-01-21 | 虚拟物体的生成方法、装置、设备及存储介质 |
CN202210073858.5 | 2022-01-21 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023138467A1 true WO2023138467A1 (zh) | 2023-07-27 |
Family
ID=81274513
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/071876 WO2023138467A1 (zh) | 2022-01-21 | 2023-01-12 | 虚拟物体的生成方法、装置、设备及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114419299A (zh) |
WO (1) | WO2023138467A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114419299A (zh) * | 2022-01-21 | 2022-04-29 | 北京字跳网络技术有限公司 | 虚拟物体的生成方法、装置、设备及存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2017049658A (ja) * | 2015-08-31 | 2017-03-09 | Kddi株式会社 | Ar情報表示装置 |
CN108830940A (zh) * | 2018-06-19 | 2018-11-16 | 广东虚拟现实科技有限公司 | 遮挡关系处理方法、装置、终端设备及存储介质 |
CN111921202A (zh) * | 2020-09-16 | 2020-11-13 | 成都完美天智游科技有限公司 | 虚拟场景的数据处理方法、装置、设备及可读存储介质 |
CN113240692A (zh) * | 2021-06-30 | 2021-08-10 | 北京市商汤科技开发有限公司 | 一种图像处理方法、装置、设备以及存储介质 |
CN114419299A (zh) * | 2022-01-21 | 2022-04-29 | 北京字跳网络技术有限公司 | 虚拟物体的生成方法、装置、设备及存储介质 |
-
2022
- 2022-01-21 CN CN202210073858.5A patent/CN114419299A/zh active Pending
-
2023
- 2023-01-12 WO PCT/CN2023/071876 patent/WO2023138467A1/zh unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2017049658A (ja) * | 2015-08-31 | 2017-03-09 | Kddi株式会社 | Ar情報表示装置 |
CN108830940A (zh) * | 2018-06-19 | 2018-11-16 | 广东虚拟现实科技有限公司 | 遮挡关系处理方法、装置、终端设备及存储介质 |
CN111921202A (zh) * | 2020-09-16 | 2020-11-13 | 成都完美天智游科技有限公司 | 虚拟场景的数据处理方法、装置、设备及可读存储介质 |
CN113240692A (zh) * | 2021-06-30 | 2021-08-10 | 北京市商汤科技开发有限公司 | 一种图像处理方法、装置、设备以及存储介质 |
CN114419299A (zh) * | 2022-01-21 | 2022-04-29 | 北京字跳网络技术有限公司 | 虚拟物体的生成方法、装置、设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN114419299A (zh) | 2022-04-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021139382A1 (zh) | 人脸图像的处理方法、装置、可读介质和电子设备 | |
CN109801354B (zh) | 全景处理方法和装置 | |
US20240273808A1 (en) | Texture mapping method and apparatus, device and storage medium | |
WO2022028254A1 (zh) | 定位模型优化方法、定位方法和定位设备 | |
WO2024198855A1 (zh) | 场景渲染方法、装置、设备、计算机可读存储介质及产品 | |
WO2023103999A1 (zh) | 3d目标点渲染方法、装置、设备及存储介质 | |
WO2024104248A1 (zh) | 虚拟全景图的渲染方法、装置、设备及存储介质 | |
WO2023193639A1 (zh) | 图像渲染方法、装置、可读介质及电子设备 | |
WO2023138467A1 (zh) | 虚拟物体的生成方法、装置、设备及存储介质 | |
CN111292406B (zh) | 模型渲染方法、装置、电子设备及介质 | |
US20240331341A1 (en) | Method and apparatus for processing video image, electronic device, and storage medium | |
CN114399588A (zh) | 三维车道线生成方法、装置、电子设备和计算机可读介质 | |
CN117132652A (zh) | 基于三维网格的目标点云标记方法、装置、设备及介质 | |
JP7262530B2 (ja) | 位置情報の生成方法、関連装置及びコンピュータプログラム製品 | |
WO2024174871A1 (zh) | 一种图像处理方法、装置、设备及介质 | |
CN110070617B (zh) | 数据同步方法、装置、硬件装置 | |
CN111862342B (zh) | 增强现实的纹理处理方法、装置、电子设备及存储介质 | |
WO2023138468A1 (zh) | 虚拟物体的生成方法、装置、设备及存储介质 | |
WO2023138469A1 (zh) | 图像处理方法、装置、设备及存储介质 | |
CN111489428B (zh) | 图像生成方法、装置、电子设备及计算机可读存储介质 | |
CN111354070B (zh) | 一种立体图形生成方法、装置、电子设备及存储介质 | |
WO2023125360A1 (zh) | 图像处理方法、装置、电子设备及存储介质 | |
WO2023029892A1 (zh) | 视频处理方法、装置、设备及存储介质 | |
WO2023216971A1 (zh) | 特效视频生成方法、装置、电子设备及存储介质 | |
CN112395826B (zh) | 文字特效处理方法及装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23742782 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |