"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

SetFrameFormat not work correctly after Application

Android 7.0+ , iOS 11.3+ , Unity 2018.2.13, Vuforia 7.5.26

 

SetFrameFormat not work correctly after ApplicationPause, and return true, but realy can't set format correctly (native code cant't invokes)

/// <summary>
    ///  Enables or disables the request of the camera image in the desired pixel
    /// format. Returns true on success, false otherwise. Note that this may
    /// result in processing overhead. Image are accessed using GetCameraImage.
    /// Note that there may be a delay of several frames until the camera image
    /// becomes availables.
    /// </summary>
    public bool SetFrameFormat(Image.PIXEL_FORMAT format, bool enabled)
    {
      if (enabled)
      { // you must check really setted format  or release Camera Images before/after // Application pause or Vuforia initialisation if (!this.mCameraImages.ContainsKey(format))         {
          if (VuforiaWrapper.Instance.QcarSetFrameFormat((int) format, 1) == 0) // <-- MARK 0
          {
            Debug.LogError((object) "Failed to set frame format");
            return false;
          }
          this.mCameraImages.Add(format, new Image()
          {
            PixelFormat = format
          });
          return true;
        }
      }
      else if (this.mCameraImages.ContainsKey(format) && !this.mForcedCameraFormats.Contains(format))
      {
        if (VuforiaWrapper.Instance.QcarSetFrameFormat((int) format, 0) != 0)
          return this.mCameraImages.Remove(format);
        Debug.LogError((object) "Failed to set frame format");
        return false;
      }
      return true;
    }

 

Line MARK 0  can't executed becouse format already exist in mCameraImages but relay (in native realisation) is can't set and then

GetCameraImage(format)

return corruped Image.

 

I fix it with same crutch ('kastil'):[quote]

   CameraDevice.Instance.SetFrameFormat(format, false);

   _isFrameSeted = CameraDevice.Instance.SetFrameFormat(format, true); [/quote]

And it's works fine (but I spent near 4 hours of time debugging this behavior), because bug represented only in mobile platforms.

 

Hello,

Have you compared your code with our reference?

https://library.vuforia.com/articles/Solution/Working-with-the-Camera

Thanks,

Vuforia Engine Support