无法在已部署版本中设置 Vuforia 帧格式
Unable to set Vuforia frame format in deployed Version
我正在开发一个 AR-App,使用 Vuforia
作为模型目标,Zxing
作为 QR 码扫描。
我已经按照 Vuforia 页面上的描述设置了项目。当我处于播放模式时,一切正常,但一旦我构建它,尽管构建时没有编译错误,但它无法设置帧格式。
我正在使用:
- 统一 2018.4.8f1
- Vuforia 8.3.8
- .Net 4.7
我尝试了不同的帧格式,授予了统一管理员权限,关闭了病毒扫描程序
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;
}
程序应该会在几秒钟后启动并初始化帧格式,这样我就可以调用 getCamerImage 来获取要解码的图像。它能够设置导致 GetCameraImage 错误的 FrameFormat。在 visual Studio 中构建解决方案时我发现的两个错误是:
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
并且在某些原生 Vuforia 代码中:int32_t returnValue = il2cppPInvokeFunc(____licenseKey0_marshaled
它停止调试,因为某些访问被拒绝
通过将 RGBLuminanceSource.BitmapFormat
切换为所选 PIXEL_FORMAT
的合适格式并将 setFrameFormat
包含在 try-catch
块中解决。
我正在开发一个 AR-App,使用 Vuforia
作为模型目标,Zxing
作为 QR 码扫描。
我已经按照 Vuforia 页面上的描述设置了项目。当我处于播放模式时,一切正常,但一旦我构建它,尽管构建时没有编译错误,但它无法设置帧格式。
我正在使用:
- 统一 2018.4.8f1
- Vuforia 8.3.8
- .Net 4.7
我尝试了不同的帧格式,授予了统一管理员权限,关闭了病毒扫描程序
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;
}
程序应该会在几秒钟后启动并初始化帧格式,这样我就可以调用 getCamerImage 来获取要解码的图像。它能够设置导致 GetCameraImage 错误的 FrameFormat。在 visual Studio 中构建解决方案时我发现的两个错误是:
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
并且在某些原生 Vuforia 代码中:int32_t returnValue = il2cppPInvokeFunc(____licenseKey0_marshaled
它停止调试,因为某些访问被拒绝
通过将 RGBLuminanceSource.BitmapFormat
切换为所选 PIXEL_FORMAT
的合适格式并将 setFrameFormat
包含在 try-catch
块中解决。