Unable to set Vuforia frame format in deployed Version

1

I'm developing an AR-App using Vuforia for model target and Zxing for QR-Code scan.
I've set the project up as discriped at the Vuforia Page. While i'm in Playmode everything works fine but once I build it, it's unable to set the Frame Format despite no compile errors while building.

I'm using:

  • Unity 2018.4.8f1
  • Vuforia 8.3.8
  • .Net 4.7

I've tried different Frame Formats, gave unity admin permission, turned of virus-Scanner

        private IEnumerator camInitializing()
        {
            //Wait for vuforia to initialize
            yield return new WaitForSeconds(4);
            if (CameraDevice.Instance == null)
            {
                Debug.LogError("No Instance of Camera could be found");
            }
            Debug.LogError( CameraDevice.Instance.IsActive());

            availableFormat = PIXEL_FORMAT.RGBA8888;
            if (!CameraDevice.Instance.SetFrameFormat(PIXEL_FORMAT.RGBA8888,true))
            {
                availableFormat = PIXEL_FORMAT.RGB888;
                if (!CameraDevice.Instance.SetFrameFormat(PIXEL_FORMAT.RGB888,true))
                {
                    availableFormat = PIXEL_FORMAT.RGB565;
                    if (!CameraDevice.Instance.SetFrameFormat(PIXEL_FORMAT.RGB565, true))
                    {
                        availableFormat = PIXEL_FORMAT.GRAYSCALE;
                        if (!CameraDevice.Instance.SetFrameFormat(PIXEL_FORMAT.GRAYSCALE, true))
                        {
                            availableFormat = PIXEL_FORMAT.UNKNOWN_FORMAT;
                            Debug.LogError("Couldnt Initiate Camera Format");
                        }
                    }
                }
            }

            var isAutoFocus = CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
            if (!isAutoFocus)
            {
                CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_NORMAL);
            }

            Debug.Log("QR Scanner ready");

            _isInitialized = true;
            DecoderThread = new Thread(decode);
            DecoderThread.Name = "T0, _decoder";
            DecoderThread.Start();
            pauseThread = true;

        }

The program should start after a few seconds and initialize the Frame format so I can call getCamerImage to get an Image to decode. It's nable to set the FrameFormat which leads to an error in GetCameraImage. The two errors I can find while building the solution in visual Studio are:

Exception thrown at 0x773DFD82 (KernelBase.dll) in zXingVuforiaTest.exe: WinRT originate error - 0x80040111 : 'Windows.UI.WindowManagement.DisplayRegion'. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\viewpositiontrackerinternal.h(94)\Windows.Devices.Sensors.dll!1FE833ED: (caller: 1FE8240F) Exception(11) tid(17f0) 80040111 ClassFactory kann angeforderte Klasse nicht liefern Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: wil::ResultException at memory location 0x0C53CA78. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\sensor.cpp(179)\Windows.Devices.Sensors.dll!1FE7F4AC: (caller: 1FE7B61C) Exception(12) tid(17f0) 80070490 Element nicht gefunden. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: wil::ResultException at memory location 0x0C53CCC0. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\sensorserver.cpp(46)\Windows.Devices.Sensors.dll!1FE78581: (caller: 1FE7593F) ReturnHr(7) tid(17f0) 80070490 Element nicht gefunden. The thread 0x48a8 has exited with code 0 (0x0). Exception thrown at 0x773DFD82 (KernelBase.dll) in zXingVuforiaTest.exe: WinRT originate error - 0x80040111 : 'Windows.UI.WindowManagement.DisplayRegion'. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\viewpositiontrackerinternal.h(94)\Windows.Devices.Sensors.dll!1FE833ED: (caller: 1FE8240F) Exception(13) tid(17f0) 80040111 ClassFactory kann angeforderte Klasse nicht liefern Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: wil::ResultException at memory location 0x0C53CA48. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\sensor.cpp(179)\Windows.Devices.Sensors.dll!1FE7F4AC: (caller: 1FE7B61C) Exception(14) tid(17f0) 80070490 Element nicht gefunden. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: wil::ResultException at memory location 0x0C53CC90. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\sensorserver.cpp(46)\Windows.Devices.Sensors.dll!1FE78581: (caller: 1FE7593F) ReturnHr(8) tid(17f0) 80070490 Element nicht gefunden. Exception thrown at 0x773DFD82 (KernelBase.dll) in zXingVuforiaTest.exe: WinRT originate error - 0x80040111 : 'Windows.UI.WindowManagement.DisplayRegion'. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\viewpositiontrackerinternal.h(94)\Windows.Devices.Sensors.dll!1FE833ED: (caller: 1FE8240F) Exception(15) tid(17f0) 80040111 ClassFactory kann angeforderte Klasse nicht liefern Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: wil::ResultException at memory location 0x0C53CAB8. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\sensor.cpp(179)\Windows.Devices.Sensors.dll!1FE7F4AC: (caller: 1FE7B61C) Exception(16) tid(17f0) 80070490 Element nicht gefunden. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: wil::ResultException at memory location 0x0C53CD00. Exception thrown at 0x773DFD82 in zXingVuforiaTest.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\sensorserver.cpp(46)\Windows.Devices.Sensors.dll!1FE78581: (caller: 1FE7593F) ReturnHr(9) tid(17f0) 80070490 Element nicht gefunden. Failed to set frame format

and at some native Vuforia Code: int32_t returnValue = il2cppPInvokeFunc(____licenseKey0_marshaled it stops debugging because some acces is denied

c#
unity3d
qr-code
zxing
vuforia
asked on Stack Overflow Sep 26, 2019 by TheMightyIch • edited Sep 27, 2019 by TheMightyIch

1 Answer

0

Solved it by switching the RGBLuminanceSource.BitmapFormat to the suitable format of the chosen PIXEL_FORMAT and enclosing the setFrameFormat with a try-catch block.

answered on Stack Overflow Oct 17, 2019 by TheMightyIch

User contributions licensed under CC BY-SA 3.0