I have developed a YoLo based algorithm in Python to detect objects from Google Maps images. Now, i have the task to GEOLOCATE that object in the image. I have tried to access the EXIF information of the image and adapt it to the object, but it gets high position errors.
Is there any way or technique to acces geolocation of an object detected of my image?
Unless Google provides an API to map Street View image pixels to vectors in North-East-Down coordinates, you can forget about doing it in general.
Street View images are the result of a very complex image processing pipeline, whose result is a cubic panorama. In the final web client view you have access to the location of the view (as latitude, longitude and elevation), and the horizontal direction of view (as an angle with respect to North), but that's about it. In order to geolocate an object in the scene you'd need to know its distance from the camera and the direction under which you see it.
Related
There are lot of objects in a point cloud and my task is to crop a particular object. I would like someone to help me on knowing the indices of points associated with the object and to crop it. I have seen the documentation in open3d site which crops using j-son file but it is not clear to me. I would like to know how to know the exact location of points in a point cloud.
I'm using the google maps static api to get top view satellite images of objects of which I have the surface coordinates (LoD1 / LoD2).
the points are always slightly off, I think this is due to a small tilt in the satellite image itself (is it a correct assumption?).
For example in this image I have the building shape, but the points are slightly off. Is there a way to correct this for all objects?
The red markers are the standard google-maps api pointers, the center of the original image (here it is cropped) is the center of the building, and the white line is a cv2.polyline implementation of the object shape.
Just shifting by n pixels will not help since the offset depends on the angle between the satellite and object and the shape of that object.
I am using the pyproj library to transform the coordinates, and then convert the coordinates to pixel values (by setting the center point as the center pixel value, and having the difference in the coordinate space, one can calculate the edge-points pixel values too).
So - the good news is that there is no need to "correct" this for all objects, because there is no way to do that without using 3d models & textures.
Google (or most map platforms for that matter) don't actually use satellite images, they use aeroplane images. The planes don't fly directly over the top of every building (imagine how tight/redundant their flight path would be if they did!).
Instead, the plane will take an image from some kind of angle, and then, through the wonders of photogrammetric processing, the images are all corrected and ortho-rectified so the ground surface is in the right place everywhere.
What can't (and shouldn't) be corrected in a 2d image is the location of objects above ground height. Like the roof in your image. For a more extreme example, just look at a skyscraper, and you'll realise you can't ever get the pixels correct above the ground:
https://goo.gl/maps/4tLSrd7yXQYWZPTy7
I have performed stereo calibration and can undistort and rectify the images obtained from both my left and right cameras. I am running an object detection algorithm on each camera to identify different objects of the same shape and color. I can compute the disparity between the two images and manually calculate the depth/distance to the objects since I am able to identify a boudary box for each detected object. I want to automate this, but will need to ensure that a detected object on the left image matches with my detected object on the right image. Provided I have my stereo camera parameters and the location of bounding box of each object in each image, is there a OpenCV function that can easily allow me to match the same objects with each other so that I can automatically calculate the distance ?
An example of the two images (sorry I couldn't provide real photos):
What I have tried:
I am currently looking into feature matching algorithms such as SIFT and ORB but my concern is that since I have multiple objects of the same shape and color, there will be multiple similar matches. I have tried filtering based on area of the bounding boxes but this will not work in all cases since I can have two different objects with a similar detected area.
I am working a gps-denied UAV localization project. I am reading this paper GPS-Denied UAV Localization using Pre-existing Satellite Imagery. In this paper, they try to align a UAV frame sequentially with a satellite map using an homography. The first homography is estimated using the GPS information stored in the first UAV frame. In the code, I don't see any information about this part. I am wondering if someone can explain this or point me to some reference that can help.
I want to fit a camera-view to a mesh from a fixed point. See attached image.
Example
So I need to adjust the camera rotation, focal length and frame width/height.
What is the best way to do this with python?
What you're asking is relatively complex in terms of operation. You're adjusting multiple camera properties to frame an object.
I recommend you decompose the problem into parts and ignore focal length all together. Simply transform a camera so it frames the object. You can then add a supplementary step to modify the width and height of the camera to tightly frame it.
The gist of what you want to do is as follows:
get bounding box of object
get camera aspect ratio
get active viewport representation
get camera matrix based on object bounding box and corresponding camera aspect ratio mapped from active viewport
apply matrix to camera
This will be much easier if you're familiar with the OpenMaya API. The OpenMayaUI.M3dView and the OpenMaya.MFnCamera classes should get you started.
https://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=__py_ref_class_open_maya_u_i_1_1_m3d_view_html
https://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=__py_ref_class_open_maya_1_1_m_fn_camera_html
If you're unfamiliar with the API, then scour the mel scripts and check how the FrameSelectedWithoutChildren Runtime Command (F key in the viewport) shortcut works, and use that to automate the process.