Method and apparatus for generating region boundary in virtual space, electronic device and medium

By processing the density and smoothing of sampling points in the virtual environment, regular closed area boundaries are generated, which solves the obstacle collision problem caused by irregular and non-closed boundaries in the virtual environment and ensures user safety.

CN119741323BActive Publication Date: 2025-10-17VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411826003.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-10-17
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

In the prior art, the boundaries of regions in a virtual environment are irregular and not closed, which may cause users to collide with obstacles in the real environment when moving in the virtual environment, posing a danger to the users.

Method used

By obtaining the N first sampling points and their distance information of the outline of the preset area collected by the XR device in the real space, density processing is performed, intersecting path segments and noise sampling points are removed, a regular closed figure is formed, and its boundary is smoothed to obtain a regular and closed target area boundary.

Benefits of technology

The generated target area boundary is regular and closed in the virtual environment, and users can intuitively avoid collisions with obstacles in the real environment, thereby improving user safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119741323B_ABST
    Figure CN119741323B_ABST
Patent Text Reader

Abstract

The application discloses a region boundary generation method and device in a virtual space, electronic equipment and a medium, and belongs to the technical field of extended reality. The method comprises the following steps: according to the number of N first sampling points of the contour of a preset region collected by an XR device in a real space and the first distance information of the XR device to each first sampling point when each first sampling point is collected, performing sparsity processing on the N first sampling points to obtain M second sampling points; in the case that there is an intersecting path segment in a first path formed by the M second sampling points and the intersecting path segment encloses a closed region, removing the second sampling points enclosing the closed region, and forming a first closed figure with the second sampling points remaining in the M second sampling points; performing smoothing processing on the boundary of the first closed figure to obtain a second closed figure; fitting the first and last sampling points of the second closed figure to obtain a target region boundary, and the target region boundary is a boundary corresponding to the contour of the preset region in the virtual space.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of extended reality, and particularly relates to a method and device for generating a region boundary in a virtual space, an electronic device and a medium. BACKGROUND

[0002] When a user enters a virtual environment using an extended reality (XR) device, the user's field of view will be blocked by the virtual environment, and the user cannot know the situation of the real environment. At this time, the XR device will scan the real environment through a camera, a direct time of flight (dTof) sensor and the like to obtain an irregular environment boundary. The XR device will render the environment boundary to the virtual space through a security protection algorithm to provide a safety prompt to the user and prevent the user from colliding with an obstacle in the real environment when the user is active in the virtual environment.

[0003] Since the security protection algorithm needs to work in a closed region, the irregular and non-closed environment boundary in the real environment will affect the application effect and performance of the security protection algorithm. Moreover, the irregular and non-closed environment boundary of the real environment is also irregular and non-closed in the virtual environment when the boundary is rendered to the virtual space. If the boundary is irregular and non-closed, it will cause visual errors of the user and bring greater danger to the user. SUMMARY

[0004] The purpose of the embodiments of the application is to provide a method and device for generating a region boundary in a virtual space, an electronic device and a storage medium, so as to generate a regular and closed region boundary in a virtual environment, so that the user can intuitively see the regular and closed region boundary in the virtual environment and avoid colliding with an obstacle in the real environment when the user is active in the virtual environment.

[0005] In a first aspect, the embodiments of the application provide a method for generating a region boundary in a virtual space. The method is applied to an XR device, and the method comprises the following steps.

[0006] obtaining N first sampling points of an outline of a preset region collected by the XR device in a real space, and first distance information of the XR device to each first sampling point when each first sampling point is collected, and the preset region is free of obstacles;

[0007] performing sparsity processing on the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each first sampling point, to obtain M second sampling points, and M and N are positive integers;

[0008] In a case where there are intersecting path segments in a first path formed by the M second sampling points, and the intersecting path segments enclose a closed area, the second sampling points enclosing the closed area are removed, and the remaining second sampling points of the M second sampling points form a first closed graph, the first path being a path formed by sequentially connecting the M second sampling points in sampling order;

[0009] The boundary of the first closed graph is smoothed to obtain a second closed graph;

[0010] The first and last sampling points of the second closed graph are fitted to obtain a target region boundary, the target region boundary being a boundary corresponding to the contour of the preset region in a virtual space.

[0011] In a second aspect, an embodiment of the present application provides a region boundary generation device in a virtual space, the device being applied to an XR device, and the device comprising:

[0012] A first acquisition module is configured to acquire N first sampling points of a contour of a preset region collected by an XR device in a real space, and first distance information of the XR device to the first sampling points when each first sampling point is collected, and there is no obstacle in the preset region;

[0013] A first determination module is configured to perform sparsity processing on the N first sampling points according to a number of the N first sampling points and the first distance information corresponding to each first sampling point, to obtain M second sampling points, M and N being positive integers;

[0014] A second determination module is configured to, in a case where there are intersecting path segments in a first path formed by the M second sampling points, and the intersecting path segments enclose a closed area, remove the second sampling points enclosing the closed area, and form a first closed graph by the remaining second sampling points of the M second sampling points, the first path being a path formed by sequentially connecting the M second sampling points in sampling order;

[0015] A third determination module is configured to perform smoothing processing on a boundary of the first closed graph to obtain a second closed graph;

[0016] A fourth determination module is configured to fit first and last sampling points of the second closed graph to obtain a target region boundary, the target region boundary being a boundary corresponding to the contour of the preset region in a virtual space.

[0017] In a third aspect, an embodiment of the present application provides a readable storage medium, the readable storage medium storing a program or instructions, the program or instructions being executed by a processor to implement steps of the method according to the first aspect.

[0018] In a fourth aspect, an embodiment of the present application provides a chip, which comprises a processor and a communication interface, the communication interface is coupled with the processor, and the processor is configured to run programs or instructions to implement the method in the first aspect.

[0019] In a fifth aspect, an embodiment of the present application provides a computer program product stored in a storage medium, which is executed by at least one processor to implement the method in the first aspect.

[0020] In the embodiment of the present application, the N first sampling points are processed in density according to the number of the N first sampling points of the contour of the preset area collected by the XR device in the real space and the first distance information of the XR device to the first sampling point when each first sampling point is collected, M second sampling points are obtained, there are intersecting path segments in the first path composed of the M second sampling points, and the intersecting path segments enclose a closed area. In the case that the second sampling points enclosing the closed area are removed, the remaining second sampling points in the M second sampling points form a first closed graph, the boundary of the first closed graph is then smoothed to obtain a second closed graph, and the head and tail sampling points of the second closed graph are fitted to obtain the target region boundary. Thus, the target region boundary obtained by the scheme of the embodiment of the present application is regular and closed, and the user can intuitively see the regular and closed target region boundary in the virtual environment, thereby avoiding the user from colliding with the obstacles in the real environment when moving in the virtual environment. BRIEF DESCRIPTION OF DRAWINGS

[0021] Figure 1 FIG. 1 is a flowchart of a method for generating a region boundary in a virtual space according to some embodiments of the present application;

[0022] Figure 2 FIG. 3 is a schematic diagram of a first sampling point according to some embodiments of the present application;

[0023] Figure 3 FIG. 5 is a schematic diagram of a second sampling point according to some embodiments of the present application;

[0024] Figure 4 FIG. 7 is a schematic diagram of a first path according to some embodiments of the present application;

[0025] Figure 5 FIG. 9 is a schematic diagram of a generation process of a first closed graph according to some embodiments of the present application;

[0026] Figure 6 FIG. 11 is a schematic diagram of a generation process of a first closed graph according to some embodiments of the present application;

[0027] Figure 7 FIG. 13 is a schematic diagram of smoothing processing of a first closed graph according to some embodiments of the present application;

[0028] Figure 8 is a schematic view of the second closed figure provided by some embodiments of the present application;

[0029] Figure 9 is a schematic view of fitting the first sampling point of the second closed figure provided by some embodiments of the present application;

[0030] Figure 10 is a schematic view of the target region boundary provided by some embodiments of the present application;

[0031] Figure 11 is a partial schematic view of the target region boundary provided by some embodiments of the present application;

[0032] Figure 12 is a partial schematic view of the initial region boundary of the preset region provided by some embodiments of the present application;

[0033] Figure 13 is a flowchart of adjusting all thresholds in the target region boundary generation process provided by some embodiments of the present application;

[0034] Figure 14 is a structural schematic view of the region boundary generation apparatus in the virtual space shown by some embodiments of the present application;

[0035] Figure 15 is a structural schematic view of the electronic device shown by some embodiments of the present application;

[0036] Figure 16 is a hardware structural schematic view of the electronic device shown by some embodiments of the present application. DETAILED DESCRIPTION

[0037] The technical solutions in the embodiments of the present application will be described clearly below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.

[0038] 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 thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than that illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of a kind and do not limit the number of objects, for example, the first object can be one or N. In addition, "and / or" in the specification and claims indicates at least one of the connected objects, and the character " / ", generally indicates that the objects before and after are in an "or" relationship.

[0039] As described in the background, the prior art has a problem that the area boundary in the virtual environment is irregular and not closed, so that the user may collide with obstacles when moving in the real environment. To solve the above problem, the embodiments of the present application provide a virtual space area boundary generation method, device, electronic equipment and medium. The number of N first sampling points of the contour of the preset area collected by the XR device in the real space, and the first distance information of the XR device to the first sampling point when collecting each first sampling point are obtained, the N first sampling points are processed in density, M second sampling points are obtained, there are intersecting path segments in the first path composed of the M second sampling points, and the intersecting path segments form a closed area. In the case of forming a closed area, the second sampling points forming the closed area are removed, and the remaining second sampling points in the M second sampling points form a first closed figure. Then, the boundary of the first closed figure is smoothed to obtain a second closed figure, and the first and last sampling points of the second closed figure are fitted to obtain a target area boundary. Thus, the target area boundary obtained by the scheme of the embodiments of the present application is regular and closed, and the user can intuitively see the regular and closed target area boundary in the virtual environment, avoiding the user from colliding with obstacles in the real environment when moving in the virtual environment.

[0040] The technical scheme of the embodiments of the present application can be applied to the scene of processing irregular and non-closed area boundaries in the virtual environment.

[0041] The virtual space area boundary generation method provided by the embodiments of the present application will be described in detail below in combination with the drawings, specific embodiments and application scenarios.

[0042] Figure 1 is a flowchart of a virtual space area boundary generation method provided by the embodiments of the present application. The execution subject of the information processing method can be an XR device, which can be but is not limited to a virtual reality (VR) device or an augmented reality (AR) device, etc.

[0043] As Figure 1 shown in the method for generating a region boundary in a virtual space provided by the embodiments of the present application can include steps 110-150.

[0044] Step 110, obtaining N first sampling points of the contour of a preset region collected by an XR device in a real space, and first distance information of the XR device to each first sampling point when collecting the first sampling point.

[0045] The preset region can be a region in which there is no obstacle in the real space, i.e., there is no obstacle in the preset region.

[0046] The first sampling point can be a sampling point obtained by sampling the contour of the preset region.

[0047] For each first sampling point, the first distance information corresponding thereto can be distance information between the XR device and the first sampling point when collecting the first sampling point.

[0048] In some embodiments of the present application, the N first sampling points of the contour of the preset region can be collected by a handle of the XR device. Specifically, the handle of the XR device can have a ray emitting end that can emit a ray, and the emitted ray is projected onto the contour of the preset region, i.e., a first sampling point is obtained.

[0049] The handle of the XR device can also have a ray receiving end that can receive the feedback ray from the contour of the preset region, and then the distance between the sampling point projected onto the contour of the preset region and the handle of the XR device can be obtained according to the dTof algorithm in the dTof sensor, which is the first distance information.

[0050] Step 120, performing sparsity processing on the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each first sampling point, to obtain M second sampling points.

[0051] The M second sampling points can be sampling points obtained after sparsity processing on the N first sampling points. Here, M and N are both positive integers.

[0052] In some embodiments of the present application, the number of the N first sampling points and the first distance information corresponding to each first sampling point can be used to determine the dense region and the sparse region of the N first sampling points, and then the first sampling points in the dense region are subjected to deletion processing, and the first sampling points in the sparse region are subjected to compensation processing, so as to obtain M second sampling points. The specific implementation manner is as follows:

[0053] In some embodiments of the present application, when the first sampling points are collected by using the handle of the XR device, the speed at which the user draws by using the handle is not constant, and thus the sparsity of the collected first sampling points is also different, that is, some first sampling points are dense and some first sampling points are sparse, which leads to irregularity in determining the contour boundary of the preset region. Therefore, in order to ensure the regularity of the contour boundary of the preset region, step 120 can specifically include:

[0054] According to the number of N first sampling points and the first distance information corresponding to each first sampling point, the average value of the first distance information corresponding to the N first sampling points is calculated to obtain average distance information.

[0055] The distance information between each adjacent two first sampling points of the N first sampling points is obtained to obtain N second distance information.

[0056] According to the average distance information and each second distance information, the sparsity state of the line segment between the two first sampling points corresponding to each second distance information is determined.

[0057] According to the sparsity state of the line segment between each adjacent two first sampling points, the N first sampling points are processed in terms of sparsity to obtain M second sampling points.

[0058] The average distance information can be the average value of the first distance information corresponding to the N first sampling points, which is calculated according to the number of N first sampling points and the first distance information corresponding to each first sampling point.

[0059] The second distance information can be the distance information between adjacent two first sampling points in the N first sampling points.

[0060] The sparsity state can be the state of the sparsity of the line segment between each adjacent two first sampling points, and specifically, the sparsity state can be a sparse state or a dense state.

[0061] In some embodiments of the present application, according to the number of N first sampling points and the first distance information corresponding to each first sampling point, the average value of the first distance information corresponding to the N first sampling points can be calculated according to the following formula (1) to obtain average distance information:

[0062] L_avg=(L1+L2+…LN) / N (1)

[0063] In the above formula (1), L_avg is the average distance information.

[0064] Then, distance information between each two adjacent first sampling points of the N first sampling points is acquired to obtain N second distance information. According to the average distance information and each second distance information, the sparsity state of the line segment between the two first sampling points corresponding to each second distance information can be determined, that is, whether the line segment between the two first sampling points corresponding to each second distance information is sparse or dense is determined. Then, according to the sparsity state of the line segment between each two adjacent first sampling points, sparsity processing is performed on the N first sampling points to obtain M second sampling points.

[0065] In one example, N=11 is taken as an example, Figure 2 The schematic diagram of the 11 first sampling points collected is shown in FIG. 9. The 9 first sampling points are P1, P2, P3, …, P11 respectively. After the average value of the first distance information corresponding to P1, P2, P3, …, P11 is calculated according to the above formula (1) to obtain the average distance information L_avg, the distance information between each two adjacent first sampling points in P1, P2, P3, …, P11 is acquired to obtain 8 second distance information, that is, Figure 2 D1, D2, …, D11 in FIG. 10, and then according to the average distance information L_avg and D1, D2, …, D11, the sparsity state of the line segment between P1 and P2, the line segment between P2 and P3, …, the line segment between P8 and P9 can be determined. Then, according to the sparsity state of the line segment between P1 and P2, the line segment between P2 and P3, …, the line segment between P10 and P11, the line segment between P1 and P2, the line segment between P2 and P3, …, the line segment between P10 and P11 can be subjected to sparsity processing.

[0066] In the embodiments of the present application, by performing sparsity processing on the N first sampling points according to the sparsity state of the line segment between each two adjacent first sampling points, the sparsity degree between the first sampling points can be consistent, and thus the contour boundary of the preset region drawn can be more regular.

[0067] In some embodiments of the present application, in order to accurately determine the sparsity state of the line segment between the two first sampling points corresponding to each second distance information, the step of determining the sparsity state of the line segment between the two first sampling points corresponding to each second distance information according to the average distance information and each second distance information can specifically include:

[0068] The difference between the average distance information and each second distance information is calculated to obtain N difference values;

[0069] In a case where the difference value corresponding to the first target distance information is greater than a first preset difference threshold, it is determined that the sparsity state of the line segment corresponding to the first target distance information is a sparse state;

[0070] In a case where the difference corresponding to the first target distance information is less than a second preset difference threshold, the sparsity state of the line segment corresponding to the first target distance information is determined as the dense state.

[0071] The first target distance information can be any one of the second distance information.

[0072] The first preset difference threshold can be a maximum threshold of the difference corresponding to the first target distance information, which can be 1.5 for example, and the value of the first preset difference threshold can be set according to user demand.

[0073] The second preset difference threshold can be a minimum threshold of the difference corresponding to the first target distance information, which can be 0.5 for example, and the value of the second preset difference threshold can be set according to user demand.

[0074] In some embodiments of the present application, in a case where the difference corresponding to the first target distance information is greater than the first preset difference threshold, the sparsity state of the line segment corresponding to the first target distance information is determined as the sparse state, and in a case where the difference corresponding to the first target distance information is less than the second preset difference threshold, the sparsity state of the line segment corresponding to the first target distance information is determined as the dense state.

[0075] With reference to the above example, taking the first preset difference threshold as 1.5 and the second preset difference threshold as 0.5 for example, if the difference between the average distance information L_avg and D3-D6 and D9-D11 is between 0.5 and 1.5, and the difference between the average distance information L_avg and D1 and D2 is greater than 1.5, then the sparsity state of the line segment between P1 and P2 and the line segment between P3 and P4 is considered as the sparse state, and if the difference between the average distance information L_avg and D5 and D8 is less than 0.5, then the sparsity state of the line segment between P7 and P8 and the line segment between P8 and P9 is considered as the dense state.

[0076] In the embodiments of the present application, the sparsity state of the line segment corresponding to each second distance information is determined by the difference between the average distance information and each second distance information, so that the sparsity state of the line segment corresponding to each second distance information can be accurately determined.

[0077] In some embodiments of the present application, if the sparsity state of the line segment between two first sampling points is sparse, sampling point compensation processing is needed, and if the sparsity state of the line segment between two first sampling points is dense, part of the sampling points need to be deleted, that is, the sparsity processing of the N first sampling points according to the sparsity state of the line segment between each adjacent two first sampling points to obtain M second sampling points can specifically include:

[0078] In the case of determining that the sparsity state of the line segment between the first target sampling point and the second target sampling point is dense, the first target sampling point or the second target sampling point is removed.

[0079] In the case of determining that the sparsity state of the line segment between the first target sampling point and the second target sampling point is sparse, a sampling point is added between the first target sampling point and the second target sampling point.

[0080] The first target sampling point and the second target sampling point can be any adjacent two first sampling points in the N first sampling points, for example, the first target sampling point and the second target sampling point can be the first sampling point P1 and the first sampling point P2 in the N first sampling points. Figure 2

[0081] In some embodiments of the present application, if the sparsity state of the line segment between the first target sampling point and the second target sampling point is dense, the first target sampling point or the second target sampling point is removed, and if the sparsity state of the line segment between the first target sampling point and the second target sampling point is sparse, a sampling point is added between the first target sampling point and the second target sampling point.

[0082] Continuing to refer to the above example, the sparsity state of the line segment between P1 and P2 and the line segment between P2 and P3 is sparse, and a sampling point P12 can be added between P1 and P2 and a sampling point P13 can be added between P2 and P3 as shown in FIG. 4. Figure 3 The sparsity state of the line segment between P7 and P8 and the line segment between P8 and P9 is dense, and P7, P8 or P9 can be deleted, for example, P8 can be deleted, so that 12 second sampling points can be obtained.

[0083] ​It should be noted that in the case that the sparsity state of the line segment between the first target sampling point and the second target sampling point is dense, when the first target sampling point or the second target sampling point is removed, specifically, the distance (distance 1) between the second target sampling point and the first sampling point in front of the first target sampling point, and the distance (distance 2) between the first target sampling point and the first sampling point behind the second target sampling point are compared, and the sampling point corresponding to the smaller distance is removed, for example, if distance 1 is greater than distance 2, the first target sampling point corresponding to distance 2 is removed, so that the distance between the sampling points is larger.

[0084] For example, continuing to refer to the above example, the distance between P6 and P8 is 2.5, the distance between P8 and P9 is less than the second preset difference threshold 0.5, the distance between P8 and P10 is 2.1, and the distance between P7 and P9 is 1.6. If P7 is removed, the distance between P6 and P8 is too large, and a sampling point needs to be added between P6 and P7. If P9 is removed, the distance between P8 and P10 is also too large. If P8 is removed, the distance between P7 and P9 is between the first preset difference threshold and the second preset difference threshold, so P8 can be removed, and P7 and P9 are retained.

[0085] In the case that the sparsity state of the line segment between the first target sampling point and the second target sampling point is sparse, when a sampling point is added between the first target sampling point and the second target sampling point, the number of added sampling points can be set as required, and the distance between the two sampling points is preferably within a certain range, for example, within 1-1.5. The above example only illustrates the case of adding one sampling point, but it is not limited to adding only one sampling point.

[0086] In the embodiments of the present application, in the case that the sparsity state of the line segment between the first target sampling point and the second target sampling point is dense, the first target sampling point or the second target sampling point is removed, and in the case that the sparsity state of the line segment between the first target sampling point and the second target sampling point is sparse, a sampling point is added between the first target sampling point and the second target sampling point, so that the line segment between the first target sampling point and the second target sampling point can be accurately processed in sparse and dense states, and regular sampling points can be obtained, and then a regular contour boundary can be obtained.

[0087] In step 130, in the case that there is an intersecting path segment in the first path composed of M second sampling points, and the intersecting path segment encloses a closed area, the second sampling points enclosing the closed area are removed, and the remaining second sampling points in the M second sampling points form a first closed figure.

[0088] The first path may be a path formed by sequentially connecting M second sampling points in a sampling order.

[0089] Continuing with the above example, the 12 second sampling points are connected in sequence, that is, P1 is connected to P12, P12 is connected to P2, P2 is connected to P13, ..., P11 is connected to P1, so that the following can be obtained: Figure 4 The first path is shown.

[0090] The first closed image may be a closed figure formed by the remaining second sampling points in the M second sampling points after removing the second sampling points that form the closed area.

[0091] In some embodiments of the present application, since the areas enclosed by the sampling points may intersect during the process of collecting the sampling points of the outline of the preset area, and the actual safety zone required in the virtual space should be an area, what is drawn is the outline boundary of the preset area, and the boundaries cannot intersect, and the intersection affects the visual effect finally displayed in the virtual space, so it is necessary to process the intersecting areas.

[0092] Specifically, when there are intersecting path segments in the first path formed by the M second sampling points, and the intersecting path segments enclose a closed area, the second sampling points enclosing the closed area can be removed, and the remaining second sampling points of the M second sampling points form a first closed figure.

[0093] Continue to refer Figure 4 , Figure 4 The path segment formed by P6 and P7 in the first path shown intersects with the path segment formed by P10 and P11, and the intersecting path segments P6-P7 and P10-P11 can enclose a closed area 41. Then, the second sampling points P7, P10 and P9 that enclose the closed area 41 can be removed, and P6 and P11 can be connected. Then, the remaining second sampling points P1, P12, P2, P13, P3, P4, P5, P6 and P11 can form the following: Figure 5 The first closed figure 51 is shown.

[0094] In other embodiments of the present application, after the second sampling points forming the closed area are removed, the paths between the remaining sampling points will be interrupted. However, according to the solution of the embodiments of the present application, the remaining sampling points can also be connected to form a first closed figure.

[0095] In one example, reference Figure 6If the second sampling point P11 forms a closed area 601 with the path segment P10-P1 and the path segment P10-P11, the second sampling point P11 is removed, and the second sampling point P10 is connected with the second sampling point P1 to form a first closed graph 602.

[0096] In some embodiments of the present application, after obtaining the M second sampling points, there can be some second sampling points deviating from the target region, which are referred to as noise sampling points. In order to make the target region boundary more regular, the method described above can further include the following steps before step 130:

[0097] Removing the noise sampling points from the M second sampling points to obtain P third sampling points.

[0098] Step 130 can specifically include the following steps:

[0099] If there are intersecting path segments in the first path formed by the P third sampling points, and the intersecting path segments form a closed area, the second sampling points forming the closed area are removed, and the remaining second sampling points from the M second sampling points form a first closed graph.

[0100] The third sampling points can be the sampling points remaining after removing the noise sampling points from the M second sampling points. Here, P is a positive integer.

[0101] In some embodiments of the present application, before processing the intersecting area, the noise sampling points from the M second sampling points can be removed first to obtain P third sampling points. In this way, the processing of the intersecting area can be performed based on the P third sampling points, and a more regular first closed graph can be obtained.

[0102] In some embodiments of the present application, by removing the noise sampling points from the M second sampling points to obtain P third sampling points, the processing of the intersecting area can be performed based on the P third sampling points, and a more regular first closed graph can be obtained, and a more regular target region boundary can be obtained.

[0103] In some embodiments of the present application, in order to improve the efficiency and accuracy of removing the noise sampling points, the removing of the noise sampling points from the M second sampling points to obtain P third sampling points can specifically include the following steps:

[0104] Dividing the M second sampling points into at least one calculation window;

[0105] For each calculation window, the following steps are performed to remove the noise sampling points in the calculation window:

[0106] obtain position information of each second sampling point in the calculation window;

[0107] calculate an average value of the coordinate value of each coordinate axis of each second sampling point in the calculation window, to obtain an average coordinate value of the X axis, an average coordinate value of the Y axis, and an average coordinate value of the Z axis, respectively.

[0108] In a case where the coordinate value of the target axis of the third target sampling point is less than the preset coordinate value of the target axis, the coordinate value of the target axis of the third target sampling point is updated based on the coordinate value of the target axis of the third target sampling point and the average coordinate value of the target axis, to obtain an updated third target sampling point.

[0109] Each calculation window can include at least one second sampling point.

[0110] For each calculation window, the position information of each second sampling point in the calculation window can include the coordinate value of the X axis, the coordinate value of the Y axis, and the coordinate value of the Z axis of the second sampling point.

[0111] The third target sampling point can be any one of the second sampling points in the calculation window.

[0112] The target axis can be the X axis, the Y axis, and / or the Z axis.

[0113] The preset coordinate value of the target axis can be a coordinate value of the target axis that is set in advance, and the preset coordinate value of the target axis can be a coordinate value of the target axis that is set in advance and enables smooth connection between the third target sampling point and the second sampling point adjacent to the third target sampling point. The specific value of the preset coordinate value of the target axis can be set by a user as required, and is not limited in the embodiments of the present application.

[0114] In some embodiments of the present application, the M second sampling points can be divided into at least one calculation window, and thus the calculation is sequentially performed for each calculation window. In this way, the calculation amount is not too large at a time, and the calculation efficiency can be improved.

[0115] For each calculation window, the position information of each second sampling point in the calculation window can be obtained, and then an average value of the coordinate value of each coordinate axis of each second sampling point in the calculation window is calculated, to obtain an average coordinate value of the X axis, an average coordinate value of the Y axis, and an average coordinate value of the Z axis, respectively.

[0116] Continuing to refer to the above example, the position information of P1, P12, P2, P13, P3, P4, P5, P6, P7, P9, P10 and P11 can be obtained respectively, and then the average of the X-axis coordinate values of P1, P12, P2, P13, P3, P4, P5, P6, P7, P9, P10 and P11, the average of the Y-axis coordinate values of P1, P12, P2, P13, P3, P4, P5, P6, P7, P9, P10 and P11, and the average of the Z-axis coordinate values of P1, P12, P2, P13, P3, P4, P5, P6, P7, P9, P10 and P11 can be calculated respectively.

[0117] The average of the X-axis coordinate values of P1, P12, P2, P13, P3, P4, P5, P6, P7, P9, P10 and P11 can be calculated by using the following formula (2) for example:

[0118]

[0119] After obtaining the average of the coordinate values of each coordinate axis of each second sampling point in the calculation window, in a case where it is determined that the coordinate value of the target axis of the third target sampling point is less than the preset coordinate value of the target axis, the coordinate value of the target axis of the third target sampling point is updated based on the coordinate value of the target axis of the third target sampling point and the average coordinate value of the target axis, to obtain an updated third target sampling point.

[0120] That is, in a case where it is determined that the coordinate value of the X-axis of a certain second sampling point is less than the preset coordinate value of the X-axis, the coordinate value of the X-axis of the second sampling point is updated based on the coordinate value of the X-axis of the second sampling point and the average coordinate value of the X-axis.

[0121] In a case where it is determined that the coordinate value of the Y-axis of the second sampling point is less than the preset coordinate value of the Y-axis, the coordinate value of the Y-axis of the second sampling point is updated based on the coordinate value of the Y-axis of the second sampling point and the average coordinate value of the Y-axis.

[0122] In a case where it is determined that the coordinate value of the Z-axis of the second sampling point is less than the preset coordinate value of the Z-axis, the coordinate value of the Z-axis of the second sampling point is updated based on the coordinate value of the Z-axis of the second sampling point and the average coordinate value of the Z-axis.

[0123] In this way, the updated second sampling point can be obtained based on the updated coordinate value of the X-axis, the updated coordinate value of the Y-axis and / or the updated coordinate value of the Z-axis.

[0124] With reference to the above example, if the position of the second sampling point Pi deviates greatly, it can be determined whether the X-axis coordinate, the Y-axis coordinate and the Z-axis coordinate of the second sampling point Pi are respectively less than the corresponding preset coordinate values. If it is determined that the X-axis coordinate and the Y-axis coordinate of the second sampling point Pi are respectively less than the corresponding preset coordinate values, the X-axis coordinate of the second sampling point Pi can be updated according to the average coordinate value of the X-axis and the X-axis coordinate value of the second sampling point Pi, and the Y-axis coordinate of the second sampling point Pi can be updated according to the average coordinate value of the Y-axis and the Y-axis coordinate value of the second sampling point Pi.

[0125] In the embodiments of the present application, by dividing the M second sampling points into at least one calculation window, the second sampling points in each calculation window can be calculated in turn, and the noise sampling points in the calculation window can be removed. In this way, the calculation amount when removing the noise sampling points each time is not too large, and the efficiency of removing the noise sampling points is improved. In addition, for each calculation window, the noise sampling points are removed according to the position information of the second sampling points in the calculation window. In this way, the sampling points with large position information deviation can be accurately determined and removed, and the removal accuracy of the noise sampling points is improved.

[0126] In some embodiments of the present application, in order to accurately determine the coordinate value of the target axis of the updated third target sampling point, the coordinate value of the target axis of the third target sampling point is updated based on the coordinate value of the target axis of the third target sampling point and the average coordinate value of the target axis, to obtain an updated third target sampling point. Specifically, the method can include:

[0127] calculating the average of the average coordinate value of the target axis and the coordinate value of the target axis of the third target sampling point;

[0128] taking the average as the coordinate value of the target axis of the updated third target sampling point.

[0129] In some embodiments of the present application, the average of the average coordinate value of the target axis and the coordinate value of the target axis of the third target sampling point can be taken as the coordinate value of the target axis of the updated third target sampling point.

[0130] That is, if it is determined that the coordinate value of the X-axis of a second sampling point is less than the preset coordinate value of the X-axis, the average coordinate value of the X-axis and the average of the coordinate value of the X-axis of the second sampling point can be calculated, and then the average is taken as the updated coordinate value of the X-axis of the second sampling point. If it is determined that the coordinate value of the Y-axis of a second sampling point is less than the preset coordinate value of the Y-axis, the average coordinate value of the Y-axis and the average of the coordinate value of the Y-axis of the second sampling point can be calculated, and then the average is taken as the updated coordinate value of the Y-axis of the second sampling point. If it is determined that the coordinate value of the Z-axis of a second sampling point is less than the preset coordinate value of the Z-axis, the average coordinate value of the Z-axis and the average of the coordinate value of the Z-axis of the second sampling point can be calculated, and then the average is taken as the updated coordinate value of the Z-axis of the second sampling point.

[0131] With reference to the above example, taking the X-axis coordinate and the Y-axis coordinate of the second sampling point Pi as less than the corresponding preset coordinate value as an example, the average coordinate value of the X-axis and the average 1 of the X-axis coordinate value of the second sampling point Pi are calculated, and the average 1 is taken as the updated X-axis coordinate value of the second sampling point Pi. The average 2 of the average coordinate value of the Y-axis and the Y-axis coordinate value of the second sampling point Pi is calculated, and the average 2 is taken as the updated Y-axis coordinate value of the second sampling point Pi, to obtain the updated second sampling point Pi.

[0132] In the embodiments of the present application, the average of the average coordinate value of the target axis and the coordinate value of the target axis of the third target sampling point is taken as the coordinate value of the target axis of the updated third target sampling point, so that the coordinate value of the target axis of the updated third target sampling point can be accurately determined.

[0133] It should be noted that after obtaining the updated second sampling point Pi, the second sampling points can be sequentially connected in order, so that the first path can be obtained, and then the first closed figure can be obtained based on the first path.

[0134] In step 140, the boundary of the first closed figure is smoothed to obtain a second closed figure.

[0135] The second closed figure can be a closed figure obtained by smoothing the boundary of the first closed figure.

[0136] In some embodiments of the present application, in order to obtain a smooth target region boundary, step 140 can specifically include:

[0137] The following steps are performed for each adjacent three sampling points in the sampling points of the first closed figure to obtain the second closed figure:

[0138] The fourth target sampling point, the fifth target sampling point and the sixth target sampling point adjacent to each other are obtained.

[0139] connecting the fourth target sampling point and the sixth target sampling point based on a Bezier curve to obtain a candidate feature point;

[0140] obtaining a first direction vector between the fourth target sampling point and the sixth target sampling point, and a second direction vector between the fifth target sampling point and the candidate feature point;

[0141] determining, based on the first direction vector and the second direction vector, an included angle value of an included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point;

[0142] determining the target candidate feature point based on the included angle value.

[0143] The fourth target sampling point, the fifth target sampling point and the sixth target sampling point can be any three adjacent sampling points of the first closed graph. Specifically, the fourth target sampling point is located before the fifth target sampling point, the sixth target sampling point is located after the fifth target sampling point, and the included angle between the line connecting the fourth target sampling point and the fifth target sampling point and the line connecting the fifth target sampling point and the sixth target sampling point is greater than a preset included angle threshold.

[0144] The preset included angle threshold can be a preset threshold of the included angle between the line connecting the fourth target sampling point and the fifth target sampling point and the line connecting the fifth target sampling point and the sixth target sampling point, which can be 80°, for example. The value of the preset included angle threshold can be set according to user requirements, and is not limited in the embodiments of the present application.

[0145] Continuing to refer to Figure 5 Taking the fifth target sampling point as P1 and the preset included angle threshold as 80° as an example, the fourth target sampling point is P11 and the sixth target sampling point is P12. If the included angle between the line connecting P1 and P11 and the line connecting P1 and P12 is greater than 80°, it is considered that there is no way to connect P1, P11 and P12 by a smooth curve when P1, P12, P2, P13, P3, P4, P5, P6 and P11 are connected by a smooth curve to form a smooth boundary, as shown in Figure 5 .

[0146] The candidate feature point can be a point on the Bezier curve, which is a feature point that can smoothly connect the fourth target sampling point and the sixth target sampling point and has the smallest difference in position information from the fifth target sampling point.

[0147] Continuing to refer to the above example, as shown in Figure 7 , a smooth curve, such as a Bezier curve, can be drawn to connect P12 and P11. There is a point P1' on the Bezier curve that is closest to P1, and P11, P12 and the point can be connected by a smooth curve.

[0148] The first direction vector can be a direction vector between the fourth target sampling point and the sixth target sampling point.

[0149] The second direction vector can be a direction vector between the fifth target sampling point and the candidate feature point.

[0150] The target candidate feature point can be a feature point determined on the Bezier curve, which connects the fourth target sampling point and the sixth target sampling point smoothly, and which is the point with the smallest distance to the position information of the fifth target sampling point.

[0151] In some embodiments of the present application, for each three adjacent sampling points in the first closed figure, it is determined whether the included angle between the line connecting the middle sampling point (hereinafter referred to as a control point) and the sampling points before and after the control point (the sampling point before the control point is referred to as a start point, and the sampling point after the control point is referred to as an end point) is greater than a preset angle threshold. If not, the three sampling points do not need to be processed. If yes, the position of the middle sampling point is determined again in the following manner to form a second closed figure.

[0152] The start point and the end point are connected by a Bezier curve, and then a point (i.e., a target candidate feature point) is found on the Bezier curve such that the distance between the point and the control point is the smallest. The point is taken as a new control point, i.e., the position of the original control point is moved to the position of the point.

[0153] Specifically, the target candidate feature point is found on the Bezier curve. First, a candidate feature point B(t) is found by the following formula (3):

[0154] B(t) = (1-t) 2 ·P 起始点 + 2 · (1-t) · t · P 控制点 +t 2 ·P 结束点 (3)

[0155] In the above formula (3), t ranges from 0 to 1, P 起始点 represents the position information of the start point, P 控制点 represents the position information of the control point, and P 结束点 represents the position information of the end point.

[0156] Then, a first direction vector between the start point and the end point and a second direction vector between the control point and the candidate feature point are obtained, and based on the first direction vector and the second direction vector, an included angle value of an included angle formed by the candidate feature point, the end point and the start point can be determined according to the dot product calculation of the following formula (4), that is, the included angle value doubleres of the included angle between the line connecting the candidate feature point and the start point and the line connecting the candidate feature point and the end point can be determined according to the following formula (4):

[0157] doubleres = V1 _ x·V2 _ x+V1 _ y·V2 _ y+V1 _ z·V2 _ z (4)

[0158] In the above formula (4), V1 is the first direction vector, V2 is the second direction vector, V1_x is the component vector of the first direction vector in the X-axis direction, V1_y is the component vector of the first direction vector in the Y-axis direction, V1_z is the component vector of the first direction vector in the Z-axis direction, V2_x is the component vector of the second direction vector in the X-axis direction, V2_y is the component vector of the second direction vector in the Y-axis direction, and V2_z is the component vector of the second direction vector in the Z-axis direction.

[0159] After the included angle value of the included angle formed by the candidate feature point, the end point and the start point is obtained according to the above formula (4), the target candidate feature point can be determined based on the included angle value.

[0160] With reference to Figure 7 , in Figure 7 , P1 is the control point, P11 is the start point, and P12 is the end point. The position information of the candidate feature point on the Bezier curve can be obtained by substituting the position information of P1, the position information of P11 and the position information of P12 into the above formula (3). Then, the direction vector between P11 and the candidate feature point is the first direction vector, and the direction vector between the candidate feature point and P12 is the second direction vector. The first direction vector and the second direction vector are substituted into the above formula (4), so that the included angle value of the included angle θ between the line connecting P11 and the candidate feature point and the line connecting the candidate feature point and P12 can be obtained. According to the included angle value of the included angle θ, the target candidate feature point P1' can be determined.

[0161] In the embodiments of the present application, the smooth target region boundary can be obtained by smoothing each adjacent three sampling points in the first closed graph.

[0162] It should be noted that before the smoothing processing is performed on each adjacent three sampling points in the first closed graph in the manner of the above-mentioned formula (3) and formula (4), the sampling points in the first closed graph can be first smoothed once in the manner of the above-mentioned formula (2), and then the smoothed sampling points are smoothed in the manner of the above-mentioned formula (3) and formula (4), so that the sampling points in the first closed graph are gradually smoothed, thereby avoiding the problem that the smoothing effect is poor when the sampling points are directly smoothed in the manner of the above-mentioned formula (3) and formula (4).

[0163] In some embodiments of the present application, the first direction vector and the second direction vector can each include an X-axis direction sub-vector, a Y-axis direction sub-vector and a Z-axis direction sub-vector; in order to determine the included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point, the included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point is determined based on the first direction vector and the second direction vector, and specifically can include:

[0164] calculating the product of the X-axis direction sub-vector of the first direction vector and the X-axis direction sub-vector of the second direction vector to obtain an X-axis direction target sub-vector;

[0165] calculating the product of the Y-axis direction sub-vector of the first direction vector and the Y-axis direction sub-vector of the second direction vector to obtain a Y-axis direction target sub-vector;

[0166] calculating the product of the Z-axis direction sub-vector of the first direction vector and the Z-axis direction sub-vector of the second direction vector to obtain a Z-axis direction target sub-vector;

[0167] determining the sum of the X-axis direction target sub-vector, the Y-axis direction target sub-vector and the Z-axis direction target sub-vector as the included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point.

[0168] The X-axis direction target sub-vector can be the product of the X-axis direction sub-vector of the first direction vector and the X-axis direction sub-vector of the second direction vector, i.e. V1_x·V2_x in the above-mentioned formula (4).

[0169] The Y-axis direction target sub-vector can be the product of the Y-axis direction sub-vector of the first direction vector and the Y-axis direction sub-vector of the second direction vector, i.e. V1_y·V2_y in the above-mentioned formula (4).

[0170] The Z-axis direction target sub-vector can be the product of the Z-axis direction sub-vector of the first direction vector and the Z-axis direction sub-vector of the second direction vector, i.e. V1_z·V2_z in the above-mentioned formula (4).

[0171] In some embodiments of the present application, the product of the X-axis directional component of the first directional vector and the X-axis directional component of the second directional vector, the product of the Y-axis directional component of the first directional vector and the Y-axis directional component of the second directional vector, and the product of the Z-axis directional component of the first directional vector and the Z-axis directional component of the second directional vector are calculated respectively, and then the sum of the products is determined as the included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point, i.e. as shown in the above formula (4).

[0172] In some embodiments of the present application, the product of the X-axis directional component of the first directional vector and the X-axis directional component of the second directional vector, the product of the Y-axis directional component of the first directional vector and the Y-axis directional component of the second directional vector, and the product of the Z-axis directional component of the first directional vector and the Z-axis directional component of the second directional vector are calculated respectively, and then the sum of the products is determined as the included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point, i.e. as shown in the above formula (4).

[0173] In some embodiments of the present application, in order to accurately determine the target candidate feature point, the target candidate feature point is determined based on the included angle value, and specifically can include:

[0174] The candidate feature point corresponding to the included angle value of 90° is determined as the target candidate feature point.

[0175] In some embodiments of the present application, the value of t in the above formula (3) can be adjusted continuously, specifically, the value of t can be adjusted continuously starting from 0 with a step of 0.01 until the included angle value obtained according to the above formula (4) is 90°, and then the candidate feature point corresponding to the included angle value of 90° is determined as the target candidate feature point.

[0176] In some embodiments of the present application, the candidate feature point corresponding to the included angle value of 90° is determined as the target candidate feature point, so that the target candidate feature point can be accurately determined.

[0177] Step 150, fitting the head and tail sampling points of the second closed graph to obtain a target region boundary.

[0178] The target region boundary can be a boundary corresponding to the contour of the preset region in the virtual space, i.e. the contour boundary of the preset region finally displayed in the virtual space, and the target region boundary is regular and closed.

[0179] In some embodiments of the present application, after obtaining the second closed graph, the head and tail sampling points in the second closed graph can not be well closed, for example, the tail boundary is drawn too much, as shown in Figure 8In this case, the first and last sampling points of the second closed graph need to be fitted to obtain the closed target region boundary.

[0180] In some embodiments of the present application, to ensure the closure of the target region boundary, step 150 can specifically include:

[0181] The following steps are performed for the last Q sampling points of the second closed graph to obtain the target region boundary:

[0182] Obtain the included angle between the first sampling point and the i-th sampling point of the tail of the second closed graph;

[0183] In the case where it is determined that the included angle is less than the third threshold value, delete the i-th sampling point of the tail;

[0184] Update i to i+1;

[0185] Return to perform the steps of obtaining the included angle between the first sampling point and the i-th sampling point of the tail of the second closed graph, and deleting the i-th sampling point of the tail in the case where it is determined that the included angle is less than the third threshold value, until the included angle is greater than or equal to the third threshold value, to obtain the target tail sampling point.

[0186] Fit the first sampling point and the target tail sampling point of the second closed graph to obtain the target region boundary.

[0187] Wherein, Q is a positive integer, the initial value of i is 1, and i is counted from the last sampling point of the tail.

[0188] The third threshold value can be a pre-set threshold value of the included angle between the first sampling point and the i-th sampling point of the tail of the second closed graph, which can be, for example, 120°. The value of the third threshold value can be set according to user requirements, and is not limited in the embodiments of the present application.

[0189] The target tail sampling point can be the i-th sampling point of the tail corresponding to the case where the included angle between the first sampling point and the i-th sampling point of the tail of the second closed graph is greater than or equal to the third threshold value.

[0190] In some embodiments of the present application, for the last Q sampling points of the second closed graph, the last Q sampling points here can be the sampling points after the sampling point closed with the first sampling point among the tail sampling points of the second closed graph, such as Figure 9 As described above, the first sampling point P1 is closed with the tail sampling point P9, and the sampling points P15-P17 after the tail sampling point P9 are the last Q sampling points that need to be processed. The specific processing process is as follows:

[0191] First, the angle between the first sampling point and the last sampling point of the tail of the second closed figure is obtained, and it is determined whether the angle is less than a third threshold. If so, it is determined that the last sampling point of the tail is a sampling point that is drawn over, and the last sampling point of the tail can be deleted. Then, the second-to-last sampling point of the tail is processed, and the angle between the first sampling point and the second-to-last sampling point of the second closed figure is determined. It is determined whether the angle is less than the third threshold. If so, it is determined that the second-to-last sampling point of the tail is a sampling point that is drawn over, and the second-to-last sampling point of the tail can be deleted. The Q sampling points of the tail are processed in this way in sequence until the angle between a certain sampling point of the tail and the first sampling point of the second closed figure is greater than or equal to the third threshold. Then, the tail sampling point is determined as the target tail sampling point, and then the target tail sampling point is connected with the first sampling point of the second closed figure to obtain the closed target area boundary.

[0192] Continue to refer Figure 9 , taking the third threshold of 120° as an example, for the overdrawn sampling points P15-P17, as Figure 9 As shown, first determine whether the angle between the first sampling point P1 and the last sampling point P18 at the tail is less than 120°. If the angle between P1 and P17 is less than 120°, then delete P17. Then determine whether the angle between P1 and P16 is less than 120°. If the angle between P1 and P16 is less than 120°, then delete P16. Then determine whether the angle between P1 and P15 is less than 120°. If the angle between P1 and P15 is less than 120°, then delete P15. Then determine whether the angle between P1 and P9 is less than 120°. If the angle between P1 and P9 is not less than 120°, then retain P9 and use P9 as the target tail sampling point. Then connect P1 and P9 to obtain the following: Figure 10 The target area boundaries are shown.

[0193] In the embodiment of the present application, the tail Q sampling points are judged in sequence to avoid drawing a line segment that is too far at the tail, thereby ensuring the closure of the target area boundary.

[0194] In some embodiments of the present application, in order to obtain a target region boundary that is more consistent with an original region boundary of a preset region, fitting the first sampling point of the second closed figure with the target tail sampling point to obtain the target region boundary may include:

[0195] Fit the first sampling point of the second closed figure with the target tail sampling point to obtain the candidate region boundary;

[0196] Get the original area boundary of the preset area;

[0197] Determine the fit between the candidate region boundary and the original region;

[0198] When the degree of fit is less than or equal to a fourth threshold, adjusting each threshold in the process of determining the candidate region boundary, regenerating the candidate region boundary, and obtaining an updated candidate region boundary;

[0199] When it is determined that the degree of fit between the updated candidate region boundary and the original region boundary is greater than a fourth threshold, the updated candidate region boundary is determined as the target region boundary.

[0200] The candidate region boundary may be a region boundary obtained by fitting the first sampling point of the second closed figure and the target tail sampling point.

[0201] The original region boundary may be a region boundary of the preset region in the real space.

[0202] The fourth threshold may be a pre-set threshold for the degree of fit between the candidate region boundary and the original region. The fourth threshold may be, for example, 90%. The specific value of the fourth threshold may be set according to user needs and is not limited in the embodiments of the present application.

[0203] In some embodiments of the present application, after performing the above operations and obtaining the candidate area boundary, the candidate area boundary may not fit the original area boundary of the user-preset area well. At this time, it is necessary to adjust each threshold in the candidate area boundary determination process, regenerate the candidate area boundary, and obtain the updated candidate area boundary. Until the degree of fit between the updated candidate area boundary and the original area boundary is less than the fourth threshold, the updated candidate area boundary is determined as the target area boundary.

[0204] In one example, if Figure 11 and Figure 12 As shown, Figure 11 A partial schematic diagram of the determined candidate region boundary. Figure 12 is a partial schematic diagram of the original area boundary of the preset area, Figure 11 and Figure 12 It can be seen that Figure 11 The candidate region boundaries shown are Figure 12 The original region boundaries shown do not fit well, specifically Figure 11 The candidate region boundary shown in the figure has lost the details of the region boundary. The sampling points P20 and P21 should be protruding outwards, but after the above operation, the sampling points P20 and P21 are excessively smoothed, resulting in Figure 11The shown candidate region boundary loses the details of the region boundary, at this time, each threshold in the candidate region boundary determination process can be adjusted, the candidate region boundary is regenerated, and an updated candidate region boundary is obtained, until the updated candidate region boundary is less than the fourth threshold. The degree of fit of the original region boundary is determined as the target region boundary.

[0205] It should be noted that each threshold in the candidate region boundary determination process can be all thresholds involved in the candidate region boundary determination process, such as the first threshold, the second threshold and the third threshold described above, and the thresholds or parameters involved in the calculation formulas (1)-(4) described above, such as the parameter t involved in the calculation of the above formula (3), and the first preset difference threshold and the second preset difference threshold involved in the determination of the density state of the line segment corresponding to the first target distance information, the order of the Bezier curve used for smoothing the first closed graph, such as second order or third order, and the like.

[0206] In the embodiments of the present application, the degree of fit of the generated candidate region boundary and the original region boundary of the preset region can obtain a target region boundary that is more consistent with the original region boundary of the preset region.

[0207] In some embodiments of the present application, in order to accurately determine the degree of fit of the candidate region boundary and the original region boundary, the determination of the degree of fit of the candidate region boundary and the original region boundary can specifically include:

[0208] Comparing the candidate region boundary and the original region boundary to determine the fitting degree between the candidate region boundary and the original region boundary;

[0209] According to the angle between each two adjacent sampling points in the candidate region boundary and the angle between each two adjacent sampling points in the original region boundary, the smoothness of the candidate region boundary is determined;

[0210] Based on the fitting degree and the smoothness, the degree of fit of the candidate region boundary and the original region boundary is determined.

[0211] In some embodiments of the present application, the candidate region boundary and the original region boundary can be compared to determine the fitting degree between the candidate region boundary and the original region boundary, and then the angle between each two adjacent sampling points in the candidate region boundary and the angle between each two adjacent sampling points in the original region boundary are determined. The smoothness of the candidate region boundary is determined, and the fitting degree and the smoothness can be used to determine the degree of fit of the candidate region boundary and the original region boundary.

[0212] In some embodiments of the present application, the fitting degree between the candidate region boundary and the original region boundary is determined by comparing the candidate region boundary with the original region boundary, and the fitting degree between the candidate region boundary and the original region boundary can be determined as follows:

[0213] The candidate region boundary and the original region boundary are cut into small squares according to the horizontal and vertical unit value 1 respectively, and if a small square existing in the candidate region boundary also completely exists in the original region boundary, the small square is discarded and not processed. If a small square existing in the candidate region boundary partially exists in the original region boundary, or a small square existing in the original region boundary partially exists in the candidate region boundary, the numerator and the denominator are both added by 1. If a small square existing in the candidate region boundary does not completely exist in the original region boundary, the denominator is added by 1. After the small squares are counted, the ratio of the numerator to the denominator is calculated to obtain the fitting degree between the candidate region boundary and the original region boundary.

[0214] In some embodiments of the present application, the fitting degree between the candidate region boundary and the original region boundary, and the smoothness of the candidate region boundary are used to determine the fitting degree of the candidate region boundary and the original region boundary, and the fitting degree can be determined as the ratio of the fitting degree to the smoothness, that is, as shown in the following formula (5):

[0215] c=f / s (5)

[0216] Wherein, c is the fitting degree of the candidate region boundary and the original region boundary, f is the fitting degree between the candidate region boundary and the original region boundary, and s is the smoothness of the candidate region boundary.

[0217] In the embodiments of the present application, the fitting degree between the candidate region boundary and the original region boundary, and the smoothness of the candidate region boundary can be used to accurately determine the fitting degree of the candidate region boundary and the original region boundary.

[0218] In some embodiments of the present application, in order to accurately determine the smoothness of the candidate region boundary, the smoothness of the candidate region boundary can be determined according to the angle between each two adjacent sampling points in the candidate region boundary and the angle between each two adjacent sampling points in the original region boundary, and the determination can include:

[0219] The average value of the angle of each sampling point in the candidate region boundary is calculated to obtain a first average value;

[0220] The average value of the angle of each sampling point in the original region boundary is calculated to obtain a second average value;

[0221] The smoothness of the candidate region boundary is determined according to the first average value and the second average value.

[0222] Wherein, the first average value can be the average value of the angle of each sampling point in the candidate region boundary.

[0223] The second average value can be an average value of the angles of each sampling point in the original region boundary.

[0224] In some embodiments of the present application, an angle can be obtained for each three adjacent sampling points in the candidate region boundary, and a plurality of angle values can be obtained for the candidate region boundary, and the first average value can be obtained by averaging the plurality of angle values. Correspondingly, an angle can be obtained for each three adjacent sampling points in the original region boundary, and a plurality of angle values can be obtained for the original region boundary, and the second average value can be obtained by averaging the plurality of angle values.

[0225] The smoothness of the candidate region boundary can then be determined according to the first average value and the second average value, and specifically, the ratio of the first average value to the second average value can be determined as the smoothness of the candidate region boundary.

[0226] In embodiments of the present application, the first average value can be obtained by calculating the average value of the angles of each sampling point in the candidate region boundary, and the second average value can be obtained by calculating the average value of the angles of each sampling point in the original region boundary, and then the smoothness of the candidate region boundary can be accurately determined according to the first average value and the second average value.

[0227] In some embodiments of the present application, when adjusting each threshold value in the candidate region boundary generation process, the adjustment can be performed in the following manner:

[0228] Before step 110, the above-mentioned method can further include:

[0229] The following process is performed for each threshold value in the candidate region boundary generation process to obtain the target value of each threshold value:

[0230] The value of the jth threshold value in the candidate region boundary generation process is set to a first value, and the values of the other threshold values are set to a second value;

[0231] The adjustment of each threshold value in the candidate region boundary determination process, the regeneration of the candidate region boundary, and the obtaining of the updated candidate region boundary can include:

[0232] The first value is adjusted to obtain an updated first value;

[0233] The candidate region boundary is regenerated based on the updated first value and the second value to obtain an updated candidate region boundary;

[0234] The updated candidate region boundary is updated as the candidate region boundary, and the process of determining the degree of fit between the candidate region boundary and the original region boundary is returned. If the degree of fit is less than or equal to a fourth threshold, each threshold in the candidate region boundary determination process is adjusted, and the candidate region boundary is regenerated to obtain an updated candidate region boundary, until the degree of fit between the updated candidate region boundary and the original region boundary is greater than the fourth threshold, thereby obtaining a target value for the j-th threshold.

[0235] The first value may be the value of the jth threshold set during the candidate region boundary generation process, where j is a positive integer and its initial value is 1.

[0236] The second value may be a value of another threshold set during the generation process of the candidate region boundary.

[0237] The other thresholds here are the thresholds except the jth threshold in the candidate region boundary generation process. For example, if there are 10 thresholds involved in the candidate region boundary generation process and j = 1, the other thresholds are the other 9 thresholds except the first threshold.

[0238] It should be noted that the above-mentioned other thresholds are second values, which does not mean that the other thresholds are all set to the same value. The second value here is only to distinguish it from the value set for the j-th threshold, that is, for each of the other thresholds, it can have its corresponding second value, and the second value corresponding to each other threshold can be the same or different. The specific value depends on the value range of each other threshold and user needs, and is not limited in the embodiments of this application.

[0239] In some embodiments of the present application, the value of the first threshold in the candidate area boundary generation process is first set to a first value, and then the values ​​of other thresholds are set to second values. If the value based on the first threshold is the first value and the values ​​of other thresholds are the second thresholds, the obtained candidate area boundary has a degree of fit with the original area boundary of the preset area that is less than or equal to a fourth threshold, then the first value is readjusted, and the values ​​of other thresholds remain unchanged to obtain an updated first value. Then, based on the updated first and second values, the candidate area boundary is regenerated to obtain an updated candidate area boundary, and the degree of fit between the updated candidate area boundary and the original area boundary of the preset area is recalculated. If the degree of fit between the updated candidate area boundary and the original area boundary of the preset area is still less than or equal to the fourth threshold, then the first value is adjusted again, and the above operations are repeated until the degree of fit between the updated candidate area boundary and the original area boundary is greater than the fourth threshold, and the value of the first threshold at this time is determined as the target value of the first threshold.

[0240] After the target value of the first threshold is determined, the value of the first threshold is kept as the target value, and then the second threshold is adjusted. The adjustment manner is the same as that of the first threshold. The target value of the second threshold is obtained. In this way, the target values of all thresholds involved in the candidate region boundary generation process are obtained. The candidate region boundary obtained based on the target values is consistent with the original region boundary of the preset region. Therefore, the candidate region boundary obtained when all thresholds take the target values can be determined as the target region boundary.

[0241] It should be noted that when all thresholds are adjusted, all thresholds can be adjusted in units of 1 (or units of 0.01, 0.1). The specific adjustment manner can be set according to user requirements, which is not limited in the embodiment of the present application.

[0242] It should be noted that, taking the adjustment of the first threshold as an example, when the value of the first threshold is adjusted, the value of the first threshold at this time is determined as the target value of the first threshold, based on the determination that the consistency between the candidate region boundary obtained based on the value of the first threshold and the original region boundary of the preset region is greater than the fourth threshold. However, in actual operation, no matter how the adjustment is made, the consistency between the candidate region boundary and the original region boundary of the preset region cannot be greater than the fourth threshold. Only the consistency between the candidate region boundary and the original region boundary of the preset region can be infinitely close to the fourth threshold. For example, taking the fourth threshold of 90% as an example, when the first threshold is continuously adjusted, the consistency between the candidate region boundary and the original region boundary of the preset region is infinitely close to 90% as the value of the first threshold is adjusted, but cannot be greater than 90%. At this time, the adjustment of the first threshold can also be stopped when the number of times of adjusting the value of the first threshold reaches a certain number, and the second threshold is continuously adjusted. In this way, in the case that no matter how the adjustment is made, the consistency between the candidate region boundary and the original region boundary of the preset region cannot be greater than the fourth threshold, the other thresholds can be continuously adjusted to avoid the delay of the adjustment of other thresholds due to the adjustment of the threshold, and to ensure the generation of the target region boundary.

[0243] It should be noted that the above generation process of the target region boundary can be executed in a model. The input of the model is all thresholds in the generation process of the target region boundary, N first sampling points of the contour of the preset region collected by the XR device in the real space, first distance information of the XR device to the first sampling point when each first sampling point is collected, and position information of the N first sampling points. The output of the model is the consistency between the target region boundary and the original region boundary of the preset region, and the target region boundary.

[0244] In the embodiment of the present application, all the threshold values in the candidate region boundary generation process are continuously adjusted so that the generated candidate region boundary is more consistent with the original region boundary of the preset region, thereby improving the consistency of the generated target region boundary with the original region boundary of the preset region.

[0245] To better understand the adjustment process of all the threshold values in the candidate region boundary generation process, the flowchart of adjusting all the threshold values in the target region boundary generation process is provided as follows. Figure 13 As shown in the adjustment process of all the threshold values in the candidate region boundary generation process includes steps 1-4.

[0246] Step 1, select the jth threshold value, and configure the jth threshold value as a first numerical value.

[0247] In step 1, the initial value of j is 1.

[0248] Step 2, randomly configure the numerical values of other threshold values.

[0249] Step 3, determine whether the consistency of the generated candidate region boundary with the original region boundary of the preset region is greater than a fourth threshold value, if yes, execute step 4, if not, return to step 1 to adjust the value of the jth threshold value.

[0250] Step 4, obtain the target value of the jth threshold value.

[0251] The virtual space region boundary generation method provided in the embodiment of the present application can be executed by a virtual space region boundary generation device. In the embodiment of the present application, the virtual space region boundary generation device is taken as an example to execute the virtual space region boundary generation method, and the virtual space region boundary generation device provided in the embodiment of the present application is described.

[0252] Figure 14 is a structural schematic diagram of a virtual space region boundary generation device according to an exemplary embodiment, which is applied to an XR device. As shown in Figure 14 The virtual space region boundary generation device 1400 can include:

[0253] The first acquisition module 1410 is configured to acquire N first sampling points of the contour of a preset region collected by an XR device in a real space, and first distance information of the XR device to each of the first sampling points when each of the first sampling points is collected, and there is no obstacle in the preset region.

[0254] The first determination module 1420 is configured to perform sparsity processing on the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each of the first sampling points, to obtain M second sampling points, and M and N are both positive integers.

[0255] The second determining module 1430 is configured to remove the second sampling points that enclose the closed area and form a first closed graph by using the remaining second sampling points in the M second sampling points, in a case where there is an intersected path segment in a first path formed by the M second sampling points, and the intersected path segment encloses a closed area, wherein the first path is a path formed by sequentially connecting the M second sampling points in the sampling order.

[0256] The third determining module 1440 is configured to perform smoothing processing on the boundary of the first closed graph to obtain a second closed graph.

[0257] The fourth determining module 1450 is configured to fit the head and tail sampling points of the second closed graph to obtain a target region boundary, wherein the target region boundary is a boundary corresponding to the contour of the preset region in the virtual space.

[0258] In the embodiments of the present application, the number of N first sampling points of the contour of the preset region collected by the XR device in the real space, and the first distance information of the XR device to the first sampling points when each first sampling point is collected are used to perform sparsity processing on the N first sampling points to obtain M second sampling points. In a case where there is an intersected path segment in a first path formed by the M second sampling points, and the intersected path segment encloses a closed area, the second sampling points that enclose the closed area are removed, and the remaining second sampling points in the M second sampling points are used to form a first closed graph. Then, the boundary of the first closed graph is smoothed to obtain a second closed graph, and the head and tail sampling points of the second closed graph are fitted to obtain a target region boundary. Thus, the target region boundary obtained by the scheme of the embodiments of the present application is regular and closed. The user can intuitively see the regular and closed target region boundary in the virtual environment, and the user is prevented from colliding with the obstacles in the real environment when moving in the virtual environment.

[0259] In some embodiments of the present application, the first determining module 1420 can include:

[0260] The first determining unit is configured to calculate the average value of the first distance information corresponding to the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each first sampling point to obtain average distance information.

[0261] The second determining unit is configured to obtain the distance information between each two adjacent first sampling points of the N first sampling points to obtain N-1 second distance information.

[0262] a third determining unit, configured to determine a density state of a line segment between two first sampling points corresponding to each second distance information according to the average distance information and each second distance information;

[0263] a fourth determining unit, configured to perform density processing on the N first sampling points according to the density state of the line segment between each adjacent two first sampling points to obtain M second sampling points.

[0264] In some embodiments of the present application, the fourth determining unit is specifically configured to:

[0265] remove the first target sampling point or the second target sampling point in a case where the density state of the line segment between the first target sampling point and the second target sampling point is determined to be a dense state;

[0266] add a sampling point between the first target sampling point and the second target sampling point in a case where the density state of the line segment between the first target sampling point and the second target sampling point is determined to be a sparse state.

[0267] The first target sampling point and the second target sampling point are any adjacent two first sampling points in the N first sampling points.

[0268] In some embodiments of the present application, the device described above can further include:

[0269] a sampling point removing module, configured to remove the second sampling points forming a closed area in a case where there are intersecting path segments in the first path composed of the M second sampling points, and the intersecting path segments form a closed area, and remove noise sampling points in the M second sampling points before the second sampling points forming a first closed figure are removed from the M second sampling points, to obtain P third sampling points, P being a positive integer;

[0270] The second determining module 1430 is specifically configured to:

[0271] remove the second sampling points forming a closed area in a case where there are intersecting path segments in the first path composed of the P third sampling points, and the intersecting path segments form a closed area.

[0272] In some embodiments of the present application, the sampling point removing module includes:

[0273] a dividing unit, configured to divide the M second sampling points into at least one calculation window, each calculation window including at least one second sampling point;

[0274] The processing unit is configured to, for each calculation window, perform the following steps of removing noise sampling points in the calculation window: obtaining position information of each second sampling point in the calculation window, wherein the position information of each second sampling point comprises a coordinate value of the second sampling point on an X-axis, a coordinate value of the second sampling point on a Y-axis, and a coordinate value of the second sampling point on a Z-axis; calculating an average value of the coordinate value of each coordinate axis of each second sampling point in the calculation window to obtain an average coordinate value of the X-axis, an average coordinate value of the Y-axis, and an average coordinate value of the Z-axis; in a case where a coordinate value of a target axis of a third target sampling point is less than a preset coordinate value of the target axis, updating the coordinate value of the target axis of the third target sampling point based on the coordinate value of the target axis of the third target sampling point and the average coordinate value of the target axis to obtain an updated third target sampling point; wherein the third target sampling point is any one of the second sampling points in the calculation window, and the target axis is the X-axis, the Y-axis, and / or the Z-axis.

[0275] In some embodiments of the present application, the processing unit is specifically configured to:

[0276] calculating an average value of the average coordinate value of the target axis and the coordinate value of the target axis of the third target sampling point;

[0277] taking the average value as the coordinate value of the target axis of the updated third target sampling point.

[0278] In some embodiments of the present application, the third determination module 1440 is specifically configured to:

[0279] for each of the adjacent three sampling points in the sampling points of the first closed figure, performing the following steps to obtain a second closed figure:

[0280] obtaining a fourth target sampling point, a fifth target sampling point, and a sixth target sampling point, wherein the fourth target sampling point, the fifth target sampling point, and the sixth target sampling point are adjacent three sampling points in the sampling points of the first closed figure, the fourth target sampling point is located before the fifth target sampling point, the sixth target sampling point is located after the fifth target sampling point, and an included angle between a line connecting the fourth target sampling point and the fifth target sampling point and a line connecting the fifth target sampling point and the sixth target sampling point is greater than a preset included angle threshold;

[0281] connecting the fourth target sampling point and the sixth target sampling point based on a Bezier curve to obtain a candidate feature point, the candidate feature point being a feature point that connects the fourth target sampling point and the sixth target sampling point smoothly on the Bezier curve and has the smallest difference from position information of the fifth target sampling point;

[0282] obtaining a first direction vector between the fourth target sampling point and the sixth target sampling point, and a second direction vector between the fifth target sampling point and the candidate feature point;

[0283] determining, based on the first direction vector and the second direction vector, an included angle value of an included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point;

[0284] determining the target candidate feature point based on the included angle value.

[0285] In some embodiments of the present application, the first direction vector and the second direction vector each include an X-axis directional component vector, a Y-axis directional component vector and a Z-axis directional component vector.

[0286] The third determination module 1440 is specifically configured to:

[0287] calculate a product of an X-axis directional component vector of the first direction vector and an X-axis directional component vector of the second direction vector to obtain an X-axis directional target component vector;

[0288] calculate a product of a Y-axis directional component vector of the first direction vector and a Y-axis directional component vector of the second direction vector to obtain a Y-axis directional target component vector;

[0289] calculate a product of a Z-axis directional component vector of the first direction vector and a Z-axis directional component vector of the second direction vector to obtain a Z-axis directional target component vector;

[0290] determine a sum of the X-axis directional target component vector, the Y-axis directional target component vector and the Z-axis directional target component vector as the included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point.

[0291] The virtual space region boundary generation apparatus in the embodiments of the present application can be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other device than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), and can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, and the like. The embodiments of the present application are not limited in this regard.

[0292] The virtual space region boundary generation apparatus in the embodiments 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 system, and the embodiments of the present application are not limited in this regard.

[0293] The virtual space region boundary generation apparatus provided in the embodiments of the present application can implement the method embodiments Figure 3 The method embodiments implement various processes, and to avoid repetition, the details are not described herein.

[0294] Optionally, as shown in Figure 15 The embodiments of the present application also provide an electronic device 1500, which includes a processor 1501 and a memory 1502. The memory 1502 stores programs or instructions that can be run on the processor 1501. When the programs or instructions are executed by the processor 1501, various steps of the virtual space region boundary generation method embodiments described above are implemented, and the same technical effects are achieved. To avoid repetition, the details are not described herein.

[0295] It should be noted that the electronic device in the embodiments of the present application includes the mobile electronic device and the non-mobile electronic device described above.

[0296] Figure 16 To implement the hardware structure of an electronic device according to an embodiment of the present application.

[0297] The electronic device 1600 includes, but is not limited to, a radio frequency unit 1601, a network module 1602, an audio output unit 1603, an input unit 1604, a sensor 1605, a display unit 1606, a user input unit 1607, an interface unit 1608, a memory 1609, and a processor 1610, etc.

[0298] Those skilled in the art can understand that the electronic device 1600 can further include a power supply (such as a battery) for supplying power to each component, and the power supply can be logically connected to the processor 1610 through a power management system, so as to realize the functions of managing charging, discharging, and power consumption management through the power management system. Figure 16 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device can include more or fewer components than the figure, or combine certain components, or different component arrangements, which are not described here.

[0299] The processor 1610 is configured to: acquire N first sampling points of an outline of a preset region collected by an XR device in a real space, and first distance information of the XR device to each first sampling point when each first sampling point is collected, and there is no obstacle in the preset region; perform sparsity processing on the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each first sampling point, to obtain M second sampling points, M and N are positive integers; in a case where there are intersecting path segments in a first path formed by the M second sampling points, and the intersecting path segments enclose a closed region, remove the second sampling points enclosing the closed region, and form a first closed figure with the remaining second sampling points in the M second sampling points, the first path being a path formed by sequentially connecting the M second sampling points in sampling order; perform smoothing processing on a boundary of the first closed figure to obtain a second closed figure; and fit a head sampling point and a tail sampling point of the second closed figure to obtain a target region boundary, the target region boundary being a boundary corresponding to the outline of the preset region in a virtual space.

[0300] Thus, by the number of N first sampling points of the contour of the preset region collected by the XR device in the real space, and the first distance information of the XR device to each first sampling point when collecting each first sampling point, the N first sampling points are processed in density, M second sampling points are obtained, there are intersecting path segments in the first path formed by the M second sampling points, and the intersecting path segments enclose a closed area. In the case of enclosing a closed area, the second sampling points enclosing the closed area are removed, and the remaining second sampling points in the M second sampling points form a first closed figure. Then, the boundary of the first closed figure is smoothed to obtain a second closed figure, and the first and last sampling points of the second closed figure are fitted to obtain the target region boundary. Thus, the target region boundary obtained by the scheme of the embodiment of the present application is regular and closed, and the user can intuitively see the regular and closed target region boundary in the virtual environment, avoiding the user from colliding with the obstacles in the real environment when moving in the virtual environment.

[0301] Optionally, the processor 1610 is further configured to calculate an average value of the first distance information corresponding to the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each of the first sampling points, to obtain average distance information; obtain distance information between each two adjacent first sampling points of the N first sampling points, to obtain N second distance information; determine the density state of the line segment between the two first sampling points corresponding to each of the second distance information according to the average distance information and each of the second distance information; and perform density processing on the N first sampling points according to the density state of the line segment between each two adjacent first sampling points, to obtain M second sampling points.

[0302] Thus, by performing density processing on the N first sampling points according to the density state of the line segment between each two adjacent first sampling points, the density of the first sampling points can be consistent, and the contour boundary of the preset region drawn is more regular.

[0303] Optionally, the processor 1610 is further configured to remove the first target sampling point or the second target sampling point in the case of determining that the density state of the line segment between the first target sampling point and the second target sampling point is dense; and add a sampling point between the first target sampling point and the second target sampling point in the case of determining that the density state of the line segment between the first target sampling point and the second target sampling point is sparse; wherein the first target sampling point and the second target sampling point are any two adjacent first sampling points of the N first sampling points.

[0304] In this way, in a case where the density state of the line segment between the first target sampling point and the second target sampling point is determined to be the dense state, the first target sampling point or the second target sampling point is removed, in a case where the density state of the line segment between the first target sampling point and the second target sampling point is determined to be the sparse state, a sampling point is added between the first target sampling point and the second target sampling point, and in this way, the line segment between the first target sampling point and the second target sampling point can be accurately processed in the dense state and the sparse state, regular sampling points are obtained, and then a regular contour boundary can be obtained.

[0305] Optionally, the processor 1610 is further configured to remove noise sampling points in the M second sampling points to obtain P third sampling points, P being a positive integer; in a case where there is an intersecting path segment in a first path formed by the P third sampling points, and the intersecting path segment encloses a closed region, remove the second sampling points enclosing the closed region, and form a first closed graph with the remaining second sampling points in the M second sampling points.

[0306] In this way, by removing noise sampling points in the M second sampling points to obtain P third sampling points, the intersecting region can be processed based on the P third sampling points, and then a more regular first closed graph can be obtained, and then a more regular target region boundary can be obtained.

[0307] Optionally, the processor 1610 is further configured to divide the M second sampling points into at least one calculation window, each calculation window including at least one second sampling point; and perform the following steps for each calculation window: obtaining position information of each second sampling point in the calculation window, wherein the position information of each second sampling point includes a coordinate value of an X-axis, a coordinate value of a Y-axis, and a coordinate value of a Z-axis of the second sampling point; calculating an average value of the coordinate value of each coordinate axis of each second sampling point in the calculation window to obtain an average coordinate value of the X-axis, an average coordinate value of the Y-axis, and an average coordinate value of the Z-axis; in a case where a coordinate value of a target axis of a third target sampling point is determined to be less than a preset coordinate value of the target axis, updating the coordinate value of the target axis of the third target sampling point based on the coordinate value of the target axis of the third target sampling point and the average coordinate value of the target axis to obtain an updated third target sampling point; wherein the third target sampling point is any one second sampling point in the calculation window, and the target axis is the X-axis, the Y-axis, and / or the Z-axis.

[0308] Thus, by dividing the M second sampling points into at least one calculation window, the second sampling points in each calculation window can be sequentially calculated, and the noise sampling points in the calculation window can be removed. The calculation amount is not too large when removing the noise sampling points each time, and the efficiency of removing the noise sampling points is improved. In addition, for each calculation window, the noise sampling points are removed according to the position information of the second sampling points in the calculation window. Thus, the sampling points with large position information deviation can be accurately determined and removed, and the removal accuracy of the noise sampling points is improved.

[0309] Optionally, the processor 1610 is further configured to calculate an average value of the average coordinate value of the target axis and the coordinate value of the target axis of the third target sampling point; and take the average value as the coordinate value of the target axis of the updated third target sampling point.

[0310] Thus, the average value of the average coordinate value of the target axis and the coordinate value of the target axis of the third target sampling point is taken as the coordinate value of the target axis of the updated third target sampling point. Thus, the coordinate value of the target axis of the updated third target sampling point can be accurately determined.

[0311] Optionally, the processor 1610 is further configured to, for each three adjacent sampling points of the first closed graph, obtain a fourth target sampling point, a fifth target sampling point and a sixth target sampling point, wherein the fourth target sampling point, the fifth target sampling point and the sixth target sampling point are the three adjacent sampling points of the first closed graph, the fourth target sampling point is located before the fifth target sampling point, the sixth target sampling point is located after the fifth target sampling point, and an included angle between a line connecting the fourth target sampling point and the fifth target sampling point and a line connecting the fifth target sampling point and the sixth target sampling point is greater than a preset included angle threshold; connect the fourth target sampling point and the sixth target sampling point based on a Bezier curve to obtain a candidate feature point, the candidate feature point being a feature point that connects the fourth target sampling point and the sixth target sampling point smoothly on the Bezier curve and has the smallest difference from the position information of the fifth target sampling point; obtain a first direction vector between the fourth target sampling point and the sixth target sampling point and a second direction vector between the fifth target sampling point and the candidate feature point; determine an included angle value of an included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point based on the first direction vector and the second direction vector; and determine a target candidate feature point based on the included angle value.

[0312] Thus, by performing smoothing processing on each three adjacent sampling points in the first closed graph, a smooth target region boundary can be obtained.

[0313] Optionally, the first direction vector and the second direction vector each include an X-axis directional sub-vector, a Y-axis directional sub-vector and a Z-axis directional sub-vector; the processor 1610 is further configured to calculate a product of the X-axis directional sub-vector of the first direction vector and the X-axis directional sub-vector of the second direction vector to obtain an X-axis directional target sub-vector; calculate a product of the Y-axis directional sub-vector of the first direction vector and the Y-axis directional sub-vector of the second direction vector to obtain a Y-axis directional target sub-vector; calculate a product of the Z-axis directional sub-vector of the first direction vector and the Z-axis directional sub-vector of the second direction vector to obtain a Z-axis directional target sub-vector; and determine a sum of the X-axis directional target sub-vector, the Y-axis directional target sub-vector and the Z-axis directional target sub-vector as an included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point.

[0314] In this way, by calculating the product of the X-axis directional sub-vector of the first direction vector and the X-axis directional sub-vector of the second direction vector, the product of the Y-axis directional sub-vector of the first direction vector and the Y-axis directional sub-vector of the second direction vector, and the product of the Z-axis directional sub-vector of the first direction vector and the Z-axis directional sub-vector of the second direction vector respectively, and then determining the sum of the products as the included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point, the included angle value of the included angle formed by the candidate feature point, the fourth target sampling point and the sixth target sampling point can be accurately determined.

[0315] It should be understood that in the embodiments of the present application, the input unit 1604 can include a graphics processing unit (GPU) 16041 and a microphone 16042. The graphics processing unit 16041 processes image data of a still picture or a video obtained by an image capture device (such as a color camera) in a video capture mode or an image capture mode. The display unit 1606 can include a display panel 16061, which can be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1607 includes at least one of a touch panel 16071 and other input devices 16072. The touch panel 16071 is also called a touch screen. The touch panel 16071 can include a touch detection device and a touch controller. The other input devices 16072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), trackballs, mice, joysticks, and the like, which will not be described here.

[0316] The memory 1609 can be used to store software programs and various data. The memory 1609 can mainly include a first storage area storing programs or instructions and a second storage area storing data, wherein the first storage area can store an operating system, application programs or instructions required by at least one function (such as a sound playing function, an image playing function, etc.), and the like. In addition, the memory 1609 can include a volatile memory or a non-volatile memory, or the memory 1609 can include both volatile and non-volatile memories. The non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synch link DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The memory 1609 in the embodiments of the present application includes but is not limited to these and any other suitable types of memories.

[0317] The processor 1610 can include one or more processing units; optionally, the processor 1610 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and an application program, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1610.

[0318] The embodiments of the present application also provide a readable storage medium, and the readable storage medium stores programs or instructions, which are executed by a processor to realize each process of the above-mentioned virtual space region boundary generation method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein.

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

[0320] The embodiment of the present application further provides a chip, which comprises a processor and a communication interface, the communication interface is coupled with the processor, the processor is used for running programs or instructions to realize the processes of the above-mentioned method for generating region boundary in virtual space and achieve the same technical effects. To avoid repetition, details are not described herein.

[0321] It should be understood that the chip mentioned in the embodiment of the present application can also be referred to as a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0322] The embodiment of the present application provides a computer program product, which is stored in a storage medium, and is executed by at least one processor to realize the processes of the above-mentioned method for generating region boundary in virtual space and achieve the same technical effects. To avoid repetition, details are not described herein.

[0323] It should be noted that in this document, the term "comprising" or "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present application is not limited to the order of performing the functions as shown or discussed, but can also include performing the functions in a substantially simultaneous manner or in a reverse order, for example, the described method can be performed in an order different from the described order, and various steps can also be added, omitted or combined. In addition, the features described with reference to some examples can be combined in other examples.

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

[0325] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative and not restrictive. Those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the scope protected by the claims.

Claims

1. A method for generating a region boundary in a virtual space, characterized in that: The method is applied to an extended reality (XR) device, and the method includes: Obtaining N first sampling points of a contour of a preset area collected by an XR device in real space, and first distance information from the XR device to each first sampling point when collecting the first sampling point, where no obstacles exist within the preset area; Performing density processing on the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each of the first sampling points to obtain M second sampling points, where M and N are both positive integers; If there are intersecting path segments in the first path formed by the M second sampling points, and the intersecting path segments enclose a closed area, the second sampling points enclosing the closed area are removed, and the remaining second sampling points of the M second sampling points form a first closed graph, where the first path is a path formed by sequentially connecting the M second sampling points in a sampling order; Smoothing the boundary of the first closed figure to obtain a second closed figure; Fitting the first and last sampling points of the second closed figure to obtain a candidate area boundary, calculating a degree of fit between the candidate area boundary and an original area boundary of the preset area, adjusting the candidate area boundary based on a relationship between the degree of fit and a preset threshold, and determining the updated candidate area boundary as a target area boundary, where the target area boundary is a boundary corresponding to the outline of the preset area in virtual space, and the original area boundary is a region boundary of the preset area in real space.

2. The method according to claim 1, characterized in that The step of performing density processing on the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each first sampling point to obtain M second sampling points includes: Calculating an average of the first distance information corresponding to the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each of the first sampling points to obtain average distance information; Acquire distance information between every two adjacent first sampling points of N first sampling points to obtain N second distance information; determining, according to the average distance information and each piece of the second distance information, a density state of a line segment between two first sampling points corresponding to each piece of the second distance information; According to the density of the line segment between every two adjacent first sampling points, the N first sampling points are subjected to density processing to obtain M second sampling points.

3. The method according to claim 2, characterized in that The step of performing density processing on the N first sampling points according to the density of the line segment between each two adjacent first sampling points to obtain M second sampling points includes: When it is determined that the density state of the line segment between the first target sampling point and the second target sampling point is a dense state, removing the first target sampling point or the second target sampling point; When it is determined that the density state of the line segment between the first target sampling point and the second target sampling point is a sparse state, adding a sampling point between the first target sampling point and the second target sampling point; The first target sampling point and the second target sampling point are any two adjacent first sampling points among the N first sampling points.

4. The method according to claim 1, wherein In a case where intersecting path segments exist in the first path formed by the M second sampling points, and the intersecting path segments enclose a closed area, before removing the second sampling points enclosing the closed area and forming a first closed figure with the remaining second sampling points of the M second sampling points, the method further includes: Remove noise sampling points from the M second sampling points to obtain P third sampling points, where P is a positive integer; The method further comprises: when there are intersecting path segments in the first path formed by the M second sampling points, and the intersecting path segments enclose a closed area, removing the second sampling points enclosing the closed area, and forming a first closed figure with the remaining second sampling points of the M second sampling points. If there are intersecting path segments in the first path formed by the P third sampling points, and the intersecting path segments enclose a closed area, the second sampling points enclosing the closed area are removed, and the remaining second sampling points of the M second sampling points form a first closed figure.

5. The method according to claim 4, characterized in that The removing of noise sampling points from the M second sampling points to obtain P third sampling points includes: Divide the M second sampling points into at least one calculation window, each calculation window including at least one second sampling point; The following steps are performed for each calculation window to remove noise sampling points within the calculation window: Acquire position information of each second sampling point in the calculation window, wherein the position information of each second sampling point includes an X-axis coordinate value, a Y-axis coordinate value, and a Z-axis coordinate value of the second sampling point; Calculating an average value of the coordinate value of each coordinate axis of each second sampling point in the calculation window to obtain an average coordinate value of the X axis, an average coordinate value of the Y axis, and an average coordinate value of the Z axis respectively; If it is determined that the coordinate value of the target axis of the third target sampling point is less than the preset coordinate value of the target axis, updating the coordinate value of the target axis of the third target sampling point based on the coordinate value of the target axis of the third target sampling point and the average coordinate value of the target axis to obtain an updated third target sampling point; The third target sampling point is any second sampling point in the calculation window, and the target axis is the X axis, the Y axis and / or the Z axis.

6. The method according to claim 5, characterized in that The updating of the coordinate value of the target axis of the third target sampling point based on the coordinate value of the target axis of the third target sampling point and the average coordinate value of the target axis to obtain an updated third target sampling point includes: Calculating an average coordinate value of the target axis and an average coordinate value of the target axis of the third target sampling point; The average value is used as the updated coordinate value of the target axis of the third target sampling point.

7. The method according to claim 1, characterized in that The step of smoothing the first closed figure to obtain a second closed figure includes: The following steps are performed for every three adjacent sampling points of each sampling point of the first closed figure to obtain a second closed figure: Acquire a fourth target sampling point, a fifth target sampling point, and a sixth target sampling point that are adjacent to each other, wherein the fourth target sampling point, the fifth target sampling point, and the sixth target sampling point are three adjacent sampling points among the sampling points of the first closed figure, the fourth target sampling point is located before the fifth target sampling point, the sixth target sampling point is located after the fifth target sampling point, and an angle between a line connecting the fourth target sampling point and the fifth target sampling point and a line connecting the fifth target sampling point and the sixth target sampling point is greater than a preset angle threshold; Connecting the fourth target sampling point and the sixth target sampling point based on a Bezier curve to obtain a candidate feature point, where the candidate feature point is a feature point that smoothly connects the fourth target sampling point and the sixth target sampling point on the Bezier curve and has the smallest difference in position information with the fifth target sampling point; Acquire a first direction vector between the fourth target sampling point and the sixth target sampling point, and a second direction vector between the fifth target sampling point and the candidate feature point; Determining, based on the first direction vector and the second direction vector, an angle value of an angle formed by the candidate feature point, the fourth target sampling point, and the sixth target sampling point; Based on the angle value, a target candidate feature point is determined.

8. The method according to claim 7, characterized in that The first direction vector and the second direction vector each include an X-axis direction component vector, a Y-axis direction component vector and a Z-axis direction component vector; The determining, based on the first direction vector and the second direction vector, an angle value of an angle formed by the candidate feature point, the fourth target sampling point, and the sixth target sampling point includes: Calculating the product of the X-axis component of the first direction vector and the X-axis component of the second direction vector to obtain an X-axis target component vector; Calculate the product of the Y-axis component of the first direction vector and the Y-axis component of the second direction vector to obtain a Y-axis target component vector; Calculating the product of the Z-axis component of the first direction vector and the Z-axis component of the second direction vector to obtain a Z-axis target component vector; The sum of the X-axis direction target component vector, the Y-axis direction target component vector, and the Z-axis direction target component vector is determined as the angle value of the angle formed by the candidate feature point, the fourth target sampling point, and the sixth target sampling point.

9. A device for generating area boundaries in a virtual space, characterized in that: The device is applied to an extended reality (XR) device, and includes: A first acquisition module is configured to acquire N first sampling points of an outline of a preset area captured by an XR device in real space, and first distance information from the XR device to each first sampling point when the first sampling point is captured, wherein no obstacles exist in the preset area; a first determining module, configured to perform a density processing on the N first sampling points according to the number of the N first sampling points and the first distance information corresponding to each of the first sampling points, to obtain M second sampling points, where M and N are both positive integers; a second determining module configured to, if intersecting path segments exist in a first path formed by the M second sampling points and the intersecting path segments enclose a closed area, remove the second sampling points that enclose the closed area, and form a first closed graph with the remaining second sampling points of the M second sampling points, where the first path is a path formed by sequentially connecting the M second sampling points in a sampling order; a third determining module, configured to smooth the boundary of the first closed figure to obtain a second closed figure; a fourth determination module, configured to fit the first and last sampling points of the second closed figure to obtain a candidate area boundary, calculate a degree of fit between the candidate area boundary and the original area boundary of the preset area, adjust the candidate area boundary based on a relationship between the degree of fit and a preset threshold, and determine the updated candidate area boundary as a target area boundary, where the target area boundary is a boundary corresponding to the outline of the preset area in virtual space, and the original area boundary is a region boundary of the preset area in real space.

10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the method for generating an area boundary in a virtual space as described in any one of claims 1 to 8 are implemented.

11. 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 method for generating a region boundary in a virtual space according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Three-dimensional model adjustment method and device, storage medium and equipment

    CN114283266A

  • Virtual reality VR-based interface display method and device, electronic equipment and medium

    CN116755545A