A Spark distributed computing method, device, electronic device and storage medium for rural road pavement width

Through Spark distributed computing system and chain code algorithm, combined with electronic maps and low-precision remote sensing image data, the problem of low calculation accuracy and matching accuracy of rural road pavement width is solved, and efficient and economical road pavement width calculation is achieved.

CN119323596BActive Publication Date: 2025-04-22CHINA ACAD OF TRANSPORTATION SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411876564.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-22
Estimated Expiration
2044-12-19

AI Technical Summary

Technical Problem

In the prior art, the calculation accuracy and matching accuracy of the road width of rural roads are low and the cost is high. Especially in mountainous areas, the calculation difficulty increases due to weak satellite signals and vegetation and building shading.

Method used

Using Spark distributed computing system, by obtaining rural road electronic maps and low-precision remote sensing image data, applying chain code algorithms and geospatial buffer analysis methods, dividing grid maps and grid images, extracting and matching road surface-like vector data, calculating the road surface width matrix and assigning value to the electronic map.

Benefits of technology

The calculation accuracy and matching accuracy of rural road pavement width are improved, while reducing costs, solving the problem of difficulty in computing rural roads in mountainous areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119323596B_ABST
    Figure CN119323596B_ABST
Patent Text Reader

Abstract

The present application provides a Spark distributed computing method, device, electronic device and storage medium for the road width of rural roads, which obtains a grid map set containing rural roads in an electronic map of rural roads, and a grid image set containing rural roads in remote sensing image data; applies a chain code algorithm to calculate each grid image in the grid image set, and determines the road surface vector data in each grid image; uses each grid image in the grid image set as the current grid image, calculates the road width matrix corresponding to the first linear road segment corresponding to the current grid image, and assigns it to the target linear road segment in the target grid map; based on the road width matrix assigned to the target linear road segment in each grid map in the grid map set, determines the road width of the specified road. The present application can improve the calculation accuracy of the road width of rural roads while reducing costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image technology, and in particular to a Spark distributed computing method, device, electronic device and storage medium for rural road pavement width. Background Art

[0002] In the prior art, for the calculation of the road width of rural roads, at least three Spark distributed nodes are deployed in a Yarn manner, and a geographic analysis processing module algorithm and a convolutional neural network model algorithm are deployed in each distributed node. Under this distributed architecture, the capacity method is used to schedule the subtasks of each distributed node. In this process, high-precision remote sensing image data is usually required to improve the calculation accuracy of the road width of rural roads, which will result in high costs. In addition, the satellite signal in the mountainous areas where most rural roads are located is weak, resulting in a large deviation between the linear shape of rural roads and remote sensing images, making it difficult to accurately match the corresponding remote sensing image data. This situation further affects the calculation accuracy of the road width; in addition, when the rural roads are blocked by surrounding vegetation, buildings, etc., the road width of rural roads cannot be accurately calculated. Summary of the invention

[0003] The purpose of this application is to provide a Spark distributed calculation method, device, electronic device and storage medium for the road width of rural roads, so as to improve the calculation accuracy and matching accuracy of the road width of rural roads while reducing the cost.

[0004] In a first aspect, the present application provides a Spark distributed computing method for the road width of rural roads, which is applied to a Spark distributed computing system, and includes: obtaining an electronic map of rural roads and corresponding remote sensing image data; determining a grid map set containing rural roads in the electronic map of rural roads, and a grid image set containing rural roads in the remote sensing image data; applying a chain code algorithm to calculate each grid image in the grid image set to determine the road surface vector data in each grid image; taking each grid image in the grid image set as a current grid image, performing the following steps: combining the current grid image with its adjacent grid images; The corresponding highway surface vector data are processed into lines to determine at least one first linear highway section; a target grid map corresponding to the current grid image is searched from the grid map set; for each first linear highway section, the first linear highway section is matched with the highway data in the target grid map for highway features to determine the target linear highway section in the target grid map that matches the features of the first linear highway section; a road width matrix corresponding to the first linear highway section is calculated and assigned to the target linear highway section in the target grid map; based on the road width matrix assigned to the target linear highway section in each grid map in the grid map set, the road width of the designated highway is determined.

[0005] Furthermore, the above-mentioned steps of determining the grid map set containing rural roads in the rural road electronic map and the grid image set containing rural roads in the remote sensing image data include: dividing the rural road electronic map and the remote sensing image data into the same grid according to a preset grid size; applying a geospatial buffer analysis method to analyze the rural road electronic map and identify the grid map set containing rural roads; determining a plurality of grid images corresponding to the grid map set in the remote sensing image data, and for each grid image, retrieving adjacent grid images corresponding to the grid image; and determining a set consisting of a plurality of grid images and corresponding adjacent grid images as a grid image set in the remote sensing image data.

[0006] Furthermore, the above-mentioned step of applying the chain code algorithm to calculate each grid image in the grid image set and determining the highway surface vector data in each grid image includes: for each grid image in the grid image set, the following steps are performed: tracing multiple pixel matrices corresponding to the grid image; each element in the pixel matrix represents a binary value corresponding to a pixel point; the pixel point corresponding to the binary pixel value representing white belongs to the highway; filtering the pixel matrix with less than a specified number of white pixels and no white pixels around a specified number of pixels to obtain a target pixel matrix; converting the target pixel matrix into white spots, merging adjacent white spots within a specified number of pixels to form a white highway raster image that identifies the edge of the highway; vectorizing the white highway raster image to obtain initial highway surface vector data; deleting highway data with an area less than a preset threshold in the initial highway surface vector data to obtain highway surface vector data in the grid image.

[0007] Furthermore, the above-mentioned step of matching the first linear highway segment with the highway data in the target grid map to determine the target linear highway segment in the target grid map that matches the feature of the first linear highway segment includes: performing a buffer analysis on the target grid map according to a preset spatial area to determine all second linear highway segments that intersect with the first linear highway segment; and comparing the highway features of each second linear highway segment with the first linear highway segment to determine the target linear highway segment in the target grid map that matches the feature of the first linear highway segment.

[0008] Furthermore, the step of comparing the highway features of each second linear highway segment with the first linear highway segment to determine the target linear highway segment in the target grid map that matches the features of the first linear highway segment includes: taking a second linear highway segment as the current linear highway segment, and performing the following calculation and judgment steps: using the chain code algorithm to search for a specified step length to obtain first eigenvalues ​​corresponding to a specified number of consecutive current linear points in the first linear highway segment, and second eigenvalues ​​corresponding to a specified number of consecutive current linear points in the second linear highway segment; judging whether the error between the specified number of consecutive second eigenvalues ​​and the specified number of consecutive first eigenvalues ​​is less than a preset value; if so, continuing to use the chain code algorithm to search for a specified step length to obtain first eigenvalues ​​corresponding to a specified number of consecutive current linear points in the first linear highway, and second eigenvalues ​​corresponding to a specified number of consecutive current linear points in the second linear highway, until the entire second linear highway segment is traversed, and the current linear highway segment is determined as the target linear highway segment; if not, determining the next second linear highway segment as the current linear highway segment, and continuing to perform the calculation and judgment steps.

[0009] Furthermore, the above-mentioned step of calculating the road surface width matrix corresponding to the first linear highway segment includes: taking the target linear point corresponding to the starting point of the target linear highway segment on the first linear highway segment as the current linear point, and executing the following width calculation steps: finding two edge points of the two edge lines of the current linear point on the first linear highway segment that are perpendicular to the corresponding highway surface vector data; calculating the distance value between the two edge points, and judging whether the distance value exceeds a preset distance range; if not, taking the distance value as the road surface width value corresponding to the current point; taking the next linear point of the current linear point on the first linear highway segment as the current linear point again, and continuing to execute the width calculation step; if yes, taking the next linear point of the current linear point on the first linear highway segment as the current linear point again, and continuing to execute the width calculation step; until all linear points on the first linear highway segment are traversed, the road surface width matrix corresponding to the first linear highway segment is obtained.

[0010] Furthermore, the above step of determining the road width of the designated highway based on the road width matrix assigned to the target linear highway segment in each grid map in the grid map set includes: searching for all target linear highway segments corresponding to the designated highway; and performing weighted summation of the road width values ​​in the road width matrix corresponding to all target linear highway segments to obtain the road width of the designated highway.

[0011] In the second aspect, the present application also provides a Spark distributed computing device for the road width of rural roads, which is applied to the Spark distributed computing system, and includes: a data acquisition module, which is used to acquire the electronic map of rural roads and the corresponding remote sensing image data; a grid set determination module, which is used to determine the grid map set containing rural roads in the electronic map of rural roads, and the grid image set containing rural roads in the remote sensing image data; a road surface data determination module, which is used to apply the chain code algorithm to calculate each grid image in the grid image set, and determine the road surface vector data in each grid image; a road matching width assignment module, which is used to take each grid image in the grid image set as the current grid image, and execute the following Steps: performing surface-to-line processing on the highway surface vector data corresponding to the current grid image and its adjacent grid images respectively, and determining at least one first linear highway section; searching for a target grid map corresponding to the current grid image from a grid map set; for each first linear highway section, performing highway feature matching between the first linear highway section and the highway data in the target grid map, and determining a target linear highway section in the target grid map that matches the feature of the first linear highway section; calculating a road surface width matrix corresponding to the first linear highway section, and assigning it to the target linear highway section in the target grid map; a road surface width determination module, for determining the road surface width of a specified highway based on the road surface width matrix assigned to the target linear highway section in each grid map in the grid map set.

[0012] In a third aspect, the present application further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method described in the first aspect above.

[0013] In a fourth aspect, the present application further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described in the first aspect above.

[0014] The present application provides a Spark distributed computing method, device, electronic device and storage medium for pavement width of rural roads. The method is applied to a Spark distributed computing system. First, an electronic map of rural roads and corresponding remote sensing image data are obtained; a grid map set containing rural roads in the electronic map of rural roads and a grid image set containing rural roads in the remote sensing image data are determined; a chain code algorithm is applied to calculate each grid image in the grid image set to determine the road surface vector data in each grid image; each grid image in the grid image set is used as a current grid image, and the following steps are performed: the current grid image and its adjacent grid images are connected; The surface vector data of the highways corresponding to the grid images are processed into lines to determine at least one first linear highway section; the target grid map corresponding to the current grid image is searched from the grid map set; for each first linear highway section, the first linear highway section is matched with the highway data in the target grid map for highway features to determine the target linear highway section in the target grid map that matches the features of the first linear highway section; the road width matrix corresponding to the first linear highway section is calculated and assigned to the target linear highway section in the target grid map; based on the road width matrix assigned to the target linear highway section in each grid map in the grid map set, the road width of the designated highway is determined. In this application, low-precision remote sensing image data can be used, and the road width determined in the remote sensing image data can be accurately assigned to the corresponding highway in the electronic map through the chain code algorithm and the Spark distributed computing process, thereby reducing costs while improving the calculation accuracy and matching accuracy of the road width. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0016] Figure 1 A flowchart of a Spark distributed calculation method for rural road pavement width provided in an embodiment of the present application;

[0017] Figure 2 A flowchart of a grid set determination process in a Spark distributed computing method for rural road pavement width provided in an embodiment of the present application;

[0018] Figure 3 A flowchart of a process for determining planar vector data in a Spark distributed computing method for rural road pavement width provided in an embodiment of the present application;

[0019] Figure 4 A schematic diagram of a highway pavement width determination process provided in an embodiment of the present application;

[0020] Figure 5 A structural block diagram of a Spark distributed computing device for rural road pavement width provided in an embodiment of the present application;

[0021] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] The technical solution of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are 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 ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0023] In view of the problems of high cost caused by using high-precision remote sensing impact data to calculate the width of rural roads in the prior art, as well as poor calculation accuracy caused by the rural roads being blocked by surrounding vegetation, buildings, etc., and poor matching accuracy caused by the large deviation between the rural road line shape and the remote sensing image due to the weak satellite signal in the mountainous area where the rural roads are located. The embodiment of the present application provides a Spark distributed calculation method, device, electronic device and storage medium for the width of rural roads, which improves the calculation accuracy and matching accuracy of the width of rural roads while reducing costs. To facilitate understanding of the present embodiment, a Spark distributed calculation method for the width of rural roads disclosed in the embodiment of the present application is first introduced in detail.

[0024] Figure 1 A flowchart of a Spark distributed computing method for rural road pavement width provided in an embodiment of the present application, the method is applied to a Spark distributed computing system, and the method specifically includes the following steps:

[0025] Step S102, obtaining a rural road electronic map and corresponding remote sensing image data;

[0026] The remote sensing image data here are low-precision remote sensing image data that can be generally obtained on the Internet, such as: Tiandi Map Images, Baidu Images, Amap Images, Google Images, etc.; the rural road electronic map and remote sensing image data are similar to the data in two layers and can be aligned based on the coordinate position of the image.

[0027] Step S104, determining a grid map set containing rural roads in the rural road electronic map, and a grid image set containing rural roads in the remote sensing image data;

[0028] In this step, it is actually necessary to divide the rural road electronic map into grid maps of a specified size, divide the remote sensing image data into grid images of a specified size, and then filter out the grid sets containing rural roads. For example, the rural road electronic map and remote sensing image data can be divided into 5 km × 5 km (divided at longitude 0.04° and latitude 0.043°) grids to be calculated according to longitude and latitude coordinates. Further apply geospatial buffer analysis to identify grid map sets and grid image sets with rural roads. The grid image set can be a grid set obtained by expanding the adjacent grids of the image grids corresponding to the grid map set on the remote sensing image data.

[0029] Step S106, applying the chain code algorithm to calculate each grid image in the grid image set to determine the road surface vector data in each grid image;

[0030] The basic principle of chain code is to convert a two-dimensional shape boundary into a series of coordinate points, each of which corresponds to a point on the original shape. These coordinate points are connected in a certain order to form a chain, so it is called "chain code". Each coordinate point has its corresponding direction code, which is used to indicate the position and direction of the point on the shape boundary.

[0031] The extraction of chain codes requires the help of boundary tracking algorithms. The boundary tracking algorithm is a method for extracting the boundary of an object in an image. The algorithm traverses the pixels in the image, finds the pixels connected to the boundary of the object, and connects these pixels according to certain rules to form a boundary. In the process of connecting pixels, it is necessary to consider the color, brightness and other information of the pixels to determine whether the pixel belongs to the boundary of the object.

[0032] The extraction of chain codes is a step in the boundary tracking algorithm. In the process of extracting the boundary, the position and direction information of each boundary pixel point needs to be recorded so as to generate the chain code later. There are many ways to represent the chain code, among which the most commonly used is the Freeman chain code. The Freeman chain code starts from the starting point, records the coordinates and direction code of the starting point, and then traverses the pixels on the boundary in a certain order and records the direction code of each pixel point. The final chain code is a sequence of coordinate points and direction codes representing the boundary of the shape.

[0033] Step S108, taking each grid image in the grid image set as the current grid image, the following steps are performed: performing surface-to-line processing on the road surface vector data corresponding to the current grid image and its adjacent grid images respectively, and determining at least one first linear road segment; searching the target grid map corresponding to the current grid image from the grid map set; performing road feature matching on the first linear road segment with the road data in the target grid map for each first linear road segment, and determining the target linear road segment in the target grid map that matches the feature of the first linear road segment; calculating the road surface width matrix corresponding to the first linear road segment, and assigning it to the target linear road segment in the target grid map;

[0034] In this step, the same operation needs to be performed for each grid image: first, the surface-to-line process is performed to determine the first linear highway segment in the current grid image and the adjacent grid image, then the target grid map corresponding to the current grid image is found from the grid map set, and further highway feature matching is performed to find the target linear highway segment corresponding to the first linear highway segment in the target grid map, and finally the road width is assigned. The specific calculation process will be described in detail later.

[0035] Step S110, determining the road width of the designated highway based on the road width matrix assigned to the target linear highway segment in each grid map in the grid map set.

[0036] In the grid map set, after assigning width matrices to all matched target linear highway segments, the road width value can be obtained for any highway in the electronic map. For example, all width matrices corresponding to the designated highway whose width is to be obtained can be extracted, and then weighted summation is performed to obtain the road width of the designated highway.

[0037] The method for calculating the road width of rural roads provided in the embodiment of the present application can use low-precision remote sensing image data, chain code algorithm, and Spark distributed computing process to accurately assign the road width determined in the remote sensing image data to the corresponding road in the electronic map, thereby improving the calculation accuracy and matching accuracy of the road width while reducing costs.

[0038] The embodiment of the present application also provides another Spark distributed calculation method for the road width of rural roads, which is implemented on the basis of the above embodiment; this embodiment focuses on describing the grid set determination process, road feature matching process, road width calculation process, etc.

[0039] See also Figure 2 As shown, the above step of determining the grid map set containing rural roads in the rural road electronic map and the grid image set containing rural roads in the remote sensing image data includes:

[0040] Step S202, according to the preset grid size, the rural road electronic map and the remote sensing image data are respectively divided into the same grids for calculation according to the latitude and longitude coordinates. For example, the rural road electronic map and the remote sensing image data are respectively divided into 5 km × 5 km (divided at longitude 0.04° and latitude 0.043°) grids to be calculated.

[0041] Step S204, applying the geospatial buffer analysis method to analyze the rural road electronic map, and identifying a grid map set containing rural roads; for example, identifying a grid map set P containing rural road vector lines. 农村公路 .

[0042] Step S206, in the remote sensing image data, multiple grid images corresponding to the grid map set are determined, and for each grid image, adjacent grid images corresponding to the grid image are retrieved; a set consisting of multiple grid images and corresponding adjacent grid images is determined as a grid image set in the remote sensing image data.

[0043] Since rural road data may have local deviations from remote sensing images, it is necessary to retrieve P in remote sensing image data. 农村公路 The corresponding image grids and the grids of each image grid in eight directions (taking the i-th grid as the starting point, due north, northeast, due east, southeast, due south, southwest, due west, and northwest) are included in the new set to form the grid image set P of the remote sensing image. 遥感影像 .

[0044] See also Figure 3 As shown, the above-mentioned step of applying the chain code algorithm to calculate each grid image in the grid image set to determine the road surface vector data in each grid image includes:

[0045] For each grid image in the grid image collection, the following steps are performed:

[0046] Step S302, tracking a plurality of pixel matrices corresponding to the grid image; each element in the pixel matrix represents a binary value corresponding to a pixel point;

[0047] In the specific implementation, starting from the upper left corner of the grid image, the chain code algorithm is applied to track and calculate the pixels in the grid image that meet the black and white binary values ​​of the highway, indicating that the pixel points corresponding to the black binary pixel values ​​do not belong to the highway; the pixel points corresponding to the white binary pixel values ​​belong to the highway;

[0048] Step S304, filtering pixel matrices whose number of white pixels is less than a specified number and whose surrounding specified number of pixels has no white pixels, to obtain a target pixel matrix;

[0049] For example, the pixel matrix with less than 5 white pixels and no other white pixels within the surrounding 5 pixels is deleted to obtain the target pixel matrix.

[0050] Step S306, converting the target pixel matrix into white spots, merging adjacent white spots within a specified number of pixels, and forming a white highway grid image that identifies the highway edge;

[0051] For example, white spots within 2 pixels of each other are merged to form a white highway grid image that identifies the edge of the highway.

[0052] Step S308, vectorizing the white highway raster image to obtain initial highway surface vector data;

[0053] Step S310, delete the road data with an area smaller than a preset threshold in the initial road surface vector data, and obtain the road surface vector data in the grid image. For example, delete the road data with an area smaller than 0.5 square meters in the initial road surface vector data, and obtain the road surface vector data U in the grid image. 识别 .

[0054] Considering the possible deviation of rural road vector data due to weak satellite signals in mountainous areas and the obstruction of vegetation or buildings near rural roads, the following steps are used to achieve road feature matching, road width assignment, and road width determination of designated roads in electronic maps:

[0055] (1) performing surface-to-line processing on the highway surface vector data corresponding to the current grid image and its adjacent grid images respectively, to determine at least one first linear highway segment;

[0056] The chain code algorithm is applied to each grid image and the surface vector data U identified in the surrounding eight directions of the grid. 识别 Perform surface-to-line processing to determine at least one first linear highway segment; the first linear highway segment can be represented by a highway characteristic matrix Fui.

[0057] ;

[0058] In the Fui highway feature matrix, each element represents feature information corresponding to a linear point in the first linear highway segment, including position information and direction information from the previous linear point to the linear point.

[0059] (2) Buffer analysis is performed on the target grid map according to a preset spatial area to determine all second linear highway segments that intersect with the first linear highway segment; road features of each second linear highway segment are compared with the first linear highway segment to determine the target linear highway segment in the target grid map that matches the features of the first linear highway segment.

[0060] Specifically, taking a second linear highway section as the current linear highway section, the following calculation and judgment steps are performed: using the chain code algorithm to search for a specified step length, obtaining first eigenvalues ​​corresponding to a specified number of consecutive current linear points in the first linear highway section, and second eigenvalues ​​corresponding to a specified number of consecutive current linear points in the second linear highway section; judging whether the error between a specified number of consecutive second eigenvalues ​​and a specified number of consecutive first eigenvalues ​​is less than a preset value; if so, continuing to use the chain code algorithm to search for a specified step length, obtaining first eigenvalues ​​corresponding to a specified number of consecutive current linear points in the first linear highway, and second eigenvalues ​​corresponding to a specified number of consecutive current linear points in the second linear highway, until the entire second linear highway section is traversed, and the current linear highway section is determined as the target linear highway section; if not, determining the next second linear highway section as the current linear highway section, and continuing to perform the calculation and judgment steps.

[0061] In the specific implementation, for each of the aforementioned grid images, the corresponding grid map is found, and each second linear highway segment that intersects with the first linear highway segment in the grid map is tracked through the chain code algorithm, and the corresponding feature matrix is ​​determined to form the feature matrix Fi of all rural roads in the grid map; the similarity between the matching feature matrix Fi and Fui is compared, and within the tolerance value range, it is considered that the linear shape of a rural road matches the highway identified on the remote sensing image, that is, Fi≈Fui. The specific implementation process is as follows:

[0062] Step 1: Perform buffer analysis on the grid map at 500 meters in space, filter out all the linear shapes that intersect with the first linear road segment; use the chain code algorithm to search the step length L to obtain three consecutive rural road linear points P in a rural road linear point set P. i-1 , P i , P i+1 The corresponding eigenvalues ​​F i-1k 、F ik 、F i+1k , , ;

[0063] Step 2: Obtain three consecutive points P on a linear highway segment using the same step length L. ui-1 , P ui , P ui+1 The eigenvalue F ui-1k 、F uik 、F ui+1k , compare the differences between the two groups of three features, if the feature value is within the error ℮, continue to search for the next linear point of the rural road according to the step size of L, and record P in the corresponding K set in order i-1 , P i , P i+1 Point set, and add U to the Ku set 识别 Intersection Line Point Pui-1 , P ui , P ui+1 Wait for the second round of screening.

[0064] Step 3: Similarly, a second linear highway section whose characteristic point difference is within the error is determined as the target linear highway section determined in the grid map.

[0065] (3) Calculating the road width matrix corresponding to the first linear highway segment, including: taking the target linear point corresponding to the starting point of the target linear highway segment on the first linear highway segment as the current linear point, and executing the following width calculation steps: finding two edge points of the two edge lines of the current linear point on the first linear highway segment that are perpendicular to the corresponding highway surface vector data; calculating the distance value between the two edge points, and judging whether the distance value exceeds a preset distance range; if not, taking the distance value as the road width value corresponding to the current point; taking the next linear point of the current linear point on the first linear highway segment as the current linear point, and continuing to execute the width calculation step; if yes, taking the next linear point of the current linear point on the first linear highway segment as the current linear point, and continuing to execute the width calculation step; until all the linear points on the first linear highway segment are traversed, the road width matrix corresponding to the first linear highway segment is obtained.

[0066] like Figure 4 As shown in the figure, the black line is the road surface shape corresponding to the first linear road segment identified based on all the surface vector data of a grid image and its surrounding grid images in the remote sensing image data; the middle gray line is the center line of this surface road, that is, the first linear road segment, and the gray points are linear points on the first linear road segment with a step length L as the interval. Based on these linear points, the width corresponding to the road surface polygon is calculated one by one. The straight lines in the figure are the lines perpendicular to the edge of the surface road corresponding to several continuous linear points shown in the figure. Data with calculated width values ​​exceeding the preset width range are discarded to form a road width matrix consisting of a group of road width values.

[0067] (4) Find all target linear highway sections corresponding to the specified highway; perform weighted summation of the road width values ​​in the road width matrix corresponding to all target linear highway sections to obtain the road width of the specified highway.

[0068] The Spark distributed calculation method for rural road pavement width provided in the embodiment of the present application mainly solves the following deficiencies in the current prior art:

[0069] (1) To solve the problem of high cost of obtaining high-precision remote sensing image data, this embodiment uses low-precision Internet remote sensing image data.

[0070] (2) To solve the problem that most rural roads are located in mountainous areas with weak satellite signals, resulting in large deviations between the alignment of rural roads and remote sensing images, making it difficult to accurately match the corresponding remote sensing image data. In this embodiment, the chain code technology can solve the problem that the alignment of rural road vector data and remote sensing image roads is similar, but the deviation is within 5 kilometers.

[0071] (3) The problem of being unable to accurately calculate the road width of rural roads when the roads are blocked by surrounding vegetation, buildings, etc. is solved. This embodiment solves the problem of being unable to identify rural roads and calculate the road width of rural roads when less than 95% of the linear shapes of the road sections in remote sensing images are blocked by vegetation, buildings, etc. through a road feature matching process.

[0072] Based on the above method embodiment, the present application embodiment also provides a Spark distributed computing device for rural road pavement width, which is applied to the Spark distributed computing system, see Figure 5 As shown, the device includes: a data acquisition module 502, which is used to acquire the rural road electronic map and the corresponding remote sensing image data; a grid set determination module 504, which is used to determine the grid map set containing rural roads in the rural road electronic map, and the grid image set containing rural roads in the remote sensing image data; a road surface data determination module 506, which is used to apply the chain code algorithm to calculate each grid image in the grid image set to determine the road surface vector data in each grid image; a road matching width assignment module 508, which is used to take each grid image in the grid image set as the current grid image, and perform the following steps: respectively assigning the current grid image and its adjacent grid images; The corresponding highway surface vector data is processed into lines to determine at least one first linear highway segment; a target grid map corresponding to the current grid image is searched from the grid map set; for each first linear highway segment, the first linear highway segment is matched with the highway data in the target grid map for highway features to determine the target linear highway segment in the target grid map that matches the features of the first linear highway segment; a road width matrix corresponding to the first linear highway segment is calculated and assigned to the target linear highway segment in the target grid map; a road width determination module 510 is used to determine the road width of the specified highway based on the road width matrix assigned to the target linear highway segment in each grid map in the grid map set.

[0073] Furthermore, the above-mentioned steps of determining the grid map set containing rural roads in the rural road electronic map and the grid image set containing rural roads in the remote sensing image data include: dividing the rural road electronic map and the remote sensing image data into the same grid according to a preset grid size; applying a geospatial buffer analysis method to analyze the rural road electronic map and identify the grid map set containing rural roads; determining a plurality of grid images corresponding to the grid map set in the remote sensing image data, and for each grid image, retrieving adjacent grid images corresponding to the grid image; and determining a set consisting of a plurality of grid images and corresponding adjacent grid images as a grid image set in the remote sensing image data.

[0074] Furthermore, the above-mentioned step of applying the chain code algorithm to calculate each grid image in the grid image set and determining the highway surface vector data in each grid image includes: for each grid image in the grid image set, the following steps are performed: tracing multiple pixel matrices corresponding to the grid image; each element in the pixel matrix represents a binary value corresponding to a pixel point; the pixel point corresponding to the binary pixel value representing white belongs to the highway; deleting the pixel matrix with less than a specified number of white pixels and no white pixels around a specified number of pixels to obtain a target pixel matrix; converting the target pixel matrix into white spots, merging adjacent white spots within a specified number of pixels to form a white highway raster image that identifies the edge of the highway; vectorizing the white highway raster image to obtain initial highway surface vector data; deleting highway data with an area less than a preset threshold in the initial highway surface vector data to obtain highway surface vector data in the grid image.

[0075] Furthermore, the above-mentioned step of matching the first linear highway segment with the highway data in the target grid map to determine the target linear highway segment in the target grid map that matches the feature of the first linear highway segment includes: performing a buffer analysis on the target grid map according to a preset spatial area to determine all second linear highway segments that intersect with the first linear highway segment; and comparing the highway features of each second linear highway segment with the first linear highway segment to determine the target linear highway segment in the target grid map that matches the feature of the first linear highway segment.

[0076] Furthermore, the step of comparing the highway features of each second linear highway segment with the first linear highway segment to determine the target linear highway segment in the target grid map that matches the features of the first linear highway segment includes: taking a second linear highway segment as the current linear highway segment, and performing the following calculation and judgment steps: using the chain code algorithm to search for a specified step length to obtain first eigenvalues ​​corresponding to a specified number of consecutive current linear points in the first linear highway segment, and second eigenvalues ​​corresponding to a specified number of consecutive current linear points in the second linear highway segment; judging whether the error between the specified number of consecutive second eigenvalues ​​and the specified number of consecutive first eigenvalues ​​is less than a preset value; if so, continuing to use the chain code algorithm to search for a specified step length to obtain first eigenvalues ​​corresponding to a specified number of consecutive current linear points in the first linear highway, and second eigenvalues ​​corresponding to a specified number of consecutive current linear points in the second linear highway, until the entire second linear highway segment is traversed, and the current linear highway segment is determined as the target linear highway segment; if not, determining the next second linear highway segment as the current linear highway segment, and continuing to perform the calculation and judgment steps.

[0077] Furthermore, the above-mentioned step of calculating the road surface width matrix corresponding to the first linear highway segment includes: taking the target linear point corresponding to the starting point of the target linear highway segment on the first linear highway segment as the current linear point, and executing the following width calculation steps: finding two edge points of the two edge lines of the current linear point on the first linear highway segment that are perpendicular to the corresponding highway surface vector data; calculating the distance value between the two edge points, and judging whether the distance value exceeds a preset distance range; if not, taking the distance value as the road surface width value corresponding to the current point; taking the next linear point of the current linear point on the first linear highway segment as the current linear point again, and continuing to execute the width calculation step; if yes, taking the next linear point of the current linear point on the first linear highway segment as the current linear point again, and continuing to execute the width calculation step; until all linear points on the first linear highway segment are traversed, the road surface width matrix corresponding to the first linear highway segment is obtained.

[0078] Furthermore, the above step of determining the road width of the designated highway based on the road width matrix assigned to the target linear highway segment in each grid map in the grid map set includes: searching for all target linear highway segments corresponding to the designated highway; and performing weighted summation of the road width values ​​in the road width matrix corresponding to all target linear highway segments to obtain the road width of the designated highway.

[0079] The device provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the embodiment of the device, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0080] The present application also provides an electronic device, such as Figure 6 As shown, it is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 61 and a memory 60, the memory 60 stores computer executable instructions that can be executed by the processor 61, and the processor 61 executes the computer executable instructions to implement the above method.

[0081] exist Figure 6 In the illustrated embodiment, the electronic device further includes a bus 62 and a communication interface 63 , wherein the processor 61 , the communication interface 63 and the memory 60 are connected via the bus 62 .

[0082] Among them, the memory 60 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 63 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 62 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 62 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0083] The processor 61 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 61. The above processor 61 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 61 reads the information in the memory and completes the steps of the method of the above embodiment in combination with its hardware.

[0084] An embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above method. The specific implementation can be found in the aforementioned method embodiment, which will not be repeated here.

[0085] The computer program products of the methods, devices, and electronic devices provided in the embodiments of the present application include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0086] Unless otherwise specifically stated, the relative steps, numerical expressions and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present application.

[0087] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0088] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0089] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A Spark distributed computing method for rural road pavement width, characterized in that: The method is applied to a Spark distributed computing system, and the method includes: Obtain electronic maps of rural roads and corresponding remote sensing image data; Determining a grid map set containing rural roads in the rural road electronic map, and a grid image set containing rural roads in the remote sensing image data; Applying a chain code algorithm to calculate each grid image in the grid image set to determine the highway surface vector data in each grid image; Taking each grid image in the grid image set as the current grid image, the following steps are performed: performing surface-to-line processing on the road surface vector data corresponding to the current grid image and its adjacent grid images respectively, and determining at least one first linear road segment; searching the target grid map corresponding to the current grid image from the grid map set; performing road feature matching on the first linear road segment with the road data in the target grid map for each first linear road segment, and determining a target linear road segment in the target grid map that matches the feature of the first linear road segment; calculating the road surface width matrix corresponding to the first linear road segment, and assigning it to the target linear road segment in the target grid map; Determining the road width of a designated highway based on a road width matrix assigned to a target linear highway segment in each grid map in the grid map set; The step of applying a chain code algorithm to calculate each grid image in the grid image set and determining the highway surface vector data in each grid image includes: for each grid image in the grid image set, performing the following steps: tracking multiple pixel matrices corresponding to the grid image; each element in the pixel matrix represents a binary value corresponding to a pixel point; the pixel point corresponding to the binary pixel value indicating white belongs to the highway; deleting the pixel matrix with less than a specified number of white pixels and no white pixels around a specified number of pixels to obtain a target pixel matrix; converting the target pixel matrix into white spots, merging adjacent white spots within a specified number of pixels to form a white highway raster image that identifies the edge of the highway; vectorizing the white highway raster image to obtain initial highway surface vector data; deleting highway data with an area less than a preset threshold in the initial highway surface vector data to obtain highway surface vector data in the grid image.

2. The method according to claim 1, characterized in that The step of determining a grid map set containing rural roads in the rural road electronic map and a grid image set containing rural roads in the remote sensing image data comprises: According to a preset grid size, the rural road electronic map and the remote sensing image data are respectively divided into the same grids; Applying a geospatial buffer analysis method to analyze the rural road electronic map, and identifying a grid map set containing rural roads; In the remote sensing image data, multiple grid images corresponding to the grid map set are determined, and for each of the grid images, adjacent grid images corresponding to the grid image are retrieved; a set consisting of the multiple grid images and the corresponding adjacent grid images is determined as a grid image set in the remote sensing image data.

3. The method according to claim 1, characterized in that The step of matching the first linear highway segment with highway data in the target grid map to determine a target linear highway segment in the target grid map that matches the feature of the first linear highway segment comprises: Performing a buffer analysis on the target grid map according to a preset spatial area to determine all second linear highway sections intersecting with the first linear highway section; A road feature comparison is performed between each of the second linear road segments and the first linear road segment to determine a target linear road segment in the target grid map that matches the feature of the first linear road segment.

4. The method according to claim 3, characterized in that The step of comparing the highway features of each of the second linear highway segments with the first linear highway segment to determine a target linear highway segment in the target grid map that matches the features of the first linear highway segment comprises: Taking one of the second linear highway segments as the current linear highway segment, the following calculation and judgment steps are performed: Using a chain code algorithm to search for a specified step length, obtain first eigenvalues ​​corresponding to a specified number of consecutive current linear points in the first linear highway segment, and second eigenvalues ​​corresponding to a specified number of consecutive current linear points in the second linear highway segment; Determine whether the error between a continuous specified number of the second eigenvalues ​​and a continuous specified number of the first eigenvalues ​​is less than a preset value; If yes, continue to use the chain code algorithm to search for the specified step length, obtain the first eigenvalues ​​corresponding to the specified number of consecutive current linear points in the first linear highway, and the second eigenvalues ​​corresponding to the specified number of consecutive current linear points in the second linear highway, until the entire second linear highway segment is traversed, and the current linear highway segment is determined as the target linear highway segment; If not, the next second linear highway segment is determined as the current linear highway segment, and the calculation and judgment steps are continued.

5. The method according to claim 1, characterized in that The step of calculating the road surface width matrix corresponding to the first linear highway segment comprises: The target linear point corresponding to the starting point of the target linear highway segment on the first linear highway segment is taken as the current linear point, and the following width calculation steps are performed: Find two edge points of two edge lines of the current linear point on the first linear highway segment that are perpendicular to the corresponding highway surface vector data; Calculating the distance between two edge points, and determining whether the distance exceeds a preset distance range; If not, taking the distance value as the road width value corresponding to the current point; taking the next linear point of the current linear point on the first linear highway segment as the current linear point again, and continuing to execute the width calculation step; If yes, taking the next linear point of the current linear point on the first linear highway segment as the current linear point again, and continuing to perform the width calculation step; Until all linear points on the first linear highway segment are traversed, a road surface width matrix corresponding to the first linear highway segment is obtained.

6. The method according to claim 1, characterized in that The step of determining the road width of a designated highway based on the road width matrix assigned to the target linear highway segment in each grid map in the grid map set comprises: Find all target linear highway segments corresponding to the designated highway; The road width values ​​in the road width matrix corresponding to all target linear highway segments are weightedly summed to obtain the road width of the designated highway.

7. A Spark distributed computing device for rural road width, characterized in that: The device is applied to a Spark distributed computing system, and the device comprises: A data acquisition module is used to obtain electronic maps of rural roads and corresponding remote sensing image data; A grid set determination module, used to determine a grid map set containing rural roads in the rural road electronic map, and a grid image set containing rural roads in the remote sensing image data; A highway surface data determination module, used for applying a chain code algorithm to calculate each grid image in the grid image set to determine the highway surface vector data in each grid image; The highway matching width assignment module is used to take each grid image in the grid image set as the current grid image and perform the following steps: performing surface-to-line processing on the highway surface vector data corresponding to the current grid image and its adjacent grid images respectively, and determining at least one first linear highway segment; searching the target grid map corresponding to the current grid image from the grid map set; for each first linear highway segment, performing highway feature matching on the first linear highway segment and the highway data in the target grid map, and determining the target linear highway segment in the target grid map that matches the feature of the first linear highway segment; calculating the road surface width matrix corresponding to the first linear highway segment, and assigning it to the target linear highway segment in the target grid map; A road width determination module, for determining the road width of a designated highway based on a road width matrix assigned to a target linear highway segment in each grid map in the grid map set; The highway surface data determination module is also used to perform the following steps for each grid image in the grid image set: tracking multiple pixel matrices corresponding to the grid image; each element in the pixel matrix represents a binary value corresponding to a pixel point; indicating that the pixel point corresponding to the white binary pixel value belongs to the highway; deleting the pixel matrix with less than a specified number of white pixels and no white pixels around a specified number of pixels to obtain a target pixel matrix; converting the target pixel matrix into white spots, merging adjacent white spots within a specified number of pixels to form a white highway raster image that identifies the edge of the highway; vectorizing the white highway raster image to obtain initial highway surface vector data; deleting highway data with an area less than a preset threshold in the initial highway surface vector data to obtain highway surface vector data in the grid image.

8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method for calculating pavement width of rural road based on remote sensing image

    CN113155033A

  • Urban non-motorized vehicle lane safety rating method

    CN118485895A