objectDetectForImage(params: Object)

Requires:
AIKit≥1.1.0@ray-js/ray≥1.6.29
Platforms:
iOSAndroid
import { ai } from '@ray-js/ray';

const { objectDetectForImage } = ai;

// Promise usage
try {
  const res = await objectDetectForImage({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Run object recognition on an image

Parameters

PropertyTypeRequiredDefaultDescription
inputPathstringYes-Image input path
outputPathstringYes-Image output path
detectType1 | 2No1Recognition type
imageEditType1 | 2 | 3No1Image processing type
complete() => voidNo-Completion callback (executed on both success and failure)
success(params: Object) => voidNo-Callback on successful API call
fail(params: Object) => voidNo-Failure callback
success callback parameters
PropertyTypeDescription
pathstringOutput path
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Valid Values

detectType
ValueDescriptionAIKit Since
1Pets-
2People-
imageEditType
ValueDescriptionAIKit Since
1No effect-
2Emphasize subject-
3Privacy protectionv1.2.0

Examples

import { ai } from '@ray-js/ray'

ai.objectDetectForImage({
  inputPath: "xx",
  outputPath: "xx",
  detectType: 1,
  imageEditType: 1,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});