Space plane detection method and device, computer equipment, storage medium and product
By mapping three-dimensional point cloud information into two-dimensional point cloud information and identifying plane candidate projection contours, the problem of low plane detection efficiency in mixed reality environments is solved and more efficient and accurate plane detection is achieved.
Patent Information
- Application Number
- CN202310297260.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-17
- Publication Date
- 2024-09-20
AI Technical Summary
Existing methods for detecting planes in mixed reality environments are time-consuming and inefficient. Methods based on deep neural networks have poor model generalization capabilities, resulting in poor detection results.
The three-dimensional point cloud information is mapped to the two-dimensional point cloud information, the candidate projection contour information of the plane is identified through the point cloud distribution characteristics, and then the three-dimensional plane point cloud information is determined to perform spatial plane detection, reducing detection difficulty and improving efficiency.
It improves the efficiency and effect of plane detection, converts plane detection in three-dimensional space into two-dimensional point cloud information processing, simplifies the detection process, and significantly improves detection accuracy and speed.
Smart Images

Figure CN118674775A
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and specifically to a spatial plane detection method, apparatus, computer equipment, storage medium and product, wherein the storage medium is a computer-readable storage medium and the product is a computer program product. Background Art
[0002] Mixed Reality (MR) refers to a new visual environment generated by merging the real environment and the virtual environment, including both augmented reality and augmented virtuality. For example, in a virtual reality (VR) headset, information about real scenes is superimposed on the virtual environment, or in an augmented reality (AR) device, virtual information is superimposed on the real environment. In the new visual environment, physical and digital objects coexist and can interact virtually. Virtual interaction refers to physical interaction between the virtual environment and the real environment, such as a virtual cat walking on the real ground and tabletop. Therefore, it is necessary to detect planes in the new visual environment to perform virtual interactions on the planes.
[0003] In a new visual environment, the search for planes usually uses the Random Sample Consensus (RANSAC) algorithm to directly detect planes from 3D point cloud information, or performs plane semantic segmentation based on a deep neural network model and fits the plane equation based on the segmented point cloud. The method of searching for fitted planes based on RANSAC directly extracts information in 3D space, which is time-consuming; while the method of directly segmenting point cloud planes based on deep neural networks is not yet mature, and the model generalization ability is relatively poor, resulting in poor plane detection effect and low efficiency. Summary of the invention
[0004] The embodiments of the present application provide a spatial plane detection method, apparatus, computer equipment, storage medium and product, which maps three-dimensional point cloud information into two-dimensional point cloud information, then identifies the candidate projection contour information of the plane by using point cloud distribution features, and then determines the three-dimensional plane point cloud information based on the two-dimensional candidate projection information, and then detects the plane from the target space based on the plane point cloud information. This scheme converts the problem of detecting a plane in three-dimensional space into the problem of detecting a plane in three-dimensional space based on two-dimensional point cloud information, thereby reducing the difficulty of plane detection and improving the efficiency and effect of plane detection.
[0005] An embodiment of the present application provides a spatial plane detection method, including:
[0006] Acquire three-dimensional point cloud information corresponding to the target space, and perform two-dimensional mapping on the three-dimensional point cloud information to obtain two-dimensional point cloud information of the target space;
[0007] Based on distribution characteristics of point clouds in the two-dimensional point cloud information, identifying candidate projection contour information belonging to at least one type of plane from the two-dimensional point cloud information;
[0008] Filtering plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection contour information, the plane point cloud information being the three-dimensional point cloud information corresponding to the plane in the target space;
[0009] Spatial plane detection is performed according to the plane point cloud information to obtain position information of the plane contained in the target space.
[0010] Accordingly, an embodiment of the present application further provides a spatial plane detection device, including:
[0011] An acquisition unit, used for acquiring three-dimensional point cloud information corresponding to the target space, performing two-dimensional mapping on the three-dimensional point cloud information, and obtaining two-dimensional point cloud information of the target space;
[0012] an identification unit, configured to identify candidate projection contour information belonging to at least one type of plane from the two-dimensional point cloud information based on distribution characteristics of point clouds in the two-dimensional point cloud information;
[0013] A screening unit, configured to select plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection profile information, wherein the plane point cloud information is the three-dimensional point cloud information corresponding to the plane in the target space;
[0014] The detection unit is used to perform spatial plane detection according to the plane point cloud information to obtain the position information of the plane contained in the target space.
[0015] In one embodiment, the at least one type of plane includes a vertical plane, and the screening unit comprises:
[0016] A de-mapping subunit, configured to perform de-mapping processing on the candidate projection contour information belonging to the vertical plane to obtain the position information of the candidate vertical plane corresponding to the candidate projection contour in the three-dimensional point cloud information;
[0017] The plane point cloud determination subunit is used to determine the plane point cloud information of the candidate vertical plane corresponding to the candidate projection contour in the three-dimensional point cloud information according to the position.
[0018] In one embodiment, the detection unit comprises:
[0019] A statistical subunit, used for performing statistical processing on the plane point cloud information of the candidate vertical plane to obtain the number of point clouds corresponding to the candidate vertical plane;
[0020] The position determination subunit is used to obtain the position information of the vertical plane contained in the target space according to the density distribution characteristics of the plane point cloud information corresponding to the candidate vertical plane if the number of the point clouds meets a preset number threshold.
[0021] In one embodiment, the identification unit includes:
[0022] A line segment detection subunit, configured to perform line segment detection on the two-dimensional point cloud information to obtain line segments contained in the two-dimensional point cloud information;
[0023] The contour determination subunit is used to use the line segment as candidate projection contour information of the vertical plane.
[0024] In one embodiment, the identification unit further includes:
[0025] A fitting subunit, used for acquiring the angle of the line segment, and performing fitting according to the angle of the line segment to obtain the alignment angle of the line segment;
[0026] The space alignment subunit is used to rotate the target space by the alignment angle to obtain an aligned target space, so as to perform space plane detection based on the aligned target space.
[0027] In one embodiment, the at least one type of plane includes a horizontal plane, and the screening unit comprises:
[0028] A calculation subunit, configured to calculate the area of a region surrounded by the candidate projection contour information according to the candidate projection contour information corresponding to the horizontal plane;
[0029] A selection subunit, configured to select target projection profile information from the candidate projection profile information based on the area;
[0030] The matching subunit is used to determine the point cloud information that matches the two-dimensional point cloud information corresponding to the target projection contour from the three-dimensional point cloud information to obtain the plane point cloud information.
[0031] In one embodiment, the matching subunit includes:
[0032] A generating module, used for generating an outer bounding rectangle according to the target projection contour information;
[0033] A mapping module is used to map the outer rectangle to the three-dimensional point cloud information to obtain the plane point cloud information corresponding to the outer rectangle in the three-dimensional point cloud information.
[0034] In one embodiment, the acquisition unit includes:
[0035] A point cloud acquisition subunit is used to obtain three-dimensional point cloud information corresponding to the target space;
[0036] A height determination subunit, used to determine the height distribution information of the target space according to the three-dimensional point cloud information, and determine the height of the plane existing in the target space;
[0037] The two-dimensional mapping subunit is used to perform two-dimensional mapping on the target space and the three-dimensional point cloud information corresponding to the height to obtain the two-dimensional point cloud information of the target space at the height.
[0038] In one embodiment, the acquisition unit includes:
[0039] The acquisition subunit is used to obtain the initial point cloud information corresponding to the target space through the acquisition device;
[0040] An alignment subunit, used for aligning the initial point cloud information with the gravity direction of the acquisition device to obtain aligned point cloud information;
[0041] The sampling subunit is used to perform sampling processing on the aligned point cloud information to obtain the three-dimensional point cloud information.
[0042] In one embodiment, the spatial plane detection device further includes:
[0043] A receiving unit, configured to receive a virtual interaction instruction for the plane in the target space;
[0044] The response unit is used to obtain corresponding virtual interaction resources in response to the virtual interaction instruction, and perform virtual interaction on the plane of the target space based on the virtual interaction resources.
[0045] Correspondingly, an embodiment of the present application also provides a computer device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any one of the spatial plane detection methods provided in the embodiments of the present application.
[0046] Correspondingly, an embodiment of the present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is loaded by a processor to execute any spatial plane detection method provided in the embodiment of the present application.
[0047] Correspondingly, an embodiment of the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, any one of the spatial plane detection methods provided in the embodiments of the present application is implemented.
[0048] In the embodiment of the present application, a computer device obtains three-dimensional point cloud information corresponding to a target space, performs two-dimensional mapping on the three-dimensional point cloud information, and obtains two-dimensional point cloud information of the target space; based on the distribution characteristics of the point cloud in the two-dimensional point cloud information, identifies candidate projection contour information of a plane belonging to at least one type from the two-dimensional point cloud information; based on the type of the plane and the candidate projection contour information, filters plane point cloud information from the three-dimensional point cloud information, the plane point cloud information being the three-dimensional point cloud information corresponding to the plane in the target space; performs spatial plane detection based on the plane point cloud information, and obtains position information of the plane contained in the target space.
[0049] The embodiment of the present application maps three-dimensional point cloud information into two-dimensional point cloud information, then identifies the candidate projection contour information of the plane by using point cloud distribution features, and then determines the three-dimensional plane point cloud information based on the two-dimensional candidate projection information, and then detects the plane from the target space based on the plane point cloud information. This solution converts the problem of detecting a plane in three-dimensional space into the problem of detecting a plane in three-dimensional space based on two-dimensional point cloud information, thereby reducing the difficulty of plane detection and improving the efficiency and effect of plane detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0051] Figure 1 is a scene graph of the spatial plane detection method provided in an embodiment of the present application;
[0052] Figure 2 is a flow chart of a spatial plane detection method provided in an embodiment of the present application;
[0053] Figure 3 is another flow chart of the spatial plane detection method provided by an embodiment of the present application;
[0054] Figure 4 is a schematic diagram of three-dimensional point cloud information provided by an embodiment of the present application;
[0055] Figure 5 is a schematic diagram of a density distribution curve provided in an embodiment of the present application;
[0056] Figure 6 is a schematic diagram of a local density distribution curve provided in an embodiment of the present application;
[0057] Figure 7 is another schematic diagram of a local density distribution curve provided in an embodiment of the present application;
[0058] Figure 8 is a schematic diagram of filtered three-dimensional point cloud information provided in an embodiment of the present application;
[0059] Figure 9a is a schematic diagram of two-dimensional point cloud information provided by an embodiment of the present application;
[0060] Figure 9b is a schematic diagram of two-dimensional point cloud information after equalization processing provided in an embodiment of the present application;
[0061] Fig.10a is a schematic diagram of line segment detection results provided by an embodiment of the present application;
[0062] Fig.10b is another schematic diagram of line segment detection results provided by an embodiment of the present application;
[0063] Fig.11 is a scatter plot of line segment angles provided in an embodiment of the present application;
[0064] Fig.12a is a schematic diagram of vertical surface detection results provided by an embodiment of the present application;
[0065] Figure 12b is another schematic diagram of vertical surface detection results provided by an embodiment of the present application;
[0066] Fig.13 is a schematic diagram of the height distribution of the target space provided in the embodiment of the present application;
[0067] Fig.14 is a schematic diagram of point cloud distribution about plane height provided in an embodiment of the present application;
[0068] Fig.15 is a schematic diagram of contour curve detection results provided in an embodiment of the present application;
[0069] Fig.16 is a schematic diagram of horizontal plane detection results provided by an embodiment of the present application;
[0070] Fig.17 is a schematic diagram of a spatial plane detection device provided in an embodiment of the present application;
[0071] Fig.18 It is a schematic diagram of the structure of the terminal provided in the embodiment of the present application. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0073] The embodiments of the present application provide a spatial plane detection method, device, computer equipment and computer readable storage medium. The spatial plane detection device can be integrated in a computer equipment, which can be a server or a terminal.
[0074] The terminal may include a mobile phone, a wearable smart device, a head-mounted display device, a VR device, an AR device, an MR device, a tablet computer, a laptop computer, a personal computer (PC), and a vehicle-mounted computer.
[0075] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.
[0076] For example, Figure 1 As shown, the computer device obtains the three-dimensional point cloud information corresponding to the target space, performs two-dimensional mapping on the three-dimensional point cloud information, and obtains the two-dimensional point cloud information of the target space; based on the distribution characteristics of the point cloud in the two-dimensional point cloud information, identifies candidate projection contour information of a plane belonging to at least one type from the two-dimensional point cloud information; according to the type of the plane and the candidate projection contour information, screens the plane point cloud information related to the plane in the target space from the three-dimensional point cloud information; performs spatial plane detection based on the plane point cloud information, and obtains the position information of the plane contained in the target space.
[0077] The embodiment of the present application maps three-dimensional point cloud information into two-dimensional point cloud information, then identifies the candidate projection contour information of the plane by using point cloud distribution features, and then determines the three-dimensional plane point cloud information based on the two-dimensional candidate projection information, and then detects the plane from the target space based on the plane point cloud information. This solution converts the problem of detecting a plane in three-dimensional space into the problem of detecting a plane in three-dimensional space based on two-dimensional point cloud information, thereby reducing the difficulty of plane detection and improving the efficiency and effect of plane detection.
[0078] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0079] This embodiment will be described from the perspective of a spatial plane detection device, which may be specifically integrated into a computer device, which may be a server or a terminal.
[0080] First, the application scenarios of the embodiments of the present application are introduced.
[0081] The embodiments of the present application can be applied to scenarios where it is necessary to detect planes in a space. For example, in mixed reality, virtual information can be superimposed on a real environment. It is necessary to first detect the planes existing in the real environment in order to display the virtual information on the plane and perform other virtual interactive operations. The embodiments of the present application can also be applied to space decoration scenarios. The planes contained in the video can be identified, such as walls and desktops. Users can change the color and pattern of the decorations on the walls and desktops to achieve the decorative effect of the preview space.
[0082] The embodiment of the present application can also be applied to game scenes. The video sequence of the player's space (i.e., the target space) can be collected through the head-mounted smart device worn by the player, and the player's space can be reconstructed in three dimensions through the video sequence to obtain the three-dimensional point cloud information of the player's space, and then plane detection can be performed based on the three-dimensional point cloud information to determine the planes such as the wall and desktop in the player's space. The virtual interaction command triggered by the player for the plane in the space can be responded to, and the corresponding virtual interaction operation can be performed to achieve the virtual interaction between the player and the target space. At the same time, the distance between the player and the plane in the space can be judged according to the player's current position in the space. When the player is too close to the plane, the player can be prompted to avoid the player colliding with the plane in the space and causing danger.
[0083] Optionally, game levels can be built based on the detected planes, and players can play games in the space they are in, thereby increasing their sense of immersion in the game.
[0084] Then, a brief description is given of the target space mentioned in the embodiments of the present application.
[0085] Target space: The target space can be a virtual space, which can also be called a virtual environment. The virtual space can be an artificially drawn space or a space generated by artificial intelligence (for example, a space generated by artificial intelligence based on keywords input by the user); the target space can also be a real space, which can also be called a real environment. The real space can be a space captured by a terminal device worn by the user. For example, the user wears a head-mounted display device, and the head-mounted display device captures a video sequence of the user's surroundings. The target space is reconstructed in three dimensions through the video sequence to obtain three-dimensional point cloud information of the target. The target space is the real space where the user is located. Based on the three-dimensional point cloud information, the reconstructed space corresponding to the target space can be further rendered.
[0086] The present application provides a spatial plane detection method, such as Figure 2 As shown, the specific process of the spatial plane detection method can be as follows:
[0087] 101. Obtain three-dimensional point cloud information corresponding to the target space, perform two-dimensional mapping on the three-dimensional point cloud information, and obtain two-dimensional point cloud information of the target space.
[0088] The three-dimensional point cloud information may include a point cloud set of the target space, and the three-dimensional point cloud information may include the position information of each point (for example, the x-, y- and z-axis coordinates of each point), color, time and other information.
[0089] The two-dimensional point cloud information may be a two-dimensional point cloud image obtained by projecting the three-dimensional point cloud information in a specified direction.
[0090] For example, a laser device can be used to collect point clouds of the target space to obtain three-dimensional point cloud information corresponding to the target space. The video sequence corresponding to the target space can also be reconstructed in three dimensions to obtain three-dimensional point cloud information of the target space. The video sequence can be collected by devices such as depth cameras, binocular cameras, or monocular cameras. The three-dimensional point cloud information corresponding to the target space can also be directly obtained from a database or other means. The above-mentioned device for collecting video sequences can be integrated on the terminal device worn by the user.
[0091] The 3D point cloud information is obtained by reconstructing the 3D space of the video sequence. Specifically, the depth map is obtained by stereo matching based on the video sequence collected by the binocular camera, and the posture is solved according to the real-time mapping and positioning (Simultaneous localization and mapping, SLAM) method, and the posture and depth map are fused to obtain the 3D point cloud information of the target space; the video sequence and posture collected by the monocular camera can be used for multi-view stereo vision (Multi-view stereo, MVS) processing to obtain the 3D point cloud information of the target space; the video sequence collected by the time of flight (Time offlight, ToF) camera can be used to obtain the 3D point cloud information of the target space by fusing the ToF depth through the SLAM posture.
[0092] The three-dimensional point cloud information can be projected in a bird's-eye view direction. If the three-dimensional point cloud information is collected based on a terminal device worn by the user, the bird's-eye view direction can be the user's line of sight direction, and two-dimensional point cloud information is obtained. The two-dimensional point cloud information projected in the bird's-eye view direction can be a bird's-eye view point cloud distribution map.
[0093] In one embodiment, a plane may be detected from three-dimensional point cloud information based on the Atlanta hypothesis. The Atlanta hypothesis assumes that planes in space are all horizontal planes or vertical planes. In the Manhattan hypothesis, different vertical planes are parallel or orthogonal, while the angles between vertical planes in the Atlanta hypothesis are arbitrary. Since the Atlanta hypothesis assumes that planes in space are all horizontal planes or vertical planes, the space may be first aligned with the gravity direction so that the planes in the vertical direction in the space are parallel to the gravity direction, that is, the step of "obtaining three-dimensional point cloud information corresponding to the target space" may specifically include:
[0094] Acquire the initial point cloud information corresponding to the target space through the acquisition device;
[0095] Align the initial point cloud information with the gravity direction of the acquisition device to obtain aligned point cloud information;
[0096] The aligned point cloud information is sampled and processed to obtain three-dimensional point cloud information.
[0097] The acquisition device may be a laser scanning device, a depth camera or a head-mounted smart device (such as VR glasses), specifically a binocular camera or a monocular camera on a head-mounted smart device. The acquisition device may be pre-configured with an inertial measurement unit (IMU), which can be used to detect and measure acceleration and rotational motion sensors. The acquisition device may also be pre-configured with a simultaneous localization and mapping system (SLAM).
[0098] For example, the obtained space, the target space can be the real environment where the user is currently located, and the point cloud obtained by point cloud acquisition of the target space can be used for three-dimensional modeling to obtain the reconstructed space corresponding to the target space.
[0099] The initial point cloud information may be obtained by collecting point clouds of a target space through a collection device, and the initial point cloud information is a three-dimensional point cloud set.
[0100] The direction of gravity can be detected by an IMU unit on the acquisition device, or by a SLAM system on the acquisition device.
[0101] The z-axis direction in the initial point cloud information is rotated to be aligned with the gravity direction to align the initial point cloud information and obtain aligned point cloud information.
[0102] The aligned point cloud information can be used as three-dimensional point cloud information, or the aligned point cloud information can be sampled to obtain three-dimensional point cloud information, thereby reducing the data volume of the three-dimensional point cloud information and improving the plane detection speed. The aligned point cloud information can be sampled uniformly based on voxels. Voxels can also be called voxels, which is short for volume pixels. Voxels are conceptually similar to the smallest unit of two-dimensional space - pixels, which are used in video data of two-dimensional computer images. As the name suggests, volume pixels are the smallest unit of digital data in three-dimensional space partitions.
[0103] The planes in the target space may include a vertical plane and a horizontal plane. When detecting the vertical plane, the entire three-dimensional point cloud information may be two-dimensionally mapped. Since the horizontal plane is at a certain height, when detecting the horizontal plane, only the point cloud information within a certain height range in the three-dimensional point cloud information may be two-dimensionally mapped. That is, in one embodiment, the step of "obtaining the three-dimensional point cloud information corresponding to the target space, performing two-dimensional mapping on the three-dimensional point cloud information, and obtaining the two-dimensional point cloud information of the target space" may specifically include:
[0104] Obtain the three-dimensional point cloud information corresponding to the target space;
[0105] Determine the height distribution information of the target space according to the three-dimensional point cloud information, and determine the height of the plane existing in the target space;
[0106] The three-dimensional point cloud information corresponding to the target space and the height is two-dimensionally mapped to obtain the two-dimensional point cloud information of the target space at the height.
[0107] For example, the three-dimensional point cloud information corresponding to the target space is obtained, and the height distribution information of the target space is determined according to the height information in the three-dimensional point cloud information. The height distribution information can be used to represent the height density distribution of the three-dimensional point cloud information, that is, it can represent the number of point clouds at each height of the three-dimensional point cloud information. If there are more points at a certain height in the three-dimensional point cloud information, it can be considered that there is a horizontal plane at this height in the target space. Therefore, the height of the horizontal plane can be determined according to the height distribution information of the three-dimensional point cloud information.
[0108] The point cloud information corresponding to the height in the three-dimensional point cloud information (for example, the point cloud at the height or the point cloud at and near the height) is two-dimensionally mapped to obtain the two-dimensional point cloud information corresponding to the target space at the height.
[0109] The embodiments of the present application can be applied to virtual hybrid scenes. In the virtual hybrid scenes, the user can wear a head-mounted display device and move the head-mounted display to obtain the environment of interest. The head-mounted display device can collect a video sequence corresponding to the user's surrounding environment, generate a dense point cloud in real time based on the video sequence, obtain the target space and the corresponding three-dimensional point cloud information, and detect the plane from the three-dimensional point cloud information, so that the user can respond to the virtual interaction with the target space. That is, in one embodiment, after the step of "performing spatial plane detection according to the plane point cloud information to obtain the position information of the plane contained in the target space", the plane detection method provided in the embodiment of the present application can also specifically include:
[0110] receiving a virtual interaction instruction for a plane in a target space;
[0111] In response to the virtual interaction instruction, a corresponding virtual interaction resource is acquired, and a virtual interaction operation is performed on the plane of the target space based on the virtual interaction resource.
[0112] Among them, the virtual interaction instruction can be an instruction triggered by the user for interacting in the target space. The user can trigger the virtual interaction instruction by clicking with a finger in the target space, or by voice or the like.
[0113] Virtual activity resources may be data resources required for responding to virtual interaction instructions, such as image data and text data.
[0114] Virtual interactive operations can be performed by displaying images or videos in the target space through rendering or other processing, or by updating the colors on the plane.
[0115] For example, in response to a virtual interaction instruction, a corresponding virtual interaction resource is obtained, and based on the virtual interaction resource, a corresponding virtual interaction operation is performed on the plane of the target space. Specifically, if the virtual interaction instruction indicates watching a football game on plane a of the target space, the video resource of the football game that the user wants to watch can be obtained, and the video resource can be rendered to display the video resource on plane a in the target space. For another example, if the virtual interaction instruction indicates changing the color of wall b of the space to red, the color channel value corresponding to red can be obtained, or a red image can be obtained, and then wall b can be processed to change the color of wall b to red. It can be understood that the user of the target space for virtual interaction can render according to the three-dimensional point cloud information to obtain a space for image or video display of the target space.
[0116] The embodiments of the present application can be applied to game scenes related to mixed reality. For example, a player can wear a head display and enter a game. After the head display performs a three-dimensional reconstruction of the player's space, the reconstructed space is displayed to the player through the head display. The player can arrange the space, for example, change the color of the wall in the space, hang decorations on the wall, and raise pets, etc. The server can plan the movement route of the moving object in the space according to the plane in the space. For example, if the player adds a sweeping robot or raises a pet in the space, the server can plan the movement route of the moving object according to the category of the moving object and the type of plane. The sweeping robot moves on the floor, and the pet can move on the horizontal plane such as the floor, sofa, and desktop, etc.
[0117] 102. Based on distribution characteristics of point clouds in the two-dimensional point cloud information, identify candidate projection contour information belonging to at least one type of plane from the two-dimensional point cloud information.
[0118] The at least one type of plane may include a vertical plane and a horizontal plane.
[0119] For a vertical plane, the step of “identifying candidate projection profile information of at least one type of plane from the two-dimensional point cloud information based on distribution characteristics of the point cloud in the two-dimensional point cloud information” may specifically include:
[0120] Perform line segment detection on the two-dimensional point cloud information to obtain the line segments contained in the two-dimensional point cloud information;
[0121] The line segment is used as the candidate projection contour information of the vertical plane.
[0122] For example, line segment detection can be performed based on the distribution characteristics of the point cloud in the two-dimensional points to obtain the line segments contained in the two-dimensional point cloud information, and the line segments can be used as candidate projection contour information of the vertical plane, so as to determine the plane point cloud data corresponding to the vertical plane from the three-dimensional point cloud information based on the candidate projection contour information.
[0123] For a horizontal plane, a closed contour curve can be detected from the two-dimensional point cloud information to obtain candidate projection contour information of the horizontal plane.
[0124] There are many vertical surfaces in the indoor space (for example, the sides of walls and furniture, etc.), and their directions are usually parallel or perpendicular to each other. The direction that appears most frequently among the directions of the vertical surfaces is called the main direction of the space. The main direction of the space can be used to optimize some planes that are parallel and perpendicular to the main direction. Therefore, the space can be aligned based on the main direction so that its main direction is 0°, so as to optimize the direction of the planes that are parallel or perpendicular to the main direction in the target space presented by the three-dimensional point cloud information. That is, in one embodiment, after the step of "performing line segment detection on the two-dimensional point cloud information to obtain the line segments contained in the two-dimensional point cloud information", the plane detection method provided in the embodiment of the present application may also specifically include:
[0125] Get the angle of the line segment, and perform fitting based on the angle of the line segment to obtain the alignment angle of the line segment;
[0126] The target space is rotated by the alignment angle to obtain an aligned target space, so as to perform spatial plane detection based on the aligned target space.
[0127] For example, the angle of the line segment obtained by line segment detection on the two-dimensional point cloud information is obtained, and the angle of the line segment is mapped to between 0° and 90°. For example, 90° is subtracted from the angle of the line segment with an angle greater than 90° to obtain the converted angle. According to the angle of the line segment with an angle less than 90° and the converted angle of the line segment greater than 90°, a scatter plot of the angle is obtained.
[0128] Then, a straight line fitting is performed based on the scatter plot to obtain the alignment angle of the line segment included in the two-dimensional point cloud information, and the target space is rotated by the alignment angle to obtain the aligned target space. Subsequent steps 103-104 can be processed based on the aligned target space.
[0129] It is understandable that if the target space is a virtual space, the target space can be directly rotated and aligned at an angle; if the target space is a real space, the three-dimensional point cloud information or the space rotation alignment angle obtained based on the three-dimensional point cloud information can be used.
[0130] 103. According to the type of the plane and the candidate projection contour information, the plane point cloud information is filtered from the three-dimensional point cloud information, where the plane point cloud information is the three-dimensional point cloud information corresponding to the plane in the target space.
[0131] The plane point cloud information may include a three-dimensional point cloud corresponding to the area of the plane in the target space.
[0132] For example, for a vertical plane, the candidate projection profile information may be pulled into the three-dimensional space to obtain the position of the corresponding plane in the three-dimensional point cloud information, and the plane point cloud information corresponding to the plane is determined according to the position. That is, in one embodiment, at least one type of plane includes a vertical plane, and the step of "selecting the plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection profile information" may specifically include:
[0133] Performing inverse mapping processing on the candidate projection contour information belonging to the vertical plane to obtain the position information of the candidate vertical plane corresponding to the candidate projection contour in the three-dimensional point cloud information;
[0134] Plane point cloud information of a candidate vertical plane corresponding to the candidate projection contour in the three-dimensional point cloud information is determined according to the position.
[0135] For example, the candidate projection contour information related to the vertical plane can be inversely mapped, and the two-dimensional candidate projection contour information can be projected into the three-dimensional space. According to the position of the candidate projection contour information projected into the three-dimensional space, the position information of the candidate vertical plane corresponding to the candidate projection contour information in the three-dimensional point cloud information can be determined, and the plane point cloud information corresponding to the candidate vertical plane in the three-dimensional point cloud information can be determined based on the position information.
[0136] For horizontal planes, horizontal planes with too small an area may be planes formed by some small objects, such as cup lids of water cups, beverage bottles, etc., and can be screened according to the size of the area surrounded by the candidate projection profile information to select a plane of appropriate size. That is, in one embodiment, at least one type of plane includes a horizontal plane, and the step of "screening plane point cloud information from three-dimensional point cloud information according to the type of plane and the candidate projection profile information" can specifically include:
[0137] According to the candidate projection contour information corresponding to the horizontal plane, the area of the region surrounded by the candidate projection contour information is calculated;
[0138] Selecting target projection profile information from candidate projection profile information based on area;
[0139] The point cloud information matching the two-dimensional point cloud information corresponding to the target projection contour information is determined from the three-dimensional point cloud information to obtain the plane point cloud information.
[0140] For example, the area of the region enclosed by the candidate projection contour information may be calculated, and an area threshold may be pre-set to filter out the candidate projection contour information whose area size of the enclosed region is smaller than the area threshold, and obtain the candidate projection contour information whose area size of the enclosed region is greater than or equal to the area threshold, and use it as the target projection contour information.
[0141] The two-dimensional point cloud information surrounded by the target projection contour information can be considered as the projection of the horizontal plane in the three-dimensional point cloud information in the two-dimensional point cloud. Therefore, the point cloud information in the three-dimensional point cloud information that matches the two-dimensional point cloud information surrounded by the target projection contour information can be used as the plane point cloud information of the plane.
[0142] In some scenarios, the shape of the plane in space is generally regular, such as rectangular or circular, or in some scenarios, there are requirements for the shape of the plane. A plane that meets the required shape, such as a rectangular plane, can be determined based on the target projection contour information, and then based on the generated two-dimensional plane with a regular shape, the corresponding three-dimensional plane is detected in the three-dimensional point cloud information. That is, in one embodiment, the step of "determining point cloud information matching the two-dimensional point cloud information corresponding to the target projection contour from the three-dimensional point cloud information to obtain the plane point cloud information" can specifically include:
[0143] Generate an outer rectangle according to the target projection contour information;
[0144] The outer bounding rectangle is mapped to the three-dimensional point cloud information to obtain the plane point cloud information corresponding to the outer bounding rectangle in the three-dimensional point cloud information.
[0145] For example, the target projection contour information may be extracted from an outer rectangle, the outer rectangle may include the target projection contour, and the outer rectangle may be a rectangle with the minimum area that can include the target projection contour.
[0146] By mapping the bounding rectangle to the three-dimensional space of the three-dimensional point cloud information, a rectangle corresponding to the two-dimensional bounding rectangle can be generated in the three-dimensional point information. The three-dimensional point cloud information contained in the three-dimensional rectangle is the plane point cloud information corresponding to the two-dimensional bounding rectangle.
[0147] 104. Perform spatial plane detection based on the plane point cloud information to obtain the position information of the plane contained in the target space.
[0148] For example, for a horizontal plane, a plane formed by a rectangle corresponding to the outer rectangle in three-dimensional space is used as the plane detected in the target space, and the position of the rectangle in the three-dimensional space corresponding to the three-dimensional point cloud information is the position information of the plane.
[0149] For the vertical plane, since the entire three-dimensional point cloud information is mapped two-dimensionally, the obtained two-dimensional point cloud information contains not only the projection of the vertical plane, but also the projection of the horizontal plane. In order to avoid misidentifying the contour of the horizontal plane as the contour of the vertical plane, the vertical plane with a smaller number of point clouds can be filtered according to the number of point clouds contained in the plane point cloud information of the vertical plane.
[0150] In the target space, there may be horizontal planes whose two-dimensional side projections are line segments. These sides are usually very narrow and cannot be used as planes for virtual interaction. The area of such vertical planes is very small, so the number of corresponding point clouds is small. Therefore, such vertical planes can be eliminated according to the number of point clouds contained in the plane point cloud information. That is, in one embodiment, the step of "performing spatial plane detection according to the plane point cloud information to obtain the position information of the plane contained in the target space" can specifically include:
[0151] Performing statistical processing on the plane point cloud information of the candidate vertical plane to obtain the number of point clouds corresponding to the candidate vertical plane;
[0152] If the number of point clouds meets a preset number threshold, the position information of the vertical plane contained in the target space is obtained according to the density distribution characteristics of the plane point cloud information corresponding to the candidate vertical plane.
[0153] Among them, the density distribution feature of the plane point cloud information can be the point cloud distribution density of the plane point cloud information at each height. For example, the number of point clouds at each height in the plane point cloud can be counted, and then the number of point clouds can be normalized to obtain the point cloud density corresponding to each height, and then the density distribution feature of the plane point cloud information corresponding to the candidate vertical plane can be obtained.
[0154] For example, the mobile device can count the number of point clouds corresponding to each candidate vertical plane to obtain the number of point clouds contained in each candidate vertical plane. If the number of point clouds is less than a preset number threshold, the candidate vertical plane is considered to be a vertical plane with a smaller area, and the candidate vertical plane is filtered.
[0155] For a candidate vertical plane whose point cloud quantity is greater than or equal to a preset quantity threshold, density distribution information about the height of the plane point cloud data corresponding to the candidate vertical plane may be calculated.
[0156] The density distribution information can count the number of point clouds corresponding to each height (or height interval), and determine the maximum number of point clouds. The number of point clouds at each height is divided by the maximum number of point clouds, and the number of point clouds at each height is mapped to the interval (0,1] to obtain the point cloud density at each height. Then, the longest continuous area with a density greater than 0.5 is selected, and the minimum height of the longest continuous area is used as the lower boundary of the vertical plane in height, and the maximum height is used as the upper boundary of the vertical plane in height to obtain the height information of the vertical plane, so as to detect the vertical plane in the three-dimensional point cloud information.
[0157] As can be seen from the above, the computer device in the embodiment of the present application obtains three-dimensional point cloud information corresponding to the target space, performs two-dimensional mapping on the three-dimensional point cloud information, and obtains two-dimensional point cloud information of the target space; based on the distribution characteristics of the point cloud in the two-dimensional point cloud information, identifies candidate projection contour information of a plane belonging to at least one type from the two-dimensional point cloud information; according to the type of the plane and the candidate projection contour information, screens plane point cloud information from the three-dimensional point cloud information, the plane point cloud information being the three-dimensional point cloud information corresponding to the plane in the target space; performs spatial plane detection based on the plane point cloud information to obtain position information of the plane contained in the target space.
[0158] The embodiment of the present application maps three-dimensional point cloud information into two-dimensional point cloud information, then identifies the candidate projection contour information of the plane by using point cloud distribution features, and then determines the three-dimensional plane point cloud information based on the two-dimensional candidate projection information, and then detects the plane from the target space based on the plane point cloud information. This solution converts the problem of detecting a plane in three-dimensional space into the problem of detecting a plane in three-dimensional space based on two-dimensional point cloud information, thereby reducing the difficulty of plane detection and improving the efficiency and effect of plane detection.
[0159] Based on the above embodiments, further detailed description will be given below with examples.
[0160] This embodiment will take the application in virtual reality scenarios as an example, specifically taking the scenario of superimposing virtual information in a real environment as an example, and will be described from the perspective of a spatial plane detection device. The spatial plane detection device can be specifically integrated in a server, or in a mobile device worn by a user. The mobile device can be a head-mounted smart device. The following will be explained using the example of the spatial plane detection device being integrated in a mobile device.
[0161] The present application provides a spatial plane detection method, such as Figure 3 As shown, the specific process of the spatial plane detection method can be as follows:
[0162] 201. The mobile device obtains a video sequence corresponding to the target space, performs three-dimensional reconstruction on the video sequence, and obtains three-dimensional point cloud information corresponding to the target space.
[0163] For example, a user may wear a mobile device and control the mobile device to capture a video sequence corresponding to the target space.
[0164] There are existing methods for detecting planes from three-dimensional space. The method for detecting planes based on scene understanding requires the acquisition of a complete spatial structure, and then the spatial structure is perceived, analyzed, and interpreted to determine the plane in the space. Compared with the method for detecting planes based on scene understanding, the embodiment of the present application projects the three-dimensional point cloud information into a two-dimensional space, and detects the plane from the three-dimensional point cloud information through line segments and closed contours, without the need for structural connections in the space. Therefore, the embodiment of the present application does not need to acquire a complete spatial structure, and can only reconstruct the area of interest to the user in the environment. The embodiment of the present application has strong flexibility in spatial plane detection, and when only part of the area in the environment needs to be reconstructed, the plane detection efficiency of the embodiment of the present application is high.
[0165] Since the embodiments of the present application can perform three-dimensional reconstruction on only a partial area of the user's environment, the mobile device can display the plane detection results to the user in real time, guiding the user to control the mobile device to collect the video sequence corresponding to the spatial area where the plane detection has not yet been completed, thereby improving the efficiency of spatial plane detection.
[0166] Based on the video sequence, a dense point cloud can be generated in real time, such as Figure 4 The three-dimensional point cloud information shown is obtained, and the target space is three-dimensionally reconstructed based on the three-dimensional point cloud information to obtain the three-dimensional point cloud information.
[0167] In one embodiment, planes can be detected from three-dimensional point cloud information based on the Atlanta hypothesis. The Atlanta hypothesis assumes that planes in space are all horizontal planes or vertical planes. In the Manhattan hypothesis, different vertical planes are parallel or orthogonal, while the angles between vertical planes in the Atlanta hypothesis are arbitrary. Since the Atlanta hypothesis assumes that planes in space are all horizontal planes or vertical planes, the space can be aligned with the direction of gravity first so that the planes in the vertical direction in the space are parallel to the direction of gravity.
[0168] For example, the direction of gravity can be detected by an IMU unit on a mobile device, or by a SLAM system on a mobile device. The z-axis direction in the initial point cloud information obtained by a video sequence acquired by the mobile device is rotated to the direction of gravity to align the initial point cloud information to obtain aligned point cloud information, and then the aligned point cloud information is uniformly sampled based on voxels.
[0169] 202. The mobile device projects the three-dimensional point cloud information in a bird's-eye view direction to obtain two-dimensional point cloud information of the target space in the bird's-eye view direction.
[0170] The bird's-eye view direction may be the direction of a line of sight looking down at the target space from a certain position in the air.
[0171] For example, the mobile device projects the three-dimensional point cloud information in the bird's-eye view direction to obtain two-dimensional point cloud information of the three-dimensional point cloud information in the bird's-eye view direction.
[0172] When the vertical plane is projected in the bird's-eye view direction, it will be projected as a line segment. Conversely, by mapping the line segment in the two-dimensional point cloud information back to the three-dimensional space, we can get the plane mapped by the line segment in the three-dimensional space. The height of the candidate vertical plane mapped to the three-dimensional space is unknown, and we can only determine the position of the candidate vertical plane in the horizontal direction. It can be considered that the height of the mapped candidate vertical plane is infinite. If the position of the point cloud in the three-dimensional point cloud information in the horizontal direction matches the position of the plane in the horizontal direction, the point cloud is used as the plane point cloud information of the candidate vertical plane.
[0173] Before projecting the 3D point cloud information in the bird's-eye view direction, the point clouds corresponding to the ceiling and floor in the 3D point cloud information can be removed to avoid interference of the ceiling and floor on the vertical and horizontal planes in the detection target space. For example, the number of point clouds corresponding to each height can be counted according to the height information contained in the 3D point cloud information to obtain the number of point clouds corresponding to each height, and then the number of point clouds can be normalized to obtain the point cloud density corresponding to each height. Based on the point cloud density corresponding to each height, a density distribution curve of the overall 3D point cloud information can be obtained. The density distribution curve can be shown as follows Figure 5 Take a peak value from each end of the density distribution curve, the larger value is the height of the ceiling, and the smaller value is the height of the floor, that is, the height of the ceiling is 1.2565, and the height of the floor is -1.3434.
[0174] In order to more accurately detect the height of the ceiling and the height of the floor, after obtaining the height of the ceiling according to the density distribution curve, the local density distribution curve near the height can be obtained. For example, the local density distribution curve of 0.05 meters of the ceiling height can be calculated with a step length of 0.005 meters. The local density distribution curve can be as follows: Figure 6 As shown, the step size of the local density distribution curve is smaller than the step size of the complete density distribution curve. Then, the height of the fine-tuned ceiling is determined according to the local density distribution curve. Similarly, the local density distribution curve of the floor can be calculated to obtain the height of the fine-tuned floor. The local density distribution curve of the floor is as follows: Figure 7 shown.
[0175] After obtaining the height of the ceiling and the height of the floor, the point cloud belonging to the ceiling and the point cloud belonging to the floor can be removed from the 3D point cloud. The 3D point cloud information after removing the point cloud belonging to the ceiling and the point cloud belonging to the floor is as follows: Figure 8 As shown, projecting in the bird's-eye view direction, the two-dimensional point cloud information of the target space in the bird's-eye view direction is obtained as follows Figure 9aAs shown, the subsequent steps are based on removing the three-dimensional point cloud information of the point cloud belonging to the ceiling and the point cloud belonging to the floor.
[0176] 203. The mobile device performs line segment detection on the two-dimensional point cloud information to obtain line segments contained in the two-dimensional point cloud information, and maps the line segments to the three-dimensional point cloud information to obtain plane point cloud information corresponding to the candidate vertical plane.
[0177] For example, a mobile device can perform line segment detection based on a two-dimensional point cloud to obtain the line segments contained in the two-dimensional point cloud information. The detection results can be as follows: Fig.10a described.
[0178] Optionally, the two-dimensional point cloud information can be processed by histogram equalization. The processing result is as follows: Figure 9b As shown in Figure 2, the line segment features in the two-dimensional point cloud information can be enhanced through histogram equalization processing, and the detection effect of the line segment can be improved. After combining the initial two-dimensional point cloud information with the two-dimensional point cloud information after histogram equalization processing, the detection result of the line segment detection is as follows: Fig.10b shown.
[0179] After detecting the line segment, the angle of the line segment can be obtained, and the angle of the line segment can be mapped to between 0° and 90°. For example, the angle of the line segment with an angle greater than 90° is subtracted by 90° to obtain the converted angle. According to the angle of the line segment with an angle less than 90° and the converted angle of the line segment greater than 90°, a scatter plot of the angle is obtained. The scatter plot is as follows: Fig.11 shown.
[0180] Then, a straight line fitting is performed based on the scatter plot to obtain the alignment angle of the line segment contained in the two-dimensional point cloud information, and the alignment angle is 68.28°. The target space is rotated by the alignment angle to obtain the aligned target space. The subsequent steps can be processed based on the aligned target space. At the same time, the two-dimensional point cloud information can also be aligned to match the two-dimensional point cloud information with the three-dimensional point cloud information.
[0181] The alignment angle can be considered as the main direction of the vertical plane in the target space. By rotating the target space by the alignment angle, the main direction in the target space can be adjusted to 0°, which is convenient for optimizing the direction of the plane parallel or perpendicular to the main direction in the 3D point cloud information.
[0182] Then the line segment is mapped to the three-dimensional space to obtain the candidate vertical plane formed by the line segment in the two-dimensional space, and the plane point cloud information of the candidate vertical plane corresponding to the line segment is selected from the three-dimensional point cloud information according to the position of the plane.
[0183] The point cloud in the three-dimensional point cloud information whose distance from the plane is less than a preset distance threshold is used as the plane point cloud information.
[0184] 204. The mobile device performs point cloud quantity statistics based on the plane point cloud information of the candidate vertical plane, and detects the vertical plane from the target space according to the point cloud quantity.
[0185] In the target space, there may be horizontal planes whose two-dimensional side projections are line segments. These sides are usually very narrow and cannot be used as planes for virtual interaction. The area of such vertical planes is very small, so the number of corresponding point clouds is small. Therefore, such vertical planes can be eliminated based on the number of point clouds contained in the plane point cloud information.
[0186] For example, the mobile device can count the number of point clouds corresponding to each candidate vertical plane to obtain the number of point clouds contained in each candidate vertical plane. If the number of point clouds is less than a preset number threshold, the candidate vertical plane is considered to be a vertical plane with a smaller area, and the candidate vertical plane is filtered.
[0187] For a candidate vertical plane whose point cloud quantity is greater than or equal to a preset quantity threshold, density distribution information about the height of the plane point cloud data corresponding to the candidate vertical plane may be calculated.
[0188] The density distribution information can count the number of point clouds corresponding to each height (or height interval), and determine the maximum number of point clouds. The number of point clouds at each height is divided by the maximum number of point clouds, and the number of point clouds at each height is mapped to the interval (0,1] to obtain the point cloud density at each height. Then, the longest continuous area with a density greater than 0.5 is selected, and the minimum height of the longest continuous area is used as the lower boundary of the vertical plane, and the maximum height is used as the upper boundary of the vertical plane to obtain the height information of the vertical plane, so that the vertical plane is detected in the three-dimensional point cloud information. The result of detecting the vertical plane in the three-dimensional point cloud information is as follows: Fig.12a and Figure 12b As shown, Fig.12a and Figure 12b Make the vertical plane detection results under different viewing angles.
[0189] Optionally, after the vertical plane is detected, the vertical plane can be classified according to its height (upper boundary of the vertical plane). For example, if the ratio of the height of the vertical plane to the height of the ceiling is greater than a preset ratio threshold (e.g., 0.8), the vertical plane is considered to be a wall in the target space, and a vertical plane less than the preset ratio threshold is considered to be another plane. For a vertical plane that is a wall, the lower boundary of the vertical plane can be aligned with the floor, and the upper boundary can be aligned with the ceiling, so that the wall is connected to the ceiling and floor in the target space.
[0190] 205. The mobile device determines the plane height where the candidate horizontal plane is located according to the height distribution information of the three-dimensional point cloud information.
[0191] For example, a mobile device can generate height distribution information of a target space based on the height information contained in the 3D point cloud information. The height distribution information can be Fig.13 As shown, the height distribution information can represent the point cloud distribution of the target space at height. The height distribution information of the target space can be generated by referring to the method of generating the density distribution information of the plane point cloud data about the height in step 204, which will not be elaborated here.
[0192] The height where the point cloud density is greater than the preset density threshold is selected to obtain the plane height, which is the height of the horizontal plane in the target space.
[0193] 206. The mobile device projects the three-dimensional point cloud information in a bird's-eye view direction based on the plane height to obtain two-dimensional point cloud information of the target space on the horizontal plane.
[0194] For example, the mobile device projects the three-dimensional point cloud within the height range corresponding to the plane height in the bird's-eye view direction to obtain two-dimensional point cloud information including the horizontal plane projection of the target space at the plane height.
[0195] If there are multiple plane heights, the corresponding two-dimensional point cloud information can be obtained for each plane height. The two-dimensional point cloud information corresponding to one plane height is as follows: Fig.14 shown.
[0196] 207. The mobile device performs contour detection on the two-dimensional point cloud information to obtain a closed contour contained in the two-dimensional point cloud information, and calculates the area of a region surrounded by the closed contour.
[0197] For example, a mobile device can detect closed contour curves from 2D point cloud information, and the detection results can be Fig.15 As shown, the closed contours contained in the two-dimensional point cloud information are obtained, and the area of the region surrounded by each closed contour is calculated.
[0198] 208. The mobile device detects a horizontal plane in the target space from the plane height based on the area.
[0199] For example, an area threshold can be set in advance in a computer program executed by the mobile device, so that the mobile device filters the candidate projection contour information whose area size of the enclosed area is smaller than the area threshold based on the area threshold, and obtains a closed contour whose area size of the enclosed area is greater than or equal to the area threshold.
[0200] An outer rectangle of a closed contour whose area size of the enclosed region is greater than or equal to the area threshold is extracted. The outer rectangle may include the target projection contour. The outer rectangle may be a rectangle with the minimum area that can include the target projection contour.
[0201] The outer rectangle is mapped to the three-dimensional space of the three-dimensional point cloud information, such as Fig.16 As shown, a rectangle corresponding to a two-dimensional bounding rectangle can be generated in the three-dimensional point cloud information. The position of the three-dimensional rectangle in the three-dimensional space corresponding to the three-dimensional point cloud information is the position information of the horizontal plane in the target space, and the size of the three-dimensional rectangle is the size of the horizontal plane in the target space.
[0202] As can be seen from the above, the mobile device of the embodiment of the present application obtains a video sequence corresponding to the space to be reconstructed, performs three-dimensional reconstruction on the video sequence, and obtains the target space and the three-dimensional point cloud information corresponding to the target space; projects the three-dimensional point cloud information in the bird's-eye view direction to obtain the two-dimensional point cloud information of the target space in the bird's-eye view direction; performs line segment detection on the two-dimensional point cloud information to obtain the line segments contained in the two-dimensional point cloud information, and maps the line segments to the three-dimensional point cloud information to obtain the plane point cloud information corresponding to the candidate vertical plane; performs point cloud quantity statistics based on the plane point cloud information of the candidate vertical plane, and detects the vertical plane from the target space according to the number of point clouds; determines the plane height where the candidate horizontal plane is located according to the height distribution information of the three-dimensional point cloud information; based on the plane height, projects the three-dimensional point cloud information in the bird's-eye view direction to obtain the two-dimensional point cloud information about the horizontal plane of the target space; performs contour detection on the two-dimensional point cloud information to obtain the closed contour contained in the two-dimensional point cloud information, and calculates the area of the area surrounded by the closed contour; and detects the horizontal plane in the target space from the plane height based on the area.
[0203] The embodiment of the present application maps three-dimensional point cloud information into two-dimensional point cloud information, then identifies the candidate projection contour information of the plane by using point cloud distribution features, and then determines the three-dimensional plane point cloud information based on the two-dimensional candidate projection information, and then detects the plane from the target space based on the plane point cloud information. This solution converts the problem of detecting a plane in three-dimensional space into the problem of detecting a plane in three-dimensional space based on two-dimensional point cloud information, thereby reducing the difficulty of plane detection and improving the efficiency and effect of plane detection.
[0204] In order to facilitate better implementation of the spatial plane detection method provided in the embodiment of the present application, a spatial plane detection device is also provided in one embodiment. The meanings of the terms are the same as those in the above-mentioned spatial plane detection method, and the specific implementation details can refer to the description in the method embodiment.
[0205] The spatial plane detection device can be integrated into a computer device, such as Fig.17 As shown, the spatial plane detection device may include: an acquisition unit 301, an identification unit 302, a screening unit 303 and a detection unit 304, which are specifically as follows:
[0206] (1) Acquisition unit 301: used to acquire the three-dimensional point cloud information corresponding to the target space, perform two-dimensional mapping on the three-dimensional point cloud information, and obtain the two-dimensional point cloud information of the target space.
[0207] In one embodiment, the acquisition unit 301 may include a point cloud acquisition subunit, a height determination subunit and a two-dimensional mapping subunit. Specifically:
[0208] Point cloud acquisition subunit: used to obtain the three-dimensional point cloud information corresponding to the target space;
[0209] Height determination subunit: used to determine the height distribution information of the target space according to the three-dimensional point cloud information, and determine the height of the plane existing in the target space;
[0210] Two-dimensional mapping subunit: used to perform two-dimensional mapping of the three-dimensional point cloud information corresponding to the target space and the height, and obtain the two-dimensional point cloud information of the target space at the height.
[0211] In one embodiment, the acquisition unit 301 may include a collection subunit, an alignment subunit and a sampling subunit, specifically:
[0212] Acquisition subunit: used to obtain the initial point cloud information corresponding to the target space through the acquisition device;
[0213] Alignment subunit: used to align the initial point cloud information with the gravity direction of the acquisition device to obtain the aligned point cloud information;
[0214] Sampling subunit: used to sample the aligned point cloud information to obtain three-dimensional point cloud information.
[0215] In one embodiment, the spatial plane detection device may further include a receiving unit and a responding unit, specifically:
[0216] Receiving unit: used for receiving virtual interaction instructions for the plane in the target space;
[0217] Responding unit: used to obtain corresponding virtual interactive resources in response to virtual interactive instructions, and perform virtual interaction on the plane of the target space based on the virtual interactive resources.
[0218] (2) Identification unit 302: used to identify candidate projection contour information belonging to at least one type of plane from the two-dimensional point cloud information based on the distribution characteristics of the point cloud in the two-dimensional point cloud information.
[0219] In one embodiment, the recognition unit 302 may include a line segment detection subunit and a contour determination subunit, specifically:
[0220] Line segment detection subunit: used to perform line segment detection on the two-dimensional point cloud information to obtain the line segments contained in the two-dimensional point cloud information;
[0221] Contour determination subunit: used to take line segments as candidate projection contour information of vertical planes.
[0222] In one embodiment, the recognition unit 302 may further include a fitting subunit and a spatial alignment subunit, specifically:
[0223] Fitting subunit: used to obtain the angle of the line segment and perform fitting according to the angle of the line segment to obtain the alignment angle of the line segment;
[0224] Spatial alignment subunit: used to rotate the target space by the alignment angle to obtain the aligned target space, so as to perform spatial plane detection based on the aligned target space.
[0225] (3) Screening unit 303: used to screen plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection contour information, where the plane point cloud information is the three-dimensional point cloud information corresponding to the plane in the target space.
[0226] In one embodiment, the at least one type of plane includes a vertical plane, and the screening unit 303 may include a reverse mapping subunit and a plane point cloud determination subunit, specifically:
[0227] The inverse mapping subunit is used to perform inverse mapping processing on the candidate projection contour information belonging to the vertical plane to obtain the position information of the candidate vertical plane corresponding to the candidate projection contour in the three-dimensional point cloud information;
[0228] Plane point cloud determination subunit: used to determine the plane point cloud information of the candidate vertical plane corresponding to the candidate projection contour in the three-dimensional point cloud information according to the position.
[0229] In one embodiment, the at least one type of plane includes a horizontal plane, and the screening unit 303 may include a calculation subunit, a selection subunit, and a matching subunit, specifically:
[0230] A calculation subunit: used to calculate the area of the region surrounded by the candidate projection contour information according to the candidate projection contour information corresponding to the horizontal plane;
[0231] A selection subunit: used for selecting target projection profile information from candidate projection profile information based on area;
[0232] Matching subunit: used to determine the point cloud information matching the two-dimensional point cloud information corresponding to the target projection contour from the three-dimensional point cloud information to obtain the plane point cloud information.
[0233] In one embodiment, the matching subunit may include a generation module and a mapping module, specifically:
[0234] Generation module: used to generate an outer rectangle according to the target projection contour information;
[0235] Mapping module: used to map the outer rectangle to the three-dimensional point cloud information to obtain the plane point cloud information corresponding to the outer rectangle in the three-dimensional point cloud information.
[0236] (4) Detection unit 304: used to perform spatial plane detection based on the plane point cloud information to obtain the position information of the plane contained in the target space.
[0237] In one embodiment, the detection unit 304 may include a statistics subunit and a location determination subunit, specifically:
[0238] Statistical subunit: used to perform statistical processing on the plane point cloud information of the candidate vertical plane to obtain the number of point clouds corresponding to the candidate vertical plane;
[0239] Position determination subunit: used to obtain the position information of the vertical plane contained in the target space according to the density distribution characteristics of the plane point cloud information corresponding to the candidate vertical plane if the number of point clouds meets the preset number threshold.
[0240] As can be seen from the above, the spatial plane detection device in the embodiment of the present application obtains the three-dimensional point cloud information corresponding to the target space through the acquisition unit 301, performs two-dimensional mapping on the three-dimensional point cloud information, and obtains the two-dimensional point cloud information of the target space; the recognition unit 302 identifies the candidate projection contour information of the plane belonging to at least one type from the two-dimensional point cloud information based on the distribution characteristics of the point cloud in the two-dimensional point cloud information; the screening unit 303 screens the plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection contour information, and the plane point cloud information is the three-dimensional point cloud information corresponding to the plane in the target space; the detection unit 304 performs spatial plane detection according to the plane point cloud information to obtain the position information of the plane contained in the target space.
[0241] The embodiment of the present application maps three-dimensional point cloud information into two-dimensional point cloud information, then identifies the candidate projection contour information of the plane by using point cloud distribution features, and then determines the three-dimensional plane point cloud information based on the two-dimensional candidate projection information, and then detects the plane from the target space based on the plane point cloud information. This solution converts the problem of detecting a plane in three-dimensional space into the problem of detecting a plane in three-dimensional space based on two-dimensional point cloud information, thereby reducing the difficulty of plane detection and improving the efficiency and effect of plane detection.
[0242] The present application also provides a computer device, which may be a terminal or a server. Fig.18 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0243] The computer device may include components such as a processor 1001 with one or more processing cores, a memory 1002 with one or more computer-readable storage media, a power supply 1003, and an input unit 1004. Those skilled in the art will appreciate that Fig.18 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0244] The processor 1001 is the control center of the computer device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 1002 and calling data stored in the memory 1002, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 1001 may include one or more processing cores; preferably, the processor 1001 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, computer program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1001.
[0245] The memory 1002 can be used to store software programs and modules. The processor 1001 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002. The memory 1002 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 1002 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1002 may also include a memory controller to provide the processor 1001 with access to the memory 1002.
[0246] The computer device also includes a power supply 1003 for supplying power to various components. Preferably, the power supply 1003 can be logically connected to the processor 1001 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 1003 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0247] The computer device may further include an input unit 1004, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0248] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically, in this embodiment, the processor 1001 in the computer device will load the executable files corresponding to the processes of one or more computer programs into the memory 1002 according to the following instructions, and the processor 1001 will run the computer programs stored in the memory 1002, thereby realizing various functions, as follows:
[0249] Obtain the three-dimensional point cloud information corresponding to the target space, perform two-dimensional mapping on the three-dimensional point cloud information, and obtain the two-dimensional point cloud information of the target space;
[0250] Based on the distribution characteristics of the point cloud in the two-dimensional point cloud information, identifying candidate projection contour information belonging to at least one type of plane from the two-dimensional point cloud information;
[0251] According to the type of the plane and the candidate projection contour information, the plane point cloud information is screened from the three-dimensional point cloud information, where the plane point cloud information is the three-dimensional point cloud information corresponding to the plane in the target space;
[0252] The spatial plane detection is performed according to the plane point cloud information to obtain the position information of the plane contained in the target space.
[0253] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.
[0254] From the above, it can be seen that the computer device of the embodiment of the present application can obtain the three-dimensional point cloud information corresponding to the target space, perform two-dimensional mapping on the three-dimensional point cloud information, and obtain the two-dimensional point cloud information of the target space; based on the distribution characteristics of the point cloud in the two-dimensional point cloud information, identify candidate projection contour information of a plane belonging to at least one type from the two-dimensional point cloud information; according to the type of the plane and the candidate projection contour information, filter the plane point cloud information from the three-dimensional point cloud information, the plane point cloud information is the three-dimensional point cloud information corresponding to the plane in the target space; perform spatial plane detection based on the plane point cloud information to obtain the position information of the plane contained in the target space.
[0255] The embodiment of the present application maps three-dimensional point cloud information into two-dimensional point cloud information, then identifies the candidate projection contour information of the plane by using point cloud distribution features, and then determines the three-dimensional plane point cloud information based on the two-dimensional candidate projection information, and then detects the plane from the target space based on the plane point cloud information. This solution converts the problem of detecting a plane in three-dimensional space into the problem of detecting a plane in three-dimensional space based on two-dimensional point cloud information, thereby reducing the difficulty of plane detection and improving the efficiency and effect of plane detection.
[0256] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional implementations in the above-mentioned embodiments.
[0257] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0258] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be loaded by a processor to execute any spatial plane detection method provided in the embodiment of the present application.
[0259] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0260] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0261] Since the computer program stored in the computer-readable storage medium can execute any one of the spatial plane detection methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the spatial plane detection methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0262] The above is a detailed introduction to a spatial plane detection method, device, computer equipment and computer-readable storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A spatial plane detection method, characterized in that: include: Acquire three-dimensional point cloud information corresponding to the target space, and perform two-dimensional mapping on the three-dimensional point cloud information to obtain two-dimensional point cloud information of the target space; Based on distribution characteristics of point clouds in the two-dimensional point cloud information, identifying candidate projection contour information belonging to at least one type of plane from the two-dimensional point cloud information; Filtering plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection contour information, the plane point cloud information being the three-dimensional point cloud information corresponding to the plane in the target space; Spatial plane detection is performed according to the plane point cloud information to obtain position information of the plane contained in the target space.
2. The method according to claim 1, characterized in that The at least one type of plane includes a vertical plane, and the screening of plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection profile information includes: Performing a reverse mapping process on the candidate projection contour information belonging to the vertical plane to obtain the position information of the candidate vertical plane corresponding to the candidate projection contour in the three-dimensional point cloud information; Plane point cloud information of a candidate vertical plane corresponding to the candidate projection contour in the three-dimensional point cloud information is determined according to the position.
3. The method according to claim 2, characterized in that The performing spatial plane detection according to the plane point cloud information to obtain the position information of the plane contained in the target space includes: Performing statistical processing on the plane point cloud information of the candidate vertical plane to obtain the number of point clouds corresponding to the candidate vertical plane; If the number of point clouds meets a preset number threshold, the position information of the vertical plane included in the target space is obtained according to the density distribution characteristics of the plane point cloud information corresponding to the candidate vertical plane.
4. The method according to claim 2, characterized in that: The step of identifying candidate projection contour information of at least one type of plane from the two-dimensional point cloud information based on distribution characteristics of the point cloud in the two-dimensional point cloud information comprises: Performing line segment detection on the two-dimensional point cloud information to obtain line segments contained in the two-dimensional point cloud information; The line segment is used as candidate projection contour information of the vertical plane.
5. The method according to claim 4, characterized in that After performing line segment detection on the two-dimensional point cloud information to obtain the line segments contained in the two-dimensional point cloud information, the method further includes: Acquire the angle of the line segment, and perform fitting according to the angle of the line segment to obtain the alignment angle of the line segment; The target space is rotated by the alignment angle to obtain an aligned target space, so as to perform spatial plane detection based on the aligned target space.
6. The method according to claim 1, characterized in that The at least one type of plane includes a horizontal plane, and the screening of plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection profile information includes: Calculate the area of a region surrounded by the candidate projection contour information according to the candidate projection contour information corresponding to the horizontal plane; Selecting target projection profile information from the candidate projection profile information based on the area; The point cloud information matching the two-dimensional point cloud information corresponding to the target projection contour is determined from the three-dimensional point cloud information to obtain the plane point cloud information.
7. The method according to claim 6, characterized in that The step of determining point cloud information matching the two-dimensional point cloud information corresponding to the target projection contour from the three-dimensional point cloud information to obtain the plane point cloud information includes: Generate an outer rectangle according to the target projection contour information; The outer bounding rectangle is mapped to the three-dimensional point cloud information to obtain plane point cloud information corresponding to the outer bounding rectangle in the three-dimensional point cloud information.
8. The method according to claim 1, characterized in that The step of acquiring three-dimensional point cloud information corresponding to the target space and performing two-dimensional mapping on the three-dimensional point cloud information to obtain two-dimensional point cloud information of the target space includes: Obtain the three-dimensional point cloud information corresponding to the target space; Determine the height distribution information of the target space according to the three-dimensional point cloud information, and determine the height of the plane existing in the target space; The target space is two-dimensionally mapped to the three-dimensional point cloud information corresponding to the height to obtain the two-dimensional point cloud information of the target space at the height.
9. The method according to claim 1, characterized in that: The obtaining of three-dimensional point cloud information corresponding to the target space includes: Acquire the initial point cloud information corresponding to the target space through the acquisition device; Aligning the initial point cloud information with the gravity direction of the acquisition device to obtain aligned point cloud information; The aligned point cloud information is sampled to obtain the three-dimensional point cloud information.
10. The method according to claim 1, characterized in that After performing spatial plane detection according to the plane point cloud information to obtain the position information of the plane contained in the target space, the method further includes: receiving a virtual interaction instruction for a plane in the target space; In response to the virtual interaction instruction, a corresponding virtual interaction resource is acquired, and virtual interaction is performed on the plane of the target space based on the virtual interaction resource.
11. A spatial plane detection device, characterized in that: include: An acquisition unit, used for acquiring three-dimensional point cloud information corresponding to the target space, performing two-dimensional mapping on the three-dimensional point cloud information, and obtaining two-dimensional point cloud information of the target space; an identification unit, configured to identify candidate projection contour information belonging to at least one type of plane from the two-dimensional point cloud information based on distribution characteristics of point clouds in the two-dimensional point cloud information; A screening unit, configured to screen plane point cloud information from the three-dimensional point cloud information according to the type of the plane and the candidate projection profile information, wherein the plane point cloud information is the three-dimensional point cloud information corresponding to the plane in the target space; The detection unit is used to perform spatial plane detection according to the plane point cloud information to obtain the position information of the plane contained in the target space.
12. A computer device, characterized in that: It comprises a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the spatial plane detection method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is loaded by a processor to execute the spatial plane detection method according to any one of claims 1 to 10.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the spatial plane detection method according to any one of claims 1 to 10 is implemented.
