FoodDetectionEvent

import type { FoodCandidates, NutritionFacts } from '.'

/**
 * An object provided in the callback for food detection containing
 * food candidates as well as nutrition facts, if found
 */
export interface FoodDetectionEvent {
  /**
   * A collection of food candidates detected by the models.
   */
  candidates?: FoodCandidates
  /**
   * Detected nutrition facts when scanning a nutrition label.
   */
  nutritionFacts?: NutritionFacts
}
import type { BarcodeCandidate, DetectedCandidate, PackagedFoodCode } from '.'

/**
 * A collection of food candidates detected by the models.
 */
export interface FoodCandidates {
  /**
   * Food candidate results from visual scanning. The array is sorted by confidence, with the most confident result at index 0.
   */
  detectedCandidates: DetectedCandidate[]

  /**
   * Food candidate results from barcode scanning.
   */
  barcodeCandidates?: BarcodeCandidate[]

  /**
   * Food candidate results from packagedFoodCode scanning.
   */
  packagedFoodCode?: PackagedFoodCode[]
}

/**
 * A food candidate detected from visual scanning
 */
export interface DetectedCandidate {
  /**
   * The ID of the detected item
   */
  passioID: PassioID

  /**
   * Confidence of the classification candidate, ranging from 0.0 to 1.0
   */
  confidence: number

  /**
   * A box describing a detected object's location in the camera view
   */
  boundingBox: BoundingBox

  /**
   * Supported only in IOS
   * Scanned AmountEstimate
   */
  amountEstimate?: AmountEstimate
}
/**
 * A UPC code captured by scanning a barcode
 */
export type Barcode = string

/**
 * A candidate resulting from barcode scanning
 */
export interface BarcodeCandidate {
  /**
   * The value of the scanned barcode
   */
  barcode: Barcode

  /**
   * A box describing the location of the barcode in the camera view
   */
  boundingBox: BoundingBox
}
/**
 * packagedFoodCode (typealias String) is the string representation of the PackagedFoodCode id
 */
export type PackagedFoodCode = string

Last updated