如何转换NSArray<;MLKImageLabel>;将结果转换为typescript对象?

如何转换NSArray<;MLKImageLabel>;将结果转换为typescript对象?,typescript,google-mlkit,Typescript,Google Mlkit,我正在实现图像标记,并试图将结果转换为Typescript对象。我无法转换它。请提出一些想法 try { let imageProviders: Array<ImageLabel>; let ciImg = CIImage.alloc().initWithContentsOfURL( NSURL.fileURLWithPath(imageUri) ); const context = CIContext.alloc().init();

我正在实现图像标记,并试图将结果转换为Typescript对象。我无法转换它。请提出一些想法

try {
    let imageProviders: Array<ImageLabel>;
    let ciImg = CIImage.alloc().initWithContentsOfURL(
      NSURL.fileURLWithPath(imageUri)
    );
    const context = CIContext.alloc().init();
    const cgImg = context.createCGImageFromRect(ciImg, ciImg.extent);
    const uIImage = UIImage.alloc().initWithCGImage(cgImg);
    let visionImage = MLKVisionImage.alloc().initWithImage(uIImage);

    let imageLabelerOptions = MLKImageLabelerOptions.alloc().init();
    imageLabelerOptions.confidenceThreshold = 0.7;
    
    var labeler = MLKImageLabeler.imageLabelerWithOptions(imageLabelerOptions);

    labeler.processImageCompletion(visionImage,(labels: NSArray<MLKImageLabel>,error: NSError)=>{
      console.log(labels); // Result
      resolve(labels);
    });
  }
  catch (err) {
    reject(err)
  }

我想把上面的结果转换成对象数组。你能给我介绍一下吗?

我一点也不懂打字脚本,但快速的谷歌搜索会发现:
(
"Text: Chair, Index: 92, Confidence: 0.96436",
"Text: Musical instrument, Index: 251, Confidence: 0.76389",
"Text: Room, Index: 289, Confidence: 0.74398",
"Text: Piano, Index: 265, Confidence: 0.70383"
)