-
-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directly using the pointer of source texture #435
Comments
It's a bit difficult to answer while I don't know what does not work how. MediaPipeUnityPlugin/Assets/Mediapipe/Samples/Common/Scripts/GraphRunner.cs Lines 157 to 161 in c4de7fd
MediaPipeUnityPlugin/Assets/Mediapipe/Samples/Common/Scripts/ImageSource/TextureFrame.cs Line 222 in c4de7fd
I think what you really want to know is why
Why Texture is Copied?It's because the sample app does not manage the source texture (e.g. OpenGL texture that Why Texture is Copied on CPU?Actually, it's not necessary, and you can copy it on GPU as long as the graphics API is OpenGL ES, but in that case, the input (image) and the output can be out of sync. You can test it by calling MediaPipeUnityPlugin/Assets/Mediapipe/Samples/Common/Scripts/ImageSource/TextureFrame.cs Lines 112 to 119 in c4de7fd
|
Thank you so much for the quick reply! I really appreciate it.
I guess this would be very hard,, Now I understand why you copied a texture. I tried to use CopyTexture, but I've got an error that the input source (AR Camera)'s texture and the However, Anyways, thank you so much for the advice and I will let you know if I find an efficient way to bypass the |
Aren't MediaPipeUnityPlugin/Assets/Mediapipe/Samples/Scenes/Holistic/HolisticTrackingSolution.cs Line 128 in c4de7fd
|
Yes! But I think it is issue in the AR camera (the camera source that I'm currently using). It's width and height are flipped by some reason. Thank you for checking! |
Description
Hi Homuler! Thank you so much for the amazing work!
I'm using your UnityPlugin in my Android project and want to improve the performance to support low-end devices.
While I was profiling my Unity project with Android target, I found that the function
ReadFromImageSource
takes quite long (~7ms). (FYI. I am usingHolisticTracking
model)Since I am using AR Camera as well, I had to use
Texture
as a source ofTextureFrame
.I found that in a
TextureFrame
, it copies the source texture to theTextureFrame
's texture and then hand over the pointer to the gpu throughGlTextureBuffer
MediaPipeUnityPlugin/Assets/Mediapipe/Samples/Common/Scripts/ImageSource/TextureFrame.cs
Lines 136 to 140 in ea587cf
MediaPipeUnityPlugin/Assets/Mediapipe/Samples/Common/Scripts/ImageSource/TextureFrame.cs
Lines 341 to 364 in ea587cf
However, since I already had the
Texture
, I thought copying the texture again is unnecessary.So, I tried to use
texture.GetNativeTexturePtr()
directly as atarget
argument ofGlTextureBuffer
, but it didn't work.So my question is, is it possible to directly use the
Texture
's pointer as an input ofGlTextureBuffer
without copying to theTextureFrame
's texture?I suspect that there should be a reason you did
GetPixel32
andSetPixel32
, could you explain it?Thank you so much for your time!
The text was updated successfully, but these errors were encountered: