frame that is got by using videoProcessFrame is blurred
I want to detect AR marker using image frame by using videoProcessFrame. So, I want convert CVPixelBuffer to UIImage. However, UIImage that converted from CVPixelBuffer was blurred (See images). How should I convert it? Or is it possible to get a clear image?
drone: Mavic 2 Zoom code
func videoProcessFrame(_ frame: UnsafeMutablePointer<VideoFrameYUV>!) {
if (self.gloVar.landingMode == 1 && autoLandingStarted == true) {
if (videoFrameCount % 10 == 0) {
var pixelBuffer:CVPixelBuffer;
var image:UIImage;
if frame.pointee.cv_pixelbuffer_fastupload != nil {
pixelBuffer = unsafeBitCast(frame.pointee.cv_pixelbuffer_fastupload, to: CVPixelBuffer.self)
image = imageFromPixelBuffer(imageBuffer: pixelBuffer)! <-- here
func imageFromPixelBuffer(imageBuffer:CVPixelBuffer) -> UIImage? {
let sourceImage = CIImage.init(cvPixelBuffer: imageBuffer, options: nil)
let size = sourceImage.extent.size
UIGraphicsBeginImageContext(size)
let rect = CGRect(origin: .zero, size: size)
let remImage = UIImage(ciImage: sourceImage)
remImage.draw(in: rect)
let result : UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
return result
}
image1

image2

Agent comment from Luce Luo in Zendesk ticket #39553:
Dear Yuki,
Thank you for contacting DJI. I have found some related issues for you, please try to refer to it if any help first. https://github.com/dji-sdk/Mobile-SDK-iOS/issues/383 https://github.com/dji-sdk/DJIWidget/issues/9
Thanks,
Luce Luo DJI Developer Support
I have read and tried these posts before asking questions. So, it's not helping. The problem is that the uv element of the received frame(cv_pixelbuffer_fastupload) is clearly missing. Therefore, the image has faded like the image I sent. It doesn't happen except for mavic2 zoom. Why is this happning? I'm asking for the solution.
2020年9月27日(日) 15:14 DJI [email protected]:
Agent comment from Luce Luo in Zendesk ticket #39553 https://djisdksupport.zendesk.com/agent/tickets/39553:
Dear Yuki,
Thank you for contacting DJI. I have found some related issues for you, please try to refer to it if any help first. #383 https://github.com/dji-sdk/Mobile-SDK-iOS/issues/383 dji-sdk/DJIWidget#9 https://github.com/dji-sdk/DJIWidget/issues/9
Thanks,
Luce Luo DJI Developer Support
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dji-sdk/Mobile-SDK-iOS/issues/399#issuecomment-699591470, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPXK6D2QS6SN7QUN426Y6LSH3J5FANCNFSM4RZMSBLQ .
@ynaka01-max
I'm not certain this will resolve you issue, but we were having a similar issue. It turned out that the DJI video frame was incorrectly reporting its frame size. Changing the camera aspect ratio to 16 by 9 instead of 4 by 3 corrected our issue.