/** Ċ Ġ* ĠCopyright Ġ 2 0 2 0 . ĠHu awei ĠTechnologies ĠCo ., ĠLtd . ĠAll Ġrights Ġreserved . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . hu awei . ml kit . sample . trans actor Ċ Ċ import Ġandroid . graphics . Bitmap Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . app . Activity Ċ import Ġkotlin . jvm . Synchron ized Ċ import Ġkotlin . Throws Ċ import Ġandroid . hardware . Camera . Picture Callback Ċ import Ġandroid . graphics . Image Format Ċ import Ġandroid . hardware . Camera . Preview Callback Ċ import Ġandroid . view . WindowManager Ċ import Ġandroid . hardware . Camera . Camera Info Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . view . Surface View Ċ import Ġandroid . graphics . Surface Texture Ċ import Ġandroid . view . Surface Holder Ċ import Ġandroid . view . Motion Event Ċ import Ġandroid . hardware . Camera . Auto Focus Callback Ċ import Ġandroid . graphics . Rect F Ċ import Ġcom . hu awei . h ms . ml sdk . common . ML Frame Ċ import Ġcom . hu awei . h mf . tasks . On Success Listener Ċ import Ġcom . hu awei . h mf . tasks . On Failure Listener Ċ import Ġcom . hu awei . ml kit . sample . trans actor . Local Object Trans actor Ċ import Ġcom . hu awei . ml kit . sample . views . graphic . Local Object Graphic Ċ import Ġcom . hu awei . ml kit . sample . trans actor . Remote Land mark Trans actor Ċ import Ġcom . hu awei . ml kit . sample . views . graphic . Remote Land mark Graphic Ċ import Ġcom . hu awei . h ms . ml sdk . sc d . ML Scene Detection Analyzer Ċ import Ġcom . hu awei . h ms . ml sdk . sc d . ML Scene Detection Analyzer Setting Ċ import Ġcom . hu awei . h ms . ml sdk . sc d . ML Scene Detection Analyzer Factory Ċ import Ġcom . hu awei . ml kit . sample . views . graphic . Scene Detection Graphic Ċ import Ġcom . hu awei . ml kit . sample . trans actor . Scene Detection Trans actor Ċ import Ġandroid . rend erscript . Render Script Ċ import Ġcom . hu awei . ml kit . sample . trans actor . Image Segmentation Trans actor Ċ import Ġandroid . util . Sparse Array Ċ import Ġandroid . widget . Toast Ċ import Ġandroid . rend erscript . Allocation Ċ import Ġandroid . rend erscript . Script Intr insic Blur Ċ import Ġcom . hu awei . ml kit . sample . trans actor . Still Image Segmentation Trans actor Ċ import Ġcom . hu awei . ml kit . sample . trans actor . Local Image Classification Trans actor Ċ import Ġcom . hu awei . ml kit . sample . views . graphic . Local Image Classification Graphic Ċ import Ġcom . hu awei . ml kit . sample . trans actor . Remote Image Classification Trans actor Ċ import Ġcom . hu awei . ml kit . sample . views . graphic . Remote Image Classification Graphic Ċ import Ġcom . hu awei . ml kit . sample . R Ċ import Ġandroid . os . Build Ċ import Ġandroid . provider . Documents Contract Ċ import Ġandroid . provider . Media Store Ċ import Ġandroid . content . Content U ris Ċ import Ġandroid . os . Environment Ċ import Ġandroid . media . Media Scanner Connection Ċ import Ġandroid . media . Media Scanner Connection . On Scan Completed Listener Ċ import Ġandroid . content . Intent Ċ import Ġandroid . graphics . Y uv Image Ċ import Ġandroid . graphics . Bitmap Factory Ċ import Ġandroid . os . Parcel FileDescriptor Ċ import Ġandroid . rend erscript . Script Intr insic Y uv To RGB Ċ import Ġandroid . content . SharedPreferences Ċ import Ġkotlin . jvm . Jvm Over loads Ċ import Ġandroid . content . res . Typed Array Ċ import Ġandroid . view . View . Measure Spec Ċ import Ġandroid . graphics . Shader Ċ import Ġandroid . os . Parcelable Ċ import Ġandroid . os . Parcel Ċ import Ġandroid . graphics . X fer mode Ċ import Ġandroid . util . Display Metrics Ċ import Ġandroid . graphics . Port er D uff X fer mode Ċ import Ġandroid . graphics . Port er D uff Ċ import Ġandroid . graphics . Dash Path Effect Ċ import Ġandroid . widget . GridView Ċ import Ġandroid . widget . Abs ListView Ċ import Ġandroid . graphics . drawable . Drawable Ċ import Ġandroid . util . Log Ċ import Ġcom . hu awei . h mf . tasks . Task Ċ import Ġcom . hu awei . h ms . ml sdk . ML Analyzer Factory Ċ import Ġcom . hu awei . h ms . ml sdk . objects . ML Object Ċ import Ġcom . hu awei . h ms . ml sdk . objects . ML Object Analyzer Ċ import Ġcom . hu awei . h ms . ml sdk . objects . ML Object Analyzer Setting Ċ import Ġcom . hu awei . ml kit . sample . camera . Frame Metadata Ċ import Ġcom . hu awei . ml kit . sample . views . overlay . Graphic Overlay Ċ import Ġjava . io . IOException Ċ import Ġjava . lang . Exception Ċ Ċ class ĠLocal Object Trans actor ( options : ĠML Object Analyzer Setting ?) Ġ: ĠBase Trans actor < List < ML Object >>() Ġ{ ĊĠĠĠ Ġprivate Ġval Ġdetector : ĠML Object Analyzer ĊĠĠĠ Ġoverride Ġfun Ġstop () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . stop () ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdetector . stop () ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIOException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLog . e ( TAG , Ġ" Exception Ġthrown Ġwhile Ġtrying Ġto Ġclose Ġobject Ġtrans actor : Ġ" Ġ+ Ġe . message ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġdetect In Image ( image : ĠML Frame ?): ĠTask < List < ML Object >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġdetector . async Analy se Frame ( image ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonSuccess ( ĊĠĠĠĠĠĠĠ Ġoriginal Camera Image : ĠBitmap ?, ĊĠĠĠĠĠĠĠ Ġresults : ĠList < ML Object >, ĊĠĠĠĠĠĠĠ Ġframe Metadata : ĠFrame Metadata , ĊĠĠĠĠĠĠĠ Ġgraphic Overlay : ĠGraph ic Overlay ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġgraphic Overlay . clear () ĊĠĠĠĠĠĠĠ Ġfor Ġ(` object ` Ġin Ġresults ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġobject Graphic Ġ= ĠLocal Object Graphic ( graphic Overlay , Ġ` object `) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgraphic Overlay . add Graphic ( object Graphic ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġgraphic Overlay . post Invalidate () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Failure ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . e ( TAG , Ġ" Object Ġdetection Ġfailed : Ġ" Ġ+ Ġe . message ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠTAG Ġ= ĠLocal Object Trans actor :: class . java . simple Name ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġdetector Ġ= ĠML Analyzer Factory . getInstance (). getLocal Object Analyzer ( options ) ĊĠĠĠ Ġ} Ċ }