How to use Virtual Nails Try On Effect
This tutorial will guide you on how to create a virtual nails coloring effect using Banuba API. The API provides ready-made documented methods making it easy for developers to call AR features in their apps.
note
The nails coloring feature requires a nails segmentation neural network. Please, make sure your licence plan includes one by contacting your sales manager or fill in the website form to request it.
Preview
#
Resource preparation#
Nails color preparation- Design or pick the color you want to use in effect. In our example, we use the color:
#FFFF496C
. - Split the color into separate channels: red, green, blue and alpha:
- red:
255
- green:
73
- blue:
108
- alpha:
255
- red:
- You have your colors in
[0, 255]
format. You need to convert them into the[0, 1]
by dividing each channel value by255
.- red:
255 / 255
=1.0
- green:
73 / 255
=0.28627450980392155
- blue:
108 / 255
=0.4235294117647059
- alpha:
255 / 255
=1.0
- red:
#
Integrating nails coloring feature into your iOS appUse the
test_Nails
effect or your version of this effect to enable nails coloring feature.note
You also need to disable ARKit on sdk initializing:
If you run your application now, you will face the problem: There will be an error message in debug console:
It happens because we haven't specified the color yet.
Let's specify the nails color and gloss:
With BanubaSdkManager: You should use this property to set the color and gloss:
Where first parameter is the color, and the second is the gloss (optional, only first element of
BNBFeatureparameter
fo gloss is considered).Here is an example:
Without BanubaSdkManager: You will have such lines of code in your application:
All you need to do is to add your feature color into the
framedata
:
Now you can run your application to test the nails segmentation and coloring.