Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid image format! DeepAR.processFrame method #13

Closed
olegkhomenko opened this issue Dec 22, 2020 · 2 comments
Closed

Invalid image format! DeepAR.processFrame method #13

olegkhomenko opened this issue Dec 22, 2020 · 2 comments

Comments

@olegkhomenko
Copy link

olegkhomenko commented Dec 22, 2020

Hi! Thank you for the amazing product 馃檶 .
I have my own implementation of CameraManager and CameraController.
I tried to use processFrameAndReturn method of DeepAR class instance. However, the following error always occurs:

2020-12-22 20:45:24.167526+0300 APPNAME [18884:12654410] Invalid image format!
extension CameraController: CameraManagerDelegate {
  func cameraManager(_ cameraManager: CameraManager, didOutputSamplePixelBuffer samplePixelBuffer: CVPixelBuffer?, withPresentationTime presentationTime: CMTime) {
      guard let samplePixelBuffer = samplePixelBuffer else { return }
      guard let deepAR = deepAR else { return }
      if !deepAR.renderingInitialized {
          print("Rendering is not initialized")
          return
      }
      // ERROR:
      self.deepAR.processFrame(samplePixelBuffer, mirror: false)
  }
}

samplePixelBuffer has the following PixelFormatType (which is a kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) :

var type: OSType = CVPixelBufferGetPixelFormatType(samplePixelBuffer)
print(type)
>>> 875704438

and resolution

var width = 720
var height = 1280

The same error is also for:

self.deepAR.processFrameAndReturn(samplePixelBuffer, outputBuffer: deepARPixelbuffer, mirror: false)
@olegkhomenko
Copy link
Author

Solution:
Use kCVPixelFormatType_32BGRA for CVPixelBufferRef

Question:
Is there any way how to use CVPixelBuffer with alternative PixelFormatType ?

@olegkhomenko
Copy link
Author

olegkhomenko commented Jan 13, 2021

It looks like there is no answer. I'm closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant