ARToolkit Multiple Mandatory Markers - ios

I studied the multimarker documentation of ARToolKit for iOS and i have some troubles in achieving some sort of QR-Code.
I want, for example:
A set of 6 markers positioned differently on a picture, and when and only when ALL of them are present, some sort of video is displayed in the origin of them( i want to use some sort of CORNER Markers like QR-Code system ).
How to do this ? From what i've seen, on multimarkers, if 1 is present out of 6 for example, the object is displayed.

From looking into the ARToolKit code you can see that a MultiMarker is internally handled as one single Marker consisting of several Pattern:
https://github.com/artoolkit/artoolkit5/blob/master/lib/SRC/ARWrapper/ARMarker.cpp#L344
https://github.com/artoolkit/artoolkit5/blob/master/lib/SRC/ARWrapper/ARMarkerMulti.cpp#L75
That is why ARToolKit will always return true whenever one of the markers configured in the multi-marker configuration is visible.
Taking that into account ‘Multi-Markers’ are not the way to go for the target you would like to reach.
What you can do, however, is to configure each marker separately and add them as ‘Single-Marker’. Then you can query if all of these ‘Single-Markers’ are visible.
If so you can calculate the origin of all these ‘Single-Markers’ and render your object there.
You can get an idea on how to configure several ‘Single-Markers’ if you take a look here:
http://augmentmy.world/moving-cars-augmented-reality
Also take that example here on how to set to markers into the same coordinate system (and calculate the distance between them) you can use that as a starting point for calculating the origin between several markers:
https://github.com/artoolkit/artoolkit5/tree/master/AndroidStudioProjects/ARMarkerDistanceProj
I know that these are not iOS examples but I have only done Android so far. Also, the ARWrapper interface should be the same on Android and iOS, meaning to say there should not be much difference between these two.
I hope that helps

Related

Achieving equal size of square/pixel on Mapbox anywhere on the world map?

The problem I'm facing is similar and closely related to this issue on Github but that's for Unity SDK, my question is for iOS SDK.
I want to achieve the same thing. Let me explain, basically I have pixel grid in which each pixel'd have equal size. Pixel is set to be 10m x 10m in real world. The thing I experienced is that if pixel locates towards the northern or southern part of the world, its size is stretched like the following.
Click for larger resolution
But when such pixel locates along the equator line, or simply along the middle part of the world. It looks ok like following
Click for larger resolution
There's no problem about rendering stuff, or positioning on Mapbox. The thing is I want every pixel to be square visually.
I've read along on the issue I linked above. It relates to mercator and the world is not flat thus makes this visual happens. It looks stretched along the northern and southern part of world map. As well, I found out that there's no equal functionalities as presented in Unity SDK for this particular problem on iOS SDK, so I'm not sure which approach I should go on to solve this solution.
How can I achieve equal size of pixel on the gridline on mapbox using Mapbox iOS SDK? Is there already solutions provided in the SDK?
FYI.
My requirement also needs real distance as shown on the map. I'm not sure it'd affect the solution as presented in the link I linked above.
I use Mapbox iOS SDK 3.7.6
My initial approach is straightforward as I fix the size of pixel to be 10m x 10m, then calculate its corresponding latitude and longitude value. Use those values to position them in Mapbox treating entire world map as a tilemap. Anyway I didn't take into account mercator in calculation, so this might be the case, if so then how to do just that? Only thing from my checking as available in iOS SDK is MGLMapView's metersPerPoint(atLatitude:). No tile ID system, or Conversions.cs as seen on Unity SDK. So i'm not sure on how to go on and solve this problem.
Update
I managed to solve it and made it work!
I'll come back and post the solution.
My solution is to port sphericalmercator.js to swift, then use it in code. I use a fixed zoom level of level 22 as its visual look is closest to what I need and also before. I went with the approach to at least have it looks visually equal not necessary its physical size.
Thanks to a hint in this answer on how to use sphericalmercator.js.
Anyway from my testing with it, tile size as set when you creating an instance using SphericalMercator seems not to be in effect no matter what value I set. Only zoom level will determine number of tiles across the world map for you. Note that upper-left corner is origin which is 0,0 tile index. Lower zoom level value will generate large tile size, but higher value will generate smaller tile size.
You can take a look as SphericalMercator-swift; the code I ported from origin JS implementation as linked above along with how to use it to get tile index, or bounding box of longitude/latitude in swift code in order to do rendering stuff on top of Mapbox.

In OpenLayers 3, how do I write on the map?

I have made an OpenLayers 3 web application I use while driving. It would be very handy to have the speed of the car in one corner of the map. Is it possible to achieve this so that the text (numbers) are locked to the viewport of the map rather than the map itself. I'm thinking of something similar to the controls of the map.
I suppose I could put it below the map but then I'm afraid I would run into problems with different sizes of screens.
Could somebody suggest a technique I should look into?

How manage when several annotations has similar or the same coordinates and want to show them?

I have an app (iPhone) that uses MapKit and users can create things on the map (annotations in the remote database, with latitude and longitude).
Problem is that very often users put things in the same building, very close, even in the same coordinates. So you only see the most up-to-date annotation unless you tap it and another is shown, but the usability of this is horrible. No users realize they can do that.
Therefore I guess a way to group close points and when tap, show all of them. It seems the first step can be done with clusters and I see several libraries for iOS for that:
http://cocoapods.org/?q=on%3Aios%20cluster
I would like to know if you have any idea or suggestion to solve the second problem, or the whole problem.
Thanks in advance.
Depending upon the clustering library used, you may be able to get the clustered region that is represented. Then, upon cluster marker tap, you could zoom to that region.
The JS library Leaflet has this behavior so you can see what it's like:
http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html
I realize this is a JS library not ObjC, but just linking it for demo purposes.

Subclassing MKMapView to provide custom maps?

I'd like to provide custom navigation maps in my iOS 6 application. I've tried adding overlay views that shows these custom maps in MKMapView and it didn't work well because it needs a higher zoom level than what Apple's component can provide (the desired zoom level is about 10 screen points per meter in the map).
The question is, is subclassing MKMapView a good way to approach to this? The primary reason is I'd like to take advantage of MKMapView's coordinate conversion functions:
convertCoordinate:toPointToView:
convertPoint:toCoordinateFromView:
convertRegion:toRectToView:
convertRect:toRegionFromView:
Those functions makes it easy to convert screen points to world coordinates (latitude/longitude) and vice-versa.
Thanks in advance!
I don't think you are going to have much luck with subclassing MKMapView. There is a lot going on behind the scenes related to tile loading that you cannot access.
I would guess you would be better served using something along the lines of the MapBox iOS SDK or another similar map engine.
It allows you to specify your own tile sources and has plenty of examples to show you how it is done. It also had functions, like map kit, to handle converting values to and from lat/lon.

How to wrap locations that are close to each other in a single marker with Mapkit?

I am looking for a good and fast way to wrap locations that are in a specific range on a MKMapView in a single marker. Clicking on that marker brings you closer to the center point of this locations. You can see what I mean on the picture below.
mc donalds app - map sample screen
My first thought was to check a specific pixel range for each marker, hide the ones that are closer than X pixels to each other and get the center of them to create a new marker.
Did anyone of you ever did something similar?
There's a demo from WDC 11 or 10 that does exactly that, and coalesces based on proximity, not grid. Much better looking than DTCluster.
After a while of searching an testing, I found several frameworks for this like:
REVClusterMap, SuperPin, DTClusterMaker and a lot more. At the moment I stick with "REMarkerClusterer". It's pretty simple to implement and is free (MIT License)
https://github.com/romaonthego/REMarkerClusterer
Here is a nice article about clustering:
http://applidium.com/en/news/too_many_pins_on_your_map/
If someone else has good frameworks for this in his bookmarks/github-list, please post it here. I sill would like to see them ...

Resources