The three-dimensional amount of geographic position of target object based on streetscape map calculates method and apparatus
Technical field
The present invention relates to streetscape map, electronically graphics, photogrammetric, GIS, Web service, computer graphics etc. are led
Domain, the purpose is on the basis of existing streetscape map resource, object actual geographic position is direct in realization streetscape map
It measures.More particularly to Http request, the contents such as the space line under polar coordinate system is determining, front crosses.
Background technique
Streetscape map is a kind of live-action map service.Level side is provided for what user provided city, street or other environment
To 360 ° and 180 ° of vertical direction of street panorama, allow user that can inspect street different location and its two on selected urban ground
Other scenery.It is it is a kind of with multichannel video camera to real scene carry out multi-angle look around Image Acquisition and then using count
Calculation machine carries out later period fusion treatment, and loads playing program a kind of three-dimensional display technique for completing.
In recent years, with the rapid development of Internet technology, three-dimensional panorama, virtual tours etc. are various with panorama image information
Based on application service, be increasingly entering daily life.Streetscape map realizes two-dimentional three-dimensional and combines
Virtual reality scenario, perception on the spot in person can be brought to user.
Currently, external Google company, the information technologies such as domestic Baidu, Tencent and Internet company, are proposed
Map Services towards city streetscape.But these streetscape maps are mainly used for display and demonstration, in serious waste street view image
The bulk information contained.Compared with traditional two-dimensional map, streetscape map cannot achieve the positioning to atural object in street view image, amount
It surveys, significantly limits the extensive use of panoramic technique.
It can only be used to the deficiency of display and demonstration for current streetscape map, the present invention proposes three based on existing streetscape map
Dimension measures algorithm, realizes to the actual geographic coordinate of atural object in street view image and the quick obtaining of height.
Summary of the invention
Present invention seek to address that existing streetscape map cannot achieve to the actual geographic position of object, height in Streetscape picture
The problem of acquisition of information such as degree.Streetscape map for user provide more true and accurate, more rich in the Map Services of picture detail
On the basis of, the measurement of object actual geographic position, height in streetscape map may be implemented in the present invention, makes special in streetscape map
Some abundant informations are utilized, and expand the application of streetscape in actual production and life.
To realize the above-mentioned technical purpose, the present invention adopts the following technical scheme:
A kind of three-dimensional amount measuring method of the geographic position of target object based on streetscape map, includes the following steps:
Step 1: in streetscape map, selecting the viewpoint in two angulars field of view comprising object to be measured;
Step 2: obtaining the longitude and latitude of selected two viewpoints;
Step 3: under each viewpoint, object bottom, top being sequentially adjusted in the center of streetscape map respectively;
Specifically, will a little be sequentially adjusted in respectively streetscape map on object bottom, top under each viewpoint
Center, the line of any respectively selected on top, bottom are located on same vertical line;
Step 4: in obtaining step 3 under each state of object viewpoint view parameter, including horizontal angle and pitch angle;
The horizontal angle refers to the compass heading of the camera of shooting camera.The range of acceptable value is 0 to 360 ° (two
Value all indicates the north, 90 ° of expression east, 180 ° of expression south).
The pitch angle refers to upward or downward angle of the camera of shooting camera relative to Street View vehicle.
Positive value indicates that camera is in upper angle (90 ° indicate vertically upward);And negative value indicates camera in downward angle (- 90 ° of expressions
Vertically downward).
Step 5: according to two viewpoints and viewpoint to the horizontal angle of object bottom, building two is non-parallel under polar coordinate system
Space line;
Step 6: finding out two space line intersection points, the longitude and latitude of intersection point is object bottom in the projection position of horizontal plane
It sets, as the actual geographic position of object;
Step 7: viewpoint is found out away from target according to viewpoint longitude and latitude any in selected two viewpoint and object bottom longitude and latitude
The distance of object bottom in the horizontal plane finds out object bottom according to viewpoint to the pitch angle of object bottom and top respectively
Relative altitude with top away from viewpoint;
Step 8: the relative altitude away from viewpoint subtracts object bottom and obtains mesh away from the relative altitude of viewpoint at the top of object
Mark the actual height of object.
Method of the invention, the step 1 further include after selecting two viewpoints, adjusting the visual angle and the visual field under the viewpoint
Object is adjusted to the suitable position of streetscape map by range.
The viewpoint refers to that camera geographic location, is indicated when shooting the street view image with longitude and latitude.Different points of view is
The geographical location of camera is different when referring to shooting Streetscape picture.
Further, in the step 1, by rotating street view image, object is adjusted to the suitable position of streetscape map
It sets;Specifically, making object is whole to be clearly located within sweep of the eye, clear is blocked by rotation adjustment streetscape image.
Method of the invention, in the step 2, longitude and latitude is obtained from the acquisition parameters of viewpoint;
Method of the invention in the step 3, respectively adjusts object bottom, top under two selected viewpoints
To the center of streetscape map;
The center of the streetscape map refers to, in streetscape map display window, the center line of horizontal direction and perpendicular
Histogram to center line intersection position.
Algorithm of the invention may be summarized to be: in streetscape map, selecting an object first, is selected according to object
Two suitable viewpoints;Under each viewpoint, object bottom/top is adjusted to the center of streetscape map, obtains view
Point arrives the view parameter of object bottom/top;Two are determined according to the visual angle of viewpoint longitude and latitude and viewpoint to object bottom
Space line, finds out the intersection point of two straight lines, and the longitude and latitude of the intersection point is longitude and latitude of the object in actual geographic space;By
The longitude and latitude of viewpoint longitude and latitude and obtained object find out viewpoint and object in the horizontal plane at a distance from, arrived further according to viewpoint
The pitch angle of object top and bottom finds out the relative altitude of viewpoint and object top, bottom, and two relative height differentials are
The actual height of object.
The present invention also provides realize device used by the above method, comprising:
For selecting the device of the viewpoint in two angulars field of view comprising object to be measured in streetscape map;
For obtaining the device of the longitude and latitude of selected two viewpoints;
For under each viewpoint, any on object bottom, top to be sequentially adjusted in streetscape map respectively
The device of heart position;
For obtaining the view parameter of viewpoint under each state after object adjusts, the device including horizontal angle and pitch angle;
For according to according to two viewpoints and viewpoint, to the horizontal angle of object bottom, building two is non-flat under polar coordinate system
The device of capable space line;
For solving the device of two space line intersection point longitudes and latitudes;
For finding out viewpoint away from object according to viewpoint longitude and latitude any in selected two viewpoint and object bottom longitude and latitude
The distance of bottom in the horizontal plane, according to viewpoint to the pitch angle of object bottom and top, find out respectively object bottom with
The device of relative altitude of the top away from viewpoint;
For the relative altitude away from viewpoint at the top of object to be subtracted to the device of relative altitude of the object bottom away from viewpoint.
It is described in streetscape map, selecting in two angulars field of view comprising to be measured in above-mentioned apparatus of the invention
The device of viewpoint of object the visual angle under the viewpoint and field range are adjusted, by target after being included in selected two viewpoints
Object is adjusted to the device of the suitable position of streetscape map.
Preferably, it is equipped with through rotation street view image, object is adjusted to the device of the suitable position of streetscape map;
Specifically, making object is whole to be clearly located within sweep of the eye, clear by rotation adjustment streetscape image
The device blocked.
The device of the longitude and latitude for being used to obtain selected two viewpoints, including obtaining its warp from the acquisition parameters of viewpoint
The device of latitude.
It is described to be used under each viewpoint, streetscape map will be a little sequentially adjusted in respectively on object bottom, top
Center device, be included under each viewpoint, by object bottom or top a little be sequentially adjusted in respectively to street
The center of scape map, the device of the central point or angle point at selection target object bottom or top.
Existing streetscape resource is effectively utilized in the present invention, realizes the direct of the geographical location of atural object in streetscape map
Obtain and atural object actual height measurement, be conducive to existing streetscape resource smart city, in terms of into
One step application.
Detailed description of the invention
Fig. 1 is the flow chart of the method for the present invention;
Fig. 2 is that geographic position of target object of the present invention solves schematic diagram;
Fig. 3 is that object actual height of the present invention solves schematic diagram.
Specific embodiment
It is described in further detail with reference to the accompanying drawings and examples.
Embodiment 1
The present embodiment further retouches the technical solution of the method for the present invention by taking the streetscape map of Google company as an example
It states.As shown in Figure 1, process of the invention includes the following steps:
Step 1: in Google streetscape map, object to be measured for one, select include in two angulars field of view
The suitable viewpoint of object to be measured;
Step 2: obtaining the longitude and latitude for two viewpoints chosen in streetscape map;
Step 3: under each viewpoint, object bottom, top being adjusted to the center of streetscape map respectively;
Step 4: in obtaining step 3 under each state of object viewpoint view parameter, including horizontal angle and pitch angle;
Step 5: according to two viewpoints and viewpoint to the horizontal angle of object bottom, it is straight that two spaces are constructed under polar coordinate system
Line;
Step 6: finding out two space line intersection points, the longitude and latitude of intersection point is object bottom in the projection position of horizontal plane
It sets, as the actual geographic position of object.
Step 7: viewpoint is found out away from target according to viewpoint longitude and latitude any in selected two viewpoint and object bottom longitude and latitude
The distance of object bottom in the horizontal plane finds out object bottom according to viewpoint to the pitch angle of object bottom and top respectively
Relative altitude with top away from viewpoint;
Step 8: the relative altitude away from viewpoint subtracts object bottom and obtains mesh away from the relative altitude of viewpoint at the top of object
Mark the actual height of object.
Specific implementation step is as follows:
Step 1: a specific object is selected first, for two different conjunctions in object selection streetscape map
Suitable viewpoint;
The viewpoint refers to that camera geographic location, is indicated when shooting the street view image with longitude and latitude.Different points of view is
The geographical location of camera is different when referring to shooting Streetscape picture.In the present embodiment, by rotating street view image, object is adjusted to
The suitable position of streetscape map;Specifically, making object is whole to be clearly located at field range by rotation adjustment streetscape image
Interior, clear is blocked.
Step 2: obtaining the longitude and latitude of two streetscape viewpoints respectively according to the related service of Google streetscape map;Streetscape map
Acquisition parameters in i.e. comprising viewpoint latitude and longitude information, other streetscape maps can be used corresponding manner obtain viewpoint longitude and latitude
Information.
The longitude and latitude of viewpoint can be obtained according to Google Street View API, and specific code is as follows:
The longitude and latitude of // acquisition viewpoint
var lat = panorama.getPosition().lat();
var lng = panorama.getPosition().lng();
Wherein, lat is the latitude of viewpoint, and lng is the longitude of viewpoint;
Step 3: will be a little adjusted in streetscape map on object bottom, top respectively under above-mentioned two viewpoint
Heart position;To be conveniently adjusted, angle point/central point of selection top or bottom;Some lines respectively selected on top, bottom,
To be located on same vertical line, such as the object of a cuboid, if top has selected the angle point of the left front on top surface, bottom
Portion will equally select the angle point of left front on bottom surface.
The center of the streetscape map refers to, in streetscape map display window, the center line of horizontal direction and perpendicular
Histogram to center line intersection position.
Step 4: the view parameter of each state in obtaining step 3, including horizontal angle and pitch angle;
The horizontal angle refers to the compass heading of the camera of shooting camera.The range of acceptable value is 0 to 360 ° (two
Value all indicates the north, 90 ° of expression east, 180 ° of expression south).
The pitch angle refers to upward or downward angle of the camera of shooting camera relative to Street View vehicle.
Positive value indicates that camera is in upper angle (90 ° indicate vertically upward);And negative value indicates camera in downward angle (- 90 ° of expressions
Vertically downward).
The code of realization is specific as follows:
The horizontal angle of // acquisition current visual angle
var heading = panorama.getPov().heading;
The pitch angle of // acquisition current visual angle
var pitch = panorama.getPov().pitch;
Step 5: the longitude and latitude of known viewpoint and the horizontal angle of viewpoint to object bottom can be true according to polar coordinate system
Make a space line.Two different viewpoints then construct two different space lines, and specific code is as follows:
//k1, k2 are respectively the slope of two space lines
var k1 = 1/Math.tan(heading1/180*Math.PI);
var k2 = 1/Math.tan(heading2/180*Math.PI);
//b1, b2 are respectively the intercept of two space lines
var b1 = lat1 - k1*lng1;
var b2 = lat2 - k2*lng2;
Step 6: as shown in Fig. 2, finding out intersection point according to two linear equations, the latitude and longitude value of the intersection point is object bottom
Portion is as follows in the projected position of horizontal plane, as the actual geographic position of object, specific code:
The intersection point of // two straight lines, the i.e. geographical location of object
var lngT = (b2 - b1)/(k1 - k2);
var latT = y0 * k1 + b1;
Wherein, latT is the latitude of intersection point, and lngT is the longitude of intersection point;
Step 7: as shown in figure 3, finding out viewpoint and object bottom by the longitude and latitude of viewpoint longitude and latitude and object bottom
Distance in the horizontal plane.According to viewpoint to the pitch angle of object bottom and top, object bottom and top are found out respectively
Relative altitude away from viewpoint.Specific code is as follows:
// distance of point-to-point transmission is found out according to viewpoint and object bottom longitude and latitude
var xyDistance = GetDistance(latT,lngT,lat,lng);
function GetDistance( lat1, lng1, lat2, lng2)
{
var radLat1 = rad(lat1);
var radLat2 = rad(lat2);
var a = radLat1 - radLat2;
var b = rad(lng1) - rad(lng2);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) +
Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2)));
s = s * EARTH_RADIUS;// earth radius
s = Math.round(s * 10000) / 10;
return s;
}
// relative altitude of object and viewpoint is sought according to the horizontal distance of the angle pitch and object and viewpoint
var z1 = xyDistance * Math.tan(pitchBottom/180*Math.PI);
var z2 = xyDistance * Math.tan(pitchTop/180*Math.PI);
Step 8: the relative altitude away from viewpoint subtracts object bottom and obtains mesh away from the relative altitude of viewpoint at the top of object
Mark the actual height of object.Specific code is as follows:
The relative altitude for subtracting object bottom and viewpoint at the top of // object with the relative altitude of viewpoint, obtains object
Actual height
var height = z2-z1;
Height is the actual height of calculated object.
Embodiment 2
The present embodiment illustrates the specific technical solution of apparatus of the present invention.
Such as Fig. 1, a kind of three-dimensional amount measuring and calculating device of the geographic position of target object based on streetscape map, comprising:
For in streetscape map, selecting the device of the viewpoint in two angulars field of view comprising object to be measured, packet
It includes after selected two viewpoints, adjusts the visual angle under the viewpoint and field range, object is adjusted to the suitable of streetscape map
The device of position.Preferably by rotation street view image, object is adjusted to the device of the suitable position of streetscape map;Specifically
To adjust streetscape image by rotation, making object is whole to be clearly located within sweep of the eye, the device that clear is blocked.
For obtaining the device of the longitude and latitude of selected two viewpoints, including obtaining its longitude and latitude from the acquisition parameters of viewpoint
Device;
For under each viewpoint, any on object bottom, top to be sequentially adjusted in streetscape map respectively
The device of heart position is included under each viewpoint, with being sequentially adjusted in streetscape respectively by any on object bottom or top
The center of figure, the device of the central point or angle point at selection target object bottom or top;
For obtaining the view parameter of viewpoint under each state after object adjusts, the device including horizontal angle and pitch angle;
For according to according to two viewpoints and viewpoint, to the horizontal angle of object bottom, building two is non-flat under polar coordinate system
The device of capable space line;
For solving the device of two space line intersection point longitudes and latitudes, as shown in Figure 2;
For finding out viewpoint away from object according to viewpoint longitude and latitude any in selected two viewpoint and object bottom longitude and latitude
The distance of bottom in the horizontal plane, according to viewpoint to the pitch angle of object bottom and top, find out respectively object bottom with
The device of relative altitude of the top away from viewpoint, as shown in Figure 3;
For the relative altitude away from viewpoint at the top of object to be subtracted to the device of relative altitude of the object bottom away from viewpoint.