API
...
Digital Human Configuration
Creating Head Visuals
Changing Digital Human Backgrounds
16min
this document describes how to use the api to replace the background of a digital human with a static image this feature allows for greater customization and flexibility in how digital humans are presented the background change functionality is currently limited to a specific selection of head visuals to get the current list of head visuals with replaceable backgrounds, contact us overview the process of changing the background involves several steps, including uploading video and image assets, creating and configuring a head visual, and finally, triggering the background replacement process flow the following diagram illustrates the overall process api endpoints the following endpoints are used in the background replacement process 1\ identify a head visual id with replaceable background we've created head visuals with associated assets that allow easy background replacement please have your head visual id ready and contact us for the list of applicable ids if you are interested in creating a completely new head visual with replaceable background, please contact us 2\ upload replacement image endpoint /image/upload method post description uploads the static image that will be used to replace the background request body (multipart/form data) curl x 'post' \\ 'https //platform api unith ai/image/upload' \\ h 'accept application/json' \\ h 'authorization bearer yourbearertoken \\ h 'content type multipart/form data' \\ f 'file=@dolphinwallpaper jpg;type=image/jpeg' response token a temporary token for the uploaded image error handling invalid file type ( png, jpg, jpeg are allowed) file size exceeds the maximum allowed limit 3\ replace background endpoint /head visual/replace background method post description initiates the background replacement process request body curl x 'post' \\ 'https //platform api unith ai/head visual/replace background' \\ h 'accept application/json' \\ h 'x head image token id imagetoken \\ h 'authorization bearer yourbearertoken \\ h 'content type application/json' \\ d '{ "id" "yourheadvisualid" }' parameters x head image token id ( header )(string, required) the id of the head visual image token (string, required) the token of the uploaded replacement image response a json object containing the url of the new idle video with the replaced background for example error handling handle errors related to the background replacement, including invalid head visual id invalid image token 4\ upload new video with replaced background endpoint /video/upload method post description upload the new video with replaced background request body (multipart/form data) curl x 'post' \\ 'https //platform api unith ai/video/upload' \\ h 'accept application/json' \\ h 'authorization yourbearertoken \\ h 'content type multipart/form data' \\ f 'file=@yourvideo mp4;type=video/mp4' response token a temporary token for the uploaded video this token is used in subsequent steps error handling invalid file type ( mp4 allowed) file size exceeds the maximum allowed limit 5\ create head visual with new replaced background endpoint /head visual/create method post description creates a new head visual using the video with replaced background request body curl x 'post' \\ 'https //platform api unith ai/head visual/create' \\ h 'accept application/json' \\ h 'x head video token id yourvideotoken' \\ h 'authorization bearer yourbearertoken' \\ h 'content type application/json' \\ d '{ "update" false, "detector version" "v2", "detector threshold" 0 2, "mode" "default", "cut timestamp" 0 1, "debug" false }' parameters include all the required parameters for the /head visual/create endpoint detector version (string) you may or may not need to include it here, depending on your logic response a json object containing the details of the newly created head visual, including its unique id error handling invalid video token ensure cut timestamp is provided when the processor mode is two loops 6\ save head visual endpoint /head visual/save method post description saves the newly created head visual request body curl x 'post' \\ 'https //platform api unith ai/head visual/save' \\ h 'accept application/json' \\ h 'authorization yourbearertoken' \\ h 'content type application/json' \\ d '{ "id" "yourheadvisualid", "name" "headvisualname", "gender" "female", "type" "talk" }' parameters include all the required parameters for the /head visual/save endpoint response a json object indicating the head visual has been saved error handling ensure the task exist for a given head visual id check the task status is in progress 7\ assign new head visual id to your organization endpoint /head visual/assign organisation method put description assigns the newly created head visual toy our organization request body curl x 'put' \\ 'https //platform api unith ai/head visual/assign organisation' \\ h 'accept / ' \\ h 'authorization bearer yourbearertoken \\ h 'content type application/json' \\ d '{ "id" "yourheadvisualid", "orgids" \[ "yourorgid" ] }' parameters include all the required parameters for the /head visual/assign organisation endpoint response a json object indicating the head visual has been assigned error handling ensure the task exist for a given head visual id and org id other considerations asynchronous processing background replacement involves synchronous processing head visual creation, preprocessing of the video etc