Retrieve images from a DJI Drone with EXIF data

痞子三分冷 提交于 2019-12-02 04:16:57

问题


I'm using the DJISDK in iOS to download pictures from the aircraft.

I'm using the downloadSelectedFiles method from PlaybackManager class.

Here is my process callback:

process: { (data, error) in
    if data != nil{
        if self.downloadedImageData != nil{
            self.downloadedImageData!.append(data!)
        }else{
            self.downloadedImageData = data!
        }

    }
}

And this is filecompletition callback:

fileCompletion: {
    self.downloadedFilesCount += 1
    let image = UIImage(data: self.downloadedImageData!)
    if let img = image {
        self.downloadedImagesArray?.append(img)
    }
    self.downloadedImageData = nil         
}

I'm correctly retrieving the image but without the EXIF data. How can I get that info and add it to the image? I already downloaded and tried the iOS-MediaManagerDemo and it's the same thing, downloads the image but without the exif data but the official DJI Go app retrieves all the info so there´s must be some way to do it.


回答1:


There's also a similar issue in their forums regarding empty metadata and downloadSelectedFilesWithPreparation. The user that created the post also found a solution:

I solved the problem by not converting the NSData into any format instead saved the NSData directly. Using PHAssets and temporary file to store the NSData as PHAssets only accepts data from URL.


Try using fetchFileDataWithOffset:updateQueue:updateBlock (it will be called fetchFileData(with:updateQueue:updateBlock) in Swift)

[...] fetching the media data will return all data for a video or image


Sample code (objc): here



来源:https://stackoverflow.com/questions/45872030/retrieve-images-from-a-dji-drone-with-exif-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!