Loading OpenCV .dlls on Hololens using Unity

-1

I have a project in Unity that has OpenCV dlls built for Win32/x86 platform(ie for Hololens 1). They are placed in : O:\Unity_Projects\MachineViewer_x86\Assets\Plugins\WSA\x86 . So I know the folder structure itself is not wrong .

In the project , i have only one script which calls detectaruco which is a OpenCV function. I have followed how to make the external dlls(in C++ here) and import them(in C# unity) as well.There seems to be no issue. After detection, i display the ID number of the aruco marker by using int variable in C++ and int ref in C#. Here is the complete code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.InteropServices;
using TMPro;

public class ArucoMarkerDetection : MonoBehaviour
{
    int ArucoID = 0;
    int arrayLength = 0;
    public GameObject mygameobject;
    public TMP_Text textobj;
    public int WebCamDeviceNo;
    public int WebcamFPS;
    Color Color1;
    Color Color2;
    Renderer ObjRenderer;
    int _width = 0;
    int _height = 0;
    Color32[] rawImg;
    WebCamTexture CamTexture;

    // Start is called before the first frame update
    void Start()
    {
        Color1 = new Color(0, 200, 0, 255);
        Color2 = new Color(200, 0, 0, 255);
        ObjRenderer = mygameobject.GetComponent<Renderer>();
        WebCamDevice[] devices = WebCamTexture.devices;
        if (devices.Length > 0)
        {
            CamTexture = new WebCamTexture();
            CamTexture.Play();
            _width = CamTexture.width;
            _height = CamTexture.height;
             rawImg = new Color32[_width * _height];
            Debug.Log("webcam width and heightg after Play()" + _width + "x" + _height);
        }
        else
        {
            Debug.Log("No webcam found!");
            return;
        }
    }
    void Update()
    {
        if (CamTexture.isPlaying)
        {
            rawImg = CamTexture.GetPixels32();
            MarkersDetection.detectAruco(ref ArucoID, ref arrayLength, ref rawImg, _width, _height);
        }
        else
            Debug.Log("No camera Playing");
        if (arrayLength > 0)
        {
            Debug.Log("Detected Aruco ID is :" + ArucoID);
            Debug.Log("Detected Aruco Array size :" + arrayLength);
            ObjRenderer = mygameobject.GetComponent<Renderer>();
            ChangeColor(ObjRenderer, Color1, "_Color");
            ChangeText(ArucoID.ToString());
        }
        else
        {
            ChangeColor(ObjRenderer, Color2, "_Color");
            ChangeText("0");
        }
    }

    private void ChangeColor(Renderer GameObjRenderer,Color colour,string colorName)
    {
        GameObjRenderer.material.SetColor(colorName, colour);
    }

    private void ChangeText(string textVal)
    {
        if (textVal != null)
        {
            Debug.Log("textVal : " + textVal);
            textobj.SetText(textVal);
        }
    }
}
internal static class MarkersDetection
{

    [DllImport("UnityCVWin32")]
    internal static extern void detectAruco(ref int outArucoID,ref int arraySize,ref Color32[] rawImg, int width, int height);
}   

The OpenCV dlls are built for Win32. Same steps as here : OpenCV: 32-bit libs & dlls for Visual Studio project

The project in C++ is also built for Win32. Here I make a function which detects the tags and then returns the ID. UnityCVWin32.sln :

#include "opencv2/aruco.hpp"
#include <iostream>
#include <stdio.h>
#include <opencv2/highgui.hpp>
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/core.hpp"
#include "opencv2/videoio/videoio.hpp"
#include <vector>
using namespace std;
using namespace cv;
struct Color32
{
    uchar red;
    uchar green;
    uchar blue;
    uchar alpha;
};

extern "C" void __declspec(dllexport) __stdcall detectAruco(int& outArucoID,int& arraySize,Color32 **rawImg,int width,int height) {

        Ptr<aruco::Dictionary> arucoDictionary;
        arucoDictionary = cv::aruco::getPredefinedDictionary(aruco::DICT_APRILTAG_36h11);
        cv::Mat imageCopy(height, width, CV_8UC3);
        cv::Mat image(height, width, CV_8UC4, *rawImg);
        if (image.empty())
        {
            std::cout << "!!! image empty" << std::endl;
            return;
        }
        std::vector<int> arucoIds(100);
        std::vector<std::vector<cv::Point2f>> arucoCorners(400), rejectedCandidates(400);
        cv::Ptr<cv::aruco::DetectorParameters> parameters = cv::aruco::DetectorParameters::create();
        cvtColor(image, imageCopy, COLOR_RGBA2BGR);
        cv::aruco::detectMarkers(imageCopy, arucoDictionary, arucoCorners, arucoIds, parameters, rejectedCandidates);
        if (arucoIds.size() > 0) {
            for (int i = 0; i < arucoIds.size(); i++) {
                outArucoID = arucoIds.at(0);
                arraySize = arucoIds.size();
            }
        }
        else
        {
            outArucoID = 0;
            arraySize = 0;
        }
    }

The same example works for Editor(however tried with x64 dlls). When I build on Hololens with following config(this is what I finally ended up using) :

Unity Build Configuration

However the sphere turns from grey to red in the beginning and ID is set to 0. This ID as 0 and red colour change is set by me.This means presently no ID is detected(which is right). So I know initially it works. But later on I get the DllNotFound Exception UnityCVWin32.dll (for my C++ Project dll).

Here is the complete Error from the VS Output .

'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\MachineViewer_x86.exe'. Symbols loaded.
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Programs\WindowsApps\Microsoft.VCLibs.140.00.Debug_14.0.29231.0_x86__8wekyb3d8bbwe\vccorlib140d_app.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Programs\WindowsApps\Microsoft.VCLibs.140.00.Debug_14.0.29231.0_x86__8wekyb3d8bbwe\vcruntime140d_app.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\ucrtbased.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Programs\WindowsApps\Microsoft.VCLibs.140.00.Debug_14.0.29231.0_x86__8wekyb3d8bbwe\msvcp140d_app.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\forwarders\kernel32.dll'. 
The thread 0xad8 has exited with code 0 (0x0).
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\procthreadexthost.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. k.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Shell.ServiceHostBuilder.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\UnityPlayer.dll'.  
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\forwarders\version.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\MMDevAPI.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Programs\WindowsApps\Microsoft.VCLibs.140.00.Debug_14.0.29231.0_x86__8wekyb3d8bbwe\vccorlib140_app.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\RTWorkQ.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Programs\WindowsApps\Microsoft.VCLibs.140.00.Debug_14.0.29231.0_x86__8wekyb3d8bbwe\vcruntime140_app.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Programs\WindowsApps\Microsoft.VCLibs.140.00.Debug_14.0.29231.0_x86__8wekyb3d8bbwe\msvcp140_app.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\ExecModelClient.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Storage.ApplicationData.dll'. 
CreateDirectory 'C:/Data' failed: Operation has failed with error 0x5: Access is denied.
 (current dir: C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/Template3DVS.Debug_Win32.spandana/Data)
Logging to C:/Data/Users/cshl/AppData/Local/Packages/Template3D_pzq3xp76mxafg/TempState/UnityPlayer.log
[0.546327 / 0.574190] - Initializing Unity runtime
Loading native plugins
  Loading opencv_xobjdetect450.dll
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_xobjdetect450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_objdetect450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_imgproc450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_imgcodecs450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_core450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_features2d450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_calib3d450.dll'. 
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_imgcodecs450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_calib3d450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_features2d450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_objdetect450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_imgproc450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_core450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_xobjdetect450.dll'
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\execmodelproxy.dll'. 
Plugins: Failed to load 'C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/Template3DVS.Debug_Win32.spandana/opencv_xobjdetect450.dll' because one or more of its dependencies could not be loaded. 
(Filename: C:\buildslave\unity\build\Runtime/Misc/Plugins.cpp Line: 248)
Plugins: 2nd attempt to load module with '.dll' extension manually appended ('opencv_xobjdetect450.dll.dll') also couldn't be found (or it's dependencies). 
(Filename: C:\buildslave\unity\build\Runtime/Misc/Plugins.cpp Line: 254)
  Loading opencv_calib3d450.dll
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_calib3d450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_features2d450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_imgproc450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_flann450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_core450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_core450.dll'. 
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_core450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_core450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_features2d450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_flann450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_imgproc450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_calib3d450.dll'
Plugins: Failed to load 'C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/Template3DVS.Debug_Win32.spandana/opencv_calib3d450.dll' because one or more of its dependencies could not be loaded. 
(Filename: C:\buildslave\unity\build\Runtime/Misc/Plugins.cpp Line: 248)

Plugins: 2nd attempt to load module with '.dll' extension manually appended ('opencv_flann450.dll.dll') also couldn't be found (or it's dependencies). 
(Filename: C:\buildslave\unity\build\Runtime/Misc/Plugins.cpp Line: 254)

Module information:
 Built with Compiler Ver '192227905'
 Built from '2020.1/staging' branch
 Version is '2020.1.17f1 (9957aee8edc2)'
 Debug build
 Application type 'D3D'
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Devices.Enumeration.dll'. 
 OS 'Windows 10 (10.0.17763)'
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\GameAssembly.dll'. Symbols loaded.
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\IPHLPAPI.DLL'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\baselib.dll'. 
PlayerConnection initialized from C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/Template3DVS.Debug_Win32.spandana/Data (debug = 0)
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Networking.Connectivity.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Networking.HostName.dll'.  
Exception thrown at 0x76F63C22 (KernelBase.dll) in MachineViewer_x86.exe: 0x000006A6: The binding handle is invalid.
Exception thrown at 0x76F63C22 (KernelBase.dll) in MachineViewer_x86.exe: 0x000006A6: The binding handle is invalid.
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\FWPUCLNT.DLL'. 
PlayerConnection initialized network socket : 0.0.0.0 55208
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\nlaapi.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.ApplicationModel.dll'. 
Multi-casting "[IP] 192.168.1.127 [Port] 55208 [Flags] 2 [Guid] 1758030973 [EditorId] 0 [Version] 1048832 [Id] UWPPlayerX86(Future) [Debug] 0 [PackageName] Template3D_pzq3xp76mxafg [ProjectName] <no name>" to [225.0.0.222:54997]...
Started listening to [0.0.0.0:55208]
PlayerConnection already initialized - listening to [0.0.0.0:55208]
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'. 
'MachineViewer_x86.exe' (Win32): Unloaded 'C:\Windows\System32\ResourcePolicyClient.dll'
[4.296159 / 13.284031] - Initialize
[Subsystems] Discovering subsystems at path C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/Template3DVS.Debug_Win32.spandana/Data/UnitySubsystems
[Subsystems] No descriptors matched for  examples in UnitySubsystems/WindowsMRXRSDK/UnitySubsystemsManifest.json.
[Subsystems] 1 'inputs' descriptors matched in UnitySubsystems/WindowsMRXRSDK/UnitySubsystemsManifest.json
[Subsystems] 1 'displays' descriptors matched in UnitySubsystems/WindowsMRXRSDK/UnitySubsystemsManifest.json
[Subsystems] 1 'meshings' descriptors matched in UnitySubsystems/WindowsMRXRSDK/UnitySubsystemsManifest.json
GfxDevice: creating device client; threaded=1
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\DXGIDebug.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\igdusc32.dll'. 
Successfully created d3d11 device with debug flag.
Direct3D:
    Version:  Direct3D 11.0 [level 11.1]
    Renderer: HoloLens Graphics (ID=0x22b0)
    Vendor:   (null)
    VRAM:     980 MB
Initialize engine version: 2020.1.17f1 (9957aee8edc2)
[AudioManager] InitNormal(tryDeviceDefaults = false, preferredOutputType = FMOD_OUTPUTTYPE_AUTODETECT) attempt with hardAudioDisable: false
[AudioManager] Setting output to FMOD_OUTPUTTYPE_AUTODETECT
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\threadpoolwinrt.dll'. 
[AudioManager] InitNormal succeeded with output "FMOD_OUTPUTTYPE_WASAPI". Driver name is "Speakers (Intel SST Audio Device (WDM))". Speaker mode is "FMOD_SPEAKERMODE_STEREO"
The thread 0x116c has exited with code 0 (0x0).
The thread 0x14a8 has exited with code 0 (0x0).
D3D11 device created for Microsoft Media Foundation video decoding.
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Gaming.Input.dll'. 
onecoreuap\xbox\devices\api\winrt\pnpapiwrapper.cpp(385)\Windows.Gaming.Input.dll!7165FE1B: (caller: 71662CD3) ReturnHr(1) tid(f2c) 8685C003 [0.002097 / 21.552707] - AppCallbacks::SetupInputEvents
onecoreuap\xbox\devices\api\winrt\pnpapiwrapper.cpp(385)\Windows.Gaming.Input.dll!7165FE1B: (caller: 71662CD3) ReturnHr(27) tid(f2c) 8685C003 'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Devices.Sensors.dll'. 
onecoreuap\xbox\devices\api\winrt\pnpapiwrapper.cpp(385)\Windows.Gaming.Input.dll!7165FE1B: (caller: 71662CD3) ReturnHr(28) tid(f2c) 8685C003 'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\biwinrt.dll'. 
onecoreuap\xbox\devices\api\winrt\pnpapiwrapper.cpp(385)\Windows.Gaming.Input.dll!7165FE1B: (caller: 71662CD3) ReturnHr(36) tid(f2c) 8685C003 Exception thrown at 0x76F63C22 (KernelBase.dll) in MachineViewer_x86.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!5ED337FD: (caller: 5ED3281F) Exception(1) tid(10ac) 80040111 ClassFactory cannot supply requested class
Exception thrown at 0x76F63C22 in MachineViewer_x86.exe: Microsoft C++ exception: wil::ResultException at memory location 0x014FDA28.
Exception thrown at 0x76F63C22 in MachineViewer_x86.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\simpleorientation.cpp(127)\Windows.Devices.Sensors.dll!5ED31ED7: (caller: 5ED2BA2C) Exception(2) tid(10ac) 80070490 Element not found.
Exception thrown at 0x76F63C22 in MachineViewer_x86.exe: Microsoft C++ exception: wil::ResultException at memory location 0x014FDC70.
onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\internal\sensorserver.cpp(46)\Windows.Devices.Sensors.dll!5ED28991: (caller: 5ED25D68) ReturnHr(1) tid(10ac) 80070490 Element not found.
onecoreuap\drivers\mobilepc\sensors\convergence\api\winrt\public\lib\simpleorientationsensor.cpp(160)\Windows.Devices.Sensors.dll!5ED8C95D: (caller: 5ED8AE39) ReturnHr(2) tid(10ac) 80070490 Element not found.
[0.252611 / 21.805697] - AppCallbacks::SetupOrientationSensorEvents
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\windows.applicationmodel.datatransfer.dll'.  
[0.446001 / 21.927334] - AppCallbacks::Load
[19.601875 / 21.929364] - Starting first scene loading
The following GlobalManagers were stripped from the build (Either because they're not used or not supported on this platform):
  ClusterInputManager
  UnityConnectSettings
Begin showing splash screen.
[2.030278 / 23.959642] - Finishing first scene loading
UnloadTime: 20.546600 ms
[0.212036 / 24.171678] - First level loaded
[0.001804 / 24.173482] - PerformUpdateAndRender started
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Media.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\MFCaptureEngine.dll'.  
Exception thrown at 0x76F63C22 (KernelBase.dll) in MachineViewer_x86.exe: 0x40080202: WinRT transform error (parameters: 0x8000000B, 0x80070490, 0x00000014, 0x010FE0C0).
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\policymanager.dll'.  
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Mirage.dll'. 
wil(439)\Windows.Mirage.dll!6F46CF6F: (caller: 6F46CD94) ReturnHr(1) tid(11e4) 80070005 Access is denied.
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\igfx11cmrt32.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Program Files\Intel\Media SDK\libmfxhw32.dll'. 
The thread 0x8e0 has exited with code 13430019 (0xcced03).
The thread 0x1154 has exited with code 13430018 (0xcced02).
The thread 0x1304 has exited with code 13430016 (0xcced00).
'MachineViewer_x86.exe' (Win32): Unloaded 'C:\Program Files\Intel\Media SDK\libmfxhw32.dll'
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\CoreMmRes.dll'. Module was built without symbols.
'MachineViewer_x86.exe' (Win32): Unloaded 'C:\Windows\System32\CoreMmRes.dll'
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\CoreMmRes.dll'. Module was built without symbols.
'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\mfsensorgroup.dll'. 
Exception thrown at 0x76F63C22 (KernelBase.dll) in MachineViewer_x86.exe: WinRT originate error - 0xC00DABE0 : 'No capture devices are available.'.
No attributes 17
Attr: {1652C33D-D6B2-4012-B834-72030849A37D} - 5497558139600
Attr: {20332624-FB0D-4D9E-BD0D-CBF6786C102E} - 331776000
Attr: {48EBA18E-F8C9-4687-BF11-0A74C9F96A8F} - {73646976-0000-0010-8000-00AA00389B71}
Attr: {490CF017-890A-425A-B32C-6ED0E1424C06} BLOB - 401b5663
Attr: {644B4E48-1E02-4516-B0EB-C01CA9D49AC6} - 1280
Attr: {73D1072D-1870-4174-A063-29FF4FF6C11E} - {05589F80-C356-11CE-BF01-00AA0055595A}
Attr: {9BCFC0A6-9C41-460D-84DB-4C6E4D531BB4} - {FB6C4282-0353-11D1-905F-0000C0CC16BA}
Attr: {B8EBEFAF-B718-4E04-B0A9-116775E3321B} - 1
Attr: {C21B8EE5-B956-4071-8DAF-325EDF5CAB11} - 1
Attr: {C459A2E8-3D2C-4E44-B132-FEE5156C7BB0} - 128849018881
Attr: {C6376A1E-8D0A-4027-BE45-6D9A0AD39BB6} - 4294967297
Attr: {C9173739-5E56-461C-B713-46FB995CB95F} - 1
Attr: {D2E7558C-DC1F-403F-9A72-D28BB1EB3B5E} - 128849018881
Attr: {DAD3AB78-1990-408B-BCE2-EBA673DACC10} - 1382400
Attr: {E2724BB8-E676-4806-B4B2-A8D6EFB44CCD} - 2
Attr: {E3371D41-B4CF-4A05-BD4E-20B88BB2C4D6} - 128849018881
Attr: {F7E34C9A-42E8-4714-B74B-CB29D72C35E5} - {3231564E-0000-0010-8000-00AA00389B71}
VideoMediaSink.cpp:586 (Webcam::VideoMediaSink::GetStreamSinkById@0314E5F0) FAILED hr=c00d36b3
Exception thrown at 0x76F63C22 (KernelBase.dll) in MachineViewer_x86.exe: WinRT originate error - 0xC00D36B3 : 'The stream number provided was invalid.'.
webcam width and heightg after Play()1280x720
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
ArucoMarkerDetection:Start()
 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
No camera Playing
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
ArucoMarkerDetection:Update()
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
textVal : 0
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
ArucoMarkerDetection:ChangeText(String)
ArucoMarkerDetection:Update()
 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

'MachineViewer_x86.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Perception.Stub.dll'. 
End showing splash screen.
Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.Dropping touch event part of canceled gesture.'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\UnityCVWin32.dll'. Symbols loaded.
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_core450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_videoio450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_aruco450.dll'. 
'MachineViewer_x86.exe' (Win32): Loaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_imgproc450.dll'. 
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_videoio450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_imgproc450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_core450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\opencv_aruco450.dll'
'MachineViewer_x86.exe' (Win32): Unloaded 'U:\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Debug_Win32.spandana\UnityCVWin32.dll'
Exception thrown at 0x76F63C22 in MachineViewer_x86.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x0220EBA0.
DllNotFoundException: Unable to load DLL 'UnityCVWin32': The specified module could not be found.
  at MarkersDetection.detectAruco (System.Int32& outArucoID, System.Int32& arraySize, UnityEngine.Color32[]& rawImg, System.Int32 width, System.Int32 height) [0x00000] in <00000000000000000000000000000000>:0 
  at ArucoMarkerDetection.Update () [0x00000] in <00000000000000000000000000000000>:0 
(Filename: currently not available on il2cpp Line: -1)
[27.813774 / 51.987256] - OnSuspending event.
[0.037689 / 52.024946] - OnWindowActivated event - Deactivated.
Trimming D3D resources.
The thread 0x1210 has exited with code 0 (0x0).
The thread 0x1238 has exited with code 0 (0x0).
wil(439)\Windows.Mirage.dll!6F46CF6F: (caller: 6F46CD94) ReturnHr(2) tid(11e4) 80070005 Access is denied.
Exception thrown at 0x76F63C22 (KernelBase.dll) in MachineViewer_x86.exe: 0x000006B5: The interface is unknown.
The thread 0x1130 has exited with code 0 (0x0).
wil(439)\Windows.Mirage.dll!6F46CF6F: (caller: 6F46CD94) ReturnHr(3) tid(11e4) 80070005 Access is denied.
The thread 0xcb4 has exited with code 0 (0x0).
Exception thrown at 0x76F63C22 (KernelBase.dll) in MachineViewer_x86.exe: 0x000006B5: The interface is unknown.
The thread 0x2a0 has exited with code 0 (0x0).
The thread 0x1764 has exited with code 0 (0x0).
The program '[404] MachineViewer_x86.exe' has exited with code 1 (0x1).

In error log , you can see the dlls are loaded and then unloaded.Also some error like : WinRT: Capture device not available, Creating C:/Data folder failed, Camera is not Playing dlls are loaded and unloaded without any reason ..which does not make sense.

I have tried to work this on a month but alas cannot find anything which worked for me.Everywhere it is suggested to use another nuget package which is very old.

I also tried a simple example without using camera.It just adds two numbers in C++ and sends to Unity C#. It too has same error logs and shows the same error DLLNotFoundException for UnityCVWin32.dll.

I really appreciate any help I can get. Sorry if the question is very long .But I thought it is imp to show in detail.

Unity version : 2020.1.17f1 HoloLens 1 Visual Studio: Community 2019

c#
c++
opencv
unity3d
hololens
asked on Stack Overflow May 13, 2021 by panda14 • edited May 13, 2021 by SE_net4 the downvoter

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0