Skip to content
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

Any method to get RGB video stream in HL2? #56

Open
whirwind opened this issue Nov 17, 2020 · 8 comments
Open

Any method to get RGB video stream in HL2? #56

whirwind opened this issue Nov 17, 2020 · 8 comments

Comments

@whirwind
Copy link

Hello,

I noticed that in v0.3 feature grayscale is forced. I just need to get the RGB stream and handle every frame in Unity. it that possible?

Thanks

@qian256
Copy link
Owner

qian256 commented Nov 28, 2020

For sure it is possible, you can look at the difference between v0.2 <-> v0.2 feature-grayscale, and apply back. It is mainly OnFrameArrived method and some settings of ARToolKit

@zxzkf1992
Copy link

For sure it is possible, you can look at the difference between v0.2 <-> v0.2 feature-grayscale, and apply back. It is mainly OnFrameArrived method and some settings of ARToolKit

Can you describe in detail how to obtain HL2 RGB stream in v0.3? I have tried to modify the source code of V0.3 (refer to the difference between v0.2 and v0.2 GrayScale). But still unable to get the RGB stream. And whenever I set the size of the framedata to four times the original size, an error occurs, causing the program to crash.

@qian256
Copy link
Owner

qian256 commented May 14, 2021

The stream is always NV12, and in current implementation, we grab the grayscale part of NV12 image. To obtain RGB image, you need to conver the NV12 to RGB using UWP API SoftwareBitmap::Convert(), then you can access the pixel data.

@zxzkf1992
Copy link

The stream is always NV12, and in current implementation, we grab the grayscale part of NV12 image. To obtain RGB image, you need to conver the NV12 to RGB using UWP API SoftwareBitmap::Convert(), then you can access the pixel data.

Thank you so much for your quick reply. I have used this function before,

var softwareBitmap = SoftwareBitmap.Convert(frame.VideoMediaFrame.SoftwareBitmap, BitmapPixelFormat.Rgba8, BitmapAlphaMode.Ignore);

I still haven't got the RGB stream of HL2, but you have given me a certain direction and I will continue to try.

@zxzkf1992
Copy link

The stream is always NV12, and in current implementation, we grab the grayscale part of NV12 image. To obtain RGB image, you need to conver the NV12 to RGB using UWP API SoftwareBitmap::Convert(), then you can access the pixel data.

As you said, v0.3 only got the gray scale part of NV12. Does it mean that frameData only stores gray scale data? Because I did not see the relevant code to obtain the gray scale in the OnFrameArrived method.

@qian256
Copy link
Owner

qian256 commented May 14, 2021

HL2 has no RGB stream, only NV12 stream. In order to get RGB image, you can convert it using SoftwareBitmap API

@zxzkf1992
Copy link

HL2 has no RGB stream, only NV12 stream. In order to get RGB image, you can convert it using SoftwareBitmap API

Thank you for your help, I have got the RGB image data of HL2.

@zxzkf1992
Copy link

HL2 has no RGB stream, only NV12 stream. In order to get RGB image, you can convert it using SoftwareBitmap API

hello, I found that v0.3 does not support the ARM (32-bit) platform. Is there an ARToolKitUWP.dll for this platform? Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants