val paint = Paint()
paint.color = Color.RED
paint.strokeWidth = 3f
paint.style = Paint.Style.STROKE
objectDetector.processImage(getVisionImageFromFrame(frame))
.addOnSuccessListener {
var result = ""
it.forEach { item ->
val id = item.trackingId
val bounds = item.boundingBox
val category = item.classificationCategory
result += category.toString() //TODO : Get the knowledge graph result for this entity
Log.e("TAG",category.toString())
}
callback(result)
}
.addOnFailureListener {
callback("Unable to detect an object")
}
.addOnCompleteListener {
}
此外,当检测到对象时,会显示一个数字而不是对象的名称。例如:检测笔时,显示的是 010 而不是名称“笔”。我也不知道如何在检测到的图像周围绘制边界框。请注意。