GPS bounding box around 2 points - gps

I have 2 GPS locations with a latitude and a longitude.
I want to create a bounding box, which incorporates both these points, plus some number of kilometers of padding on either side (for example, a 10km bounding box which includes both point X and point Y).
I have seen implementations for bounding boxes around 1 singular GPS location, but I have not seen any implementations which incorporate 2 GPS locations.
Can somebody help with an implementation, or the name of a solution?

Related

Extracting a plane from an image taken by a camera

I have a camera at a known fixed location and orientation.
I also have a plane at a known location whose z position changes.
I want to turn the image from the camera into a top down view of the plane.
I can do this without knowing any positions by using the 4 points of the plane for a homography matrix and warping the image but each time the plane moves in Z I have to repeat this process.
After searching around online most methods seem to center on finding features of the image (using SIFT or something like it) then computing a homography matrix.
With the problem so constrained I thought there may be a simple linear algebra based approach.

Is there a way to programmatically determine the optimal Bing Maps Zoom Level based on an array of GPS Coordinates?

When programmatically adding an array of GPS Coordinates to a Bing Map, I want to set the Zoom level to the optimal - to show every pushpin/location, but "just barely."
I imagine a way to do this would be to identify the furthest points in the cardinal directions found within the array of coordinates, and then calculate how many miles you need to display both east-to-west and north-to-south.
For example, let's say the furthest north and furthest south locations are determined to be forty miles distant from each other, and the furthest east and furthest west locations are determined to be sixty miles apart from each other. Is there a rule of thumb/calculation/algorithm that would determine what the most "zoomed-in" level would be that would display all of the locations/coordinates, with the "outliers" being as close to the edge of the displayed portion of the map as possible?
You can set a map view with a bounding box, which will automatically determine the zoom level. See the example here
https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/setmapviewoptions
using the Bounds property as documented here
https://learn.microsoft.com/en-us/bingmaps/v8-web-control/map-control-api/viewoptions-object

Drawing/Calculating an area with an angle in Google's object detection API

I want to use some parking lot images of cars in Google's object detection API(https://github.com/tensorflow/models/tree/master/research/object_detection). The cars are usually not portrayed as a straight box but more of a box that is turned 45 degrees to either side, causing the x and y coordinates to lay in a diagonal line instead of straight line. Normally, just using a box would work but the cars are quite close to each other which is why I need to change it.
In the API they use ymin, ymax, xmin, xmax to draw the boxes for the objects in the images. So my question is, can I change it so the code does the calculations and draws the box out of the defined by 4 points in order to used an angled box? And if possible... how?
I want to draw the box like the one to the left.
Thanks in advance.

Convert a Lat/Lon coordinate on a map based on preset coordinates

First off, I am not sure if this is the right place so I apologize if this belongs elsewhere - please let me know if it does. I am currently doing some prototyping with this in VB so that's why I come here first.
My Goal
I am trying to make a program to be able to log different types of information for a video game that I play. I would like to be able to map out the entire game with my program and add locations for mobs, resources, etc.
What I have
The in game map can be downloaded so I have literally just stuck this in as a background image on the form (just for now). The map that I get downloaded though is not exactly as the map appears in the game though since the game will add extra water around everything when scrolling around. This makes it a bit tricky to match up where the origin for the map is in game compared to where it would be on the downloaded map.
The nice thing though is that while I am in the game I can print my current coordinates to the screen. So I thought that maybe I can somehow use this to get the right calculation for the rest of the points on the map.
Here is an example image I will refer to now:
In the above map you will see a dotted bounding box. This is an invisible box in the game where once you move your mouse out of the longitude and latitude points will no longer show. This is what I refer to above when I mean I can't find the exact point of origin for the in game map.
You will also see 2 points: A and B. In the game there are teleporters. This is what I would use to get the most accurate position possible. I am thinking I can find the position (in game) of point A and point B and then somehow calculate that into a conversion for my mouse drag event in VB.
In VB the screen starts at top-left and is 0,0. I did already try to get the 2 points like this and just add or subtract the number to the x and y pixel position of the mouse, but it didn't quite line up right.
So with all this information does anyone know if it is possible to write a lon/lat conversion to pixels based on this kind of data?
I appreciate any thoughts and suggestions and if you need any clarification of any information I have posted please let me know and I will be happy to expand on it. I am really hoping I can get this solved!
Thanks!
EDIT:
I also want to mention I am not sure if there is an exact pixel to lat/lon point for the in game map. I.e. the in game map could be 1 pixel = 100 latitude or something. So I might also need to figure out what that conversion number is?
Some clarifications about conversion between the pixel location to 'latitude and longitude'.
First the map in your game is in a geometry coordinate system, which means everything lies in 2D and you can measure the distance between two points by calculate the pixel position.
But when we talk about longitude and latitude, we are actually talking about a geography coordinate system, which is a '3D' model of the sphere oabout the surface of the earth. All the maps on earth are abstracted from 3D to 2D through one step called projection. Like google maps or your GPS. In this projection process, the 3D model converted to 2D model but there is always some part of the map will be tortured, so that same distance in pixels on a map could be different in length in reality.
So if you don't care about the accuracy then you can consider the geometry point as geography point. Otherwise, you need to implement some GIS library to handle the geodesic distance and calculate the geography point based on the projection coordinate system.

How to extract images inside the bounding box using Instagram API?

I'm trying to collect all images from a specific location, for example Tokyo. I manages to create a bounding box which gave me the following results
(50.607041876988994, -1.3187316344406208, 52.40735812301099, 1.5737316344406207)
Main problem is, what do I do next? What do each of these figure represent and how would I plot these if I were to use them for coding?
All I want is to use this bounding box and within it collect all images from Instagram. I was wondering if anyone can write a short pseudo code, or any language code.
Using this stackoverflow answer you can calculate the center of bounding box: Calculate the center point of multiple latitude/longitude coordinate pairs
which is 51.51608899635712, 0.09891956707558282
You can then calculate distance between the center and corner of bounding box: Function to calculate distance between two coordinates shows wrong
which comes to about 141km
using gramfeed, you can search instagram by location with a lat,lng and a radius, here are the resulting posts that are within the bounding box, it may have some extra posts outside the bounding box since instagram api searches within a circular area, if you want you can further filter the posts one by one for accuracy.
Here are the instagram posts within the bounding box:
http://www.gramfeed.com/instagram/map#/51.5165,0.0999/200/-