AR output method, device and equipment based on face positioning in H5 page and medium

Through the AR output method based on face positioning in the H5 page, the problem of low efficiency of AR game development in the existing technology is solved, the convenient development and intuitive operation of interactive logic are realized, and the user experience is improved.

CN118710852AInactive Publication Date: 2024-09-27广州三七极耀网络科技有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410696585.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In H5 pages, existing AR game development technologies such as Vuforia and EasyAR require interactive logic development based on 3D thinking, which is inefficient. Moreover, H5 pages have limited processing capabilities for images and video streams and cannot meet the processing needs of these technologies, resulting in inability to Convert coordinates in AR to coordinates in H5 pages, thereby affecting the development of interactive logic.

Method used

By obtaining image data for face positioning, determine the world coordinates of the face mark points, and convert them to screen coordinates in the H5 page, perform AR image rendering based on these coordinates, and output the AR image rendering results to achieve centralized development of interactive logic. On the H5 page, an AR output method, device and medium based on face positioning are provided.

Benefits of technology

This allows the development of interactive logic to be concentrated on the H5 page, allowing users to perform intuitive and convenient interactive operations, which improves the development efficiency and interactive experience of AR games on the H5 page.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710852A
    Figure CN118710852A
Patent Text Reader

Abstract

The invention discloses an AR output method and device based on face positioning in an H5 page, equipment and a medium, and belongs to the technical field of augmented reality. The method comprises the following steps: acquiring image data, and performing face positioning on the image data; determining world coordinates of the face mark points according to a face positioning result in the image data and a preset extraction rule of the face mark points; determining screen coordinates of the face mark points in the H5 page according to the world coordinates of the face mark points; and obtaining an AR image rendering result in the H5 page based on the screen coordinates of the face mark points in the H5 page according to an image rendering requirement for the face mark points in the AR execution scheme, and outputting the AR image rendering result. According to the technical scheme, the world coordinates of the face mark points are determined through the AR technology, the world coordinates are converted into the screen coordinates in the H5 page, development of interaction logic can be concentrated on the H5 page, and therefore a user can conduct visual and convenient interaction operation easily.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of augmented reality technology, and specifically relates to an AR output method, device, equipment and medium based on face positioning in an H5 page. Background Art

[0002] AR (Augmented Reality) games are a form of game that combines virtual elements with real environments, providing players with new and interesting immersive interactions. AR games implemented in H5 pages can run on different Web (World Wide Web) browsers and smart devices, have good cross-platform compatibility, and are convenient for players to experience games, thus gaining the favor of more and more players.

[0003] Currently, Vuforia technology or EasyAR technology is mainly used to develop AR games. However, Vuforia technology or EasyAR technology is implemented based on the unity3D engine, and requires the development of interactive logic based on 3D thinking, which is inefficient. In addition, the H5 page has limited processing capabilities for images and video streams, which cannot meet the processing requirements of Vuforia technology or EasyAR technology, and thus cannot be applied. Therefore, how to convert the coordinates in AR into the coordinates in the H5 page and develop the interactive logic based on the coordinates in the H5 page is a problem that people in this field need to solve urgently. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide an AR output method, device, equipment and medium based on face positioning in an H5 page, with the aim of concentrating the development of interactive logic on the H5 page, thereby facilitating users to perform intuitive and convenient interactive operations.

[0005] In a first aspect, an embodiment of the present application provides an AR output method based on face positioning in an H5 page, the method comprising:

[0006] Acquire image data, and perform face location on the image data;

[0007] Determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rule of the face marker points;

[0008] Determine the screen coordinates of the face marker point in the H5 page according to the world coordinates of the face marker point;

[0009] According to the image rendering requirements for the facial marker points in the AR execution solution, based on the screen coordinates of the facial marker points in the H5 page, the AR image rendering result in the H5 page is obtained, and the AR image rendering result is output.

[0010] In a second aspect, an embodiment of the present application provides an AR output device based on face positioning in an H5 page, the device comprising:

[0011] A face positioning module, used to obtain image data and perform face positioning on the image data;

[0012] A world coordinate determination module, used to determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rules of the face marker points;

[0013] A screen coordinate determination module, used to determine the screen coordinates of the face marker point in the H5 page according to the world coordinates of the face marker point;

[0014] The rendering result output module is used to obtain the AR image rendering result in the H5 page based on the screen coordinates of the face marker points in the H5 page according to the image rendering requirements of the face marker points in the AR execution solution, and output the AR image rendering result.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0016] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0017] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0018] In an embodiment of the present application, image data is acquired, and face positioning is performed on the image data; the world coordinates of the face marker points are determined based on the face positioning results in the image data and the preset extraction rules of the face marker points; the screen coordinates of the face marker points in the H5 page are determined based on the world coordinates of the face marker points; according to the image rendering requirements for the face marker points in the AR execution scheme, the AR image rendering results in the H5 page are obtained based on the screen coordinates of the face marker points in the H5 page, and the AR image rendering results are output. The above-mentioned AR output method based on face positioning in the H5 page, by using AR technology to determine the world coordinates of the face marker points and converting the world coordinates into screen coordinates in the H5 page, can concentrate the development of the interactive logic on the H5 page, thereby facilitating users to perform intuitive and convenient interactive operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is a flowchart of an AR output method based on face positioning in an H5 page provided in Embodiment 1 of the present application;

[0020] Figure 2 It is a flowchart of an AR output method based on face positioning in an H5 page provided in Embodiment 2 of the present application;

[0021] Figure 3 It is a flowchart of an AR output method based on face positioning in an H5 page provided in Embodiment 3 of the present application;

[0022] Figure 4 It is a flowchart of an AR output method based on face positioning in an H5 page through a MindAR plug-in provided in Embodiment 3 of the present application;

[0023] Figure 5 It is a structural diagram of an AR output device based on face positioning in an H5 page provided in the fourth embodiment of the present application;

[0024] Figure 6 It is a structural diagram of an electronic device not provided in the embodiments of the present application. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0026] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0027] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0028] In conjunction with the accompanying drawings, the AR output method, device, equipment and medium based on face positioning in the H5 page provided by the embodiments of the present application are described in detail through specific embodiments and their application scenarios.

[0029] Embodiment 1

[0030] Figure 1 1 is a flow chart of an AR output method based on face positioning in an H5 page provided in the first embodiment of the present application. Figure 1 As shown, the specific steps include:

[0031] S101, acquiring image data, and performing face location on the image data;

[0032] First of all, this application is applicable to scenarios where users interact with H5 pages. Based on the above usage scenarios, it can be understood that the execution subject of this application can be a platform that can run and display H5 pages. Specifically, the determination of screen coordinates and the output of AR image rendering results can be performed by the platform, and users can interact with H5 pages through the camera to obtain a rich interactive experience.

[0033] Among them, H5 page can refer to a web page built using HTML5 (HyperText Markup Language 5, the fifth generation of hypertext markup language) technology. Platforms that can run and display H5 pages may include web browsers, mobile device browsers, desktop applications, and mobile applications.

[0034] Image data may be digital data used to represent an image. Image data may be obtained by using a camera. A camera is a device used to capture images and videos. Specifically, the basic process of obtaining image data through a camera includes: an optical sensor located behind the camera lens converts light entering through the lens into an electrical signal; a photosensitive element in the optical sensor detects the intensity and color of the light and converts it into a voltage signal; an analog-to-digital converter converts the continuously changing analog voltage signal into a digital form for further processing and storage; an image processor processes and enhances the digital signal, and the processing may include color correction, contrast adjustment, and noise reduction, etc., to improve the quality and clarity of the image data.

[0035] The method of locating faces in image data can be to use the face detection algorithm in computer vision technology to find the position of faces in image data, and use the face feature point algorithm to determine the key feature points of the face, such as eyes, nose, and mouth, etc., by matching the face feature points of the previous frame image data with the face feature points of the current frame image data, the position and posture changes of the face between different frames can be tracked, so that the direction and angle of the face can be determined. In this solution, the addFaceMesh method in the MindAR plug-in can be called to locate faces in image data.

[0036] Video data is composed of continuous frames of image data; face location can be achieved by performing face location on image data frame by frame. Video stream data refers to the transmission of video data, which can be processed as a stable and continuous stream through the network; video stream data can be obtained by real-time and continuous acquisition and transmission of image data by the camera, and face location can be achieved by performing face location on the continuous frames of image data constituting the video stream data.

[0037] S102, determining the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rule of the face marker points;

[0038] The face positioning result may refer to data obtained after performing face positioning on image data, and specifically, may be a face recognition contour object, which is a three-dimensional representation of a face contour.

[0039] The face marker point may refer to a point in the face positioning result used to interact with the H5 page. The world coordinate of the face marker point may refer to the coordinate of the face marker point in the spatial rectangular coordinate system used to represent the face positioning result.

[0040] The definition of the spatial rectangular coordinate system used to represent the face positioning result is related to the camera that obtains the image data, the pre-set scene information, and the AR technology for face positioning. For example, if the AR technology for face positioning uses the MindAR plug-in, the definition of the spatial rectangular coordinate system used to represent the face positioning result is expressed as taking a fixed reference point as the origin, and the value ranges of the x-axis, y-axis, and z-axis are all [0,1]; if the rule for the user to interact with the H5 page is that the user uses the nose to control the character to jump and avoid obstacles on the ground with the desktop in reality as the scene floor, the definition of the spatial rectangular coordinate system used to represent the face positioning result is expressed as taking a corner of the desktop as the origin, and the length units of the x-axis, y-axis, and z-axis are the actual length units in the real world.

[0041] The preset extraction rule may refer to a pre-set method step for determining the face marker point in the face positioning result. Specifically, the preset extraction rule describes the relative position of the face marker point in the face positioning result, and is related to the rule for the user to interact with the H5 page. For example, if the rule for the user to interact with the H5 page is that the user uses the nose to control the character to avoid obstacles displayed on the H5 page, the preset extraction rule is to determine the center point of the face positioning result as the face marker point to represent the user's nose; if the rule for the user to interact with the H5 page is that the user uses the mouth to control the brush to draw a graphic, the preset extraction rule is to determine the center axis of the face positioning result from the bottom to the top 1 / 5 as the face marker point to represent the user's mouth.

[0042] When face positioning is performed by calling the addFaceMesh method in the MindAR plug-in, the world coordinates of the face marker points can be determined by calling the computeBoundingBox method in the geometry object properties (geometry) in the face positioning result; if face recognition is performed using AR technologies based on the unity3D engine such as Vuforia or EasyAR, the world coordinates of the face marker points can be determined by using the Physics module of Unity3D.

[0043] S103, determining the screen coordinates of the face marker point in the H5 page according to the world coordinates of the face marker point;

[0044] The screen coordinates of the face marker in the H5 page may refer to the coordinates of the face marker in the plane rectangular coordinate system representing the H5 page, wherein the plane rectangular coordinate system representing the H5 page takes the upper left corner as the origin, the x-axis ranges from the left side to the right side of the H5 page, and the y-axis ranges from the top to the bottom of the H5 page.

[0045] The screen coordinates of the face markers in the H5 page can be determined by normalizing the world coordinates of the face markers to obtain the standard device coordinates of the face markers, and then determining the screen coordinates of the face markers in the H5 page based on the standard device coordinates of the face markers. This method has a high degree of standardization, so that the face markers have the same coordinates in the same H5 page opened on different platforms.

[0046] The screen coordinates of the face marker points in the H5 page can also be determined by directly converting the world coordinates of the face marker points into the coordinates in the H5 page according to the projection relationship between the preset world coordinates and the coordinates in the H5 page. This method makes the conversion process relatively simple and direct, and has a high degree of customizability.

[0047] S104, according to the image rendering requirements of the face marker points in the AR execution solution, based on the screen coordinates of the face marker points in the H5 page, obtain the AR image rendering result in the H5 page, and output the AR image rendering result.

[0048] The AR implementation scheme may be a method step for subsequent processing of the data obtained through AR technology. Specifically, the AR implementation scheme describes the specific implementation method of the rules for user interaction with the H5 page based on the data obtained through AR technology on the H5 page. Among them, AR (augmented reality) technology is a technology that integrates virtual reality with real-world scenes. In this scheme, the data obtained through AR technology is the screen coordinates of the face marker points in the H5 page.

[0049] The image rendering requirement for face markers can describe the image rendering effect at the screen coordinates of the face markers in the H5 page. For example, if the rule for a user to interact with the H5 page is that the user uses his nose to control the character to avoid obstacles displayed in the H5 page, then the image rendering requirement for face markers is to display the character image at the screen coordinates of the face markers in the H5 page.

[0050] The AR image rendering result in the H5 page is the rendering parameters of the image to be displayed in the H5 page, which may include position parameters, size parameters, and border parameters, etc. The method of obtaining the AR image rendering result in the H5 page based on the screen coordinates of the face marker points in the H5 page can be to determine the rendering parameters of the image to be displayed in the H5 page according to the screen coordinates of the face marker points in the H5 page and the image rendering requirements, add a video tag in the H5 page, and set the corresponding parameters of the video tag according to the rendering parameters to output the AR image rendering result.

[0051] In an embodiment of the present application, image data is acquired, and face positioning is performed on the image data; the world coordinates of the face marker points are determined based on the face positioning results in the image data and the preset extraction rules of the face marker points; the screen coordinates of the face marker points in the H5 page are determined based on the world coordinates of the face marker points; according to the image rendering requirements for the face marker points in the AR execution scheme, the AR image rendering results in the H5 page are obtained based on the screen coordinates of the face marker points in the H5 page, and the AR image rendering results are output. The above-mentioned AR output method based on face positioning in the H5 page, by using AR technology to determine the world coordinates of the face marker points and converting the world coordinates into screen coordinates in the H5 page, can concentrate the development of the interactive logic on the H5 page, thereby facilitating users to perform intuitive and convenient interactive operations.

[0052] Embodiment 2

[0053] Figure 2 This is a flow chart of an AR output method based on face positioning in an H5 page provided in Example 2 of the present application. This solution makes a better improvement on the above-mentioned embodiment, and the specific improvement is: according to the world coordinates of the face marker point, the screen coordinates of the face marker point in the H5 page are determined, including: normalizing the world coordinates of the face marker point to obtain the standard device coordinates of the face marker point; according to the standard device coordinates of the face marker point, the screen coordinates of the face marker point in the H5 page are determined.

[0054] like Figure 2 As shown, the specific steps include:

[0055] S201, acquiring image data, and performing face location on the image data;

[0056] S202, determining the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rule of the face marker points;

[0057] S203, normalizing the world coordinates of the facial marker points to obtain standard device coordinates of the facial marker points;

[0058] The standard device coordinates of the face markers may refer to the coordinates of the face markers in the standard device coordinate system. The standard device coordinate system is a normalized three-dimensional coordinate system, in which all coordinate values ​​are in the range [-1,1], the origin is located at the center of the screen, the x-axis ranges from the left to the right of the screen, the y-axis ranges from the bottom to the top of the screen, and the z-axis ranges from the inside to the outside of the screen. Accordingly, the normalization process is the process of converting the world coordinates of the face markers into the standard device coordinates.

[0059] The method for obtaining the standard device coordinates of the face landmark points can be to determine the projection relationship of converting the world coordinates into the standard device coordinates based on the external parameters and internal parameters of the camera that obtains the image data, and finally convert the current world coordinates into the standard device coordinates based on the projection relationship.

[0060] Specifically, the standard device coordinates of the face markers can be obtained by calling the vector3.project method in Three.js. Three.js is an open source 3D graphics library based on JavaScript, which is used to create and display various 3D scenes, animations, and interactive effects; the vector3.project method is used to project the three-dimensional coordinates to the standard device coordinates, which can directly modify the original vector3 object and return the modified result.

[0061] S204, determining the screen coordinates of the face marker point in the H5 page according to the standard device coordinates of the face marker point;

[0062] The method of determining the screen coordinates of the face marker points in the H5 page according to the standard device coordinates of the face marker points can be achieved by obtaining the window display height and the window display width of the image data in the H5 page, and determining the screen coordinates of the face marker points in the H5 page according to the window display height, the window display width and the standard device coordinates.

[0063] In the technical solution, optionally, determining the screen coordinates of the face marker point in the H5 page according to the standard device coordinates of the face marker point includes:

[0064] Obtain the window display height and window display width of the image data on the H5 page;

[0065] The screen coordinates of the face marker point in the H5 page are determined according to the window display height, the window display width and the standard device coordinates.

[0066] The window display height may refer to the height occupied by the image data when displayed in the H5 page; the window display width may refer to the width occupied by the image data when displayed in the H5 page. The method of obtaining the window display height and the window display width of the image data in the H5 page may adopt the method of obtaining the height information of the video tag inserted in the current H5 page as the window display height, and obtaining the width information of the video tag as the window display width.

[0067] In this technical solution, optionally, after acquiring the image data, the method further includes:

[0068] Insert the video tag into the current H5 page;

[0069] Correspondingly, obtaining the window display height and window display width of the image data includes:

[0070] The height information of the video tag is obtained as the window display height, and the width information of the video tag is obtained as the window display width.

[0071] The video tag is a tag used to embed and play video content in an H5 page. To insert a video tag into the current H5 page, you can execute a program in JavaScript for inserting the video tag when the camera is turned on. Before inserting the video tag into the current H5 page, you can call the getUserMedia method to obtain the video stream data.

[0072] The height information of the video tag may refer to the height attribute of the video tag in the CSS style sheet; the width information of the video tag may refer to the width attribute of the video tag in the CSS style sheet. The height information and width information of the video tag may be obtained by calling the querySelector method. Among them, the CSS style sheet (CascadingStyle Sheets) is used to define the style and layout of the H5 page.

[0073] The advantage of this arrangement of the present solution is that by obtaining the height information of the video tag as the window display height, and obtaining the width information of the video tag as the window display width, the screen coordinates can be adapted to the actual display situation of the image data, thereby improving accuracy.

[0074] According to the window display height, window display width and standard device coordinates, the screen coordinates of the face marker point in the H5 page can be determined by calculation according to the following formula:

[0075]

[0076] Among them, x represents the x value in screen coordinates, y represents the y value in screen coordinates, vector.x represents the x value in standard device coordinates, vector.y represents the y value in standard device coordinates, width represents the window display width, height represents the window display height, and Math.round() is a rounding operation.

[0077] The benefit of this setting is that by determining the screen coordinates of the face marker points in the H5 page based on the window display height, window display width and standard device coordinates, the face marker points can be accurately positioned and displayed on different devices and screen sizes, thereby ensuring the consistency and accuracy of the user experience.

[0078] In this technical solution, optionally, after inserting the video tag into the current H5 page, the method further includes:

[0079] Obtain source camera information of the image data;

[0080] If the source camera information is a front camera, the video tag is horizontally flipped.

[0081] The source camera information of the image data may refer to the camera that obtains the image data, which may include a front camera and a rear camera, etc. Among them, the camera direction of the front camera is consistent with the screen display direction, and the camera direction of the rear camera is opposite to the screen display direction. When receiving image data, the source camera information of the image data can be obtained by reading the sending object of the image data.

[0082] The horizontal flip operation may refer to mirror-flipping the image data along the vertical center axis to achieve a left-right swap effect. Specifically, the transform attribute of the video tag may be set to scaleX(-1).

[0083] The benefit of this setting is that by horizontally flipping the video tag when the source camera information is the front camera, the movement direction of the face marker in the H5 page can be consistent with the movement direction of the user in reality, thereby optimizing the user experience.

[0084] S205, according to the image rendering requirements of the face marker points in the AR execution solution, based on the screen coordinates of the face marker points in the H5 page, obtain the AR image rendering result in the H5 page, and output the AR image rendering result.

[0085] The benefit of this setting is that by normalizing the world coordinates to obtain the standard device coordinates, and then determining the screen coordinates based on the standard device coordinates, the AR image rendering results in the subsequent H5 page can correctly adapt to the size and proportion of the screen.

[0086] Embodiment 3

[0087] Figure 3 It is a flowchart of an AR output method based on face positioning in an H5 page provided in Example 3 of the present application. This solution makes better improvements to the above-mentioned embodiments, and the specific improvements are: obtaining image data and performing face positioning on the image data, including: obtaining image data and performing face positioning on the image data through a MindAR plug-in; correspondingly, determining the world coordinates of the face marker points according to the face positioning results in the image data and the preset extraction rules of the face marker points, including: determining the world coordinates of the face marker points according to the face positioning results in the image data and the preset extraction rules of the face marker points through a MindAR plug-in.

[0088] like Figure 3 As shown, the specific steps include:

[0089] S301, acquiring image data, and performing face location on the image data through a MindAR plug-in;

[0090] The MindAR plugin is a script plugin for AR facial recognition tracking and AR object recognition based on the Three.js graphics library and the A-Frame web framework. The MindAR plugin can run on web browsers, mobile device browsers, and WebXR devices. A-Frame is a web framework for building virtual reality (VR) and augmented reality (AR) experiences, built on Three.js and providing a declarative HTML syntax.

[0091] To locate faces in image data through the MindAR plug-in, you can call the addFaceMesh method in the MindAR plug-in.

[0092] S302, determining the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rule of the face marker points through the MindAR plug-in;

[0093] To determine the world coordinates of the face markers, you can call the computeBoundingBox method in the MindAR plugin.

[0094] In this technical solution, optionally, obtaining image data and performing face location on the image data through a MindAR plug-in includes:

[0095] Obtain image data and call the addFaceMesh method in the MindAR plug-in to determine the face recognition contour of the user's face based on the image data;

[0096] Accordingly, the MindAR plug-in is used to determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rules of the face marker points, including:

[0097] The computeBoundingBox method in the MindAR plug-in is called to determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rule of the face marker points.

[0098] The addFaceMesh method is used to add a face mesh to the scene. A face mesh is a 3D model that can represent the shape and position of a face in an A-Frame scene. The following is a sample code that calls the addFaceMesh method:

[0099] <a-scene>

[0100] <a-entity id="face-entity"face-mesh>

[0101]

[0102] <script>

[0103] AFRAME.registerComponent('face-mesh',{

[0104] init:function(){

[0105] this.el.sceneEl.addFaceMesh(this.el);

[0106] }

[0107] });

[0108] < / script>

[0109] The computeBoundingBox method is a method used to calculate the bounding box of a 3D object. The bounding box is a rectangular area that can surround all points of the 3D object. The following is a sample code that calls the computeBoundingBox method:

[0110] AFRAME.registerComponent('compute-bounding-box',{

[0111] init:function(){

[0112] this.el.addEventListener('loaded',()=>{

[0113] const box=this.el.getObject3D('mesh').boundingBox;

[0114] console.log('Bounding box:');

[0115] console.log('-Position:',box.min.x,box.min.y,box.min.z,'-',box.max.x,box.max.y,box.max.z);

[0116] console.log('-Size:',box.max.x-box.min.x,box.max.y-box.min.y,box.max.z-box.min.z);

[0117] console.log('-Rotation:',this.el.object3D.rotation.x,this.el.object3D.rotation.y,this.el.object3D.rotation.z);

[0118] });

[0119] }

[0120] });

[0121] The benefit of this setting is that by using the addFaceMesh method and the computeBoundingBox method, the process of obtaining the face positioning results and determining the world coordinates of the face landmark points can be made more efficient.

[0122] S303, determining the screen coordinates of the face marker point in the H5 page according to the world coordinates of the face marker point;

[0123] S304, according to the image rendering requirements of the face marker points in the AR execution solution, based on the screen coordinates of the face marker points in the H5 page, obtain the AR image rendering result in the H5 page, and output the AR image rendering result.

[0124] Figure 4 : is a flowchart of an AR output method based on face positioning in an H5 page through a MindAR plug-in provided in Example 3 of the present application. Figure 4As shown, before performing face positioning on image data through the MindAR plug-in, it is necessary to first obtain the scene object, the camera object and the renderer object to initialize the MindAR plug-in. The initialized MindAR plug-in can perform face positioning on image data and output video stream data; after initializing the MindAR plug-in, by calling the addFaceMesh method, a facial contour object mesh can be obtained, and the facial contour object mesh is the face positioning result; after obtaining the facial contour object mesh, by calling the computeBoundingBox method of the geometry attribute of the facial contour object mesh, the world coordinates of the facial marker points in the frame image data can be obtained, and the obtained world coordinates are time-aligned with the video stream data obtained by calling the getUserMdia method to obtain the real-time changing world coordinates; by calling the vector3.project method in Three.js, the world coordinates can be normalized to the standard device coordinates, which can be further converted into the mobile phone screen coordinates for personalized interactive development on the H5 page.

[0125] The benefit of this solution is that by using the MindAR plug-in, the complex details of AR development can be abstracted, so that developers do not have to develop interactive logic at the AR level, thereby improving efficiency.

[0126] Embodiment 4

[0127] Figure 5 Schematic diagram of the structure of an AR output device based on face positioning in an H5 page provided in the fourth embodiment of the present application. Figure 5 As shown, the device comprises:

[0128] A face positioning module 510 is used to obtain image data and perform face positioning on the image data;

[0129] A world coordinate determination module 520, configured to determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rules of the face marker points;

[0130] A screen coordinate determination module 530, used to determine the screen coordinates of the face marker point in the H5 page according to the world coordinates of the face marker point;

[0131] The rendering result output module 540 is used to obtain the AR image rendering result in the H5 page based on the screen coordinates of the face marker points in the H5 page according to the image rendering requirements of the face marker points in the AR execution solution, and output the AR image rendering result.

[0132] In an embodiment of the present application, a face positioning module is used to obtain image data and perform face positioning on the image data; a world coordinate determination module is used to determine the world coordinates of the face marker points according to the face positioning results in the image data and the preset extraction rules of the face marker points; a screen coordinate determination module is used to determine the screen coordinates of the face marker points in the H5 page according to the world coordinates of the face marker points; a rendering result output module is used to obtain the AR image rendering result in the H5 page based on the screen coordinates of the face marker points in the H5 page according to the image rendering requirements for the face marker points in the AR execution scheme, and output the AR image rendering result. The above-mentioned AR output device based on face positioning in the H5 page can concentrate the development of the interactive logic on the H5 page by using AR technology to determine the world coordinates of the face marker points and convert the world coordinates into screen coordinates in the H5 page, so as to facilitate users to perform intuitive and convenient interactive operations.

[0133] The AR output device based on face positioning in the H5 page in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0134] The AR output device based on face positioning in the H5 page in the embodiment of the present application can be a device with an operating system. The operating system can be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0135] The AR output device based on face positioning in the H5 page provided in the embodiment of the present application can implement the various processes implemented in the above-mentioned embodiments one to three. To avoid repetition, they will not be repeated here.

[0136] Embodiment 5

[0137] like Figure 6As shown, an embodiment of the present application further provides an electronic device 600, including a processor 601, a memory 602, and a program or instruction stored in the memory 602 and executable on the processor 601. When the program or instruction is executed by the processor 601, each process of the above-mentioned AR output method embodiment based on face positioning in the H5 page is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0138] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0139] Embodiment 6

[0140] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned AR output method embodiment based on face positioning in the H5 page is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0141] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0142] Embodiment 7

[0143] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned AR output method embodiment based on face positioning in the H5 page, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0144] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0145] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0146] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0147] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

[0148] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. An AR output method based on face positioning in an H5 page, characterized in that: The method comprises: Acquire image data, and perform face location on the image data; Determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rule of the face marker points; Determine the screen coordinates of the face marker point in the H5 page according to the world coordinates of the face marker point; According to the image rendering requirements for the facial marker points in the AR execution solution, based on the screen coordinates of the facial marker points in the H5 page, the AR image rendering result in the H5 page is obtained, and the AR image rendering result is output.

2. The AR output method based on face positioning in H5 page according to claim 1, characterized in that: Determining the screen coordinates of the face marker point in the H5 page according to the world coordinates of the face marker point includes: Normalizing the world coordinates of the facial marker points to obtain standard device coordinates of the facial marker points; According to the standard device coordinates of the face marker points, the screen coordinates of the face marker points in the H5 page are determined.

3. The AR output method based on face positioning in H5 page according to claim 2, characterized in that: Determining the screen coordinates of the face marker points in the H5 page according to the standard device coordinates of the face marker points includes: Obtain the window display height and window display width of the image data on the H5 page; The screen coordinates of the face marker point in the H5 page are determined according to the window display height, the window display width and the standard device coordinates.

4. The AR output method based on face positioning in H5 page according to claim 3, characterized in that: After acquiring the image data, the method further includes: Insert the video tag into the current H5 page; Correspondingly, obtaining the window display height and window display width of the image data includes: The height information of the video tag is obtained as the window display height, and the width information of the video tag is obtained as the window display width.

5. The AR output method based on face positioning in H5 page according to claim 4, characterized in that: After inserting the video tag into the current H5 page, the method further includes: Obtaining source camera information of the image data; If the source camera information is a front camera, the video tag is horizontally flipped.

6. The AR output method based on face positioning in H5 page according to claim 1, characterized in that: Acquiring image data and performing face location on the image data includes: Acquire image data, and perform face location on the image data through the MindAR plug-in; Accordingly, according to the face positioning result in the image data and the preset extraction rule of the face landmark points, the world coordinates of the face landmark points are determined, including: The MindAR plug-in is used to determine the world coordinates of the facial marker points based on the face positioning results in the image data and the preset extraction rules of the facial marker points.

7. The AR-based face positioning output method according to claim 6, characterized in that: Acquire image data, and perform face location on the image data through the MindAR plug-in, including: Obtain image data and call the addFaceMesh method in the MindAR plug-in to locate the face of the image data; Accordingly, the MindAR plug-in is used to determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rules of the face marker points, including: The computeBoundingBox method in the MindAR plug-in is called to determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rule of the face marker points.

8. An AR output device based on face positioning in an H5 page, characterized in that: The device comprises: A face positioning module, used to obtain image data and perform face positioning on the image data; A world coordinate determination module, used to determine the world coordinates of the face marker points according to the face positioning result in the image data and the preset extraction rules of the face marker points; A screen coordinate determination module, used to determine the screen coordinates of the face marker point in the H5 page according to the world coordinates of the face marker point; The rendering result output module is used to obtain the AR image rendering result in the H5 page based on the screen coordinates of the face marker points in the H5 page according to the image rendering requirements of the face marker points in the AR execution solution, and output the AR image rendering result.

9. An electronic device, characterized in that: It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the AR output method based on face positioning in an H5 page are implemented as described in any one of claims 1 to 7.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the AR output method based on face positioning in the H5 page as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Interaction method, device and equipment and computer readable storage medium

    CN113867531A

  • Image processing method and device and storage medium

    CN117135454A

  • Methods and systems for measuring and modeling spaces using markerless photo-based augmented reality process

    US20200357132A1