{"id":50220,"date":"2023-03-16T18:22:18","date_gmt":"2023-03-16T12:52:18","guid":{"rendered":"https:\/\/www.oneclickitsolution.com\/blog\/?p=50220"},"modified":"2023-03-16T18:22:20","modified_gmt":"2023-03-16T12:52:20","slug":"implementation-of-arkit-in-ios","status":"publish","type":"post","link":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios","title":{"rendered":"Implementation of ARKit in iOS for Face Detection &#038; Image Processing"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u200b\u200bWhat is ARKit?<\/h2>\n\n\n\n<p>ARKit is an augmented reality framework for iPhones and iPads that is included with <strong><a href=\"https:\/\/developer.apple.com\/xcode\/\" target=\"_blank\" rel=\"noreferrer noopener\">Xcode<\/a><\/strong>. By combining the camera on the screen with virtual things, <strong>ARKit<\/strong> allows developers to place digital objects in the actual world, letting users interact with them in the real world.<\/p>\n\n\n\n<p>Using CoreMotion data, it creates a map of the environment using the camera on <strong><a href=\"https:\/\/www.oneclickitsolution.com\/services\/ios-app-development\/\" target=\"_blank\" rel=\"noreferrer noopener\">iOS<\/a><\/strong>\/iPad devices, recognizing things like face, photos, space, and the device&#8217;s location in the actual world.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">AR face tracking configuration<\/h2>\n\n\n\n<p>With the help of the TrueDepth camera, the AR face tracking system tracks the movement and expressions of a face.<\/p>\n\n\n\n<p>The front camera is used to recognize a user&#8217;s face in the face tracking configuration. An AR session identifies the user&#8217;s face and adds an <strong>ARFaceAnchor<\/strong> object representing the face to the anchor&#8217;s list when the setup is run.<\/p>\n\n\n\n<p>All information about a face&#8217;s position, orientation, and traits that describe facial expressions is stored in the face anchor.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<div class=\"box_section_read\">\n<p style=\"border-left: 5px solid #0072bb; padding: 10px 20px; font-size: 20px; line-height: 22px; color: #0072bb; text-align: center; font-style: italic; margin-bottom: 0px; font-weight: 700;\"><span style=\"color:#000000\"> Read More:<\/span> <a href=\"https:\/\/www.oneclickitsolution.com\/blog\/android-vs-ios\/\" target=\"_blank\" rel=\"noreferrer noopener\">Android vs iOS: Which Platform is Better for You?<\/a><\/p>\n<\/div>\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Tracking Face Orientation and positions<\/h2>\n\n\n\n<p>Inherited transform property describes the face\u2019s current position in world coordinates. Use this transform matrix to position the virtual content you want to add to the face in the AR scene.<\/p>\n\n\n\n<p>Transform matrix creates a face coordinates system for positioning other elements relative to the user\u2019s face.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Face Topology&nbsp;<\/h3>\n\n\n\n<p>Geometry property is providing an <strong>ARFaceGeometry<\/strong> object which is representing detailed topology for the face, which confirms a face model to match the dimensions, shape, and expression of the captured face.<\/p>\n\n\n\n<p>We can use this face model for overlaying content that follows the user\u2019s face.<\/p>\n\n\n\n<p>For example, adding glasses or other makeup on the face model.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Facial Expressions&nbsp;<\/h3>\n\n\n\n<p>BlendShapes property provides a high-level model of the current user\u2019s facial expressions. We can use blend shape coefficients to animate 2D or 3D content.<\/p>\n\n\n\n<p><strong>Requirements:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An iOS device with a True Depth Front camera\n<ul class=\"wp-block-list\">\n<li>iPhone X or later<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>iOS 11.0 or later<\/li>\n\n\n\n<li>Xcode 11.0 or later<\/li>\n<\/ul>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-arbody-tracking-configuration\">ARBody Tracking Configuration<\/h2>\n\n\n\n<p>ARKit\u2019s body tracking configuration track the body\u2019s moment using <strong>ARBodyAnchor<\/strong>.<\/p>\n\n\n\n<p>When ARKit recognizes a person in the back camera, it calls delegates\u2019s session(_:didAdd:) function with <strong>ARBodyAnchor<\/strong>.<\/p>\n\n\n\n<p>The body anchor\u2019s transform position defines the world position of the body\u2019s joints.<\/p>\n\n\n\n<p>Place Skeleton on a Surface:<\/p>\n\n\n\n<p>The body anchor\u2019s origin maps to the hip joint, user can calculate the current offset of the feet to the hip to place the body\u2019s skeleton on the surface.&nbsp;<\/p>\n\n\n\n<p>Pass the foot joint index to jointModelTransfroms, then you will get the foot\u2019s offset from skeleton\u2019s origin.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"html\" class=\"language-html\">static var hipToFootOffsetCal: Float {\n\nlet footIndexs = ARSkeletonDefinition.defaultBody3D.index(forJointName: .leftFoot)\n\nlet footTransforms = ARSkeletonDefinition.defaultBody3D.neutralBodySkeleton3D!.jointModelTransforms[footIndexs]\n\nlet distanceFromHipsOnY = abs(footTransforms.columns.3.y)\n\nreturn distanceFromHipsOnY}<\/code><\/pre>\n\n\n\n<p>frameSemantics includes bodyDetection, which gives you access to the joint positions of a user that ARKit detects in the camera feed via the frame&#8217;s detectedBody.<\/p>\n\n\n\n<p><strong>ARWorld Tracking Configuration <\/strong>ARWorldTrackingConfiguration class tracks device\u2019s movement with three rotation axes and three translation axis.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Plane detection And ARPlaneAnchor<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"html\" class=\"language-html\">var planeDetectionMain: ARWorldTrackingConfiguration.PlaneDetection { get set }<\/code><\/pre>\n\n\n\n<p>If we enable horizontal or vertical plane detections, the session adds <strong>ARPlaneAnchor<\/strong> objects and notifies <strong>ARSessionDelegate<\/strong>, <strong>ARSCNViewDelegate<\/strong> object when its analysis of captured video images detects an area that appears to be a flat surface. &nbsp;Each plane anchor offers information about the surface, such as its location and shape in the real world.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">ARImageAnchor&nbsp;<\/h3>\n\n\n\n<p>When we run world tracking AR sessions and use the <strong>ARReferenceImage<\/strong> object as the detectionImages property in the session setup, ARKit looks for those images in the actual world. When this session recognizes the images it will automatically add an <strong>ARImageAnchor<\/strong> for each detected image to its list of anchors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">ARObjectAnchor<\/h3>\n\n\n\n<p>When we run a world tracking AR session and specify <strong>ARReferenceObject<\/strong> objects for the detectionObjects property in the session setup, ARKit looks for those items in the actual world. When the session detects an object, an <strong>ARObjectAnchor<\/strong> is automatically added to the list of anchors for each identified object.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.oneclickitsolution.com\/contact-us\/\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2021\/09\/Benefits-of-iOS-App-Development-CTA-1.png\" alt=\"Benefits of iOS App Development CTA - 1\" class=\"wp-image-45804\"\/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">AR Image Tracking Configuration&nbsp;<\/h3>\n\n\n\n<p>ARKit creates a three-dimensional space with <strong>ARImageTrackingConfiguration<\/strong> by not only tracking the device&#8217;s motion in relation to the real world but also recognizing and tracking the motion of known pictures in front of the camera.<\/p>\n\n\n\n<p>In <strong>ARWorldTrackingConfiguration<\/strong> also we can detect images but with ARImageTrackingConfiguration we can reliably track more images at once.<\/p>\n\n\n\n<p><strong>ARImageTrackingConfiguration<\/strong>, define ARReferenceImage objects and assign them to the configuration&#8217;s tracking images property. Then send the configurations to your session&#8217;s run( :options:) method, just like any other<a href=\"https:\/\/www.oneclickitsolution.com\/solutions\/cost-to-build-an-ar-app\/\" target=\"_blank\" rel=\"noreferrer noopener\"> AR<\/a> configuration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u200b\u200bWhat is ARKit? ARKit is an augmented reality framework for iPhones and iPads that is included with Xcode. By combining the camera on the screen with virtual things, ARKit allows developers to place digital objects in the actual world, letting users interact with them in the real world. Using CoreMotion data, it creates a map &hellip;<\/p>\n","protected":false},"author":7,"featured_media":54680,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[516,838],"tags":[886],"class_list":["post-50220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mobile-apps","category-solutions","tag-ios"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v18.2.1 (Yoast SEO v24.8.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Implementation of ARKit in iOS for Face Detection &amp; Image Processing<\/title>\n<meta name=\"description\" content=\"Implementation of ARKIt allows developers to place digital objects in the actual world, letting users interact with them in the real world.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Implementation of ARKit in iOS for Face Detection &amp; Image Processing\" \/>\n<meta property=\"og:description\" content=\"Implementation of ARKIt allows developers to place digital objects in the actual world, letting users interact with them in the real world.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios\" \/>\n<meta property=\"og:site_name\" content=\"OneClick IT Consultancy\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/oneclickconsultancy\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-16T12:52:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-16T12:52:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2022\/05\/Implementation-of-ARKit-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ajay Mishra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@OneclickIT\" \/>\n<meta name=\"twitter:site\" content=\"@OneclickIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay Mishra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Implementation of ARKit in iOS for Face Detection & Image Processing","description":"Implementation of ARKIt allows developers to place digital objects in the actual world, letting users interact with them in the real world.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios","og_locale":"en_US","og_type":"article","og_title":"Implementation of ARKit in iOS for Face Detection & Image Processing","og_description":"Implementation of ARKIt allows developers to place digital objects in the actual world, letting users interact with them in the real world.","og_url":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios","og_site_name":"OneClick IT Consultancy","article_publisher":"https:\/\/www.facebook.com\/oneclickconsultancy","article_published_time":"2023-03-16T12:52:18+00:00","article_modified_time":"2023-03-16T12:52:20+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2022\/05\/Implementation-of-ARKit-1.png","type":"image\/png"}],"author":"Ajay Mishra","twitter_card":"summary_large_image","twitter_creator":"@OneclickIT","twitter_site":"@OneclickIT","twitter_misc":{"Written by":"Ajay Mishra","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios#article","isPartOf":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios"},"author":{"name":"Ajay Mishra","@id":"https:\/\/www.oneclickitsolution.com\/blog\/#\/schema\/person\/950d1e3b808c0e75144fb6bf5026e198"},"headline":"Implementation of ARKit in iOS for Face Detection &#038; Image Processing","datePublished":"2023-03-16T12:52:18+00:00","dateModified":"2023-03-16T12:52:20+00:00","mainEntityOfPage":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios"},"wordCount":746,"commentCount":0,"publisher":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios#primaryimage"},"thumbnailUrl":"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2022\/05\/Implementation-of-ARKit-1.png","keywords":["IOS"],"articleSection":["Mobile Application","Solutions"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios","url":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios","name":"Implementation of ARKit in iOS for Face Detection & Image Processing","isPartOf":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios#primaryimage"},"image":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios#primaryimage"},"thumbnailUrl":"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2022\/05\/Implementation-of-ARKit-1.png","datePublished":"2023-03-16T12:52:18+00:00","dateModified":"2023-03-16T12:52:20+00:00","description":"Implementation of ARKIt allows developers to place digital objects in the actual world, letting users interact with them in the real world.","breadcrumb":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios#primaryimage","url":"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2022\/05\/Implementation-of-ARKit-1.png","contentUrl":"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2022\/05\/Implementation-of-ARKit-1.png","width":1200,"height":628,"caption":"Implementation of ARKit"},{"@type":"BreadcrumbList","@id":"https:\/\/www.oneclickitsolution.com\/blog\/implementation-of-arkit-in-ios#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.oneclickitsolution.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Implementation of ARKit in iOS for Face Detection &#038; Image Processing"}]},{"@type":"WebSite","@id":"https:\/\/www.oneclickitsolution.com\/blog\/#website","url":"https:\/\/www.oneclickitsolution.com\/blog\/","name":"OneClick IT Consultancy","description":"We Build Brands from Ideas","publisher":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/#organization"},"alternateName":"OneClick IT Solution","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.oneclickitsolution.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.oneclickitsolution.com\/blog\/#organization","name":"OneClick IT Consultancy","alternateName":"OneClick IT Solution","url":"https:\/\/www.oneclickitsolution.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.oneclickitsolution.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2022\/10\/oneclick-official-logo.png","contentUrl":"https:\/\/www.oneclickitsolution.com\/blog\/wp-content\/uploads\/2022\/10\/oneclick-official-logo.png","width":100,"height":100,"caption":"OneClick IT Consultancy"},"image":{"@id":"https:\/\/www.oneclickitsolution.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/oneclickconsultancy","https:\/\/x.com\/OneclickIT","https:\/\/www.instagram.com\/oneclick.it.consultancy\/","https:\/\/www.linkedin.com\/company\/one-click-it-consultancy\/","https:\/\/www.pinterest.com\/oneclickitconsultancy\/","https:\/\/www.youtube.com\/channel\/UCsEG6aiwOwvYrcZxMoP5xjg","https:\/\/oneclickit.tumblr.com\/","https:\/\/dribbble.com\/oneclickitconsultancy"]},{"@type":"Person","@id":"https:\/\/www.oneclickitsolution.com\/blog\/#\/schema\/person\/950d1e3b808c0e75144fb6bf5026e198","name":"Ajay Mishra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.oneclickitsolution.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c5bfb4247f92695a87b79f1c4530e31a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c5bfb4247f92695a87b79f1c4530e31a?s=96&d=mm&r=g","caption":"Ajay Mishra"},"description":"I am an experienced native iOS\/React developer with a proven track record of working at OneClick IT Consultancy. I have knowledge in mobile app development, Github, Objective-C, iOS development, react native and flutter.","jobTitle":"Software Engineer","url":"https:\/\/www.oneclickitsolution.com\/blog\/author\/ajaymishra"}]}},"_links":{"self":[{"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/posts\/50220"}],"collection":[{"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/comments?post=50220"}],"version-history":[{"count":0,"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/posts\/50220\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/media\/54680"}],"wp:attachment":[{"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/media?parent=50220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/categories?post=50220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oneclickitsolution.com\/blog\/wp-json\/wp\/v2\/tags?post=50220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}