A method for improving straight-line precision of a map and a master control chip

By binarizing and thinning the robot map, and combining line detection algorithms and the least squares method, the problem of insufficient line detection accuracy in robots is solved, achieving sub-pixel level line detection and improving the accuracy and stability of map construction.

CN122244197APending Publication Date: 2026-06-19AMICRO SEMICONDUCTOR CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
AMICRO SEMICONDUCTOR CO LTD
Filing Date
2024-12-06
Publication Date
2026-06-19

Smart Images

  • Figure CN122244197A_ABST
    Figure CN122244197A_ABST
Patent Text Reader

Abstract

This application discloses a method and a main control chip for improving the accuracy of straight lines in a map. The main control chip includes a binarization unit, an image thinning unit, and a line detection unit. The robot pre-constructs a map by collecting environmental information. The method includes: Step 1, binarizing the map to obtain a binary image; then performing Step 2; Step 2, extracting a skeleton image from the binary image using an image thinning algorithm; then performing Step 3; Step 3, extracting edge detection lines from the skeleton image using a line detection algorithm, denoising the extracted edge detection lines, and then fitting the denoised edge detection lines with straight lines to obtain fitted line segments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of map image processing, and in particular to a method and main control chip for improving the straight-line accuracy of maps. Background Technology

[0002] Chinese invention patent application number 202210720084.0 discloses a method for adjusting the direction of movement of a robot and a method for updating a map. In order to update the walking map of the completed walking based on the optimal angle, the robot first forms a set of straight lines with the same angle, and then uses the longest straight line in the set of straight lines with the largest number of straight lines as the reference straight line. If there are too many isolated obstacles in the robot's environment, or if the wall is too thick, the extracted straight line will be tilted relative to the straight line contour of the physical obstacle and will not reflect the contour features of the real environment. Summary of the Invention

[0003] This application aims to provide a method and main control chip for improving the straight-line accuracy of maps. The specific technical solution is as follows: A method for improving the accuracy of straight lines in a map involves a robot pre-constructing a map by collecting environmental information. The method includes: Step 1, binarizing the map to obtain a binary image; then performing Step 2; Step 2, extracting a skeleton image from the binary image using an image thinning algorithm; then performing Step 3; Step 3, extracting edge detection lines from the skeleton image using a straight line detection algorithm, denoising the extracted edge detection lines, and then fitting straight lines to the denoised edge detection lines to obtain fitted straight line segments. Compared with existing technologies, the robot disclosed in this application, by performing the aforementioned Steps 1 to 3, first refines the map to create a skeleton, then performs straight line detection, denoising, and straight line fitting within the skeleton to obtain straight line segments with higher extraction accuracy, achieving the extraction of fitted straight line segments and reducing the impact of map annotation contour thickness or frequent robot collisions with obstacles.

[0004] Further, in step 2, the method for extracting a skeleton image from a binary image using an image thinning algorithm includes: searching for pixels in the binary image used to label map contours, and progressively deleting non-skeleton pixels in the neighborhood of the searched pixels according to the image thinning algorithm until no new non-skeleton pixels are deleted in the binary image, thus obtaining a skeleton image. This skeleton image is then used to thin the connected regions used to label map contours to the width of a single pixel. The non-skeleton pixels are those pixels to be deleted in the image thinning algorithm, ensuring that their deletion does not change the shape of the map contour. Therefore, the image thinning algorithm can thin a connected region of a wall to the width of a single pixel, facilitating the extraction of connected wall contour segments to form a skeleton image.

[0005] Further, in step 3, the method for extracting edge detection lines from the skeleton image using the line detection algorithm includes: traversing the skeleton image using a filtering kernel and calculating the gradient of each pixel; selecting a batch of continuous pixels based on the pixel gradients, and then connecting the selected batch of continuous pixels into an initial line segment; using the least squares method to perform line fitting on the initial line segment to obtain the edge detection line. In summary, this achieves the extraction of multiple edge detection lines using EDLines, each edge detection line being pixel-level and representing continuous edge features in the skeleton image. In robot navigation, after inputting wall information, the line detection algorithm sequentially performs filtering, gradient selection, and line fitting, outputting a clean, continuous pixel chain that connects to form the edge detection line, achieving accurate identification and tracking of straight line features in the environment and reducing interference from unnecessary edge points in the image.

[0006] Furthermore, in step 3, the method for denoising the extracted edge detection lines includes: identifying the pixels at both ends of the edge detection lines, and then removing the identified pixels at both ends, retaining the middle segment of the edge detection lines as the denoised edge detection lines. This prevents the pixels at both ends from causing the edge detection lines to tilt relative to the gradient direction determined by the calculated gradient. This reduces the impact of errors by removing outliers at the beginning and end, allowing for the fitting of higher-precision straight line segments from the remaining pixels.

[0007] Furthermore, in step 3, the method for linear fitting of the denoised edge detection lines includes: using the least squares method to perform linear fitting on the denoised edge detection lines to obtain fitted line segments, thereby achieving two linear fittings on the initial line segments. This improves the extraction accuracy of the line segments, raising the extraction accuracy of the fitted line segments relative to the edge detection lines from the pixel level to the sub-pixel level.

[0008] A main control chip is disclosed, comprising a binarization unit, an image thinning unit, and a line detection unit. The robot pre-constructs a map by collecting environmental information and then transmits the map to the main control chip. The binarization unit performs binarization processing on the map to obtain a binary image. The image thinning unit extracts a skeleton image from the binary image obtained by the binarization unit using an image thinning algorithm. The line detection unit extracts edge detection lines from the skeleton image extracted by the image thinning unit using a line detection algorithm, denoises the extracted edge detection lines, and then performs line fitting on the denoised edge detection lines to obtain fitted line segments. Compared with existing technologies, the main control chip disclosed in this application first thins the map to create a skeleton, then performs line detection, denoising, and line fitting within the skeleton to obtain line segments with higher extraction accuracy. This achieves the extraction of fitted line segments, reduces the influence of map annotation contour thickness or robot collision factors, and improves the accuracy and stability of map construction.

[0009] Furthermore, the image thinning unit is used to search for pixels within the binary image used to label the map outline, and to progressively delete non-skeleton pixels in the neighborhood of the searched pixels according to the image thinning algorithm, until no new non-skeleton pixels are deleted in the binary image, thus obtaining a skeleton image. This skeleton image is used to thin the connected regions used to label the map outline to the width of a single pixel. The non-skeleton pixels are those pixels to be deleted in the image thinning algorithm, ensuring that the map outline shape remains unchanged before and after deletion. Therefore, the image thinning unit can thin a connected region of a wall to the width of a single pixel, facilitating the extraction of connected wall outline segments to form a skeleton image. This prevents the extracted straight lines from being overly slanted due to excessively thick obstacles labeled on the raster map.

[0010] Furthermore, the line detection unit is used to traverse the skeleton image using a filtering kernel, calculate the gradient of each pixel, select a batch of consecutive pixels based on the gradient, connect the selected batch of consecutive pixels to form an initial line segment, and then use the least squares method to fit the initial line segment to obtain the edge detection line. In summary, the line detection unit uses EDLines to extract multiple edge detection lines, each edge detection line being pixel-level and representing continuous edge features in the skeleton image. In robot navigation, after inputting wall information, the line detection algorithm sequentially performs filtering, gradient selection, and line fitting, outputting a clean, continuous pixel chain that connects to form the edge detection line, achieving accurate identification and tracking of straight line features in the environment and reducing interference from unnecessary edge points in the image.

[0011] Furthermore, the line detection unit is used to identify the pixels at both ends of the edge detection line, and then remove the identified pixels at both ends, retaining the middle segment of the edge detection line as the denoised edge detection line. This prevents the pixels at both ends from causing the edge detection line to tilt relative to the gradient direction determined by the calculated gradient (i.e., introducing a small angular deviation in the line fitting, resulting in a fitting angle deviation). By removing outliers at the beginning and end, the influence of errors is reduced, and a higher-precision line segment can be fitted from the remaining pixels.

[0012] Furthermore, the line detection unit is used to perform line fitting on the denoised edge detection line using the least squares method to obtain a fitted line segment, thereby achieving two line fittings on the initial line segment. This improves the extraction accuracy of the line segment, raising the extraction accuracy of the fitted line segment relative to the edge detection line from the pixel level to the sub-pixel level. Attached Figure Description

[0013] Figure 1 This is a flowchart illustrating a method for improving the straight-line accuracy of a map, as disclosed in one embodiment of this application.

[0014] Figure 2 This is another embodiment of the present application, which discloses a schematic diagram of the composition of the internal unit of a main control chip. Detailed Implementation

[0015] The technical solutions of the embodiments of this application will be described in detail below with reference to the accompanying drawings. To further illustrate the embodiments, this application provides accompanying drawings. These drawings are part of the disclosure of this application and are mainly used to illustrate the embodiments, and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementation methods and the advantages of this application.

[0016] Due to the complexity and diversity of indoor working environments for robotic vacuum cleaners, the straight lines they identify sometimes do not match the actual wall distribution in the working scene. For example, if there are too many densely distributed small obstacles, the robot is prone to frequent collisions with these small obstacles. The combination / connection lines of the outlines of densely distributed small obstacles are also easily identified as walls, resulting in deviations in the angle calculation of the wall's extension direction. In addition, the grid map may mark obstacles that are too thick, meaning that the outline information of straight obstacles marked on the map is affected by the wall thickness, causing deviations in the angle calculation of the calculated wall outline, resulting in a tilt relative to the actual wall surface.

[0017] To address the aforementioned technical deficiencies, this application discloses a method for improving the straight-line accuracy of maps. Before executing this method, the robot collects environmental information through relevant sensors to construct a map. As the executor of this method, the robot, in conjunction with its installed inertial sensors, laser sensors, etc., collects environmental information to construct the map and acquires map images for straight-line feature processing. The robot described herein is a mobile robot, which can be a sweeping robot, a mopping robot, a navigation robot, or a disinfection robot, etc. Due to their working characteristics, navigation robots and disinfection robots do not have high requirements for their movement trajectory; therefore, the technical solution of this application can be used only when detecting wall outlines, and does not need to be used throughout the entire working process.

[0018] As one example, such as Figure 1 As shown, the method includes: Step 1: Binarize the map to obtain a binary image. In Step 1, the robot can first convert the pre-built map into a grayscale image, and then perform binarization to convert the grayscale image into the binary image. Then, proceed to Step 2. Generally, during navigation, the robot will mark the environmental information scanned by the sensors onto a grid map and use the grid to mark the corresponding contours, including marking the contours of walls in the indoor environment, to build a map. Then, the grid map will be binarized. Since the distance between points on the edge of a single grid in the grid map is relatively short, the contour marked between two points is a line segment with pixel-level precision.

[0019] In step 1, during the binarization process, the robot assigns binary 0 to both the grids occupied by the scanned passable areas and the grids occupied by the unscanned areas, and assigns binary 1 to the grids occupied by the scanned obstacles. Grids assigned binary 0 and binary 1 are filled with pixels of different pixel values / grayscale values ​​to display different colors. For example, grids assigned binary 1 are displayed as white, and grids assigned binary 0 are displayed as black, thus obtaining the binary image. This eliminates irrelevant information in the original map image, reduces discrete pixels near the wall outline, restores useful real information, enhances the detectability of straight line feature-related information, and simplifies pixel data to the maximum extent, thereby improving the reliability of straight line segment extraction, matching, and recognition.

[0020] Step 2: Extract the skeleton image from the binary image using an image thinning algorithm. This can also be understood as simplifying / thinning the skeleton to refine the outline shape of the map. Specifically, the thickness of the walls marked in the binary image (the wall outline can be marked in white) can be reduced to refine the skeleton of the scanned indoor rooms / the boundary lines that enclose each scanned room. This results in a skeleton image. Reducing the interference of the marked wall thickness on the extraction of straight line segments will prevent the required straight line segments from being too tilted due to the previously marked obstacles being too thick in the raster map. Then, proceed to step 3.

[0021] The preferred image thinning algorithm is the Zhang-Suen algorithm. In order to reduce the wall thickness, step 2 thins the binary image to obtain each contour point. Then, it is determined from each contour point and its neighborhood information which pixels should be deleted. After gradual deletion, the skeleton of the image is obtained, forming the thinned map contour. That is, the skeleton image is extracted, and the connectivity of the thinned map contour is also ensured.

[0022] Step 3: Extract the edge detection lines required in Step 1 of the aforementioned embodiment from the skeleton image using a line detection algorithm. The skeleton described in Step 2 is composed of multiple intersecting boundary line segments connected sequentially. Therefore, the line detection algorithm can detect each continuous edge detection line one by one. Then, denoise each extracted edge detection line. Next, perform line fitting on each denoised edge detection line to obtain a fitted line segment. That is, each denoised edge detection line is fitted into a fitted line segment, serving as a sub-pixel level line. This indicates improved pixel-level extraction accuracy of the line. Furthermore, the length and angle of the fitted line segment in the map coordinate system can be calculated, allowing for the filtering of the line detection results from the line detection algorithm, thus improving the extraction accuracy of the line segment and raising the extraction accuracy of the fitted line segment relative to the edge detection line from the pixel level to the sub-pixel level.

[0023] Compared with the prior art, the robot disclosed in this application, by performing the aforementioned steps 1 to 3, first refines the skeleton of the map, then performs line detection, noise reduction and line fitting in the skeleton to obtain line segments with higher extraction accuracy, thereby reducing the influence of the contour thickness of the map annotation or robot collision factors, and improving the accuracy and stability of map construction.

[0024] As one embodiment, in step 2, the method for extracting the skeleton image from the binary image using an image thinning algorithm includes: the robot searches for pixels in the binary image used to mark the map outline, and gradually deletes non-skeleton pixels in the neighborhood of the searched pixels according to the image thinning algorithm. The non-skeleton pixels are the pixels to be deleted in the image thinning algorithm so that the outline shape of the map is not changed before and after deletion. Therefore, the image thinning algorithm can remove a portion of the points in the binary image, and the remaining points can still maintain their original shape, that is, the skeleton of the map.

[0025] To progressively remove non-skeleton pixels within the neighborhood of individual pixels, the preferred image thinning algorithm is the Zhang-Suen algorithm. This algorithm thins the binarized image for more efficient image processing. The Zhang-Suen algorithm is an iterative algorithm that thins the image by repeatedly applying two sub-steps. The core of the Zhang-Suen algorithm lies in the fact that each iteration consists of two sub-steps, each with a series of conditions to determine which pixels should be removed (i.e., the non-skeleton pixels). These conditions are based on the pixel's neighborhood information, ensuring that the thinned image maintains connectivity.

[0026] During the image thinning algorithm, non-skeleton pixels are progressively deleted from the neighborhood of the searched pixels until no new non-skeleton pixels are deleted in the binary image, resulting in a skeleton image. The algorithm then terminates, effectively thinning connected regions of annotated map contours to the width of a single pixel. Therefore, the image thinning algorithm can thin a connected region of a wall to the width of a single pixel, facilitating the extraction of connected wall contour segments to form a skeleton image. It avoids the problem of excessively slanted lines extracted due to thickly annotated obstacles in the raster map.

[0027] In step 3, the method for extracting edge detection lines from the skeleton image using a line detection algorithm includes: After traversing the skeleton image using a filtering kernel, the robot calculates the gradient of each pixel. Specifically, the robot uses the filtering kernel built into its line detection algorithm to traverse the skeleton image, applying Gaussian filtering to suppress noise. Then, the robot uses gradient operators such as the Prewitt operator and the Sobel operator to calculate the pixel gradient, including the gradient along the X-axis (corresponding to the horizontal coordinate axis) and the gradient along the Y-axis (corresponding to the vertical coordinate axis).

[0028] The robot selects a batch of consecutive pixels based on the gradient of the pixels. The preferred line detection algorithm is the EDLines algorithm, which can select pixels with larger gradients from a pair of adjacent pixels and configure them as anchors. Pixels with larger gradients are generally located at the edge of the image. This application uses anchors to provide more accurate edge direction information.

[0029] The selected batch of consecutive pixels are then connected to form an initial line segment, i.e., the initial line segment is generated by connecting anchor points. However, the generated initial line segment may contain some unnecessary intermediate points. Then, the least squares method is used to fit the initial line segment to obtain the edge detection line. The line fitting is essentially to fit the anchor points and filter out the intermediate points that have no value, making the fitted line segment smoother.

[0030] In summary, EDLines is used to extract multiple edge detection lines, each at the pixel level, representing continuous edge features in the skeleton image. In robot navigation, after the line detection algorithm takes wall information as input, it sequentially performs filtering, gradient selection, and line fitting, outputting a clean, continuous chain of pixels that forms the edge detection lines. This enables accurate identification and tracking of straight line features in the environment, reducing interference from unnecessary edge points in the image.

[0031] Based on the above embodiments, the method for denoising the extracted edge detection lines in step 3 includes: After the robot extracts the edge detection lines, it identifies the pixels at both ends of the edge detection lines. For example, if multiple edge detection lines are selected, the coordinate data of the discrete points of the edge detection or the connection of the edge detection in the map coordinate system are identified and fitted one by one. It can be determined that in most edge detection lines, the two endpoints of the edge detection line or the two discrete points near the two endpoints are obviously noise points and need to be removed.

[0032] Considering the short distance between adjacent endpoints of a single grid cell in a raster map, and the fact that extracted straight line pixels are pixel-precision, determining the two endpoints of the edge detection line is most likely to cause the edge detection line to tilt by at least one pixel. Therefore, for each extracted edge detection line, the head and tail endpoints of the edge detection line must be identified. Then, the pixels at both ends are removed to retain the middle segment of the edge detection line (retaining the edge points in the middle part) as the denoised edge detection line. This prevents the pixels at both ends from causing the edge detection line to tilt relative to the gradient direction determined by the calculated gradient (i.e., introducing a small angular deviation in the straight line fitting, resulting in a fitting angle deviation). By removing the outliers at the head and tail, the influence of errors is reduced, and a higher-precision straight line segment can be fitted from the remaining pixels.

[0033] Based on the above embodiments, in step 3, the method for straight line fitting of the denoised edge detection line includes: using the least squares method to perform straight line fitting on the denoised edge detection line. The pixels that make up the denoised edge detection line are still at the pixel level, but the denoised edge detection line (the remaining pixels after removing outliers) can extract straight line segments with higher pixel accuracy. Then, the fitted straight line segment is obtained through straight line fitting, and the straight line parameters can be calculated using the least squares method to obtain the angle of the fitted straight line segment.

[0034] Equivalently, the robot uses the least squares method to process the denoised pixels on the edge detection line until all pixels are fitted, thereby performing two straight line fittings on the initial line segment. This allows the fitted straight line segment to be extracted from the grid map with sub-pixel accuracy, i.e., high-precision straight lines at the sub-pixel level are selected, improving the extraction accuracy of the straight line segment. This improves the extraction accuracy of the fitted straight line segment relative to the edge detection line from the pixel level to the sub-pixel level.

[0035] In robot navigation, if there are many small obstacles densely distributed in a local area, the robot is prone to frequent collisions with these small obstacles. Due to the characteristics of grid maps (the points on the map edges are relatively short, and the algorithms for extracting straight lines are all pixel-precision), the points on the edges can easily cause the straight lines to tilt by one pixel. Therefore, we continue to use the least squares method to fit the denoised edge detection lines to straight lines, which can prevent the robot from colliding with too many obstacles in the local area and causing the angle of the fitted straight line segment to deviate.

[0036] Therefore, the robot first refines the skeleton image from the preprocessed map, and then runs new edge detection and edge drawing operations through the straight line detection algorithm to generate a set of adjacent pixel chains, called edge detection lines. The edge detection lines intuitively reflect the outline of the wall and are pixel-level edge lines, representing continuous edge features in the image. However, the extracted edge detection lines still have interference factors. For example, if there are many small obstacles in a local area, the robot will frequently collide with them and continuously scan out multiple discrete edge points, or if the thickness of the obstacle is too large, the straight line segments extracted by the robot to mark the outline of the wall will be tilted relative to the actual wall. Therefore, denoising each extracted edge detection line can be seen as filtering the edge points that make up the edge detection line, removing outliers, and retaining edge points with unidirectional connections. Then, straight line fitting is performed on the retained edge points to output multiple fitted straight line segments. Each fitted straight line segment can be regarded as a sub-pixel straight line. The least squares method can then be used to calculate the straight line parameters, and the angle of each fitted straight line segment can be calculated, achieving sub-pixel-level straight line segment angle extraction accuracy. This prevents the robot from deviating from the angle calculation of the fitted straight line due to too many obstacles in local areas. In the robot's laser vision system, the aforementioned straight line detection algorithm, denoising, and straight line fitting can help the robot identify paths and obstacles in the environment, thereby achieving autonomous navigation.

[0037] This application also discloses a main control chip, such as Figure 2 As shown, the main control chip includes a binarization unit, an image thinning unit, and a line detection unit. The main control chip can be set inside or outside the robot and connected to relevant sensors. The robot pre-constructs a map by collecting environmental information and then transmits the map to the main control chip.

[0038] Those skilled in the art will understand that all or part of the processes in the embodiments of the above-described method for improving map line accuracy can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above-described methods. When selecting a main control chip to execute the above-described method for improving map line accuracy, the main control chip can sequentially divide into three interconnected circuit modules or storage medium modules according to steps 1 to 3: a binarization unit, an image thinning unit, and a line detection unit. Specifically, the binarization unit defined in this application corresponds to step 1 of the aforementioned embodiments; the binarization unit is a hardware logic circuit implementation of step 1 of the aforementioned embodiments or serves as a single storage medium for executing step 1. The image thinning unit defined in this application corresponds to step 2 of the aforementioned embodiments; the image thinning unit is a hardware logic circuit implementation of step 2 of the aforementioned embodiments or serves as a single storage medium for executing step 2. The line detection unit is a hardware logic circuit implementation of step 3 of the aforementioned embodiments or serves as a single storage medium for executing step 3.

[0039] The binarization unit is used to binarize the map to obtain a binary image. The binarization unit first converts the pre-built map into a grayscale image, then performs binarization processing to convert the grayscale image into the binary image, and then transmits the binary image to the image thinning unit. Generally, during the navigation process, the robot will mark the environmental information scanned by the sensors into a grid map and use the grid to mark the corresponding contours, including marking the contours of walls in the indoor environment, to build a map. Then the grid map is binarized. Since the point distance of a single grid edge in the grid map is relatively short, the contour marked between two points is a line segment with pixel-level precision.

[0040] In the specific implementation of binarization processing by the binarization unit, the grids occupied by the scanned passable area and the grids occupied by the unscanned area are both assigned a binary 0 value, while the grids occupied by the scanned obstacles are assigned a binary 1 value. The grids assigned a binary 0 value and the grids assigned a binary 1 value are filled with pixels of different pixel values / grayscale values ​​to display different colors. For example, the grids assigned a binary 1 value are displayed as white, and the grids assigned a binary 0 value are displayed as black, thereby obtaining the binary image. This eliminates irrelevant information in the original map image, reduces discrete pixels near the wall outline, restores useful real information, enhances the detectability of straight line feature-related information, and simplifies pixel data to the maximum extent, thereby improving the reliability of straight line segment extraction, matching, and recognition.

[0041] The image thinning unit is used to extract a skeleton image from the binary image obtained by the binarization unit using an image thinning algorithm. This can be understood as simplifying / thinning the skeleton to refine the outline shape of the map. Specifically, it can reduce the thickness of the walls marked in the binary image (the wall outline can be marked in white), refine the skeleton of the scanned indoor rooms / the boundary lines surrounding each scanned room, and generate a skeleton image. By reducing the interference of the marked wall thickness on the extraction of straight line segments, the straight line segments to be extracted will not be too tilted due to the original thick obstacles marked in the aforementioned raster map. The preferred image thinning algorithm is the Zhang-Suen algorithm. In order to reduce the wall thickness, the image thinning unit performs thinning processing on the binary image to obtain each contour point. Then, it determines which pixels should be deleted from each contour point and its neighborhood information. After gradual deletion, the skeleton of the image is obtained, forming the thinned map contour. That is, the skeleton image is extracted, and the connectivity of the thinned map contour is also ensured.

[0042] The line detection unit extracts edge detection lines from the skeleton image extracted by the image thinning unit using a line detection algorithm. The extracted edge detection lines are then denoised, and finally fitted with a straight line to obtain a fitted line segment. The skeleton extracted by the image thinning unit is composed of multiple intersecting boundary line segments connected sequentially. Therefore, the line detection algorithm can detect each continuous edge detection line one by one. Each extracted edge detection line is then denoised, and finally fitted with a straight line to obtain a fitted line segment. In other words, each denoised edge detection line is fitted into a fitted line segment, serving as a sub-pixel level straight line. This indicates improved pixel-level line extraction accuracy. Furthermore, the length and angle of the fitted line segment in the map coordinate system can be calculated, allowing for the filtering of the line detection results from the line detection algorithm and improving the extraction accuracy of the line segment. This elevates the extraction accuracy of the fitted line segment relative to the edge detection line from the pixel level to the sub-pixel level.

[0043] Compared with existing technologies, the main control chip disclosed in this application first refines the skeleton of the map, and then performs line detection, noise reduction and line fitting in the skeleton to obtain line segments with higher extraction accuracy. This achieves the extraction of fitted line segments, reduces the influence of map annotation contour thickness or robot collision factors, and improves the accuracy and stability of map construction.

[0044] In one embodiment, the image thinning unit searches for pixels within a binary image used to label map contours. It then progressively removes non-skeleton pixels from the neighborhood of the searched pixels using an image thinning algorithm, until no new non-skeleton pixels are removed from the binary image, resulting in a skeleton image. This skeleton image is then used to thin the connected regions used to label map contours to the width of a single pixel. The non-skeleton pixels are those selected for deletion in the image thinning algorithm to ensure that the map's contour shape remains unchanged before and after deletion. Therefore, the image thinning unit achieves the goal of removing a portion of points from a binary image while maintaining the original shape of the remaining points, i.e., the map's skeleton.

[0045] In order to progressively delete non-skeleton pixels within the neighborhood of each pixel, the image thinning unit preferably uses the Zhang-Suen algorithm. This algorithm thins the binarized image to make it thinner for more efficient image processing. The Zhang-Suen algorithm is an iterative algorithm that thins the image by repeatedly applying two sub-steps. The core of the Zhang-Suen algorithm lies in the fact that each iteration consists of two sub-steps, each with a series of conditions to determine which pixels should be deleted (i.e., the non-skeleton pixels). These conditions are based on the pixel's neighborhood information, ensuring that the thinned image maintains connectivity.

[0046] During the image thinning algorithm execution, the image thinning unit progressively deletes non-skeleton pixels within the neighborhood of the searched pixels until no new non-skeleton pixels are deleted from the binary image, resulting in a skeleton image. The algorithm then terminates, thinning the connected regions used to annotate map contours to the width of a single pixel. Therefore, the image thinning unit can thin a connected region of a wall to the width of a single pixel, facilitating the extraction of connected wall contour segments to form a skeleton image. This prevents the extracted lines from becoming overly slanted due to excessively thick obstacle annotations on the raster map.

[0047] As one embodiment, the line detection unit is used to calculate the gradient of each pixel after traversing the skeleton image using a filtering kernel. Specifically, the line detection unit uses a filtering kernel built into the line detection algorithm to traverse the skeleton image, and the filtering kernel applies Gaussian filtering to the skeleton image to suppress noise. Then, the line detection unit uses gradient operators such as the Prewitt operator and the Sobel operator to calculate the pixel gradient, including the gradient in the X-axis direction (corresponding to the horizontal coordinate axis direction) and the gradient in the Y-axis direction (corresponding to the vertical coordinate axis direction).

[0048] The line detection unit is also used to select a batch of consecutive pixels based on the gradient of the pixels. The preferred line detection algorithm is the EDLines algorithm, which can select pixels with larger gradients from a pair of adjacent pixels and configure them as anchor points. Pixels with larger gradients are generally located at the edge of the image. The line detection unit provides more accurate edge direction information using anchor points.

[0049] The line detection unit is also used to connect a batch of selected consecutive pixels into an initial line segment, that is, to connect anchor points to generate an initial line segment. However, the generated initial line segment may contain some unnecessary intermediate points. Then, the least squares method is used to perform line fitting on the initial line segment to obtain the edge detection line. The line fitting is essentially to fit the anchor points and filter out the intermediate points that have no value, so that the fitted line segment is smoother.

[0050] In summary, the line detection unit uses EDLines to extract multiple edge detection lines, each at the pixel level, representing continuous edge features in the skeleton image. In robot navigation, after inputting wall information, the line detection algorithm sequentially performs filtering, gradient selection, and line fitting, outputting a clean, continuous chain of pixels that forms the edge detection lines. This enables accurate identification and tracking of straight line features in the environment, reducing interference from unnecessary edge points in the image.

[0051] As one embodiment, the line detection unit is used to identify the pixel points at both ends of the edge detection line. For example, multiple edge detection lines are selected, and for each edge detection line, the coordinate data of the discrete points of the edge detection or the connection of the edge detection in the map coordinate system are identified and fitted one by one. It can be determined that in most edge detection lines, the two endpoints of the edge detection line or the two discrete points near the two endpoints are obviously noise points and need to be removed. Then, the pixel points at both ends of the identified edge detection line are removed to retain the middle part of the edge detection line as the denoised edge detection line. Considering the short distance between adjacent endpoints of a single grid cell in a raster map, and the fact that the extracted straight line pixels are pixel-precision, determining the two endpoints of the edge detection line is most likely to cause the edge detection line to tilt by at least one pixel. Therefore, for each extracted edge detection line, the head and tail endpoints of the edge detection line must be identified. Then, the pixels at both ends are removed to retain the middle segment of the edge detection line (retaining the edge points in the middle part) as the denoised edge detection line. This prevents the pixels at both ends from causing the edge detection line to tilt relative to the gradient direction determined by the calculated gradient (i.e., introducing a small angular deviation in the straight line fitting, resulting in a fitting angle deviation). By removing the abnormal points at the head and tail, the influence of error is reduced, and a higher-precision straight line segment can be fitted from the remaining pixels.

[0052] Based on the above embodiments, the line detection unit is used to perform line fitting on the denoised edge detection line using the least squares method. The pixels that make up the denoised edge detection line are still at the pixel level, but the line detection unit can extract line segments with higher pixel accuracy using the denoised edge detection line (the remaining pixels after removing outliers). The fitted line segment is obtained through line fitting, and the line parameters can be calculated using the least squares method to obtain the angle of the fitted line segment.

[0053] Equivalently, the line detection unit uses the least squares method to process the denoised pixels on the edge detection line until all pixels are fitted, thereby performing two line fittings on the initial line segment. This allows for the extraction of the fitted line segment in the grid map with sub-pixel accuracy, i.e., filtering out high-precision lines at the sub-pixel level, improving the extraction accuracy of the line segment, and raising the extraction accuracy of the fitted line segment relative to the edge detection line from the pixel level to the sub-pixel level.

[0054] In robot navigation, if there are many small obstacles densely distributed in a local area, the robot is prone to frequent collisions with these small obstacles. Due to the characteristics of grid maps (the points on the map edges are relatively short, and the algorithms for extracting straight lines are all pixel-precision), the points on the edges can easily cause the straight lines to tilt by one pixel. Therefore, the straight line detection unit continues to use the least squares method to fit the denoised edge detection lines to a straight line. This can prevent the robot from colliding with too many obstacles in a local area, which would cause the angle of the straight line segment fitted by the straight line detection unit to deviate.

[0055] The above embodiments are only for illustrating the technical concept and features of this application, and are intended to enable those skilled in the art to understand the content of this application and implement it accordingly. They should not be construed as limiting the scope of protection of this invention. All equivalent changes or modifications made in accordance with the spirit and essence of this application should be covered within the scope of protection of this application.

Claims

1. A method for improving straight-line accuracy of a map, a robot previously constructing a map by collecting environment information, characterized by, The method includes: Step 1: Binarize the map to obtain a binary image; then proceed to Step 2. Step 2: Extract the skeleton image from the binary image using an image thinning algorithm; then proceed to step 3. Step 3: Extract edge detection lines from the skeleton image using a line detection algorithm, then denoise the extracted edge detection lines, and finally fit the denoised edge detection lines with a straight line to obtain the fitted line segments.

2. The method of claim 1, wherein, In step 2, the method for extracting the skeleton image from the binary image using an image thinning algorithm includes: Search for pixels in the binary image used to label the map outline, and gradually delete non-skeleton pixels in the neighborhood of the searched pixels according to the image thinning algorithm until no new non-skeleton pixels are deleted in the binary image to obtain the skeleton image, which is used to thin the connected regions used to label the map outline into the width of a single pixel. Among them, non-skeleton pixels are pixels that are set in the image thinning algorithm to be deleted so that the outline shape of the map is not changed before and after deletion.

3. The method of claim 2, wherein, In step 3, the method for extracting edge detection lines from the skeleton image using a line detection algorithm includes: After traversing the skeleton image using a filter kernel, the gradient of each pixel is calculated. Select a batch of consecutive pixels based on the gradient of the pixels, and then connect the selected batch of consecutive pixels to form an initial line segment. The edge detection line is obtained by fitting a straight line to the initial line segment using the least squares method.

4. The method of claim 3, wherein, In step 3, the method for denoising the extracted edge detection lines includes: The pixels at both ends of the edge detection line are identified, and then the identified pixels at both ends are removed, so that the middle part of the edge detection line is retained as the denoised edge detection line.

5. The method of claim 4, wherein, In step 3, the method for linear fitting of the denoised edge detection lines includes: The denoised edge detection line is fitted with a straight line using the least squares method to obtain a fitted straight line segment, thereby achieving two straight line fittings on the initial line segment.

6. A master chip, characterized by The main control chip includes a binarization unit, an image thinning unit, and a line detection unit; the robot pre-constructs a map by collecting environmental information and then transmits the map to the main control chip. Binarization units are used to binarize maps to obtain binary images. An image thinning unit is used to extract a skeleton image from the binary image obtained by the binarization unit using an image thinning algorithm; The line detection unit is used to extract edge detection lines from the skeleton image extracted by the image thinning unit using a line detection algorithm. Then, the extracted edge detection lines are denoised, and the denoised edge detection lines are fitted with lines to obtain fitted line segments.

7. The master chip of claim 6, wherein, The image thinning unit is used to search for pixels in the binary image that are used to mark the map outline, and to gradually delete non-skeleton pixels in the neighborhood of the searched pixels according to the image thinning algorithm until no new non-skeleton pixels are deleted in the binary image, thereby obtaining a skeleton image, which is used to thin the connected region used to mark the map outline into the width of a single pixel. Among them, non-skeleton pixels are pixels that are set in the image thinning algorithm to be deleted so that the outline shape of the map is not changed before and after deletion.

8. The master chip of claim 7, wherein, The line detection unit is used to traverse the skeleton image using a filter kernel, calculate the gradient of the pixels, select a batch of consecutive pixels based on the gradient, connect the selected batch of consecutive pixels into an initial line segment, and then use the least squares method to perform line fitting on the initial line segment to obtain the edge detection line.

9. The master chip of claim 8, wherein, The line detection unit is used to identify the pixels at both ends of the edge detection line, and then remove the identified pixels at both ends, so as to retain the middle part of the edge detection line as the denoised edge detection line.

10. The master chip of claim 9, wherein, The line detection unit is used to perform line fitting on the denoised edge detection line using the least squares method to obtain a fitted line segment, thereby realizing two line fittings on the initial line segment.