A method and device for extracting precipitation curves assisted by spatial neighborhood
By using spatial neighborhood-assisted methods in the hydrological document archive pictures, combining threshold and clustering methods to extract precipitation curves, and using neighborhood spatial information to supplement the missing parts, the problems of incomplete extraction and redundant interference pixel points in the prior art are solved, and the precipitation curve extraction effect with high integrity and low noise is achieved.
Patent Information
- Application Number
- CN202210371600.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2042-04-11
AI Technical Summary
The prior art is difficult to accurately extract precipitation curves in hydrological document pictures, especially when pencil scratches and table lines are superimposed, resulting in incomplete extraction results and excess interference pixel points.
The spatial neighborhood-assisted precipitation curve extraction method is used to extract the precipitation curve based on threshold and clustering methods, and the missing parts of the curve are supplemented with neighboring spatial information during the scanning process to reduce the influence of noise.
The high-complete extraction of the precipitation curve in the hydrological document image is achieved, reducing the occurrence of unnecessary interference pixel points, and ensuring the accuracy and completeness of the extraction results.
Smart Images

Figure CN114677697B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for extracting precipitation curves assisted by spatial neighborhood, belonging to the technical field of image segmentation. Background Art
[0002] Existing image segmentation techniques can be divided into unsupervised image segmentation and supervised image segmentation. Supervised image segmentation requires a large number of labeled images as samples for training, can make full use of the semantic information of images, cope with the challenges of increasingly complex image segmentation scenarios, and achieve semantic segmentation of images. For the extraction of precipitation curves in hydrological archive pictures, supervised image segmentation requires a large number of precipitation curves with pixel-level annotations as the training set, but this process is too costly. In contrast, unsupervised image segmentation is characterized by not requiring a large training set and having stronger application capabilities. Unsupervised image segmentation often divides an image into several non-overlapping regions by extracting low-level semantic information of the image, such as grayscale, color, spatial texture, etc. However, in a complex environment, the coping ability and accuracy cannot meet the requirements. An obvious situation is that in hydrological archive pictures, the precipitation curve is affected by the superposition of pencil scratches and table lines, making the color of the overlapping part close to the color of the table line and the annotation, so that the precipitation curve cannot be extracted only from the color perspective. Therefore, how to accurately extract the precipitation curve from hydrological archive pictures is a problem worthy of research. Summary of the Invention
[0003] Object of the Invention: In order to be able to automatically read hydrological data in hydrological archive pictures, the present invention provides a method and device for extracting precipitation curves assisted by spatial neighborhood, and the obtained curve has high integrity and low noise.
[0004] Technical Solution: In order to achieve the above object of the invention, the present invention adopts the following technical solution:
[0005] A method for extracting precipitation curves assisted by spatial neighborhood, comprising the following steps:
[0006] (1) Determine a threshold according to the different RGB value characteristics of the precipitation curve, table lines, annotations and other backgrounds in the hydrological archive picture, and extract the precipitation curve based on the threshold;
[0007] (2) Extract the precipitation curve based on the clustering method according to the characteristics of the four parts of the precipitation curve, table lines, annotations and other backgrounds in the hydrological archive picture;
[0008] (3) Taking the precipitation curve extracted based on the threshold as a reference, scan the picture. During the scanning process, if a curve pixel point is encountered, check whether there is a curve pixel point at the corresponding position of the curve extracted based on clustering in the neighborhood of this pixel point. If so, it means that this pixel point is the missing part of the curve and is added to the curve extracted based on the threshold.
[0009] A precipitation curve extraction device assisted by spatial neighborhood includes:
[0010] A curve extraction module based on threshold determines the threshold according to the different RGB value characteristics of the precipitation curve, the table lines, annotations and other backgrounds in the hydrological archive picture, and extracts the precipitation curve based on the threshold;
[0011] A curve extraction module based on clustering extracts the precipitation curve based on the clustering method according to the characteristics of four parts including the precipitation curve, table lines, annotations and other backgrounds in the hydrological archive picture;
[0012] A curve determination module assisted by neighborhood takes the precipitation curve extracted based on the threshold as a reference, scans the picture. During the scanning process, if a curve point is encountered, check whether there is a curve pixel point at the corresponding position of the curve extracted based on clustering in the neighborhood of this pixel point. If so, it means that this pixel point is the missing part of the curve and is added to the curve extracted based on the threshold.
[0013] A computer device, characterized in that it includes: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the program is executed by the processor, the steps of the above-mentioned precipitation curve extraction method assisted by spatial neighborhood are implemented.
[0014] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned precipitation curve extraction method assisted by spatial neighborhood are implemented.
[0015] Beneficial effects: A precipitation curve extraction method assisted by spatial neighborhood proposed by the present invention ensures that the finally extracted precipitation curve meets two conditions by adding neighborhood spatial position information to the picture: one is that the curve part is as complete as possible, and the other is that there are as few redundant interfering pixel points as possible. Description of the Drawings
[0016] Figure 1 It is an example of a hydrological archive picture.
[0017] Figure 2 It is a partial enlarged view of the precipitation curve covered by a pencil scratch and a schematic diagram of its color change.
[0018] Figure 3 It is a partial enlarged view of the precipitation curve covering the table line and a schematic diagram of its color change.
[0019] Figure 4 It is the overall flow chart of the precipitation curve extraction method assisted by spatial neighborhood
[0020] Figure 5 It is the specific flow chart of the precipitation curve extraction method assisted by spatial neighborhood.
[0021] Figure 6 It is the result diagram of the precipitation curve extracted from the hydrological archive picture based on the threshold method.
[0022] Figure 7 It is the result diagram of the precipitation curve extracted from the hydrological archive picture based on the clustering method.
[0023] Figure 8 It is the schematic diagram of the algorithm for curve merging based on spatial neighborhood.
[0024] Figure 9 It is the result diagram of the precipitation curve extraction assisted by spatial neighborhood.
[0025] Figure 10 It is the comparison diagram of the precipitation curve extraction results assisted by spatial neighborhood. Specific implementation manner
[0026] The following further describes the implementation method of the present invention in conjunction with the accompanying drawings.
[0027] The hydrological departments in China use a unified precipitation self-recording paper to record precipitation data, and the ink colors of the self-recording pens used to draw the water level rising curves on the self-recording paper are also unified. The hydrological departments in China have started using this recording paper to record precipitation data since the 1950s. Therefore, when processing precipitation self-recording papers on a large scale, the method for extracting precipitation curves proposed by the present invention has universality. Figure 1 It is an example of a hydrological archive picture, and the hand-drawn line part in the picture represents the precipitation curve. The purpose of the present invention is to extract the precipitation curve from the hydrological archive picture.
[0028] Due to reasons of use and preservation, the precipitation curve will be affected by the superposition of pencil scratches and table lines, making the color of their overlapping parts close to the colors of the table lines and markings, so that the precipitation curve cannot be extracted only from the color perspective. Specifically as Figure 2 and 3 shown. Figure 2 It is a partial enlarged view of the precipitation curve covered by pencil scratches and its color change. The part boxed by the square is the pencil scratch, and the part circled by the circle is the overlapping part of the precipitation curve and the pencil scratch. Figure 3It is a partial enlarged view of the precipitation curve covering the table line and its color change.
[0029] The present invention proposes a method for extracting precipitation curves assisted by spatial neighborhood, and its process is as Figure 4 and Figure 5 shown. The method specifically includes:
[0030] Step 1: Extract the precipitation curve based on a threshold.
[0031] The present invention determines the threshold according to the different RGB value characteristics of the precipitation curve and other backgrounds, table lines, and annotations in the hydrological archive picture, and realizes curve extraction based on the threshold.
[0032] First, initialize a picture with the same size as the hydrological archive picture, and set the pixel values to (255, 255, 255), that is, all appear white; then, judge whether the RGB values of each pixel point in the hydrological archive picture meet the first threshold condition, and the first threshold condition is specifically that the R value is less than 200, and the G value is greater than 30, and the B value is greater than 50. If the first threshold condition is not met, it is determined that the pixel point is a non-curve pixel point, and the pixel value at the current position is not processed. If the first threshold condition is met, then take out the minimum value min and the maximum value max in the RGB three components, calculate the difference diff between max and min, and judge whether the minimum value min is the value corresponding to the R component and whether diff is greater than the preset value 15. If both are satisfied, it can be determined that this pixel point is a point on the curve, and the values of these pixel points are correspondingly set to (0, 0, 0) on the initialized white picture, that is, they appear black in the binary image.
[0033] The precipitation curve extracted from the hydrological archive picture based on the threshold method in Step 1 is as Figure 6 shown.
[0034] From Figure 6 it can be seen that the precipitation curve extracted based on the threshold method does not introduce extra interference. However, Figure 2 and Figure 3 the overlapping parts interfered by the table lines and annotations in
[0035] are recognized as non-precipitation curve parts, that is, the extracted precipitation curve is incomplete.
[0036] The specific implementation method is as follows:
[0037] Step 2-1: According to the obvious differences in the distribution of the four categories of precipitation curves, table lines, annotations, and other backgrounds in the hydrological archive picture in the RGB color space, determine the number of clustering categories k = 4.
[0038] Step 2-2: Select 4 initial clustering centers C = {C 1 , C 2 , C 3 , C 4}, which are (17, 93, 146), (185, 120, 84), (49, 48, 38), and (252, 243, 221) respectively.
[0039] Step 2-3: Calculate the Euclidean distance
[0040] Calculate the Euclidean distance from the value of each pixel point in the hydrological archive picture to the clustering centers C = {C 1 , C 2 , C 3 , C 4}, and divide the value of the current pixel point into the same group as the nearest clustering center.
[0041] In the n-dimensional space, the Euclidean distance formula for calculating the data sample x to the clustering center C i is:
[0042]
[0043] where x is the sample data, that is, the RGB value of the current pixel point, C i is the i-th clustering center (RGB value), i = 1, 2, 3, 4, d is the distance from the sample data x to the clustering center C i (RGB value), n is the dimension of the sample data, here n = 3. x j and C i,j are the j-th values of x and C i , j = 1, 2, 3.
[0044] Step 2-4: Update the clustering center
[0045] For each clustering group C i , calculate the average value of all pixel point values in this group and use it as the new clustering center for the next calculation iteration.
[0046] Step 2-5: Iterate until the termination condition is met
[0047] Repeat steps 2-3 and 2-4 until the stopping condition is met, the error function no longer changes or the maximum number of running rounds is reached, then the clustering ends.
[0048] The precipitation curve extracted from the hydrological archive picture based on the clustering method after step 2 is as Figure 7 shown.
[0049] From Figure 7It can be seen that the precipitation curve extracted based on the clustering method includes many table lines and annotated parts, that is, there are more introduced interfering pixel points, but the missing part of the precipitation curve is less.
[0050] Step 3: Curve merging based on spatial neighborhood
[0051] There is a problem of partial pixel point loss on the precipitation curve extracted based on the threshold, and this missing part of pixel points may exist in the precipitation curve extracted based on the clustering method. The present invention proposes curve merging based on spatial neighborhood. Add neighborhood spatial information to the picture, reduce the influence of noise points using the neighborhood space, and try to fill in the missing part of the precipitation curve as much as possible.
[0052] Taking the precipitation curve picture extracted based on the threshold as a reference, scan each pixel point in the picture. During the scanning process, if a curve point is encountered, check whether the pixel points in the 13*13 neighborhood centered on the coordinate position of this point on the precipitation curve picture extracted based on clustering are black. If so, it means that this pixel point is the missing part of the precipitation curve and is added to the precipitation curve extracted based on the threshold.
[0053] As Figure 8 shown, taking the pixel points in the 5*5 neighborhood centered on the current pixel point coordinate position as an example, draw a schematic diagram of the algorithm. Figure 8 In it, (a) is the precipitation curve extracted based on the threshold, (b) is the precipitation curve extracted based on clustering, and (c) is the precipitation curve assisted by spatial neighborhood extraction. Specifically, Figure 8 (a) The black block in the middle represents the curve point encountered during the Figure 5 scanning process, then check the pixel points in the 5*5 neighborhood centered on the coordinate position of the current pixel point in Figure 8 (b). If the pixel points are black, then consider this point as Figure 8 the missing curve point in (a), and fill this curve point into Figure 8 (a). The result is as Figure 8 (c) shown. Through this method, try to make up for the missing part of the curve as much as possible.
[0054] Let the coordinate of the current pixel point be (x,y), then the neighborhood coordinate is (x+i,y+j). Where i∈{-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6}, j∈{-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6}. Specifically, when i is -6, the value of j can be -6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6; when i is -5, the value of j can be -6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6. And so on.
[0055] The process description of the curve merging algorithm based on spatial neighborhood is as follows:
[0056] (1) Read the precipitation curve extracted based on the threshold and the precipitation curve extracted based on the clustering method, and denote them as images I1 and I2.
[0057] (2) Initialize the parameters. Set a matrix A of w×h to store the pixel values of the finally generated merged curve image I3. Among them, w and h are the widths and heights of images I1 and I2 respectively.
[0058] (3) Traverse each pixel point in turn. Starting from the top-leftmost position of image I1, traverse each pixel point in turn. At the same time, check whether the current pixel point is a point on the curve. If so, process the current pixel point and go to step (4). Otherwise, skip the current pixel point and continue to traverse the next pixel point.
[0059] (4) Find the pixel point at position (x, y) in Figure I2, and determine whether this pixel point and the pixel points in its spatial neighborhood are points on the curve in Figure I2. If so, determine that this pixel point is a missing point in Figure I1, and set the pixel value at the corresponding position of this point in Figure I3 to (0, 0, 0), that is, it appears as black. Otherwise, assign the pixel point value of Figure I1 to the corresponding position of matrix A.
[0060] (5) Repeat steps (3) to (4) until all pixel points in Figure I1 are traversed.
[0061] Figure 9 This is the result graph of the precipitation curve extraction method assisted by spatial neighborhood of the present invention.
[0062] Analyze the final extraction result. As Figure 10 shown, the local areas in Figure 6 , Figure 7 and Figure 9 are intercepted and enlarged, corresponding to (a) the extraction result based on the threshold, (b) the extraction result based on clustering, and (c) the extraction result assisted by spatial neighborhood in Figure 10 in turn. It can be seen from the local enlarged graphs that:
[0063] (1) For the background part of the precipitation curve, Figure 10 (b) there are isolated small noise points, but after the extraction method assisted by spatial neighborhood, Figure 10 (c) there are no small noise points.
[0064] (2) For the problem of missing pixel points of the precipitation curve, it can be seen that Figure 10Too many pixel points are missing from the curve in (a), which will not be conducive to the later curve repair work. However, after the extraction method assisted by the spatial neighborhood, compared with Figure 10 (a), Figure 10 the problem of missing pixel points in the curve in (c) is alleviated. For example, in the parts boxed in the three pictures, Figure 10 in (a), the curve is broken due to excessive missing precipitation pixel points, but this problem is solved in Figure 10 (c). Therefore, the present invention has excellent effects on extracting precipitation curves from hydrological archive pictures.
[0065] The present invention also provides a spatial neighborhood-assisted precipitation curve extraction device, including:
[0066] A threshold-based curve extraction module that determines a threshold according to the different RGB value characteristics of the precipitation curve, the table lines, annotations, and other backgrounds in the hydrological archive picture, and extracts the precipitation curve based on the threshold;
[0067] A clustering-based curve extraction module that extracts the precipitation curve based on the clustering method according to the characteristics of the four parts of the precipitation curve, table lines, annotations, and other backgrounds in the hydrological archive picture;
[0068] A neighborhood-assisted curve determination module that takes the precipitation curve extracted based on the threshold as a reference, scans the picture, and during the scanning process, if a curve point is encountered, checks whether there is a curve pixel point at the corresponding position of the curve extracted based on clustering in the neighborhood position of the pixel point. If so, it means that the pixel point is the missing part of the curve and is added to the curve extracted based on the threshold.
[0069] It should be understood that the spatial neighborhood-assisted precipitation curve extraction device in the embodiments of the present invention can implement all the technical solutions in the above method embodiments. The functions of its various functional modules can be specifically implemented according to the methods in the above method embodiments, and the specific implementation process can refer to the relevant descriptions in the above embodiments, which will not be elaborated here.
[0070] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0071] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing devices to generate a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices produce means for implementing the functions specified in the flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in multiple blocks.
[0072] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means that implement the functions specified in the flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0073] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in the flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0074] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: it is still possible to modify the specific implementation manners of the present invention or make equivalent replacements, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.
Claims
1. A method for extracting precipitation curves assisted by spatial neighborhood, characterized in that, it includes the following steps: (1) Determine a threshold according to the different RGB value characteristics of the precipitation curve, table lines, annotations, and other backgrounds in the hydrological archive picture, and extract the precipitation curve based on the threshold, including: (11) Initialize a picture with the same size as the hydrological archive picture, and set the pixel values to (255, 255, 255); (12) Judge whether the RGB value of each pixel point in the hydrological archive picture meets the first preset condition; (13) If the pixel point does not meet the first preset condition, it is determined as a non-curve pixel point; (14) If the pixel point meets the first preset condition, take out the minimum value min and the maximum value max in the RGB three components, calculate the difference diff between max and min, and judge whether the minimum value min corresponds to the R component value and whether diff is greater than the preset value. If both are satisfied, it is determined that this pixel point is a point on the curve, and the values of these pixel points are set to (0, 0, 0) in the initialized picture; (2) According to the characteristics of the four parts of the precipitation curve, table lines, annotations, and other backgrounds in the hydrological archive picture, extract the precipitation curve based on the clustering method, including: (21) According to the four categories of precipitation curves, table lines, annotations, and other backgrounds in the hydrological archive pictures, the number of clustering categories k = 4 is determined, and 4 initial clustering centers C = {C 1 , C 2 , C 3 , C 4} are selected; (22) Calculate the Euclidean distance from the value of each pixel point in the hydrological archive picture to the clustering center C, and divide the value of the current pixel point and the clustering center with the closest distance into the same family; (23) Update the clustering center, and then repeat the calculation of the Euclidean distance, and repeatedly calculate and iterate until the stop condition is met, the error function no longer changes or the maximum number of running rounds is iterated, then the clustering ends; (3) Taking the precipitation curve extracted based on the threshold as a benchmark, scan the picture. During the scanning process, if a curve pixel point is encountered, check whether there is a curve pixel point at the corresponding position of the curve extracted based on clustering in the neighborhood position of this pixel point. If so, it means that this pixel point is the missing part of the curve and is added to the curve extracted based on the threshold, including: (31) Read the precipitation curve extracted based on the threshold and the precipitation curve extracted based on the clustering method, and record them as images I1 and I2; (32) Set a matrix A of w×h to store the pixel values of the final generated merged curve image I3, where w and h are the widths and heights of images I1 and I2 respectively; (33) Starting from the top-leftmost position of image I1, traverse each pixel point in turn. At the same time, check whether the current pixel point is a point on the curve. If so, process the current pixel point and enter step (34). Otherwise, skip the current pixel point and continue to traverse the next pixel point; (34) Find the pixel point at position (x, y) in figure I2, and judge whether this pixel point and the pixel points in its spatial neighborhood are points on the curve in figure I2. If so, it is determined that this pixel point is the missing point in figure I1, and the pixel value at the corresponding position of this point in figure I3 is set to (0, 0, 0). Otherwise, assign the pixel point value of figure I1 to the corresponding position of matrix A; (35) Repeat steps (33) to (34) until all pixel points in figure I1 are traversed.
2. The precipitation curve extraction method assisted by spatial neighborhood according to claim 1, characterized in that, the first preset condition is: the R value is less than 200, the G value is greater than 30, and the B value is greater than 50.
3. The precipitation curve extraction method assisted by spatial neighborhood according to claim 1, characterized in that, the RGB values of the 4 initial clustering centers are (17, 93, 146), (185, 120, 84), (49, 48, 38), and (252, 243, 221) respectively.
4. The precipitation curve extraction method assisted by spatial neighborhood according to claim 1, characterized in that, the neighborhood is defined as: assuming the coordinates of the current pixel point are (x, y), then the neighborhood coordinates are (x + i, y + j), where i ∈ {-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6}, and j ∈ {-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6}.
5. A precipitation curve extraction device assisted by spatial neighborhood, characterized in that, comprising: a curve extraction module based on threshold, which determines a threshold according to the different RGB value characteristics of the precipitation curve, the table lines, annotations, and other backgrounds in the hydrological archive picture, and extracts the precipitation curve based on the threshold, including: (11) Initialize a picture with the same size as the hydrological archive picture, and set the pixel values to (255, 255, 255); (12) Judge whether the RGB values of each pixel point in the hydrological archive picture meet the first preset condition; (13) If the pixel point does not meet the first preset condition, it is determined as a non-curve pixel point; (14) If the pixel point meets the first preset condition, take out the minimum value min and the maximum value max in the RGB three components, calculate the difference diff between max and min, and judge whether the minimum value min corresponds to the R component value and whether diff is greater than the preset value. If both are satisfied, it is determined that this pixel point is a point on the curve, and the values of these pixel points are set to (0, 0, 0) in the initialized picture; a curve extraction module based on clustering, which extracts the precipitation curve based on the clustering method according to the characteristics of the four parts of the precipitation curve, table lines, annotations, and other backgrounds in the hydrological archive picture, including: (21) Based on the four categories of precipitation curves, table lines, annotations, and other backgrounds in the hydrological archive pictures, determine that the number of clustering categories k = 4 and select 4 initial clustering centers C = {C 1 , C 2 , C 3 , C 4}; (22) Calculate the Euclidean distance from the value of each pixel point in the hydrological archive picture to the clustering center C, and divide the value of the current pixel point and the clustering center with the closest distance into the same family; (23) Update the clustering center, then repeat the calculation of the Euclidean distance, and repeatedly calculate and iterate until the stop condition is met, the error function no longer changes or the maximum number of running rounds is iterated, then the clustering ends; a curve determination module assisted by neighborhood, taking the precipitation curve extracted based on the threshold as a reference, scanning the picture. During the scanning process, if a curve pixel point is encountered, check whether there is a curve pixel point at the corresponding position of the curve extracted based on clustering in the neighborhood position of this pixel point. If so, it means that this pixel point is the missing part of the curve and is added to the curve extracted based on the threshold, including: (31)Read the precipitation curve extracted based on the threshold and the precipitation curve extracted based on the clustering method, and denote them as images I1 and I2; (32)Set up a matrix A of w×h to store the pixel values of the finally generated merged curve image I3, where w and h are the widths and heights of images I1 and I2 respectively; (33)Starting from the top-leftmost position of image I1, traverse each pixel point in sequence. At the same time, check whether the current pixel point is a point on the curve. If so, process the current pixel point and go to step (34). Otherwise, skip the current pixel point and continue to traverse the next pixel point; (34)Find the pixel point at position (x, y) in figure I2, and determine whether this pixel point and the pixel points in its spatial neighborhood are points on the curve in figure I2. If so, determine that this pixel point is a missing point in figure I1, and set the pixel value at the corresponding position in figure I3 to (0, 0, 0). Otherwise, assign the pixel point value of figure I1 to the corresponding position of matrix A; (35)Repeat steps (33) to (34) until all pixel points in figure I1 have been traversed.
6. A computer device, characterized in that, it includes: one or more processors; a memory; and one or more programs, where the one or more programs are stored in the memory and are configured to be executed by the one or more processors. When the program is executed by the processor, it implements the steps of the spatial neighborhood-assisted precipitation curve extraction method described in any one of claims 1-4.
7. A computer-readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, it implements the steps of the spatial neighborhood-assisted precipitation curve extraction method described in any one of claims 1-4.
Citation Information
Patent Citations
Method for extracting track in weather self-recording paper
CN111738208A
Table extracting method and apparatus
CN1949249A