Comments (10)
您是否尝试过使用
DUMPBIN /exports my.dll
以获取正确的入口点?
这给你这样的东西:[DllImport("my.dll", EntryPoint = "?InitSensors@DllExports@@SAXXZ")] public static extern void initSensors();
First of all, thank you for your reply. I still cannot detect the method in DLL library according to the method you provided.Do you also try to use sensor data from Hololens2ForCV in Unity for your own projects?Can you tell me the complete process?From publishing projects to Hololens and how to build DLL library files.
from hololens2forcv.
您的DLL成功建立了,对吗?你看到#31了吗?我有同样的问题并解决了。您是否将DLL放在了Assets / Plugins文件夹中?
The DLL library I successfully built is a case study in the depth camera project, and my DLL library cannot be used on the journey.
I used the DLL library built into this project.Hope I can help you.https://github.com/petergu684/HoloLens2-ResearchMode-Unity
from hololens2forcv.
Have you tried using DUMPBIN /exports my.dll
to get the correct entry points?
This gives you something like this:
[DllImport("my.dll", EntryPoint = "?InitSensors@DllExports@@SAXXZ")]
public static extern void initSensors();
from hololens2forcv.
您是否尝试过使用
DUMPBIN /exports my.dll
以获取正确的入口点?
这给你这样的东西:[DllImport("my.dll", EntryPoint = "?InitSensors@DllExports@@SAXXZ")] public static extern void initSensors();
First of all, thank you for your reply. I still cannot detect the method in DLL library according to the method you provided.Do you also try to use sensor data from Hololens2ForCV in Unity for your own projects?Can you tell me the complete process?From publishing projects to Hololens and how to build DLL library files.
Hi @RenSiyao ,
yes I use research mode sensor data in Unity, strictly speaking accelerometer and gyro values.
If you haven't already, take a look into #31.
The complete process would be a bit to much but here are the general steps:
- For the DLL I used a VS 2019 C++ DLL project in which I added the research mode api header. then I implemented functions to init the sensors and get their data analogue to the SensorVisualization example. These are my functions declared in the DLL's header:
class DllExports {
public:
DllExport static void InitSensors();
DllExport static void OpenAccSensorStream();
DllExport static void OpenGyroSensorStream();
DllExport static void OpenMagnetSensorStream();
DllExport static void GetAccDataStamped(float& accX, float& accY, float& accZ, UINT64& timestamp);
DllExport static void GetGyroDataStamped(float& gyroX, float& gyroY, float& gyroZ, UINT64& timestamp);
DllExport static void GetMagnetDataStamped(float& magnetX, float& magnetY, float& magnetZ, UINT64& timestamp);
DllExport static SensorDataStruct* GetAccDataBatched();
DllExport static SensorDataStruct* GetGyroDataBatched();
DllExport static SensorDataStruct* GetMagnetDataBatched();
DllExport static void CloseAccSensorStream();
DllExport static void CloseGyroSensorStream();
DllExport static void CloseMagnetSensorStream();
DllExport static void ReleaseSensors();
};
Target platform has to be ARM64.
- I tested my DLL with a C++ UWP app before including it to Unity.
- For Unity I needed the correct entry points of my exported functions. Via the developer command prompt for VS and the command
dumpbin /exports my.dll
you can get them. - Then copy the DLL into your Unity project and import the functions that you want to use in a script:
[DllImport("my.dll", EntryPoint = "?InitSensors@DllExports@@SAXXZ")]
public static extern void initSensors();
...
Here you have to be careful how you pass data from C++ to C#. I solved it with an 'unsafe' block but marshalling can be a way too.
- After the first build you have to modify the Package.appxmanifest as discribet in the ResearchMode API Doc and add
<rescap:Capability Name="perceptionSensorsExperimental" />
. - Research mode must be activated in the Device Portal as described here.
- Finally you can deploy to your HoloLens 2.
I hope that helps a little. Otherwise just feel free to ask.
from hololens2forcv.
@RenSiyao I'm trying to get the StartRecording() and StopRecording() functions incorporated as well but can't get the winrt::Windows library in my DLL. How did you manage to do that? Did you use a Windows Runtime Component format? Thanks, it would help me a lot
from hololens2forcv.
@RenSiyao我正在尝试同时合并StartRecording()和StopRecording()函数,但是无法在我的DLL中获得winrt :: Windows库。您是如何做到的?您是否使用Windows运行时组件格式?谢谢,对我有很大帮助
It's a pity that I can't help you, because my project hasn't been built successfully yet.
from hololens2forcv.
Your DLL built succesfully right? Did you look at #31 ? I had the same problem and solved it. Did you put your DLL in your Assets/Plugins folder?
from hololens2forcv.
I'll look into it and let you know if I can get it to work!
from hololens2forcv.
You can only get one depth sensor data for the DLL library I provided to you. I cannot solve your function problem of StartRecording () and StopRecording () for you.
from hololens2forcv.
@RenSiyao
Your page: https://github.com/petergu684/HoloLens2-ResearchMode-Unity has disappeard.
from hololens2forcv.
Related Issues (20)
- Getting pixels per mm of Depth Camera
- variable sampling frequency of rgb and depth cameras in StreamRecorder application
- CameraWithCVAndCalibration runtime error: Unable to activate Microsoft Store app HOT 3
- Can I get spatial mapping directly from the Research Mode?
- PV camera frame's origin HOT 1
- Interpreting depth camera data
- Samples cannt install after the system is updated HOT 1
- Explanation about vectors in StreamRecorder
- sample code StreamRecorder can compile on unity?
- Low resolution on PV stream HOT 1
- Long Throw mode resolution
- Undistort frames from LF camera
- Any ways to extract the TSDF volume?
- A question about getting the 3D coordinates in world space coordinates system according to a pv image point HOT 1
- HOLOLENS 2 RESEARCH MODE COORDINATE SYSTEM AND ROTOTRANSLATIONS BETWEEN SENSORS
- Low-signal depth mode in the Windows 11 update
- problem with git lfs
- Internal Error when Deploying Sensor Visualization(twinapi.core.dll)
- MediaFrameReader, no FrameArrived callback
- What does head_hand_eye.csv file contains?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hololens2forcv.