-
Posts
18 -
Joined
-
Last visited
Content Type
Profiles
Forums
Gallery
Blogs
Events
Store
Downloads
Posts posted by Frank_D
-
-
On 6/11/2021 at 5:23 AM, Slim said:
Hi,
The forum seems not very active. I am also struggling, but maybe what I got so far can help someone.
The problem with OpenCV is that you need the image to be in CPU memory. So first you need to copy it somehow from GPU.
I used AsyncGPUReadbackRequest for it. Now I am stuck on how to Apply this modified Texture back to SRWorks.
Here is my code:
using System.Collections; using System.Collections.Generic; using UnityEngine; using Vive.Plugin.SR; using OpenCvSharp; using UnityEngine.Rendering; public class OpenCVMat : MonoBehaviour { Texture2D left; public Texture2D leftCPU; public Texture2D gray; Texture2D right; int frameIndex; int timeIndex; Matrix4x4 poseLeft; Matrix4x4 poseRight; AsyncGPUReadbackRequest request; private bool initialized; void OnCompleteReadback(AsyncGPUReadbackRequest request) { if (request.hasError) { Debug.Log("GPU readback error detected."); return; } var tex = new Texture2D(ViveSR_DualCameraImageCapture.UndistortedImageWidth, ViveSR_DualCameraImageCapture.UndistortedImageHeight, TextureFormat.RGBA32, false); tex.LoadRawTextureData(request.GetData<uint>()); tex.Apply(); Graphics.CopyTexture(tex, leftCPU); Destroy(tex); } void Update() { if(ViveSR.FrameworkStatus == FrameworkStatus.WORKING) { if (!initialized) { InitTextures(); initialized = true; } if(initialized && request.done) { Mat mat = OpenCvSharp.Unity.TextureToMat(leftCPU); Mat grayMat = new Mat(); Cv2.CvtColor(mat, grayMat, ColorConversionCodes.BGRA2GRAY); gray = OpenCvSharp.Unity.MatToTexture(grayMat); grayMat.Dispose(); mat.Dispose(); ViveSR_DualCameraImageCapture.GetUndistortedTexture(out left, out right, out frameIndex, out timeIndex, out poseLeft, out poseRight); request = AsyncGPUReadback.Request(left, 0, TextureFormat.RGBA32, OnCompleteReadback); } } } void InitTextures() { left = new Texture2D(ViveSR_DualCameraImageCapture.UndistortedImageWidth, ViveSR_DualCameraImageCapture.UndistortedImageHeight, TextureFormat.RGBA32, false); leftCPU = new Texture2D(ViveSR_DualCameraImageCapture.UndistortedImageWidth, ViveSR_DualCameraImageCapture.UndistortedImageHeight, TextureFormat.RGBA32, false); gray = new Texture2D(ViveSR_DualCameraImageCapture.UndistortedImageWidth, ViveSR_DualCameraImageCapture.UndistortedImageHeight, TextureFormat.RGBA32, false); right = new Texture2D(ViveSR_DualCameraImageCapture.UndistortedImageWidth, ViveSR_DualCameraImageCapture.UndistortedImageHeight, TextureFormat.RGBA32, false); } }
Hi~
Thank you for your great work!
Yet this script make the texture transparent and 180 degree rotation.
-
How can we make the PassThrough content as a texture streaming like we use a webcam?
In other words, I want to render the PassThrough to a plane as a texture.
Platform: Unity3D 19, Windows
Device: VIVE pro
-
I am using a VIVE pro which can provide a passthrough view. I am developing a game, but without Unreal or Unity3D.
So we choose to use C++ with SRwork.
However, when we try to write the content of passthrough view, we can only get the first frame.
After 1st frame the res is False ( in res = ViveSR_GetModuleData(ID_PASSTHROUGH, see_through_element.data(), see_through_count);)
Is there anything wrong?
-
OK. I see. Thank you!
Actually, I have dived into Unity3D. Yet your lib is not able to work on my VIVE Cosmos...
Can you give us more instructions?
How can we get the front-facing camera video stream since I wanna develop a AR game. - Vive Cosmos Developer FAQs - Community Forum
-
Hi~May I know how to get the 6DOF estimation data from VIVE COSMOS using C++?
I found there are only materials related to Unity3D and Unreal... So, just wonder how can we get a C++ API.
Thanks!
-
Hi! I am a game developer.
I just bought one eye pro and one VIVE COSMOS. For VIVE COSMOS, I want to develop a game which is a little like the AR game, I need to see the environment around me. How can I get the content of the six cameras on the headset ? the 'content' means the video stream. since I need to detect the objects around me through the video, it is better to be the RGB video.
-
Hi!
I just bought one eye pro and one VIVE COSMOS. For VIVE COSMOS, I want to develop a game which is a little like the AR game, I need to see the environment around me. How can I get the content of the six cameras on the headset ? the 'content' means the video stream. since I need to detect the objects around me through the video, it is better to be the RGB video.
-
Hello, are all the cameras (6) on HTC VIVE cosmic fisheye cameras?
Where can we get the demo video output from the VR? I want to buy one but a little worried about the result.
Which one is the most powerful device for VR?
Many thanks!
Best,
-
Hello, are all the cameras (6) on HTC VIVE cosmic fisheye cameras?
Which one is the most powerful device for VR?
Best,
Can not get the distorted view from SRWork.
in VIVE SRWorks SDK
Posted
ViveSR_DualCameraImageCapture.GetDistortedTexture(out left, out right, out frameIndex, out timeIndex, out poseLeft, out poseRight);
When I try to render the left as a texture2D in Unity3D, there is nothing displayed.
Anyone can help?