HoloLensARToolKit icon indicating copy to clipboard operation
HoloLensARToolKit copied to clipboard

Any method to get RGB video stream in HL2?

Open whirwind opened this issue 4 years ago • 8 comments

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

whirwind avatar Nov 17 '20 20:11 whirwind

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

qian256 avatar Nov 28 '20 15:11 qian256

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.

zxzkf1992 avatar May 13 '21 09:05 zxzkf1992

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.

qian256 avatar May 14 '21 00:05 qian256

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 avatar May 14 '21 02:05 zxzkf1992

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.

zxzkf1992 avatar May 14 '21 05:05 zxzkf1992

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

qian256 avatar May 14 '21 16:05 qian256

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 avatar May 17 '21 00:05 zxzkf1992

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 !

zxzkf1992 avatar May 21 '21 07:05 zxzkf1992