简体   繁体   English

关于无人机实时发送图像数据的问题

[英]Question about Real time Image data sending from drone

I have a question for developing a function...我有一个关于开发 function 的问题...

I'm developing a function that receives image datas from 2 drones(Phantom 4 Advanced, Inspire 2) in real time and merges them.我正在开发一个 function 实时接收来自 2 架无人机(Phantom 4 Advanced,Inspire 2)的图像数据并将它们合并。

For test, I tried to receive a picture, but it took a long time to receive..为了测试,我尝试接收一张图片,但花了很长时间才收到..

here is my code...这是我的代码...

camera.setShootPhotoMode(photoMode, new CommonCallbacks.CompletionCallback() {
            @Override
            public void onResult(DJIError djiError) {
                if (null == djiError) {
                    mHandler.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            camera.startShootPhoto(new CommonCallbacks.CompletionCallback() {
                                @Override
                                public void onResult(DJIError djiError) {
                                    if (djiError == null) {
                                        showToast("take photo: success");
                                        //start 시간 찍고
                                        Log.d("Start Time: ", Long.toString(System.currentTimeMillis()));
                                    } else {
                                        showToast(djiError.getDescription());
                                    }
                                }
                            });
                        }
                    }, 2000);
                }
            }
        });
        //카메라 데이터 핸드폰에 저장
        camera.setMediaFileCallback(new MediaFile.Callback() {
            @Override
            public void onNewFile(@NonNull MediaFile mediaFile) {
                mediaFile.fetchFileData(file, "imageData", new DownloadListener<String>() {
                    @Override
                    public void onStart() {
                        showToast("Start downloading.");
                    }

                    @Override
                    public void onRateUpdate(long l, long l1, long l2) {

                    }

                    @Override
                    public void onRealtimeDataUpdate(byte[] bytes, long l, boolean b) {

                    }

                    @Override
                    public void onProgress(long l, long l1) {

                    }

                    @Override
                    public void onSuccess(String s) {
                        showToast("Download Succeed.");
                        //end time
                        Log.d("End Time: ", Long.toString(System.currentTimeMillis()));
                    }

                    @Override
                    public void onFailure(DJIError djiError) {
                        if(djiError != null){
                            showToast("Failed..");
                            //end time
                            Log.d("End Time: ", Long.toString(System.currentTimeMillis()));
                        }
                    }
                });
                showToast("Image is successfully Saved");
                Log.d("Camera Image Transfer: ", "Succeed!");
            }
        });

I use shootphotomode and setmediafilecallback to send it to my Phone..我使用 shootphotomode 和 setmediafilecallback 将其发送到我的手机..

Is there any other ways to receive data in real time?还有其他实时接收数据的方法吗?

I'm always appreciate that you take a couple of time to read my problem..Thank you very much!我一直很感激您花一些时间阅读我的问题。非常感谢您!

Fullres photos take a long time, you can't do anything about that. Fullres 照片需要很长时间,您对此无能为力。 This will never be realtime.这永远不会是实时的。

If you need realtime image, you must grab frames from the fpv livestream, which is lowres and 720p/1080p h264 coded.如果您需要实时图像,则必须从 fpv 直播中抓取帧,该直播是低分辨率和 720p/1080p h264 编码的。 This is realtime with about 200ms delay, like what you see in fpvview.这是实时的,大约有 200 毫秒的延迟,就像您在 fpvview 中看到的一样。

I usually just export a bitmap from the fpvview, that's the fastest way, since you don't need to decode 264. Can easily read 60fps with that method.我通常只是从 fpvview 导出一个 bitmap,这是最快的方法,因为您不需要解码 264。使用该方法可以轻松读取 60fps。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM