Real-time processing method and device for dynamically loading SAR image under GIS
Technical Field
The invention relates to the technical field of radars, in particular to a real-time processing method and device for dynamically loading SAR images under GIS.
Background
Synthetic Aperture Radar (SAR) is not affected by climatic conditions in the process of ground observation, and can penetrate through vegetation canopy, the obtained image has clear outline, and the structural information is stored completely, so that the SAR has an extremely important position in the modern remote sensing field. At present, most of data of a Geographic Information System (GIS) come from early field survey and optical image-based production, the former has long updating period and high cost, and the latter can not describe an imaging area completely due to the influence of weather conditions or shielding of mountain shadows. Therefore, updating the GIS by taking the SAR image as a data source has become the primary choice for solving the problems of long updating period, poor completeness and the like of the GIS database at present.
The geographic information system (Geographic Information System, GIS) is one particular spatial information system. Which is a computer system having means for centralizing, storing, operating, and displaying geographical reference information. The method has powerful functions in aspects of data editing, data conversion, data query, space analysis and the like, and has the advantages of clear classification of ground features, accurate geographic position, convenience in geographic research and geographic decision and the like.
Based on the characteristics of the GIS, the SAR image is guided to carry out information extraction by taking GIS information as priori knowledge. The method has the advantages that (1) the acquired real-time SAR image is analyzed by utilizing GIS information, the defects of SAR image imaging blurring caused by speckle noise, low resolution caused by radar performance and the like can be reduced, and (2) the SAR image is extracted by utilizing GIS information as priori knowledge, so that the fuzzy or hidden targets in the SAR image can be extracted, the limit of manual interpretation is broken through, and the method has important significance in the aspects of military target identification and accurate striking.
SAR images or data are fused with GIS geographic information, so that on one hand, guidance of the GIS on the SAR images can be realized, and on the other hand, change detection of landform can be realized by updating a GIS information base by using the SAR data.
In some occasions needing to correct and mark SAR images, the SAR images need to be loaded on a geographic information system in real time, and then the operations such as correcting and marking the images are performed. When images are generally superimposed on a geographic information system, loading efficiency can be ensured when the image size is within a range of tens of M, but in many cases, the size of the SAR image can reach more than 1G, and at this time, the entire image superimposition mode is basically impossible. If the SAR image is pyramid-constructed and then loaded as a map into the geographic information system, the entire map needs to be reloaded, and the SAR image cannot be moved. Therefore, the present invention is needed to design a real-time display processing system for dynamically loading a plurality of oversized SAR images under a geographic information system to solve the above-mentioned problems.
Disclosure of Invention
The invention aims to provide a real-time processing method for dynamically loading SAR images under GIS to solve the problems in the background technology.
In order to achieve the purpose, the invention provides a real-time processing method for dynamically loading SAR images under GIS, which is based on a PC end and a server and comprises the following steps:
The method comprises the steps that firstly, a PC end loads SAR images and displays a map, a server obtains SAR image files, the PC end calculates the current visible range of the SAR images, and a map cutting request is sent to the server according to a calculation result;
the server receives the image cutting request, cuts images according to the coordinate range and the pixel size, and then sends image cutting information to the PC end;
and thirdly, the PC end receives the image cutting information and then adds the image cutting information to a map for display.
Further, in the present invention, the PC and the server exchange data via ethernet.
Further, in the present invention, when calculating the current visible range of the SAR image in the first step, different modes are adopted for the difference of the two-dimensional and three-dimensional display modes;
In a two-dimensional mode, acquiring a rectangular range coordinate of the current screen display, and then performing high-precision geometric intersection with the rectangular range coordinate of the SAR image to finally obtain an accurate intersection range value;
in the three-dimensional mode, the SAR image is cut into small square areas through an iterative optimization algorithm, whether the small square areas are in the view angle range or not is calculated, and after a plurality of iterations, the small square areas remained in the display range are calculated to be the maximum display rectangular range, and the rectangular range is the approximate actual display area range.
Further, in the present invention, the specific steps in the two-dimensional mode are as follows:
S1, uniformly converting screen coordinates of a display area and longitude and latitude coordinates of an SAR image into world coordinates, and obtaining two polygons;
S2, carrying out high-precision geometric intersection on the two polygons, if the two polygons are intersected, returning a result to contain all intersected points, traversing the intersected points at the moment, converting world coordinates into longitude and latitude coordinates, finding out the maximum and minimum values in the longitude and latitude directions, and forming a rectangular coordinate range, wherein the range is an intersected area, and thus the calculation result is obtained.
Further, in the first step, when a graph cutting request is sent to the server according to the calculation result, the pixel width and height values of the intersection region image are calculated and sent to the server together, and the method includes the following steps:
And calculating the range under the world coordinates represented by 1 pixel in the longitude and latitude directions according to the current map display zoom level, converting the longitude and latitude range of the image into world coordinates, converting according to the world coordinate size represented by each pixel, and finally calculating the pixel width and height values of the image of the intersection region.
Further, in the present invention, in the three-dimensional display mode, the map is displayed in a spherical shape, whether the position of the target point is in front of or behind the viewing plane, and whether the angle between the target point and the viewpoint is within the range of the angle between the viewpoint and the earth are determined, whether the target point is within the visual range is determined, the viewing plane is a plane formed by connecting all points from the viewpoint position and the earth tangential position, and the method for calculating whether the target point is in front of the horizon viewing plane comprises the following specific steps:
definition V is the viewpoint, T is the target point, C is the sphere center, H is the horizon point of the tangential position of the viewpoint and the earth, H 'is the projection point of VH on VC, T' is the projection point of VT on VC, HC is the earth radius, we will As a unit vector, according to the pythagorean theorem:
triangles Δvch and Δhch' are similar triangles that share one corner at point C and all have a right angle, so:
thus, the distance from the viewpoint to the plane is:
If it is At the position ofThe projection onto the lens is smaller than or equal toThen the target point is immediately in front of the plane,
Both sides are multiplied by
I.e. using the dot product of the vector from the viewpoint to the target point and the vector from the viewpoint to the center of the ellipsoid, if this value is less than or equal to the square of the modulus of the vector from the observer to the center of the ellipsoid minus one, the target point is in front of the view plane.
Further, in the present invention, if the target point is behind the view plane, it needs to be determined whether the target point is in the view cone, the view cone is an infinite cone formed by connecting the view point with all the horizon points, if the target point is in the view cone, it is blocked, if the target point is out of the view cone, it is not blocked, and the method for calculating whether the target point is in the view cone range is as follows:
Defining an angle HVC as alpha, and an angle TVC as beta, if the point T is in the cone, then:
β<α;
namely:
cos(β)>cos(α);
the angle α is part of a right triangle Δvch, the right side of the inequality is rewritten by a trigonometric function:
According to the definition of dot product, there are:
according to the previous formula The square is performed on both sides of the formula,
Finally, the following formula is obtained:
If this inequality holds, the target point is inside the view cone. If it is also behind the view plane, the target point is occluded.
Further, in the present invention, in order to reduce the number of iterations, the target point is replaced by a target sphere, and whether the target sphere is within the display range is calculated;
the method for calculating whether the target point is within the view cone range is as follows:
Defining T as the center point of the target ball, the radius of the ball as R t,T2 as the tangent point from the viewpoint to the target ball, T 1 as the point from the viewpoint to the center point of the target ball and the intersection of the edge of the target ball, and the angle CVT 2 as beta 1. First, the vector from the viewpoint to T 1、T2 is calculated:
At this time, the mode of calculating whether the target ball is in front of the viewing plane is that as long as the point T 1 is in front of the viewing plane, the target ball is considered to be in front of the viewing plane, and the judgment formula is as follows:
At this time, whether the target point is in the view cone range is calculated, and the judgment formula is as follows:
Then an iterative optimization algorithm is adopted to divide the image into a plurality of square blocks, and then whether the square blocks are in a visual range or not is calculated iteratively, specifically, the center point of the square is taken as the center of a circle, and the side length of the square is calculated iteratively As a radius, after a plurality of iterations, the regions not in the visual range are removed, and the positions of the remaining regions are calculated as a maximum rectangular range.
When the image is divided for the first time, the short side of the image is used forDividing an image into a plurality of square line areas as the side length of the square divided for the first time, expanding and complementing the area where the long side of the image is not divided enough, and finally removing small square areas which are not in the range of the SAR image area;
Then centering on the square central point and the side length And after the radius is used for detecting whether the circle is in the visual range or not, filtering squares which are not in the visual range after the first round of detection, then cutting the rest squares, visually detecting the cut areas, after a plurality of iterations, considering that the accuracy required by calculation is achieved when the edge length pixel distance of the cut squares is preset, exiting the iteration, counting the current rest small square areas and combining the current rest small square areas into a rectangular range, wherein the rectangular range is the finally required SAR image display range.
The real-time processing device for dynamically loading SAR images under the GIS comprises a geographic information display module and an SAR image processing module, wherein the geographic information display module and the SAR image processing module adopt a distributed deployment mode, the SAR image processing module operates on a server with a multi-core CPU and can process a plurality of oversized SAR images at the same time, and the geographic information display module operates on a computer and is used for displaying a map and the SAR images;
the geographic information display module loads SAR images and displays maps, calculates the current visible range of the SAR images, sends a map cutting request to the SAR image processing module according to calculation results, and adds the map cutting information to the maps for display after receiving the map cutting information;
the SAR image processing module acquires an SAR image file, receives a graph cutting request, cuts a graph according to a coordinate range and a pixel size, and then sends graph cutting information to the geographic information display module.
Furthermore, in the invention, the geographical information display module needs to perform a translation operation on the SAR image, and during the operation, a mouse event is monitored, and the translation operation is performed by adopting a mode of pressing and dragging a left button of a mouse.
The beneficial effects are that the technical scheme of the application has the following technical effects:
According to the image computing processing mode, the image is cut according to the content displayed according to actual needs, the memory size of the loaded image is greatly reduced, the SAR image processing module is installed on a server with good CPU performance in a distributed mode, the image parallel processing capability is improved, the capability of loading, displaying and processing the oversized SAR image on a geographic information system in real time is realized, and the problems of loading, displaying and processing the oversized SAR image are solved.
It should be understood that all combinations of the foregoing concepts, as well as additional concepts described in more detail below, may be considered a part of the inventive subject matter of the present disclosure as long as such concepts are not mutually inconsistent.
The foregoing and other aspects, embodiments, and features of the present teachings will be more fully understood from the following description, taken together with the accompanying drawings. Other additional aspects of the invention, such as features and/or advantages of the exemplary embodiments, will be apparent from the description which follows, or may be learned by practice of the embodiments according to the teachings of the invention.
Drawings
The drawings are not intended to be drawn to scale. In the drawings, each identical or nearly identical component that is illustrated in various figures may be represented by a like numeral. For purposes of clarity, not every component may be labeled in every drawing. Embodiments of various aspects of the invention will now be described, by way of example, with reference to the accompanying drawings, in which:
FIG. 1 is a system overall frame diagram of the method of the present invention;
FIG. 2 is a topology of the present invention;
FIG. 3 is a diagram of a system network architecture of the present invention;
FIG. 4 is a diagram showing SAR image display modes in a two-dimensional mode according to the present invention;
FIG. 5 is a view of the position of a target point relative to a plane of view in a three-dimensional mode according to the present invention;
FIG. 6 is a view of the position of a target point relative to a cone in a three-dimensional mode according to the present invention;
FIG. 7 is a view of the target ball relative to the viewing plane and viewing cone in a three-dimensional mode of the present invention;
FIG. 8 is a schematic diagram of an image iterative optimization algorithm of the present invention;
FIG. 9 is a schematic view of image movement according to the present invention;
FIG. 10 is a diagram showing the code generation in the present embodiment;
FIG. 11 is a diagram of the code in the present embodiment;
FIG. 12 is a diagram of the code in the present embodiment;
FIG. 13 is a diagram of an embodiment of an epoch code.
Detailed Description
For a better understanding of the technical content of the present invention, specific examples are set forth below, along with the accompanying drawings. Aspects of the invention are described in this disclosure with reference to the drawings, in which are shown a number of illustrative embodiments. The embodiments of the present disclosure need not be defined to include all aspects of the present invention. It should be understood that the various concepts and embodiments described above, as well as those described in more detail below, may be implemented in any of a number of ways, as the disclosed concepts and embodiments are not limited to any implementation. Additionally, some aspects of the disclosure may be used alone or in any suitable combination with other aspects of the disclosure.
At present, when images are generally superimposed on a geographic information system, loading efficiency can be ensured when the image size is within a range of tens of M, but in many cases, the size of the SAR image can reach more than 1G, and at this time, the entire image superimposition mode is basically impossible. If the SAR image is pyramid-constructed and then loaded as a map into the geographic information system, the entire map needs to be reloaded, and the SAR image cannot be moved. Therefore, the present invention is needed to design a real-time display processing system for dynamically loading a plurality of oversized SAR images under a geographic information system to solve the above-mentioned problems.
Based on the above problems, the embodiment improves the following technical scheme:
Referring to fig. 1-9, specifically, the present embodiment provides a real-time processing method for dynamically loading SAR images under GIS, based on a PC end and a server, as shown in fig. 1, including the following steps:
The method comprises the steps that firstly, a PC end loads SAR images and displays a map, a server obtains SAR image files, the PC end calculates the current visible range of the SAR images, and a map cutting request is sent to the server according to a calculation result;
the server receives the image cutting request, cuts images according to the coordinate range and the pixel size, and then sends image cutting information to the PC end;
and thirdly, the PC end receives the image cutting information and then adds the image cutting information to a map for display.
The invention provides a real-time processing device for dynamically loading SAR images under GIS, which comprises a geographic information display module and an SAR image processing module, wherein the geographic information display module and the SAR image processing module adopt a distributed deployment mode, the SAR image processing module operates on a server with a multi-core CPU and can process a plurality of oversized SAR images at the same time, and the geographic information display module operates on a computer and is used for displaying a map and the SAR images. The geographic information display module loads SAR images and displays maps, the geographic information display module calculates the current visible range of the SAR images, sends a map cutting request to the SAR image processing module according to a calculation result, adds map cutting information to the map for display after receiving the map cutting information, obtains SAR image files by the SAR image processing module, receives the map cutting request, cuts maps according to the coordinate range and the pixel size, and then sends the map cutting information to the geographic information display module.
The geographic information display module is used for displaying a geographic information picture, calculating the display range of the SAR image in the picture, requesting to process the SAR image, displaying the SAR image and translating the SAR image;
The SAR image processing module is used for carrying out image interception on the SAR image according to the requested content and returning the result to the geographic information display module.
The geographic information display module is operated on a PC, the SAR image processing module is operated on a high-performance server, and data exchange is carried out between the modules through a high-speed Ethernet, as shown in figure 3.
The geographical information display module calculates the current visible range of the SAR image and then informs the SAR image processing module to intercept the image. When the visible range is calculated, different modes are adopted according to different two-dimensional and three-dimensional display modes.
In two-dimensional mode:
In the two-dimensional geographic information display mode, various conditions can occur in map display, and three conditions including ① normal display, ② map rotation display and ③ map incomplete display are summarized. As in fig. 4. In this figure, we need to calculate the intersection area of the display area, which is the screen coordinates, and the SAR image area, which is the latitude and longitude coordinates. Because four corner positions of the display area in ③ mode are not covered by the map, longitude and latitude coordinates cannot be obtained, and calculation cannot be performed by using the longitude and latitude coordinates. When the SAR image is not within the screen range, the screen coordinates cannot be used for calculation either. Therefore, in order to solve the problem that our calculation mode can be used in various display states, we choose to perform calculation by uniformly converting them into world coordinates. Note that when in ③ mode, the world coordinates cannot be limited in scope to the map range when screen coordinates reincarnation world coordinates are performed, otherwise world coordinates outside the map range cannot be acquired.
The method for converting screen coordinates into world coordinates is as follows:
Coordinates of the near point and the far point of the current screen point are calculated by using a matrix formula, and then coordinates of the z=0 position are calculated according to the coordinates of the far point and the near point.
A code segment of screen coordinates to world coordinates is shown in fig. 10.
When the intersection area is prepared to be calculated, screen coordinates of a current screen display rectangular range are firstly converted into world coordinates, then longitude and latitude coordinate ranges of SAR images are also converted into world coordinates, and after the coordinate systems are unified, high-precision geometric intersection is carried out on two polygons. If so, the returned result will contain all points of intersection. At this time, the intersecting points are traversed, the points are converted from world coordinates to longitude and latitude coordinates, and the maximum and minimum values in the longitude and latitude directions are found out to form a rectangular coordinate range, namely an intersecting area.
When a cut is requested from the SAR image processing software, the pixel width and height values of the image in the intersecting range are also needed, the range under world coordinates represented by 1 pixel in the longitude and latitude directions is calculated according to the current map display zoom level, then the longitude and latitude range of the image is converted into world coordinates, conversion is carried out according to the world coordinate size represented by each pixel, and finally the pixel width and height values of the image are calculated.
When the calculation method in the two-dimensional mode is used, the calculation display of the SAR image in the 2.5D mode can be supported.
In three-dimensional mode:
In the three-dimensional display mode, the map is in spherical display, a display area cannot be obtained through a polygon-solving intersection mode in the two-dimensional mode, and whether a point is in a display range or not in the three-dimensional mode cannot be judged through a screen coordinate calculating mode. In the three-dimensional mode, whether the target point is in the visual range can be known by judging whether the position of the target point is in front of the visual plane (the visual plane: the plane formed by connecting all points from the viewpoint position and the tangential position of the earth) and whether the included angle between the target point and the viewpoint is in the range of the included angle between the viewpoint and the earth.
The method for calculating whether the target point is in front of the horizon plane is as follows:
See fig. 5, v is the viewpoint, T is the target point, C is the sphere center, H is the horizon point of the tangential position of the viewpoint and the earth, H 'is the projection point of VH on VC, T' is the projection point of VT on VC, HC is the earth radius, we will be As a unit vector, according to the pythagorean theorem:
Next, we note that triangles Δvch and Δhch' are similar triangles. They share a corner at point C and all have a right angle, so:
thus, the distance from the viewpoint to the plane is:
If it is At the position ofThe projection onto the lens is smaller than or equal toThen the target point is immediately in front of the plane.
Both sides are multiplied by
To sum up, to determine whether the target point is in front of the view plane, a dot product of the vector from the view point to the target point and the vector from the view point to the center of the ellipsoid may be used. If the value is equal to or less than one less than the square of the modulus of the vector from the observer to the center of the ellipsoid, then the target point is in front of the view plane.
If the target point is in front of the view plane, the target point is never occluded by the sphere, at which point the task is complete. But if it is behind the view plane it is uncertain whether it can be occluded. It is necessary to determine whether the target point is inside the view cone (view cone: infinite cone formed by connecting the viewpoint with all horizon points), if the target point is inside the view cone, it is occluded, and if outside the view cone, it is not occluded.
The method for calculating whether the target point is within the view cone range is as follows:
See fig. 5. Angle HVC is marked as α, angle TVC is marked as β, if point T is inside the cone:
β<α;
namely:
cos(β)>cos(α);
the angle α is part of a right triangle Δvch, so we rewrite the right side of the inequality by a trigonometric function:
According to the definition of dot product, there are:
according to the previous formula Squaring the two sides of the formula
Finally, the following formula is obtained:
If this inequality holds, the target point is inside the view cone. If it is also behind the view plane, the target point is occluded.
In order to reduce the iteration times, the target point is replaced by a target ball, and whether the target ball is in the display range is calculated.
The method of calculating whether the target sphere is within the view cone range is as follows:
See fig. 6:T for a target ball center point, a ball radius R t,T2 for a point of tangency from the viewpoint to the target ball, and T 1 for a point of intersection of the viewpoint to the target ball center point and the target ball edge, with angle < CVT 2 labeled β 1. First, the vector from the viewpoint to T 1、T2 is calculated:
At this time, the mode of calculating whether the target ball is in front of the vision plane is changed to a minimum mode, and the target ball is considered to be in front of the vision plane as long as the point T 1 is in front of the vision plane. The previous judgment formula is Now change to:
At this time, the mode of calculating whether the target point is within the view cone range is changed into the judgment point T 2, and the previous judgment formula is Now change to:
After judging whether the sphere is in the visual angle range, dividing the image into a plurality of square blocks by adopting an iterative optimization algorithm, and then iteratively calculating whether the square blocks are in the visual range (taking the center point of the square as the circle center and the side length of the square) As radius). After multiple iterations, removing the areas which are not in the visual range, and calculating the positions of the remaining areas to obtain a maximum rectangular range.
When the image is divided for the first time, the short side of the image is used forAs the square side length of the first division, the image is divided into a plurality of square line areas, and the area where the long side of the image is not divided is expanded and complemented (small square areas which are not in the range of the SAR image area are finally removed) first, see fig. 8- (1). The main code segments are as in fig. 11.
Then centering on the square central point and the side lengthAs a radius it is checked whether this circle is in the visible range. After the first round of detection, squares that are not within a possible range are filtered out, then the remaining squares are segmented, see fig. 8- (2), and the segmented areas are visually detected. After a plurality of iterations, when the edge length pixel distance of the segmented square is smaller than a certain value (for example, 10 pixels), the calculation accuracy is considered to be achieved, the iteration is stopped, the current remaining small square area is counted and combined into a rectangular range, and the rectangular range is the final required SAR image display range. The main code segments are as in fig. 12 and 13.
When the SAR image processing software requests to cut a picture, the pixel width and height values of the image in the intersecting range are also needed, the screen coordinates are converted according to the longitude and latitude coordinates of the intersecting image range, and the obtained polygon is not a rectangle but a rectangle in the three-dimensional mode, and the longer side of the polygon in the longitude/latitude direction is taken as the image width and height values.
The SAR image translation operation is needed in the geographic information display module. When in operation, the current state is set as an editing mode, and at the moment, the operation event of the mouse on the map is intercepted. When the left button of the mouse is pressed and the pressed position is on the image, the image can be dragged at the moment, the position of the mouse is recorded as the moving starting position, and when the current mouse moves, the offset of the image is set according to the moving position of the mouse and the offset of the starting position, as shown in fig. 9.
The SAR image processing module is used for carrying out image interception on the SAR image according to the requested content and returning the result to the geographic information display module. After receiving the request, the SAR image processing module takes out the requested image interception range and size and the image name parameter, then uses GDAL library to intercept the tiff image of the SAR, and returns the intercepted image to the geographic information display module.
According to the image computing processing mode, the image is cut according to the content displayed according to actual needs, the memory size of the loaded image is greatly reduced, the SAR image processing module is installed on a server with good CPU performance in a distributed mode, the image parallel processing capability is improved, the capability of loading, displaying and processing the oversized SAR image on a geographic information system in real time is realized, and the problems of loading, displaying and processing the oversized SAR image are solved.
While the invention has been described with reference to preferred embodiments, it is not intended to be limiting. Those skilled in the art will appreciate that various modifications and adaptations can be made without departing from the spirit and scope of the present invention. Accordingly, the scope of the invention is defined by the appended claims.