UNPKG

react-native-object-detection

Version:
18 lines (15 loc) 628 B
import { NativeModules } from "react-native"; const { ObjectDetectionModule } = NativeModules; /** * Starts object detection on the provided image * @param {string} imagePath - The path to the image file (can be local or remote URL) * @returns {Promise<Array>} Promise that resolves with an array of detected objects * @throws {Error} if image loading or detection fails */ export const startObjectDetection = (imagePath) => { return new Promise((resolve, reject) => { ObjectDetectionModule.startObjectDetection(imagePath) .then((objects) => resolve(objects)) .catch((error) => reject(error)); }); };