Zoom Disabled When Switching to Different Camera Modes on M3E Drone for High-Quality Image Capture

Comments

6 comments

  • DJI Developer Support
    Are you currently looking to enhance the visibility of the target by using zoom?
    0
    Comment actions Permalink
  • logisticsbrreply

    Yes, because it’s the only way to read with the sensor active. Is it possible to reduce the sensor distance to less than two meters? Could you please run a test by creating a data matrix label with a size of 1.6 cm and this value: 2100000000006005611727]01434978]100141622024]1201052025]3000037489000]920]01434978]1001416?

    We are currently using the following code to capture the label value:

    import com.google.mlkit.vision.barcode.BarcodeScanner;
    import com.google.mlkit.vision.barcode.BarcodeScannerOptions;
    import com.google.mlkit.vision.barcode.BarcodeScanning;
    import com.google.mlkit.vision.barcode.common.Barcode;
    import com.google.mlkit.vision.common.InputImage;
    ...
    frame = droneFlight.getFpvWidgetBitmap();
    if (frame == null) continue;

    String barcodeString = ImageDetector.readBarCode(frame);
    if (barcodeString == null || barcodeString.isEmpty()) continue;
    public static String readBarCode(Bitmap bitmap) {

    final String[] textBarCode = {""};
    final CountDownLatch latch = new CountDownLatch(NUMBER_OF_COUNTDOWN_TO_RELEASE_THREADS);

    try{

    BarcodeScannerOptions options = new BarcodeScannerOptions.Builder()
    .setBarcodeFormats(
    Barcode.FORMAT_QR_CODE, Barcode.FORMAT_DATA_MATRIX, Barcode.FORMAT_CODE_128)
    .build();

    InputImage image = InputImage.fromBitmap(bitmap, 0);

    BarcodeScanner detector = BarcodeScanning.getClient(options);

    detector.process(image)
    .addOnSuccessListener(barcodes -> {
    for (Barcode barcode : barcodes) {
    String rawValue = barcode.getRawValue();

    if (textBarCode[0].isEmpty()) textBarCode[0] = rawValue;
    else textBarCode[0] += "=/sep/=" + rawValue;
    }

    latch.countDown();
    }).addOnFailureListener(e -> latch.countDown());

    latch.await(READ_BARCODE_WAIT_DURATION, TimeUnit.MILLISECONDS);
    } catch (Exception e) {
    e.printStackTrace();
    }

    return textBarCode[0].isEmpty() ? null : textBarCode[0];
    }

     


    We are specifically using this code to extract the barcode data from the frame. Could you test this with the given label and let us know the results?

    1
    Comment actions Permalink
  • DJI Developer Support
    You can switch the current view to a zoomed view using CameraKey.KeyCameraVideoStreamSource, and then control the zoom ratio with CameraKey.KeyCameraZoomRatios to make the target clearer. Sorry,but the barcode monitoring you mentioned is beyond our work. If the image remains blurry after zooming, you might consider bringing the aircraft closer to the target or using algorithms to enhance image clarity. These solutions will need to be implemented and tested by you. Regarding the sensor distance, are you referring to the sensors that the drone uses to detect obstacles?
    0
    Comment actions Permalink
  • logisticsbrreply

    Thank you for the reply. I will test adjusting the view with CameraKey.KeyCameraVideoStreamSource and controlling the zoom with CameraKey.KeyCameraZoomRatios to improve the clarity of the target. Regarding the barcode monitoring, I understand that it's beyond your scope.

    As for the sensor distance, yes, I am referring to the sensors the drone uses to detect obstacles. My goal is to better understand the minimum and optimal distance at which the drone can accurately detect objects. Any additional information on this would be greatly appreciated.

    0
    Comment actions Permalink
  • DJI Developer Support
    The obstacle sensor range of the aircraft can be less than 2 meters. If you have used the Pilot 2, you can view the perception range in different directions on the perception menu. The minimum distance in the horizontal direction is 0.5 meters. You may refer to this article for the guidance:https://sdk-forum.dji.net/hc/en-us/articles/9882785690009-Chapter-16-Visual-obstacle-avoidance-system https://developer.dji.com/doc/mobile-sdk-tutorial/en/tutorials/perception.html
    0
    Comment actions Permalink
  • logisticsbrreply

    From what I see, the minimum distance seems to be 1 meter. Is there a way to set it to a shorter range for the horizontal sensor?
    Also, do you know if it's possible to configure the drone's movement speed or calibrate the joystick’s sensitivity for speed control?

    And what about the CameraKey configurations? Currently, I'm using this method in the onCreate of my activity. Would this be the change needed to improve the image quality?

    public void switchCameraTypeToZoomAndSetFocus() {

    KeyManager.getInstance().setValue(KeyTools.createKey(CameraKey.KeyCameraVideoStreamSource), CameraVideoStreamSourceType.ZOOM_CAMERA, new CommonCallbacks.CompletionCallback() {
    @Override
    public void onSuccess() {
    log.info("Drone is now in camera zoom mode. Setting drone zoom to the default value...");
    KeyManager.getInstance().setValue(KeyTools.createKey(CameraKey.KeyCameraZoomRatios), 1.0, new CommonCallbacks.CompletionCallback() {
    @Override
    public void onSuccess() {
    log.info("Set drone zoom to 1.0 successfully");
    sleepThreadUntilCameraCallback();
    setFocus();
    }

    @Override
    public void onFailure(@NonNull IDJIError error) {
    log.error("Error setting zoom in drone: " + error.description() + ", CODE: " + error.errorCode());
    }
    });
    }

    @Override
    public void onFailure(@NonNull IDJIError error) {
    log.error("Error setting drone in camera zoom mode: " + error.description() + ", CODE: " + error.errorCode());
    }
    });
    }
    0
    Comment actions Permalink

Please sign in to leave a comment.