il421 / DroneScan

MIT License
0 stars 0 forks source link

DJI Phantom 3 #1

Open SemihSandal opened 5 years ago

SemihSandal commented 5 years ago

I am coding on Phantom 3, i am trying to use Google Face Tracker in the FPV Demo application as you. But the drone's camera returns VideoDataCallBack ,Google Face Tracker uses CameraSource. How could you use that live view on the Google's app.

il421 commented 5 years ago

yes, it was a problem))) I used another approach. It is a callback in DJI camera view. When a surface is changing, you call a function to get a bitmap, and then you analyze it (run the Google face detection) in a thread (ExecutorService). In your case, it is the same, I suppose.

@Override public void onSurfaceTextureUpdated(SurfaceTexture surface) {

    if(cameraMode != 0) {
        // GET FRAMES AND RUN BARCODE DETECTION
        Bitmap bitman = mVideoSurface.getBitmap();
        frame = new Frame.Builder().setBitmap(bitman).build();
        barcodeThread.execute(new BarcodeDetectionTimber());
    }
}

This class (everything is in there): https://github.com/il421/DroneScan/blob/master/FPVDemo/app/src/main/java/com/dji/FPVDemo/MainActivity.java