Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
val objectPredictor = FritzVisionObjectPredictor.getInstance(this)
var fritzVisionImage: FritzVisionImage
cameraView.addFrameProcessor { frame ->
if (yuvDataLength == 0) {
//Run this only once
//Camera Preview returns NV21, so convert it to Bitmap :
allocationIn.copyFrom( //Take the NV21 format
yuvToRGB.forEach(allocationOut) //Convert it to Bitmap readable format
allocationOut.copyTo(bitmapOut) //Set it to the empty Bitmap created earlier
//Create a fritzVisionImage
fritzVisionImage = FritzVisionImage.fromBitmap(bitmapOut)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.