iOS GoogleMaps area accuracy and Polygon drawing - ios

I am trying to mark location points while walking around small area say my house. How accurate it would be to draw perimeter i.e. Polygon.
How accurate the distance would be.
Thirdly can we draw curved path
Any suggestion with experience will be highly appreciated.
Thank you

I can't comment on the accuracy of the polygon area, but there's a lot of questions about it when searched (eg. this Stackoverflow question.
For drawing curved path, you can use the GMSPolyline with geodesic option set to YES.
When YES, render this polyline edge as a geodesic. Geodesic segments follow the shortest path along the Earth's surface and may appear as curved lines on a map with a Mercator projection. Non-geodesic segments are drawn as straight lines on the map. Defaults to NO.

Related

Draw epipolar lines for spherical images with known pose

I have a couple of spherical images, given in equirectangular projection, looking at the same object from different positions. I know the absolute pose of each image e.g. position in geographical coordinates and roll/pitch/yaw angles. Given the pixel coordinate of a point in one image I would like to find a way to draw the epipolar line (where the correspondent point lies) in the other one.
I tried to deal with Essential/Fundamental matrix in python using OpenCV but I did'nt figure out how to achieve this.
Any help is really appreciated.
Thanks

How to Find The Shortest Displacement Between an Annotation on MKMap to a Polygon

I am parsing a polygon from a KML file to an MKMap and when a user add an annotation (point) on the map I need to calculate the shortest displacement between the annotation to the polygon (not to on of the polygon points but to his bounds).
Heres an example :
I have the coordinates for each point of the polygon and I have the coordinates of the annotation.
What I had in mind is to run through all the points coordinates and try to calculate the perpendicular line from the annotation to each line and then compare the displacements, then calculate all the displacements to the polygon points from my annotation and choose the smallest displacement but I am sure there is a much better and simpler solution.
I was searching for some ready to use framework but with no success.

How can I project a rectangular texture into a region of curved shape?

I want to map a texture image of rectangular shape into a curved area. The curved area has a axis defined by bezier curve and fixed width.
I can map the points on the axis to the texture by percentile, and get a stripe of pixels to fill the region. But this way the left side of the region is "stretched", and I get unfilled gaps.
How can I map the texture to the curved area "smoothly"? Is there an algorithm for such a task?
To answer my own question:
My own naive solution is to fill the gaps(trianglar area in the image) with pixel values by interpolating between the adjacent points on normal vectors.
Later I found a more mathematical solution to this problem in a paper:
http://www.stat.ucla.edu/~sczhu/papers/Conf_2011/portrait-painting-preprint.pdf
It map the grids of the rectanglar texture to the spline-shaped area with a method called thin-plate spline (TPS) transformation:
we compute a thin-plate spline (TPS) transformation [Barrodale
et al. 1993] between the pairs of source and target dot positions
(e.g., between the corresponding backbone control points in Figs.4a
and 4b), and apply the transformation to the vertices of a quadrilateral
mesh covering the source brush stroke to get the deformed
mesh. Finally, we compute a texture mapping using the mesh, with
a bilinear interpolation inside each quadrilateral.
I am thinking maybe the same transformation can be done with bezier curves.
Hope this is helpful.

Is there an MKSquare in iOS?

I have a bunch of lat/long coordinates and I need to draw a square polygon around each one. Each square will be a set size (e.g. 50x50) with the coordinate in the centre. I see there is a MKCircle class but is there an MKSquare equivalent (I couldn't fine one but that doesn't mean there isn't) and if there isn't, any suggestions on how this could be achieved? I have done some searching and didn't produce any solid suggestions.
I would also like to make the square 3D as in if the map is tilted it would show a height kind of like buildings.
You can use MKPolygon for this. Simply provide four coordinates the correct distance from your center point and the four coordinates will form a square.

Defining a 3D scene from a photo of a circle

Given a photo containing a circle, for example this photo of a fountain:
is it possible to define the 3D position and rotation of the fountain in relation to the camera?
I realise we have to define the scale, so lets say the fountain is 2m wide (the diameter of the circle consisting of the inner rim of the fountain is 2m).
So assuming the circle is a perfect circle, and defining the diameter to 2m, is it possible to determine how the circle and the camera relate spatially? I dont know any camera matrix or anything, the only information i have is the picture.
I specifically want to determine the 3D coordinates of a given pixel on the rim of the fountain.
What would be the math and/or OpenCV code to do this?
Circle with perspective is an ellipse. So you basicly you need an ellipse detector.
This algorithm should work:
Detect all ellipses in the given image.
Filter ellipses that you think they are not a circles in origin. (This is not possible using just 1 Camera so you have to depend on previous knowledge. Something like that you knows that you are taking a photo for a circle).
mmm I stopped typing here and bring a paper&pen and started figuring how to estimate the Homography and it is not that easy! you should deal with the circle a special case of an ellipse and then try to construct a linear system of equations. However, I made quick googling :
https://www.researchgate.net/publication/265212988_Homography_estimation_using_one_ellipse_correspondence_and_minimal_additional_information
http://www.macs.hw.ac.uk/bmvc2006/papers/306.pdf
Seems very interesting topic, I am going to spare sometimes on it later!

Resources