Radar puzzle combination reflectivity extraction method based on image segmentation

Through image segmentation and filling technology, the problem of difficult to obtain reflectivity information in radar puzzles is solved, accurate extraction of radar puzzles and improvement of image quality are achieved, and more continuous and realistic image data are provided.

CN118736174APending Publication Date: 2024-10-01BEIJING JIUTIAN METEOROLOGICAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410750694.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the existing technology, it is difficult to obtain the combined reflectivity of radar puzzle pieces, which leads to problems of information loss and image discontinuity in data processing.

Method used

Using a method based on image segmentation, download the regional radar puzzle in PNG format, extract the reflectance color value, exclude interference colors, use the screenshot tool to extract the terrain shadow color, merge the color list, perform threshold segmentation and Boolean matrix operations, and fill the defective area. Use k-d tree to find the nearest reflectance point for color filling.

Benefits of technology

It effectively extracts the reflectivity information in the radar puzzle, removes interference and non-reflectivity areas, fills the image gaps, makes the image more continuous and complete, and improves the quality and usability of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736174A_ABST
    Figure CN118736174A_ABST
Patent Text Reader

Abstract

The invention relates to an image segmentation-based radar puzzle combination reflectivity extraction method, which relates to the technical field of meteorological radars, and comprises the following steps of: downloading a regional radar puzzle, extracting a reflectivity color value in the radar puzzle, eliminating an interference color, extracting a picture only containing a terrain shadow color from a radar map, and extracting the reflectivity value of the radar puzzle; the method comprises the following steps of: obtaining a radar puzzle, converting an RGB tuple of the picture into a hexadecimal color function, combining an interference color and a terrain shadow color to form a new color list, removing a reflectivity color from the radar puzzle to obtain a base map without the reflectivity color, recording position coordinates of all non-white pixel points in the base map, and performing set operation of a Boolean matrix to obtain a target image. RGB channel values meeting conditions are screened, coordinate position points of total image reflectivity are obtained, according to position coordinates of all non-white pixel points in a base image, the positions of non-reflectivity coordinate points are assigned to be white, gaps in a reflectivity area are filled with a nearest distance interpolation method, and defect areas are filled with corresponding colors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of meteorological radars, and more specifically to a radar jigsaw combination reflectivity extraction method based on image segmentation. Background Art

[0002] Weather radar is an important meteorological observation device, which is widely used in weather forecast, meteorological disaster warning and other fields. With the continuous development of radar technology, radar jigsaw combination has become an important data processing method. In radar jigsaw combination, how to accurately extract the reflectivity information of each area is a key issue.

[0003] Since radar-based data is difficult to obtain, combined reflectivity images can be extracted based on the radar puzzle released by the China Meteorological Observatory through image segmentation and other related technologies. Summary of the invention

[0004] In view of the technical problems existing in the prior art, the present invention provides a radar puzzle combined reflectivity extraction method based on image segmentation, aiming to overcome the difficulty in obtaining the radar puzzle combined reflectivity and extract the combined reflectivity from the regional radar puzzle to solve the problems raised in the above background technology.

[0005] The technical solution of the present invention to solve the above technical problem is as follows: a radar jigsaw puzzle combination reflectivity extraction method based on image segmentation, specifically comprising the following steps:

[0006] Step S1, downloading a regional radar puzzle in PNG format, extracting the reflectivity color value in the radar puzzle by obtaining the color codes represented by the 14 color blocks displayed below the original radar puzzle, and excluding interference colors;

[0007] Step S2: Use a screenshot tool to extract a picture containing only terrain shadow colors from the radar picture, and convert the RGB tuple of the picture into a hexadecimal color function;

[0008] Step S3, merging the excluded interference color and the terrain shadow color to form a new color list, and saving it as an auxiliary file;

[0009] Step S4, according to the reflectivity color value extracted in step S1, remove the reflectivity color from the radar puzzle to obtain a base map without reflectivity color, and record the position coordinates of all non-white pixel points in the base map;

[0010] Step S5, use the numpy library to perform set operations on Boolean matrices, filter the RGB channel values ​​that meet the conditions according to the reflectance color values ​​extracted in step S1, obtain the coordinate position points of the reflectance of the entire image, and assign the positions of the non-reflectance coordinate points to white according to the position coordinates recorded in step S4 to exclude the non-reflectance area;

[0011] Step S6: Use the nearest distance interpolation method to fill the gaps in the reflectivity area, use the kd tree to find the nearest reflectivity point, and fill the defective area with the corresponding color.

[0012] In a preferred embodiment, in step S1, a regional radar puzzle in PNG format is downloaded, and the color codes represented by the 14 color blocks displayed below the original radar puzzle are obtained to extract the reflectivity color value in the radar puzzle, and exclude interference colors. The specific steps are as follows:

[0013] Step A1, extracting color codes: downloading regional radar puzzle data from the official website of the Central Meteorological Observatory. The radar puzzle is published in PNG format and updated every 6 minutes. Parsing the 14 color blocks displayed below the original radar puzzle image to obtain the represented Hex color codes. The Hex color code is a method of representing colors using hexadecimal numbers, corresponding to different dBZ values, and the dBZ value represents the reflectivity color value;

[0014] Step A2, extracting reflectivity color values: according to the color codes, matching the color values ​​in the radar puzzle with the color codes of the 14 reflectivity values ​​to extract the reflectivity color values ​​in the radar puzzle;

[0015] Step A3, exclude interference colors: create a color list exclude_colors, which contains the Hex codes of pure interference colors such as shadows, national boundaries, island and reef signs, and ocean background colors. Compare the color values ​​extracted from the radar puzzle with the Hex codes of these interference colors to exclude interference colors. After eliminating the interference colors, the obtained color value list is the effective reflectivity color value in the radar puzzle.

[0016] In a preferred embodiment, in step A1, parsing the 14 color blocks displayed below the original radar puzzle image to obtain the represented Hex color code further includes the following steps:

[0017] Step A101, open the PNG format image for which you want to obtain Hex encoding in Photoshop;

[0018] Step A102, select the "Eyedropper Tool" in Photoshop and click the color block on the legend for which you want to obtain the Hex code;

[0019] Step A103, Photoshop displays the color of the color block on the screen, and displays its RGB value and Hex code in the information panel.

[0020] In a preferred embodiment, in step S2, a screenshot tool is used to extract a picture containing only terrain shadow colors from the radar map, and a function of converting the RGB tuple of the picture into a hexadecimal color is performed, and the specific steps are as follows:

[0021] Step B1, using a screenshot tool, take out a picture containing only the terrain shadow color, thereby obtaining a terrain shadow sample map. In the radar puzzle, two color base maps both contain mountain shadow areas, and two terrain shadow sample maps are captured in total;

[0022] Step B2: According to the terrain shadow sample map, use the matplotlib library in Python to load the terrain shadow sample map respectively, and add all colors to a separate list rgb_set through the function that converts the RGB tuple of the image into hexadecimal color.

[0023] In a preferred embodiment, in step S3, the interference exclusion color and the terrain shadow color are merged to form a new color list, and the new color list is saved as an auxiliary file. The specific steps are as follows:

[0024] Step C1, merging color lists: merging the interference color exclusion list excl._colors and the terrain shadow color list rgb_set into a new color list rgb_list;

[0025] Step C2, deduplication: ensure that the new color list rgb_list does not contain duplicate colors. By removing duplicate colors, duplicate data can be avoided in subsequent processing;

[0026] Step C3, save as auxiliary file: Save the merged new color list into a text file, with one color code per line. When saving the color list, add some instructions and tags so that you can understand the meaning and source of the colors when needed.

[0027] In a preferred embodiment, in step S4, according to the reflectivity color value extracted in step S1, the reflectivity color is removed from the radar puzzle to obtain a base map without reflectivity color, and the position coordinates of all non-white pixel points in the base map are recorded. The specific steps are as follows:

[0028] Step D1, threshold segmentation: Use the image processing library to read the radar puzzle image and store it as an array, set the threshold according to the extracted reflectance color value, use the grayscale image for threshold segmentation, compare the reflectance color value with the set threshold, all pixels greater than the threshold are classified as reflectance color, and all pixels less than or equal to the threshold are classified as non-reflectance color;

[0029] Let the extracted reflectance color value be c r , the image is segmented into reflectance color and non-reflectance color areas according to the set threshold, and the segmented image is recorded as B. The expression of the threshold segmentation is expressed as: B(x,y)={1,ifI(x,y)>T0,otherwise}, where I(x,y) is the gray value of the original image at the position (x,y), B(x,y) is the segmented image, T is the set threshold, otherwise represents other situations, B(x,y)=1 means that the original image pixel value corresponding to the position (x,y) is greater than the threshold; B(x,y)=0 means that the original image pixel value corresponding to the position (x,y) is less than or equal to the threshold;

[0030] Step D2, creating a mask: according to the segmentation result, creating a mask to represent the reflectance color, wherein the area of ​​the reflectance color is marked as 1, and the area of ​​the non-reflectance color is marked as 0;

[0031] The expression of the mask is expressed as: M(x,y)={1,ifB(x,y)=10,otherwise}, where M(x,y) is the mask image, B(x,y) is the segmented image, otherwise represents other cases, M(x,y)=1 represents that the image pixel value obtained by the threshold segmentation corresponding to the position (x,y) is 1, which belongs to the reflectance color; M(x,y)=0 represents that it is not the reflectance color;

[0032] Step D3, applying a mask: applying the mask to the original image, performing a logical operation on the mask and the original image to remove the reflectance color, and obtaining a base image without the reflectance color after the mask processing;

[0033] By performing logical operations on the original image and the mask image pixel by pixel, we can obtain the base image I without the reflectance color. masked (x, y), the mathematical expression is: masked (x,y)={I(x,y),ifM(x,y)=00,otherwise}, where, I masked (x, y) is the base image with reflectance color removed, I(x, y) is the grayscale value of the original image at position (x, y), M(x, y) is the mask image, otherwise represents other situations, and the result of the mathematical expression indicates that the mask M(x, y) at the corresponding position is 0, then the pixel value of the base image is taken from the original image; otherwise, the pixel value of the base image is set to 0;

[0034] Step D4, recording position coordinates: using an image traversal method to traverse the base map without reflectance color, and recording the position coordinates of all non-white pixel points.

[0035] In a preferred embodiment, in step S5, the numpy library is used to perform set operations on Boolean matrices, and the RGB channel values ​​that meet the conditions are screened according to the reflectance color values ​​extracted in step S1 to obtain the coordinate position points of the reflectance of the entire image. According to the position coordinates recorded in step S4, the positions of the non-reflectance coordinate points are assigned white to exclude the non-reflectance areas. The specific steps are as follows:

[0036] Step E1, RGB channel value screening: Based on the extracted reflectance color value, create a Boolean matrix of the same size as the RGB image, in which each element indicates whether the corresponding position meets the conditions. For the RGB image, it is represented as a three-dimensional array, representing the values ​​of the red, green, and blue channels respectively. Use the function in the numpy library to compare the RGB channel values ​​with the extracted reflectance color value to generate a Boolean array, in which the pixels that meet the conditions are True, and those that do not meet the conditions are False;

[0037] Step E2, perform logical operations on the Boolean matrices of the three channels to obtain the final positions that meet the conditions, and extract the coordinate position points of all True values ​​from the Boolean matrix, which are the coordinate position points of the reflectivity of the entire image;

[0038] Step E3: according to the non-white pixel position coordinates recorded in step S4, the pixel values ​​at these positions in the base map are set to white to exclude the non-reflectivity area.

[0039] In a preferred embodiment, in step S6, the nearest distance interpolation method is used to fill the gaps in the reflectivity area, the kd tree is used to find the nearest reflectivity point, and the defective area is filled with the corresponding color. The specific steps are as follows:

[0040] Step F1, constructing a kd tree: taking the position coordinates of all reflectivity points as input, construct a kd tree;

[0041] Step F2, find the nearest neighbor point: for each defect point located in the reflectivity area, use the kd tree to find the nearest reflectivity point as its filling value, and find the nearest reflectivity point by calculating the distance metric;

[0042] The defect point that needs to be filled in color is represented as P, and the nearest reflectivity point Q is found as the filling value of P through the kd tree. The Euclidean distance formula between two points P and Q is defined as:

[0043]

[0044] Among them, (x p ,y p ) and (x q ,y q) are the coordinates of point P and point Q respectively, and D(P,Q) is the Euclidean distance between points P and Q; after finding the nearest neighbor reflectance point Q of P, set the color value of P to the color value of Q;

[0045] Step F3, filling defective areas: replacing the position of each defective point with the color value of its nearest neighbor reflectivity point to fill the defective area;

[0046] Step F4, complete filling: repeat the above steps until all defective areas are filled.

[0047] In a preferred embodiment, the step F1 of constructing the kd tree further comprises the following steps:

[0048] Step F101, selecting a division dimension: selecting a dimension from the position coordinates of the reflectivity points as a division dimension by selecting coordinate axes in turn;

[0049] Step F102, select a partition value: on the selected partition dimension, select the median of all points on the dimension as the partition value;

[0050] Step F103, dividing the data set: according to the selected division dimension and division value, the data set is divided into two subsets, one subset contains data points less than or equal to the division value, and the other subset contains data points greater than the division value;

[0051] Step F104, recursively construct subtrees: repeat steps F101 to F103 for the two divided subsets respectively until each subset contains only one data point;

[0052] Step F105, constructing a root node: the root node is the division point on the division dimension selected in the entire data set, and saves the two subsets after the division;

[0053] Step F106, repeat the above steps until all data points have been processed, at which point the construction of the kd tree is completed.

[0054] The beneficial effects of the present invention are as follows: downloading a regional radar puzzle, extracting a reflectivity color value in the radar puzzle, and excluding interference colors, extracting a picture containing only terrain shadow colors from the radar picture, and converting the RGB tuple of the picture into a function of hexadecimal colors, merging the excluded interference colors and the terrain shadow colors to form a new color list, removing the reflectivity color from the radar puzzle, obtaining a base map without reflectivity colors, and recording the position coordinates of all non-white pixel points in the base map, performing a set operation of a Boolean matrix, and screening the RGB channel values ​​that meet the conditions, obtaining the coordinate position points of the reflectivity of the entire image, assigning the positions of the non-reflectivity coordinate points to white according to the position coordinates of all non-white pixel points in the base map, using the nearest distance interpolation method to fill the gaps in the reflectivity area, and filling the defective area with the corresponding color, so that the image is more continuous and complete, and filling the defective area can further improve the quality of the image, making the image more realistic and easy to understand, and improving the image's ornamental and usability. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 is a flow chart of the method of the present invention;

[0056] Figure 2 It is a structural block diagram of the present invention;

[0057] Figure 3 Jigsaw puzzle for radar;

[0058] Figure 4 Samples for terrain shadows Figure 1 ;

[0059] Figure 5 Samples for terrain shadows Figure 2 ;

[0060] Figure 6 Extract result map for reflectivity;

[0061] Figure 7 This is the dBZ diagram after filling. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0063] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.

[0064] In the description of the present application, the term "for example" is used to mean "used as an example, illustration or description". Any embodiment described as "for example" in the present application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any technician in the field to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid unnecessary details to obscure the description of the present invention. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.

[0065] Example 1

[0066] This embodiment provides Figure 1 A radar jigsaw puzzle combined reflectivity extraction method based on image segmentation is shown, which specifically includes the following steps:

[0067] Step S1, downloading a regional radar puzzle in PNG format, extracting the reflectivity color value in the radar puzzle by obtaining the color codes represented by the 14 color blocks displayed below the original radar puzzle, and excluding interference colors;

[0068] Step S2: Use a screenshot tool to extract a picture containing only terrain shadow colors from the radar picture, and convert the RGB tuple of the picture into a hexadecimal color function;

[0069] Step S3, merging the excluded interference color and the terrain shadow color to form a new color list, and saving it as an auxiliary file;

[0070] Step S4, according to the reflectivity color value extracted in step S1, remove the reflectivity color from the radar puzzle to obtain a base map without reflectivity color, and record the position coordinates of all non-white pixel points in the base map;

[0071] Step S5, use the numpy library to perform set operations on Boolean matrices, filter the RGB channel values ​​that meet the conditions according to the reflectance color values ​​extracted in step S1, obtain the coordinate position points of the reflectance of the entire image, and assign the positions of the non-reflectance coordinate points to white according to the position coordinates recorded in step S4 to exclude the non-reflectance area;

[0072] Step S6: Use the nearest distance interpolation method to fill the gaps in the reflectivity area, use the kd tree to find the nearest reflectivity point, and fill the defective area with the corresponding color.

[0073] Preferably, in step S1, the regional radar puzzle in PNG format is downloaded, the color codes represented by the 14 color blocks displayed below the original radar puzzle are obtained, the reflectivity color values ​​in the radar puzzle are extracted, and interference colors are excluded. The specific steps are as follows:

[0074] Step A1, extracting color code: access the official website of the Central Meteorological Observatory from a web browser, access the radar map download page from the weather real-time column, select the regional radar puzzle, right-click to download the PNG format lossless compression image data, the radar puzzle is published in PNG format and updated every 6 minutes, parse the 14 color blocks displayed below the original radar puzzle, and obtain the represented Hex color code. The Hex color code is a method of representing colors using hexadecimal numbers, corresponding to different dBZ values, and the dBZ value represents the reflectivity color value, such as Figure 3 As shown;

[0075] Step A2, extracting reflectivity color values: according to the color codes, matching the color values ​​in the radar puzzle with the color codes of the 14 reflectivity values ​​to extract the reflectivity color values ​​in the radar puzzle;

[0076] Step A3, exclude interference colors: create a color list exclude_colors, which contains the Hex codes of pure interference colors such as shadows, national boundaries, island and reef signs, and ocean background colors. Compare the color values ​​extracted from the radar puzzle with the Hex codes of these interference colors to exclude interference colors. After eliminating the interference colors, the obtained color value list is the effective reflectivity color value in the radar puzzle.

[0077] Preferably, in step A1, parsing the 14 color blocks displayed below the original radar puzzle image to obtain the represented Hex color code further includes the following steps:

[0078] Step A101, open the PNG format image for which you want to obtain Hex encoding in Photoshop;

[0079] Step A102, select the "Eyedropper Tool" in Photoshop and click the color block on the legend for which you want to obtain the Hex code;

[0080] Step A103, Photoshop displays the color of the color block on the screen, and displays its RGB value and Hex code in the information panel.

[0081] Preferably, in step S2, a screenshot tool is used to extract a picture containing only the terrain shadow color from the radar picture, and a function of converting the RGB tuple of the picture into a hexadecimal color is performed, and the specific steps are as follows:

[0082] Step B1: Use the screenshot tool to take out a picture containing only the terrain shadow color, thereby obtaining a terrain shadow sample map. In the radar puzzle, the two color base maps both contain the mountain shadow area, and two terrain shadow sample maps are intercepted, as shown in the figure. Figure 4 , 5 As shown;

[0083] Step B2: According to the terrain shadow sample map, use the matplotlib library in Python to load the terrain shadow sample map respectively, and add all colors to a separate list rgb_set through the function that converts the RGB tuple of the image into hexadecimal color.

[0084] Preferably, in step S3, the interference exclusion color and the terrain shadow color are merged to form a new color list, and the new color list is saved as an auxiliary file. The specific steps are as follows:

[0085] Step C1, merging color lists: merging the interference color exclusion list excl._colors and the terrain shadow color list rgb_set into a new color list rgb_list;

[0086] Step C2, deduplication: ensure that the new color list rgb_list does not contain duplicate colors. By removing duplicate colors, duplicate data can be avoided in subsequent processing;

[0087] Step C3, save as auxiliary file: Save the merged new color list into a text file, with one color code per line. When saving the color list, add some instructions and tags so that you can understand the meaning and source of the colors when needed.

[0088] Preferably, in the step C2 of deduplication, ensuring that the new color list rgb_list does not contain duplicate colors further comprises the following steps:

[0089] Step C201, create an empty set unique_colors for storing unique color values;

[0090] Step C202, traverse each color value in rgb_list:

[0091] Step C203: When the color value is not in the unique_colors set, add it to the unique_colors set; and convert the unique_colors set into a list to obtain a color list after deduplication.

[0092] Preferably, in step S4, according to the reflectivity color value extracted in step S1, the reflectivity color is removed from the radar puzzle to obtain a base map without reflectivity color, and the position coordinates of all non-white pixel points in the base map are recorded. The specific steps are as follows:

[0093] Step D1, threshold segmentation: Use the image processing library to read the radar puzzle image and store it as an array, set the threshold according to the extracted reflectance color value, use the grayscale image for threshold segmentation, compare the reflectance color value with the set threshold, all pixels greater than the threshold are classified as reflectance color, and all pixels less than or equal to the threshold are classified as non-reflectance color;

[0094] Let the extracted reflectance color value be c r , the image is segmented into reflectance color and non-reflectance color areas according to the set threshold, and the segmented image is recorded as B. The expression of the threshold segmentation is expressed as: B(x,y)={1,ifI(x,y)>T0,otherwise}, where I(x,y) is the gray value of the original image at the position (x,y), B(x,y) is the segmented image, T is the set threshold, otherwise represents other situations, B(x,y)=1 means that the original image pixel value corresponding to the position (x,y) is greater than the threshold; B(x,y)=0 means that the original image pixel value corresponding to the position (x,y) is less than or equal to the threshold;

[0095] Step D2, creating a mask: according to the segmentation result, creating a mask to represent the reflectance color, wherein the area of ​​the reflectance color is marked as 1, and the area of ​​the non-reflectance color is marked as 0;

[0096] The expression of the mask is expressed as: M(x,y)={1,ifB(x,y)=10,otherwise}, where M(x,y) is the mask image, B(x,y) is the segmented image, otherwise represents other cases, M(x,y)=1 represents that the image pixel value obtained by the threshold segmentation corresponding to the position (x,y) is 1, which belongs to the reflectance color; M(x,y)=0 represents that it is not the reflectance color;

[0097] Step D3, applying a mask: applying the mask to the original image, performing a logical operation on the mask and the original image to remove the reflectance color, and obtaining a base image without the reflectance color after the mask processing;

[0098] By performing logical operations on the original image and the mask image pixel by pixel, we can obtain the base image I without the reflectance color. masked (x, y), the mathematical expression is: masked (x,y)={I(x,y),ifM(x,y)=00,otherwise}, where, I masked (x, y) is the base image with reflectance color removed, I(x, y) is the grayscale value of the original image at position (x, y), M(x, y) is the mask image, otherwise represents other situations, and the result of the mathematical expression indicates that the mask M(x, y) at the corresponding position is 0, then the pixel value of the base image is taken from the original image; otherwise, the pixel value of the base image is set to 0;

[0099] Step D4, recording position coordinates: using an image traversal method to traverse the base map without reflectance color, and recording the position coordinates of all non-white pixel points.

[0100] Preferably, in step S5, the numpy library is used to perform set operations on Boolean matrices, and the RGB channel values ​​that meet the conditions are screened according to the reflectance color values ​​extracted in step S1 to obtain the coordinate position points of the reflectance of the entire image, and according to the position coordinates recorded in step S4, the positions of the non-reflectance coordinate points are assigned white to exclude the non-reflectance areas. The specific steps are as follows:

[0101] Step E1, RGB channel value screening: Based on the extracted reflectance color value, create a Boolean matrix of the same size as the RGB image, in which each element indicates whether the corresponding position meets the conditions. For the RGB image, it is represented as a three-dimensional array, representing the values ​​of the red, green, and blue channels respectively. Use the function in the numpy library to compare the RGB channel value with the extracted reflectance color value to generate a Boolean array, in which the pixels that meet the conditions are True, and those that do not meet the conditions are False;

[0102] Step E2, perform logical operations on the Boolean matrices of the three channels to obtain the final positions that meet the conditions, and extract the coordinate position points of all True values ​​from the Boolean matrix, which are the coordinate position points of the reflectivity of the entire image;

[0103] Step E3: Using the position coordinates of all non-white pixels in the base map, use the complement operation of the numpy Boolean matrix to assign all non-dBZ coordinate points in the regional radar puzzle to white to exclude non-reflectivity areas, such as Figure 6 shown.

[0104] Preferably, in step S6, the nearest distance interpolation method is used to fill the gaps in the reflectivity area, the kd tree is used to find the nearest reflectivity point, and the defective area is filled with the corresponding color. The specific steps are as follows:

[0105] Step F1, constructing a kd tree: taking the position coordinates of all reflectivity points as input, constructing a kd tree, which is a binary tree data structure for efficiently finding the nearest neighbor point, further comprising the following steps:

[0106] Step F101, selecting a division dimension: selecting a dimension from the position coordinates of the reflectivity points as a division dimension by selecting coordinate axes in turn;

[0107] Step F102, select a partition value: on the selected partition dimension, select the median of all points on the dimension as the partition value;

[0108] Step F103, dividing the data set: according to the selected division dimension and division value, the data set is divided into two subsets, one subset contains data points less than or equal to the division value, and the other subset contains data points greater than the division value;

[0109] Step F104, recursively construct subtrees: repeat steps F101 to F103 for the two divided subsets respectively until each subset contains only one data point;

[0110] Step F105, constructing a root node: the root node is the division point on the division dimension selected in the entire data set, and saves the two subsets after the division;

[0111] Step F106, repeat the above steps until all data points have been processed, at which point the construction of the kd tree is completed;

[0112] Step F2, find the nearest neighbor point: for each defect point located in the reflectivity area, use the kd tree to find the nearest reflectivity point as its filling value, and find the nearest reflectivity point by calculating the distance metric;

[0113] The defect point that needs to be filled in color is represented as P, and the nearest reflectivity point Q is found as the filling value of P through the kd tree. The Euclidean distance formula between two points P and Q is defined as:

[0114]

[0115] Among them, (x p ,y p ) and (x q ,y q) are the coordinates of point P and point Q respectively, and D(P,Q) is the Euclidean distance between points P and Q; after finding the nearest neighbor reflectance point Q of P, set the color value of P to the color value of Q;

[0116] Step F3, filling defective areas: replacing the position of each defective point with the color value of its nearest neighbor reflectivity point to fill the defective area;

[0117] Step F4, complete filling: Repeat the above steps until all defect areas are filled, and obtain a pure dbz image with gaps filled, such as Figure 7 shown.

[0118] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0119] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0120] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0121] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0122] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0123] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0124] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A radar mosaic combined reflectivity extraction method based on image segmentation, characterized in that: The specific steps include: Step S1, downloading the regional radar puzzle, extracting the reflectivity color value in the radar puzzle by obtaining the color codes represented by the 14 color blocks displayed below the original radar puzzle, and excluding interference colors; Step S2: Use a screenshot tool to extract a picture containing only terrain shadow colors from the radar picture, and convert the RGB tuple of the picture into a hexadecimal color function; Step S3, merging the excluded interference color and the terrain shadow color to form a new color list, and saving it as an auxiliary file; Step S4, according to the reflectivity color value extracted in step S1, remove the reflectivity color from the radar puzzle to obtain a base map without reflectivity color, and record the position coordinates of all non-white pixel points in the base map; Step S5, use the numpy library to perform set operations on Boolean matrices, filter the RGB channel values ​​that meet the conditions according to the reflectance color values ​​extracted in step S1, obtain the coordinate position points of the reflectance of the entire image, and assign the positions of the non-reflectance coordinate points to white according to the position coordinates recorded in step S4 to exclude the non-reflectance area; Step S6: Use the nearest distance interpolation method to fill the gaps in the reflectivity area, use the kd tree to find the nearest reflectivity point, and fill the defective area with the corresponding color.

2. The radar jigsaw puzzle combined reflectivity extraction method based on image segmentation according to claim 1, characterized in that: In step S1, the regional radar puzzle is downloaded, the color codes represented by the 14 color blocks displayed below the original radar puzzle are obtained, the reflectivity color values ​​in the radar puzzle are extracted, and the interference colors are excluded. The specific steps are as follows: Step A1, extracting color codes: downloading regional radar mosaic data from the official website of the Central Meteorological Observatory, parsing the 14 color blocks displayed below the original radar mosaic, and obtaining the represented Hex color codes, wherein the Hex color codes correspond to different dBZ values; Step A2, extracting reflectivity color values: according to the color codes, matching the color values ​​in the radar puzzle with the color codes of the 14 reflectivity values ​​to extract the reflectivity color values ​​in the radar puzzle; Step A3, exclude interference colors: create a color list exclude_colors, which contains the Hex codes of pure interference colors such as shadows, national boundaries, island and reef signs, and ocean background colors, and compare the color values ​​extracted from the radar puzzle with the Hex codes of these interference colors to exclude interference colors.

3. The radar jigsaw puzzle combined reflectivity extraction method based on image segmentation according to claim 1 is characterized in that: In step S2, a screenshot tool is used to extract a picture containing only the terrain shadow color from the radar picture, and a function of converting the RGB tuple of the picture into a hexadecimal color is performed. The specific steps are as follows: Step B1, using a screenshot tool, take out a picture containing only the terrain shadow color, thereby obtaining a terrain shadow sample map. In the radar puzzle, two color base maps both contain mountain shadow areas, and two terrain shadow sample maps are captured in total; Step B2: According to the terrain shadow sample images, use the matplotlib library in Python to load the terrain shadow sample images respectively, and add all the colors to a separate list rgb_set through the function that converts the RGB tuple of the image into hexadecimal colors.

4. The radar jigsaw puzzle combined reflectivity extraction method based on image segmentation according to claim 1 is characterized in that: In step S3, the interference exclusion color and the terrain shadow color are merged to form a new color list, and the new color list is saved as an auxiliary file. The specific steps are as follows: Step C1, merging color lists: merging the exclusion interference color list exclude_colors and the terrain shadow color list rgb_set into a new color list rgb_list; Step C2, deduplication: ensure that the new color list rgb_list does not contain duplicate colors; Step C3, save as auxiliary file: Save the merged new color list into a text file, with one color code per line. When saving the color list, add some labels.

5. The radar mosaic combined reflectivity extraction method based on image segmentation according to claim 1 is characterized in that: In step S4, according to the reflectivity color value extracted in step S1, the reflectivity color is removed from the radar puzzle to obtain a base map without reflectivity color, and the position coordinates of all non-white pixel points in the base map are recorded. The specific steps are as follows: Step D1, threshold segmentation: Use the image processing library to read the radar puzzle image and store it as an array, set the threshold according to the extracted reflectivity color value, use the grayscale image to perform threshold segmentation, and compare the reflectivity color value with the set threshold; Step D2, creating a mask: according to the segmentation result, creating a mask to represent the reflectance color, wherein the area of ​​the reflectance color is marked as 1, and the area of ​​the non-reflectance color is marked as 0; Step D3, applying a mask: applying the mask to the original image, performing a logical operation on the mask and the original image to remove the reflectance color, and obtaining a base image without the reflectance color after the mask processing; Step D4, recording position coordinates: using an image traversal method to traverse the base map without reflectance color, and recording the position coordinates of all non-white pixel points.

6. The radar jigsaw puzzle combined reflectivity extraction method based on image segmentation according to claim 5, characterized in that: The step of threshold segmentation includes: expressing the extracted reflectance color value as c r , the image is segmented into reflectance color and non-reflectance color areas according to the set threshold, and the segmented image is recorded as B. The expression of threshold segmentation is expressed as: B(x,y)={1,ifI(x,y)>T0,otherwise}, where I(x,y) is the grayscale value of the original image at position (x,y), B(x,y) is the segmented image, T is the set threshold, otherwise represents other situations, B(x,y)=1 means that the original image pixel value corresponding to the position (x,y) is greater than the threshold; B(x,y)=0 means that the original image pixel value corresponding to the position (x,y) is less than or equal to the threshold.

7. The radar jigsaw puzzle combined reflectivity extraction method based on image segmentation according to claim 5 is characterized in that: The expression of the mask is expressed as: M(x,y)={1,ifB(x,y)=10,otherwise}, where M(x,y) is the mask image, B(x,y) is the segmented image, otherwise represents other situations, M(x,y)=1 represents that the image pixel value obtained by the threshold segmentation corresponding to the position (x,y) is 1, which belongs to the reflectance color; M(x,y)=0 represents that it is not the reflectance color.

8. The radar jigsaw puzzle combined reflectivity extraction method based on image segmentation according to claim 5 is characterized in that: The step of applying the mask comprises: performing a logical operation on the original image and the mask image pixel by pixel to obtain a base image I with the reflectivity color removed. masked (x, y), the mathematical expression is: masked (x,y)={I(x,y),ifM(x,y)=00,otherwise}, where, I masked (x, y) is the base image with reflectance color removed, I(x, y) is the grayscale value of the original image at position (x, y), M(x, y) is the mask image, and otherwise represents other situations.

9. The radar jigsaw puzzle combined reflectivity extraction method based on image segmentation according to claim 1, characterized in that: In step S5, the numpy library is used to perform a set operation of a Boolean matrix, and the RGB channel values ​​that meet the conditions are screened according to the reflectance color value extracted in step S1 to obtain the coordinate position points of the reflectance of the entire image. According to the position coordinates recorded in step S4, the positions of the non-reflectance coordinate points are assigned white. The specific steps are as follows: Step E1, RGB channel value screening: Based on the extracted reflectance color value, create a Boolean matrix of the same size as the RGB image, in which each element indicates whether the corresponding position meets the conditions. For the RGB image, it is represented as a three-dimensional array, representing the values ​​of the red, green, and blue channels respectively. Use the function in the numpy library to compare the RGB channel value with the extracted reflectance color value to generate a Boolean array, in which the pixels that meet the conditions are True, and those that do not meet the conditions are False; Step E2, perform logical operations on the Boolean matrices of the three channels to obtain the final positions that meet the conditions, and extract the coordinate position points of all True values ​​from the Boolean matrix, which are the coordinate position points of the reflectivity of the entire image; Step E3: Using the position coordinates of all non-white pixel points in the base map, the complement operation of the Boolean matrix is ​​used to assign white values ​​to all the positions of the non-reflectivity coordinate points in the regional radar puzzle to exclude the non-reflectivity area.

10. The radar mosaic combined reflectivity extraction method based on image segmentation according to claim 1, characterized in that: In step S6, the nearest distance interpolation method is used to fill the gaps in the reflectivity area, the kd tree is used to find the nearest reflectivity point, and the defective area is filled with the corresponding color. The specific steps are as follows: Step F1, constructing a kd tree: taking the position coordinates of all reflectivity points as input, construct a kd tree; Step F2, find the nearest neighbor point: for each defect point located in the reflectivity area, use the kd tree to find the nearest reflectivity point as its filling value, and find the nearest reflectivity point by calculating the distance metric; The defect point that needs to be filled in color is represented as P, and the nearest reflectivity point Q is found as the filling value of P through the kd tree. The Euclidean distance formula between two points P and Q is defined as: Among them, (x p ,y p ) and (x q ,y q ) are the coordinates of point P and point Q respectively, and D(P,Q) is the Euclidean distance between points P and Q; after finding the nearest neighbor reflectance point Q of P, set the color value of P to the color value of Q; Step F3, filling defective areas: replacing the position of each defective point with the color value of its nearest neighbor reflectivity point to fill the defective area; Step F4, complete filling: repeat the above steps until all defective areas are filled.