{"id":363,"date":"2018-10-09T22:41:08","date_gmt":"2018-10-09T22:41:08","guid":{"rendered":"https:\/\/www.xlsoft.com\/doc\/kudan\/?page_id=363"},"modified":"2018-10-18T01:12:52","modified_gmt":"2018-10-18T01:12:52","slug":"markers","status":"publish","type":"page","link":"https:\/\/www.xlsoft.com\/doc\/kudan\/markers\/","title":{"rendered":"Markers"},"content":{"rendered":"<p>Useful information regarding markers and Kudan&#8217;s image tracking.<\/p>\n<hr>\n<h2>Features<\/h2>\n<ul>\n<li>No limit on the number of markers it can load, capable of handling hundreds.<\/li>\n<li>An API for creating images programatically using image files.<\/li>\n<li>An API for combining\/manipulating sets of markers, leading to differential updates.<\/li>\n<li>Offline tools for processing markers to use with the framework.<\/li>\n<li>Extended Detection and Tracking capabilities for tracking markers at long distances.<\/li>\n<li>Auto-cropping functionality for improved tracking performance.<\/li>\n<\/ul>\n<h2>Upcoming features<\/h2>\n<ul>\n<li>Command line tools for converting markers outside the Toolkit that can be scripted to process in batch. (Please <a href=\"https:\/\/www.xlsoft.com\/en\/products\/kudan\/purchase.html\" target=\"_self\">contact us<\/a> to get Kudan AR Toolkit CLI.)<\/li>\n<\/ul>\n<h2>Markers<\/h2>\n<p>\nMarkers are images that have been loaded into the image tracker. While any marker can be used in theory, there are good and bad markers. If a marker is too poor to detect or track reliably, the tracker will not load it.<\/p>\n<p>A good marker has the following properties:<\/p>\n<ul>\n<li>Lots of high contrast corners.<\/li>\n<li>A non-repeating pattern.<\/li>\n<li>Fairly large in the camera view from its typical viewing position.<\/li>\n<li>When combined with other markers in the same trackable set, markers should be fairly unique compared to the others.<\/li>\n<\/ul>\n<p>\nFor more information, please read more about\u00a0<a class=\"doc-link\" href=\"https:\/\/www.xlsoft.com\/doc\/kudan\/what-makes-a-good-marker\/\" data-sidebar=\"what-makes-a-good-marker\">What Makes a Good Marker?<\/a><\/p>\n<h2>Creating a marker<\/h2>\n<p>To use your own custom markers, there are two approaches:<\/p>\n<ol>\n<li value=\"1\"><em>Create a marker using the API<\/em><\/li>\n<\/ol>\n<p>\nKudanAR provides an API for creating markers from image files. This way, you can add images to your device and load them as markers at runtime. Kudan&#8217;s image tracker will support any format that is also supported by the native OS.<\/p>\n<p>To create a marker from an image file, we use the\u00a0<code>ARImageTrackable<\/code>\u00a0class.<\/p>\n<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Objective-C<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Swift<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Java<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Objective-C\">\n[code lang=&#8221;objc&#8221;]\nARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithImage:[UIImage imageNamed:@&quot;example.jpg&quot;] name:@&quot;Example Marker&quot;];<br \/>\n[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Swift\">\n[code lang=&#8221;swift&#8221;]\nlet imageTrackable = ARImageTrackable(image: UIImage(named: &quot;example.jpg&quot;), name: &quot;Example Marker&quot;)<br \/>\n[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Java\">\n[code lang=&#8221;java&#8221;]\nARImageTrackable imageTrackable = new ARImageTrackable(&quot;Example Marker&quot;);<br \/>\nimageTrackable.loadFromAsset(&quot;example.jpg&quot;);<br \/>\n[\/code]\n<\/div><\/div><\/div>\n<ol>\n<li value=\"2\"><em>Create a marker using the Toolkit<\/em><\/li>\n<\/ol>\n<p>KudanAR also provides an external tool for converting image files and batching them together into a single\u00a0<code>KARMarker<\/code>\u00a0file. This lightweight format is optimised for smart devices and reduces file size as well as providing a way to store multiple markers.<\/p>\n<p>We can use the same\u00a0<code>ARImageTrackable<\/code>\u00a0class to load\u00a0<code>.KARMarker<\/code>\u00a0files, and we have two options. We can either bundle them with the app and load them when we need them:<\/p>\n<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Objective-C<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Swift<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Java<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Objective-C\">\n[code lang=&#8221;objc&#8221;]\nARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithBundledFile:@&quot;example.KARMarker&quot;];<br \/>\n[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Swift\">\n[code lang=&#8221;swift&#8221;]\nlet imageTrackable = ARImageTrackable(bundledFile: &quot;example.KARMarker&quot;)<br \/>\n[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Java\">\n[code lang=&#8221;java&#8221;]\nARImageTrackable imageTrackable = new ARImageTrackable(&quot;Example Marker&quot;);<br \/>\nimageTrackable.loadFromAsset(&quot;example.KARMarker&quot;);<br \/>\n[\/code]\n<\/div><\/div><\/div>\n<p>\nBut for apps with a lot of markers, this isn&#8217;t an ideal solution, because bundling 500 markers or so into an app will massively bloat its size. Fortunately, we have a separate method for loading files from a file path. This is especially useful because the file can be stored anywhere on your device, including the camera roll, or even downloaded at runtime, and still be used as a marker:<\/p>\n<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Objective-C<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Swift<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Java<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Objective-C\">\n[code lang=&#8221;objc&#8221;]\nNSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@&quot;example.KARMarker&quot;];<br \/>\nARImageTrackable *imageTrackable = [[ARImageTrackable alloc] initWithPath:filePath];<br \/>\n[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Swift\">\n[code lang=&#8221;swift&#8221;]\nvar filePath: String = Bundle.main.resourcePath? + (&quot;example.KARMarker&quot;)<br \/>\nlet imageTrackable = ARImageTrackable(path: filePath)<br \/>\n[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Java\">\n[code lang=&#8221;java&#8221;]\nARImageTrackable imageTrackable = new ARImageTrackable(&quot;Example Marker&quot;);<br \/>\nimageTrackable.loadFromPath(&quot;\/mnt\/sdcard\/images\/example.KARMarker&quot;);<br \/>\n[\/code]\n<\/div><\/div><\/div>\n<h2>Marker names<\/h2>\n<p>Markers within the same trackable set, or registered with the same tracker if marker sets have been combined, require a unique name. This name can be set via the marker creator tools or via the API, and can be used to locate the marker easily.<\/p>\n<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Objective-C<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Swift<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">Java<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Objective-C\">\n[code lang=&#8221;objc&#8221;]\nimageTrackable.name = @&quot;Example Marker&quot;;<br \/>\n[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Swift\">\n[code lang=&#8221;swift&#8221;]\nimageTrackable.name = &quot;Example Marker&quot;<br \/>\n[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"Java\">\n[code lang=&#8221;java&#8221;]\nimageTrackable.setName(&quot;Example Marker&quot;);<br \/>\n[\/code]\n<\/div><\/div><\/div>\n<h2>Marker dimensions<\/h2>\n<p>Markers have an arbitrary size property. This is used to define the scene units for rendering and can be set via the marker tools or the API. If a marker is 20&#215;10 then a 3D model with width 20 and height 10 will fit the marker perfectly. It can sometimes be useful to assign real-world units to the marker, for example, the dimensions of the marker in millimeters.<\/p>\n<p>While the dimensions are arbitrary, the aspect ratio of the dimensions should match the aspect ratio of the source image, otherwise the behaviour will be undefined.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Useful information regarding markers and Kudan&#8217;s image tracking. Features No limit on the number of markers it can load, capable of handling hundreds. An API for creating images programatically using image files. An API for combining\/manipulating sets of markers, leading to differential updates. Offline tools for processing markers to use with the framework. Extended Detection &#8230; <a title=\"Markers\" class=\"read-more\" href=\"https:\/\/www.xlsoft.com\/doc\/kudan\/markers\/\">Read more<span class=\"screen-reader-text\">Markers<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"bekko_page_header":""},"_links":{"self":[{"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/pages\/363"}],"collection":[{"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/comments?post=363"}],"version-history":[{"count":9,"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/pages\/363\/revisions"}],"predecessor-version":[{"id":1362,"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/pages\/363\/revisions\/1362"}],"wp:attachment":[{"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/media?parent=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}