Visual positioning mapping method, system, equipment and medium
Through image enhancement and feature weight optimization technologies, the positioning accuracy and robustness of traditional visual SLAM systems in low-texture dark environments are solved, and a more comprehensive scenario understanding and stability improvement are achieved.
Patent Information
- Application Number
- CN202510313003.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-08-01
AI Technical Summary
Traditional visual SLAM systems face problems such as reduced positioning accuracy, insufficient perception of complex geometric structures, and poor robustness and stability in low texture dark environments.
Image enhancement technology is used to improve image contrast and clarity, combine the use of point features and line segment features, and optimize map and camera posture by dynamically adjusting feature weights to enhance system adaptability and stability.
It improves the system's positioning accuracy and map construction accuracy in dark environments, enhances the perception of complex environments, and improves the stability and robustness of the system.
Smart Images

Figure CN120411218A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical fields of computer vision and robotics, and particularly relates to a visual positioning and mapping method, system, device, and medium. Background Art
[0002] Currently, the technical fields of computer vision and robotics are in a stage of rapid development. As a key technology among them, simultaneous localization and mapping (SLAM) is widely used in fields such as autonomous driving, unmanned aerial vehicle navigation, and augmented reality. It is a technology that uses image data captured by a camera to simultaneously estimate the camera's motion trajectory and construct an environmental map in an unknown environment. Traditional visual SLAM systems mainly rely on the extraction and matching of feature points to achieve positioning and map construction. However, they still face several limitations in some special environments:
[0003] Challenges in Low-Texture Dark Environments
[0004] In low-texture dark environments, traditional feature point extraction and matching algorithms face challenges. Due to the lack of illumination and significant texture information, feature point extraction algorithms often fail to extract a sufficient number and quality of feature points, resulting in a decrease in positioning accuracy and even an inability to construct an accurate map.
[0005] Insufficient Perception Ability for Complex Geometric Structures
[0006] The performance of traditional feature point extraction algorithms deteriorates in low-texture environments, resulting in insufficient perception ability of the system for complex geometric structures. For example, line segment features may be more prominent in complex environments, but traditional algorithms have not fully utilized them.
[0007] Challenges to System Robustness and Stability
[0008] The decline in feature extraction ability in dark environments with low texture affects the robustness and stability of the system. The system may be more vulnerable to noise interference, and positioning errors may gradually accumulate, resulting in a decrease in the performance of the SLAM system. Summary of the Invention
[0009] The present invention proposes a visual positioning and mapping method, system, device, and medium to solve the problems of reduced accuracy in low-texture dark environments, insufficient perception ability for complex geometric structures, and affecting the robustness and stability of the system in the prior art.
[0010] To achieve the above object, the present invention proposes the following technical solutions:
[0011] A visual positioning and mapping method, comprising the following steps:
[0012] Step 1, preprocess the image sequence from the camera to obtain a grayscale image, and construct an image pyramid based on the grayscale image;
[0013] Step 2, use a feature extraction algorithm to simultaneously extract feature points and line segments in the image pyramid, and calculate descriptors;
[0014] Step 3, obtain the initial pose and current pose of the camera, and obtain the current map based on the initial pose, current pose of the camera, and the descriptors obtained in Step 2;
[0015] Step 4, perform feature distribution analysis by calculating the point feature density and line feature density according to the number of feature points and feature line segments in the current map;
[0016] Step 5, detect the camera motion state and perform low-texture motion detection, and calculate the weight of the feature information according to the camera motion state detection result, low-texture environment detection result, and feature distribution;
[0017] Step 6, optimize and update the current map and camera pose according to the dynamically adjusted weight of the feature information.
[0018] Preferably, the preprocessing in Step 1 specifically includes:
[0019] Perform denoising processing on the image sequence from the camera by Gaussian filtering, perform histogram equalization on the denoised image sequence, adjust the pixel value distribution of the image sequence to enhance the contrast of the image, and convert the image sequence with enhanced contrast into a grayscale image.
[0020] Preferably, in Step 5, the process of detecting the camera motion state is specifically:
[0021] Let the motion speed v of the camera be obtained from a visual odometer or a motion information sensor, and obtain the camera motion state index S as the camera motion state detection result, which is defined as:
[0022]
[0023] where v max is a set maximum speed threshold.
[0024] Preferably, in Step 5, the specific process of low-texture environment detection is:
[0025] Calculate the local variance σ(x, y) in the n×n area around each pixel (x, y) in the image, compare the local variance with a preset threshold T, and determine whether the pixel is a low-texture area:
[0026]
[0027] Among them, I(x+i,y+j) represents the gray value of the pixel (x+i,y+j) in the image, and μ represents the average gray value of this local area; L(x,y) represents the low-texture detection result at the pixel (x,y) in the image. The value of 1 indicates that the pixel is in a low-texture area, and the value of 0 indicates that the pixel is not in a low-texture area.
[0028] Preferably, the method for calculating the weight of the feature information in step 5 is specifically as follows:
[0029] Set α and β as the adjustment coefficients for the balance point feature and the line segment feature. Then the initial weights of the point feature and the line segment feature are respectively expressed as:
[0030] w‘ p =α·ρ p ·(1 - S)·(1 - L)
[0031] w‘ L =β·ρ L ·S·(1 - L)
[0032] In the formula, ρ p is the point feature density, ρ L is the line segment feature density, S is the motion state index of the camera, v is the motion speed of the camera, v max is the preset maximum speed threshold; L represents the low-texture detection result of the pixel in the image.
[0033] Preferably, step 5 further includes normalizing the initial weights of the point feature and the line segment feature. After normalization, the point feature weight and the line segment feature weight are obtained, and are respectively expressed as:
[0034]
[0035] Preferably, in step 6, the objective function for optimizing the camera pose is specifically as follows:
[0036]
[0037] Among them, E represents minimizing the sum of the weighted reprojection errors, N represents the number of point features, e' pi is the weighted reprojection error of the i-th point feature, represents the weight of the i-th point feature, represents the reprojection error of the i-th point feature; M represents the number of line segment features, j represents the current line segment feature, e′ Lj is the weighted reprojection error of the j-th line segment feature, represents the weight of the j-th line segment feature, Denote the reprojection error of the j-th line segment feature.
[0038] A visual localization and mapping system, which operates using the described visual localization and mapping method. The visual localization and mapping system includes the following modules:
[0039] A preprocessing module for preprocessing an image sequence from a camera to obtain a grayscale image and constructing an image pyramid based on the grayscale image;
[0040] A descriptor module for simultaneously extracting feature points and line segments in the image pyramid through a feature extraction algorithm and calculating descriptors;
[0041] A map update module that obtains the initial pose and current pose of the camera, and obtains the current map based on the initial pose, current pose of the camera, and the descriptors obtained in the descriptor module;
[0042] A feature distribution analysis module that calculates the point feature density and line segment feature density according to the number of feature points and line segment features in the current map;
[0043] A feature weight adjustment module that detects the camera motion state and performs low-texture motion detection, and calculates the weight of feature information according to the camera motion state detection result, low-texture environment detection result, point feature density, and line segment feature density;
[0044] An optimization module that optimizes and updates the current map and camera pose according to the dynamically adjusted feature information weight.
[0045] An electronic device includes a memory and a processor;
[0046] The memory is used to store a computer program;
[0047] The processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the described visual localization and mapping method are implemented.
[0048] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the described visual localization and mapping method are implemented.
[0049] The advantages of the present invention are as follows:
[0050] The present invention provides a visual positioning and mapping method, which introduces preprocessing and grayscale images to achieve image enhancement, effectively improving the contrast and clarity of images; the present invention also combines the use of point features and line segment features, enabling the system to make full use of the advantages of different types of features to achieve a more comprehensive understanding of the scene; further, the present invention also introduces a method for dynamically adjusting feature weights, enhancing the adaptability and robustness of the system. In different environments, the system will dynamically adjust the weights of point features and line segment features according to the analysis of the camera's motion state, the distribution of features, and the strength of textures in the environment, so as to optimize the proportion of each feature and enhance the system's perception ability of complex environments, improving the stability and accuracy of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings forming a part of this invention are used to provide a further understanding of the invention. The schematic embodiments and descriptions thereof of the invention are used to explain the invention and do not constitute an improper limitation of the invention. In the drawings:
[0052] Figure 1 is a schematic flow diagram of a visual positioning and mapping method;
[0053] Figure 2 is a schematic diagram of a visual positioning and mapping system;
[0054] Figure 3 is a schematic diagram of an electronic device. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0055] The present invention will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments may be combined with each other.
[0056] The following detailed descriptions are all exemplary descriptions, aiming to provide further details of the present invention. Unless otherwise specified, all technical terms used in the present invention have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs. The terms used in the present invention are only for the purpose of describing specific embodiments and are not intended to limit the exemplary embodiments of the present invention.
[0057] Embodiment 1:
[0058] This embodiment provides a visual positioning and mapping method, as shown in Figure 1 and includes the following steps:
[0059] Step 1, input an image sequence from a camera and preprocess the image;
[0060] Further, the method for image preprocessing in Step 1 is:
[0061] First, perform denoising processing on the image sequence from the camera using Gaussian filtering to reduce the impact of noise on subsequent processing;
[0062] To adapt to the application scenario of low-light environments, perform histogram equalization on the image sequence, adjust the pixel value distribution of the image sequence to enhance the contrast of the image, so that the image becomes clearer and brighter;
[0063] Convert the enhanced color image into a grayscale image, which helps to reduce the computational load of the system;
[0064] Perform edge detection on the grayscale image to extract the structural information of the image;
[0065] Construct an image pyramid, which is a series of images obtained by repeatedly downsampling or upsampling the original image, to extract feature information at different scales and retain the structural information of the image at different scales;
[0066] Step 2: Use a feature extraction algorithm to simultaneously extract N p feature points and N l line segments in the image, and calculate descriptors;
[0067] Furthermore, for the feature extraction algorithm and descriptor calculation in Step 2, the method is as follows:
[0068] For the extraction of feature points, use the Harris corner detection algorithm. Determine whether a pixel is a feature point based on its gray value and gradient information. The extracted feature points can be expressed as: Feature point = {p i}, i = 1, 2,..., N p , p i represents the coordinates of the i-th feature point; N p represents the number of feature points; the descriptor of a feature point is generated by comparing the pixels around the feature point. The feature point descriptor can be expressed as: D(p i ) = ComputeDescriptor(p i ), D(p i ) represents the descriptor of the feature point p i ;
[0069] For the extraction of line segments, use an algorithm based on edge detection and Hough transform. Perform Hough transform on the detected edges, and by setting certain thresholds and parameters, filter out the straight line segments that meet the conditions. The extracted line segment features can be expressed as:
[0070] Line feature = {L j}, j = 1, 2,..., N L , l j represents the parameters of the j-th line segment feature; N LIndicates the number of line segments; for line segment features, the descriptor represents geometric attributes such as the length, direction, and curvature of the line segment. The line segment feature descriptor can be expressed as:
[0071] D(L j ) = ComputeDescriptor(L j ), D(L j ) represents the descriptor of line segment L j .
[0072] Step 3: Use the PnP algorithm to estimate the initial pose of the camera. Based on the initial pose and the position information of the feature points, construct an initial map; then use the feature matching algorithm to achieve real-time positioning and estimate the current pose of the camera.
[0073] Update the map according to the current pose, newly extracted feature point information, and line segment feature information.
[0074] Step 4: Conduct a feature distribution analysis based on the number of feature points and line segment features in the current map to obtain the point feature density and line segment feature density.
[0075] Furthermore, the calculation method of the feature distribution analysis in Step 4 is as follows:
[0076] Point feature density:
[0077] Line segment feature density:
[0078] where A represents the total area of the current map.
[0079] Step 5: Dynamically adjust the weights of the feature information according to the camera motion state analysis, low-texture environment detection analysis, and feature distribution analysis to make it more adaptable to the current environment and motion state.
[0080] Furthermore, the calculation method of the camera motion state analysis in Step 5 is as follows:
[0081] Let the motion speed v of the camera be obtained from the visual odometer or motion information sensor. The motion state index S of the camera is defined as:
[0082]
[0083] where v max is a set maximum speed threshold.
[0084] When the motion speed of the camera approaches or reaches the maximum speed threshold, the motion state index S will approach 1, indicating that the camera is moving fast; when the motion speed of the camera is slow, the motion state index S will approach 0, indicating that the camera is moving slowly.
[0085] Further, for the low-texture environment detection and analysis in step 5, the calculation method is as follows:
[0086] For each pixel (x, y) in the image, calculate the local variance σ(x, y) within the surrounding n×n region. The formula for local variance is:
[0087]
[0088] where I(x + i, y + j) represents the gray value of the pixel (x + i, y + j) in the image, and μ represents the average gray value of this local region. Compare the local variance with a preset threshold T to determine whether the pixel is in a low-texture area. When the local variance σ(x, y) is less than the threshold T, it is considered that the pixel is in a low-texture area; otherwise, it is considered not to be in a low-texture area. The low-texture environment detection process can be expressed as:
[0089]
[0090] where L(x, y) represents the low-texture detection result at the pixel (x, y) in the image, with a value of 1 indicating that the pixel is in a low-texture area and a value of 0 indicating that the pixel is not in a low-texture area.
[0091] Further, for the dynamic adjustment of feature weights in step 5, the calculation method is as follows:
[0092] According to the system state and environmental conditions, dynamically adjust the weights of the features. Let α and β be the adjustment coefficients for the balance point feature and the line segment feature respectively, then the weights of the point feature and the line segment feature can be defined as:
[0093]
[0094] To ensure that the total weight is 1, it is necessary to normalize w‘ p and w‘ L After normalization, the weights of the point feature and the line segment feature can be expressed as:
[0095]
[0096] Step 6: Use the dynamically adjusted feature information weights to periodically execute the global optimization algorithm to optimize the map and the camera pose, and update the system state to prepare for processing the next frame of the image.
[0097] Further, for the pose optimization using the dynamically adjusted feature weights in step 6, the calculation method is as follows:
[0098] Suppose N point features and M line segment features are detected, and the dynamically adjusted normalized weights are and The corresponding reprojection errors are respectively and For the i-th point feature, the weighted reprojection error e' pi is:
[0099]
[0100] Similarly, for the j-th line segment feature, the weighted reprojection error e′ Lj is:
[0101]
[0102] Then, the weighted reprojection errors are used in the optimization process. By minimizing the weighted reprojection errors, the pose of the camera is estimated. The objective function is to minimize the sum of the weighted reprojection errors, and the objective function can be expressed as:
[0103]
[0104] The present invention fully considers complex scenarios of dark environments and low texture, increases the system's perception ability of complex environments, and improves the stability and accuracy of the system.
[0105] The present invention improves the feature extraction effect in dark environments through image enhancement technology. In low-light conditions, traditional feature extraction algorithms are often restricted, resulting in a decrease in the accuracy of localization and map construction. By introducing image enhancement, the contrast and clarity of the image can be effectively improved, the efficiency and accuracy of feature extraction can be increased, and the stability and reliability of the visual SLAM system in dark environments are ensured.
[0106] Secondly, by combining the use of point features and line segment features, the system can make full use of the advantages of different types of features to achieve a more comprehensive understanding of the scene. In low-texture areas, line segment features are usually more discriminative and stable than point features and can better describe the scene structure. Point features, on the other hand, perform better in high-texture areas and can provide richer information. By using both types of features in the system, more accurate and robust localization and map construction can be achieved in different scenarios.
[0107] Finally, the present invention designs a method for dynamically adjusting feature weights to further enhance the adaptability and robustness of the system. In different environments, the system will dynamically adjust the weights of point features and line segment features according to the analysis of the camera's motion state, the detection and analysis of low-texture environments, and the analysis of feature distribution, so as to achieve the best feature selection. Compared with traditional visual SLAM systems, the present invention fully considers complex scenarios of dark environments and low texture, increases the system's perception ability of complex environments, and improves the stability and accuracy of the system.
[0108] Embodiment 2:
[0109] As shown in Figure 2 , the present invention provides a visual positioning and mapping system, specifically including:
[0110] A preprocessing module for preprocessing the image sequence from the camera. Specifically: perform denoising processing on the image sequence from the camera by Gaussian filtering to reduce the influence of noise on subsequent processing; for adapting to the application scenario of dark environment, perform histogram equalization on the image sequence to adjust the pixel value distribution of the image sequence to enhance the contrast of the image, so that the image is clearer and brighter; convert the enhanced color image into a grayscale image, which is beneficial to reducing the computational amount of the system; perform edge detection on the grayscale image to extract the structural information of the image; construct an image pyramid, which is a series of images obtained by performing multiple downsamplings or upsamplings on the original image, to extract feature information at different scales and retain the structural information of the image at different scales.
[0111] [[ID=ll]]A descriptor module for simultaneously extracting N p feature points and N l line segments in the image by a feature extraction algorithm, and calculating the descriptors corresponding to the feature points and line segments.
[0112] A map update module for estimating the initial pose of the camera by using the PnP algorithm, constructing an initial map according to the initial pose and the position information of the feature points; then realizing real-time positioning by using a feature matching algorithm to estimate the current pose of the camera; updating the map according to the current pose and the newly extracted point feature information and line segment feature information.
[0113] A feature distribution analysis module for performing feature distribution analysis according to the number of feature points and line segment features in the current map.
[0114] A feature weight adjustment module for dynamically adjusting the weight of feature information according to the analysis of the camera's motion state, the detection and analysis of low-texture environments, and the feature distribution analysis, so as to make it more adaptable to the current environment and motion state.
[0115] An optimization module for using the dynamically adjusted feature information weight to periodically execute a global optimization algorithm to optimize the map and the camera pose, and update the system state to prepare for the processing of the next frame of image.
[0116] Embodiment 3:
[0117] Please refer to Figure 3 . The present invention also provides an electronic device 100; the electronic device 100 includes a memory 101, at least one processor 102, a computer program 103 stored in the memory 101 and executable on the at least one processor 102, and at least one communication bus 104.
[0118] The memory 101 can be used to store the computer program 103. By running or executing the computer program stored in the memory 101 and invoking the data stored in the memory 101, the processor 102 implements the steps of the method for visual positioning and mapping described in Embodiment 1. The memory 101 may mainly include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the electronic device 100 (such as audio data, etc.). In addition, the memory 101 may include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0119] The at least one processor 102 can be a Central Processing Unit (CPU), or can also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 102 can be a microprocessor or the processor 102 can also be any conventional processor, etc. The processor 102 is the control center of the electronic device 100 and connects various parts of the entire electronic device 100 through various interfaces and lines.
[0120] Embodiment 4:
[0121] If the modules / units integrated in the electronic device 100 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of the present invention, it can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, and read-only memory (ROM, Read-Only Memory).
[0122] As is known by those skilled in the art, the present invention can be implemented by other embodiments that do not deviate from its spiritual essence or essential features. Therefore, the above-disclosed embodiments are illustrative in all aspects and are not exclusive. All changes within the scope of the present invention or within the scope equivalent to the present invention are encompassed by the present invention.
[0123] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, system, or computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0124] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0125] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to work in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction device that implements the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 specified in the block or multiple blocks.
[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, such that a series of operation steps are executed on the computer or other programmable apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 specified in the block or multiple blocks.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: the specific implementation manners of the present invention can still be modified or equivalently replaced, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the protection scope of the claims of the present invention.
Claims
1. A visual positioning and mapping method, characterized in that, It includes the following steps: Step 1: Preprocess the image sequence from the camera to obtain a grayscale image, and construct an image pyramid based on the grayscale image; Step 2: Use a feature extraction algorithm to simultaneously extract feature points and line segments in the image pyramid, and calculate descriptors; Step 3: Obtain the initial pose and the current pose of the camera, and obtain the current map according to the initial pose, the current pose of the camera, and the descriptors obtained in Step 2; Step 4: According to the number of feature points and feature line segments in the current map, perform feature distribution analysis by calculating the point feature density and the line feature density; Step 5: Detect the camera motion state and perform low-texture motion detection. According to the camera motion state detection result, the low-texture environment detection result, and the feature distribution, calculate the weights of the feature information; Step 6: Optimize and update the current map and the camera pose according to the dynamically adjusted weights of the feature information.
2. The visual positioning and mapping method according to claim 1, wherein The preprocessing in Step 1 specifically includes: Perform denoising processing on the image sequence from the camera by Gaussian filtering, perform histogram equalization on the denoised image sequence, adjust the pixel value distribution of the image sequence to enhance the contrast of the image, and convert the image sequence with enhanced contrast into a grayscale image.
3. The visual positioning and mapping method according to claim 1, characterized in that, In Step 5, the process of detecting the camera motion state is specifically: Let the motion speed v of the camera be obtained from a visual odometer or a motion information sensor, and obtain the camera motion state index S as the camera motion state detection result, which is defined as: where v max is a set maximum speed threshold value.
4. The visual positioning and mapping method according to claim 1, wherein In Step 5, the specific process of low-texture environment detection is: Calculate the local variance σ(x, y) within the n×n region around each pixel (x, y) in the image, and compare the local variance with a preset threshold T to determine whether the pixel is a low-texture region: where I(x + i, y + j) represents the grayscale value of the pixel (x + i, y + j) in the image, μ represents the average grayscale value of this local region; L(x, y) represents the low-texture detection result at the pixel (x, y) in the image, taking a value of 1 indicates that the pixel is in a low-texture region, and taking a value of 0 indicates that the pixel is not in a low-texture region.
5. The visual positioning and mapping method according to claim 1, characterized in that, The method for calculating the weights of the feature information in Step 5 is specifically: Set α and β as the adjustment coefficients for the balance point feature and the line segment feature, then the initial weights of the point feature and the line segment feature are respectively expressed as: w‘ p = α·ρ p ·(1 - S)·(1 - L) w‘ L = βρ L ·S·(1 - L) where ρ p is the point feature density, ρ L is the line segment feature density, S is the motion state index of the camera, v is the motion speed of the camera, v max is the preset maximum speed threshold; L represents the low texture detection result of the pixels in the image.
6. The visual positioning and mapping method according to claim 5, characterized in that Step 5 further includes normalizing the initial weights of the point feature and the line segment feature. After normalization, the point feature weight and the line segment feature weight are obtained, which are respectively expressed as:
7. The visual positioning and mapping method according to claim 1, wherein In Step 6, the objective function for camera pose optimization is specifically: Among them, E represents the sum of the weighted reprojection errors to be minimized, N represents the number of point features, and e' pi is the reprojection error of the i-th point feature after weighting, represents the weight of the i-th point feature, represents the reprojection error of the i-th point feature; M represents the number of line features, j represents the current line feature, and e′ Lj is the reprojection error of the j-th line feature after weighting, represents the weight of the j-th line feature, represents the reprojection error of the j-th line feature.
8. A visual positioning and mapping system, characterized in that, The visual positioning and mapping system operates using the visual positioning and mapping method according to any one of claims 1 to 7. The visual positioning and mapping system includes the following modules: A preprocessing module for preprocessing the image sequence from the camera to obtain a grayscale image and constructing an image pyramid based on the grayscale image; A descriptor module for simultaneously extracting feature points and line segments in the image pyramid through a feature extraction algorithm and calculating descriptors; A map update module that obtains the initial pose and the current pose of the camera, and obtains the current map according to the initial pose of the camera, the current pose, and the descriptors obtained from the descriptor module; A feature distribution analysis module that calculates the point feature density and the line segment feature density according to the number of feature points and line segment features in the current map; A feature weight adjustment module that detects the camera motion state and performs low-texture motion detection, and calculates the weight of the feature information according to the camera motion state detection result, the low-texture environment detection result, the point feature density, and the line segment feature density; An optimization module that optimizes and updates the current map and the camera pose according to the dynamically adjusted weight of the feature information; 9. An electronic device, characterized in that, It includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program, and when the computer program is executed by the processor, it realizes the steps of a visual positioning and mapping method as described in any one of claims 1 to 7; 10. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, it realizes the steps of a visual positioning and mapping method as described in any one of claims 1 to 7.