Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. 3D Blocks
  4. AR Face Camera

AR Face Camera

Scheduled Pinned Locked Moved 3D Blocks
1 Posts 1 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

     

    Prerequisite

    • AR World Camera

     

    Description

    The AR face camera is a fixed camera. It shows the images from the front camera of the device, and recognizes the human face in it. Therefore, this block works on all devices, including computers, laptops, Chromebooks, touchpads and smartphones.

    When the AR face camera finds the face in the camera view, it tries to estimate the 3D position of key parts of the face (called “markers”). such as the nose and the mouth. In your program, you can attach other 3D objects to any of these markers.

    To turn on the AR face camera, you can use this block:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/4765b1bc-e51f-4a3c-b872-bc5947451f94.png" width="1400" style="filter: drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5));">

    Parameters

    • Show Marker: whether you want to display some white boxes to indicate where are the markers. When you are developing or debugging your program, it is easier if the markers are shown. You should hide them when the project is released to the users.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a340fe59-758a-46dc-8662-196b14d08026.gif" width="400" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">

    • Scale: this value controls the scale of virtual 3D objects vs real objects. For example, when it is 100, a virtual box of size 100 will look like a box of 1 foot in the real world. For another way to think about it: to use a box to cover the entire head in the camera image, then the box’s edge length should be around the value of the scale.

    • Emulation Mode: this value controls if you are running an emulation. If "yes’, then the real camera will not be used. Some markers will be added to the virtual scene for your to test your program with. If “no”, then the real camera will be turned on, and the markers will represent the real face detected in the camera view.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/9d08a91f-aa3d-4b58-adbd-4499011d496e.gif" width="450" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">

    • Data Table: if this option is not set to “none”, then the 3D position of all the markers will be written into this table in real-time.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/99efd610-66af-4118-8cfc-39d6eee5b29d.gif" width="470" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">

    • Mesh for Face/Eyes/Mouth/Lips: for these 4 options, if you set any of them to “yes”, then that part of the face in the camera will be covered by a 3D mesh surface. Note that “mouth” refers to the mouth opening, not the lips. For example, here is what you get when all options are set to “yes”:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/5fc39714-d8ea-48de-b8fd-26b820e429c9.gif" width="400" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">

     
     

    Updating Face Mesh Color or Texture

    You can use the “update color” or “update texture” block to change the look of the 4 meshes. The name of the object is always “ARHead”, and the 4 areas are mapped this way: main -> face, second -> eyes, third -> mouth, forth -> lips

    For example, this is how to update the 4 areas’ colors:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/e41e7b1b-d84d-41cf-8ade-8311742ad1ea.gif" width="1300" style="">

     
     

    Attaching objects to markers

    After turning on the AR face camera, any 3D object you add to the scene will be displayed over the images from the real camera. However, if you want the 3D object to move or turn with the face in the camera, you need to attach that object to one of the markers using this block:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/07a28aa7-49ef-4901-98fa-86292ad1544e.png" width="800" style="">

    Parameters

    • Part Name: this is the name of the marker you want to attach to. Since this block is also used for avatar bones, not all the options in the list can be used for the AR face camera. You can only use the items listed below “chin”.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f11bc520-5272-40a1-a61c-a9ce9f85a269.png" width="300" style="margin-left: 40px">

    • Face Object Name: you should always write “ARHead” for this input when using the AR face camera. This object is added to the scene automatically when a face has been detected.

    • Sprite with the face object: this should be the name of the sprite that has turned on the AR face camera.

    • Target Height: the desired height of the object you are attaching. For example, if the scale is 100, and you want an object to be half of the height of the head, then its height should be around 50.

     

    Demo - Soccer Nose

    In this short program, we turn on the AR face camera in an empty scene, then we attach a soccer ball to the “Nose Tip” marker.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/dc371eb8-abab-4e46-89af-c0181917ea52.png" width="800" style="">

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/7a7eb444-98df-486a-bce0-75014a7bacbc.gif" width="480" style="border-radius: 5px; border: 1px solid #29622d;">

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode