Class: RevieveAR

RevieveAR(sdk)

new RevieveAR(sdk)

RevieveAR class. Revieve AR image manipulation.
Parameters:
Name Type Description
sdk Object instance of RevieveSDK

Members

methods

Properties:
Name Type Description
methods Object Helper list of methods available in module.
You have all the methods of the AR module subdivided in six categories:

Methods

applyBlush(strengthopt, color) → {Promise}

Apply blush in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the effect. See RevieveAR.defaultStrength
color String rgb, hex or name of the blush's color you want to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

applyEyeliner(strengthopt, color) → {Promise}

Apply eyeliner in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the effect. See RevieveAR.defaultStrength
color String rgb, hex or name of the eyeliner's color you want to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

applyEyeshadow(strengthopt, color) → {Promise}

Apply eyeshadow in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the effect. See RevieveAR.defaultStrength
color String rgb, hex or name of the eyeshadow's color you want to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

applyFoundation(strengthopt, color) → {Promise}

Apply foundation in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the effect. See RevieveAR.defaultStrength
color String rgb, hex or name of the foundation's color you want to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

applyLipliner(strengthopt, color) → {Promise}

Apply lipliner in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the effect. See RevieveAR.defaultStrength
color String rgb, hex or name of the lipliner's color you want to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

applyLipstick(strengthopt, color) → {Promise}

Apply lipstick in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the effect. See RevieveAR.defaultStrength
color String rgb, hex or name of the lipstick's color you want to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

brightenSkin(strengthopt, masks) → {Promise}

Brighten the skin in the user image areas defined in masks parameter. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the reduction effect. See RevieveAR.defaultStrength
masks Array.<String> Array of RevieveAR.masks defining the areas where the effect is going to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

canVisualizeProduct(product) → {Boolean}

Method to determine if a product could be visualize by AR module
Parameters:
Name Type Description
product Object JSON object with information of a product.
See:
Returns:
Type
Boolean

dehighlightAll() → {Promise}

Method to remove all the highlights configured in picture
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

getColorInfoFromProduct(product)

Help method to get color info of a product to AR module interactions
Parameters:
Name Type Description
product Object JSON object with information of a product.
See:

getDefaultStregthFromProduct(product)

Help method to get default stregth info of a product to AR module interactions
Parameters:
Name Type Description
product Object JSON object with information of a product.
See:

getDefaultStrength() → {float}

Methot to get the default strength defined by AR or user
Returns:
default strength
Type
float

getResultsDiv() → {HTMLDivElement}

See the results of the manipulations.
Returns:
After image - Div containing original image with added manipulations
Type
HTMLDivElement

highlightAcne(masks, fillColoropt) → {Promise}

Highlight areas with acne detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
masks Array.<String> Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightAcneIndividually(ranges, Array) → {Promise}

Highlight individual acne spots detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Description
ranges Array.<Object> Array of ranges that defines the acne visualization. Each object has three keys, minValue (value between 0 and 2500), maxValue (value between 0 and 2500) and color. Default value is [ { minValue: 0, maxValue: 80, color: 'rgba(44, 192, 205,0.3)' }, { minValue: 80, maxValue: 300, color: 'rgba(253, 164, 98, 0.7)' }, { minValue: 300, maxValue: 2500, color: 'rgba(205, 44, 66, 1)' }, ]
Array Array.<String> of RevieveAR.masks defining the areas where you want to highlight the concern.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightCheekArea() → {Promise}

Highlight cheek area.
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect.
Type
Promise

highlightDarkcircles(masks, fillColoropt) → {Promise}

Highlight darkcircles detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
masks Array.<String> Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightEyebags(masks, fillColoropt) → {Promise}

Highlight eye bags detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
masks Array.<String> Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightEyeColor() → {Promise}

Highlight the eye color information.
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect.
Type
Promise

highlightEyesArea() → {Promise}

Highlight the eyes area.
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect.
Type
Promise

highlightFaceShape(coloropt) → {Promise}

Highlight the face shape detected by CV module.
Parameters:
Name Type Attributes Description
color String <optional>
color to be used to stoke the face shape
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect.
Type
Promise

highlightFinding(findingName, masks, fillColoropt) → {Promise}

Highlight a finding detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
findingName String String with the finding name.
masks Array.<String> Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightHyperpigmentation(masks, fillColoropt) → {Promise}

Highlight areas with hyperpigmentation detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
masks String Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightHyperpigmentationIndividually(ranges, Array) → {Promise}

Highlight individual hyperpigmentation spots detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Description
ranges Array.<Object> Array of ranges that defines the hyperpigmentation visualization. Each object has three keys, minValue (value between 0 and 10), maxValue (value between 0 and 10) and color. Default value is [ { minValue: 0, maxValue: 1, color: 'rgba(44, 192, 205,0.3)' }, { minValue: 1, maxValue: 2, color: 'rgba(253, 164, 98, 0.7)' }, { minValue: 2, maxValue: 9, color: 'rgba(205, 44, 66, 1)' }, ]
Array Array.<String> of RevieveAR.masks defining the areas where you want to highlight the concern.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightRedness(masks, fillColoropt) → {Promise}

Highlight areas with redness detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
masks Array.<String> Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightSkinFoundation() → {Promise}

Highlight skin foundation matching information.
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect.
Type
Promise

highlightSkinShine(ranges) → {Promise}

Highlight skin shine areas detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Description
ranges Array.<Object> Array of ranges that defines the skin shine visualization. Each object has three keys, minValue (value between 0 and 10), maxValue (value between 0 and 10) and color. Default value is [ { minValue: 0, maxValue: 2, color: 'rgba(255,255,255, 0.5)' }, { minValue: 2, maxValue: 4, color: 'rgba(44, 192, 205, 0.2)' }, { minValue: 4, maxValue: 9, color: 'rgb(255, 255, 255)' }, ]
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightSkinUndertone() → {Promise}

Highlight skin undertone information.
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect.
Type
Promise

highlightSmoothness(masks, fillColoropt) → {Promise}

Highlight areas with smoothness detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
masks Array.<String> Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightTexture(masks, fillColoropt) → {Promise}

Highlight areas with texture detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
masks Array.<String> Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightWrinkles(masks, fillColoropt) → {Promise}

Highlight areas with wrinkles detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
masks Array.<String> Array of RevieveAR.masks defining the areas where you want to highlight the concern. Null or empty array will highlight the worst area detected by CV module.
fillColor String <optional>
rgb, hex or name of color to be used to darken the image
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

highlightWrinklesIndividually(ranges, Array) → {Promise}

Highlight individual wrinkles detected by CV module. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Description
ranges Array.<Object> Array of ranges that defines the wrinkles visualization. Each object has three keys, minValue (value between 0 and 1), maxValue (value between 0 and 1) and color. Default value is [ { minValue: 0, maxValue: 0.2, color: 'rgba(44, 192, 205,0.3)' }, { minValue: 0.2, maxValue: 0.4, color: 'rgba(253, 164, 98, 0.7)' }, { minValue: 0.4, maxValue: 1, color: 'rgba(205, 44, 66, 1)' }, ],
Array Array.<String> of RevieveAR.masks defining the areas where you want to highlight the concern.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

redrawEffects()

Method to redraw all the effects applied until now

reduceCrowsFeet(strengthopt) → {Promise}

Reduce crows feet in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the reduction effect. See RevieveAR.defaultStrength
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

reduceDarkcircles(strengthopt) → {Promise}

Reduce dark circles in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the reduction effect. See RevieveAR.defaultStrength
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

reduceEyebags(strengthopt) → {Promise}

Reduce eyebags in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the reduction effect. See RevieveAR.defaultStrength
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

reduceHyperpigmentation(strengthopt, masks) → {Promise}

Reduce hyperpigmentated spots in the user image areas defined in masks parameter. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the reduction effect. See RevieveAR.defaultStrength
masks Array.<String> Array of RevieveAR.masks defining the areas where the effect is going to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

reduceRedness(strengthopt, masks) → {Promise}

Reduce redness in the user image areas defined in masks parameter. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the reduction effect. See RevieveAR.defaultStrength
masks Array.<String> Array of RevieveAR.masks defining the areas where the effect is going to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

reduceWrinkles(strengthopt, masks) → {Promise}

Reduce wrinkles in the user image areas defined in masks parameter. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Description
strength Float <optional>
Strength of the reduction effect. See RevieveAR.defaultStrength
masks Array.<String> Array of RevieveAR.masks defining the areas where the effect is going to be applied.
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

reset()

Method to reset results and delete all the effects applied before.

setContainer(container, disableOnResize)

Sets the container Id where you want to render automatically results of setting effects
Parameters:
Name Type Default Description
container String | Object valid HTML Element or HTML tag id
disableOnResize Boolean false set to true if you don't want to redraw all the events on window resize

setDefaultStrength(strength)

Method to update the default strength of the effects
Parameters:
Name Type Description
strength float default strength to apply in all effects

setEffectByName(effectName, masks, strengthopt, fillColoropt, highlightopt, highlightShapeopt, ranges) → {Promise}

Please don't use this method directly. You have the general effect methods to work with them. Set an effect determined by parameter effect name in the user image. Resulting effects will be applied to div containing the image returned by getResults or to the container specified in constructor.
Parameters:
Name Type Attributes Default Description
effectName String Name of the effect to be applied.
masks Array.<String> Array of RevieveAR.masks defining the areas where the effect is going to be applied.
strength Float <optional>
Strength of the reduction effect. See RevieveAR.defaultStrength
fillColor String <optional>
Rgb, hex or name of color you want to be applied.
highlight Boolean <optional>
false true if you want to highlight a problem in an area
highlightShape Boolean <optional>
false true if you want to zoom
ranges Array.<Object> ranges configuration for wrinkles visualization. (for example, face shape)
See:
  • getResults
Returns:
When promise is resolved, it will return the style object to be applied if you wish to animate the effect
Type
Promise

setOrientation(orientation)

Sets the orientation of the container to fit image and canvas properly
Parameters:
Name Type Description
orientation String landscape, portrait or auto

setScaleFactor(factor)

Method to set the scale factor to apply in animation style returned by highlight methods. For example, if you want to increase the zoom a 20%, you will set the factor to 1.2
Parameters:
Name Type Description
factor float factor to apply.

setWhiteBalanceCorrection(value)

Activates or deactivates the white balance correction feature
Parameters:
Name Type Description
value Boolean true if you want to activate or false to deactive white balance feature when you apply effects

testImages()

Test method that add to the root of the HTML document two objects: the original image and the resulting div with all the effects applied

visualizeProduct(product, strengthopt) → {Promise}

Method to apply the simulated effect of applying a product in picture
Parameters:
Name Type Attributes Description
product Object JSON object with information of a product.
strength Float <optional>
Strength of product effect. See RevieveAR.defaultStrength
See:
Returns:
Type
Promise