1
我试图让Tango的相机流将自制的AR套件与探戈相结合。获取Tango的相机流数据
我被卡在Tango的编辑器模拟中一切按预期工作的地步,但没有推送到平板电脑。
我正在使用的代码如下:
YUVTexture yuvTexture = m_tangoApplication.GetVideoOverlayTextureYUV();
Texture2D yTexture = yuvTexture.m_videoOverlayTextureY;
// m_videoOverlayTextureCr is not used by Tango yet for some reason
Texture2D uvTexture = yuvTexture.m_videoOverlayTextureCb;
// convert from YV12 to RGB
for (int i = 0; i < yTexture.height; ++i)
{
for (int j = 0; j < yTexture.width; ++j)
{
Color yPixel = yTexture.GetPixel(j, i);
Color uvPixel = uvTexture.GetPixel(j, i);
m_texture.SetPixel(4 * j + 0, yTexture.height - i - 1, YUV2Color(yPixel.r, uvPixel.r, uvPixel.g));
m_texture.SetPixel(4 * j + 1, yTexture.height - i - 1, YUV2Color(yPixel.g, uvPixel.r, uvPixel.g));
m_texture.SetPixel(4 * j + 2, yTexture.height - i - 1, YUV2Color(yPixel.b, uvPixel.b, uvPixel.a));
m_texture.SetPixel(4 * j + 3, yTexture.height - i - 1, YUV2Color(yPixel.a, uvPixel.b, uvPixel.a));
}
}
YUV2Color(从探戈的YUV2RGB着色器中提取):
public static Color YUV2Color(float y_value, float u_value, float v_value)
{
float r = y_value + 1.370705f * (v_value - 0.5f);
float g = y_value - 0.698001f * (v_value - 0.5f) - (0.337633f * (u_value - 0.5f));
float b = y_value + 1.732446f * (u_value - 0.5f);
return new Color(r, g, b, 1f);
}
是不是有人已经解决了这个问题?我见过很多职位有关它的时候ITangoVideoOverlay大部分是使用,但没有与当前IExperimentalTangoVideoOverlay
我已经尝试了很多事情,到目前为止,它一直是我得到的最接近以我的预期...任何帮助将不胜感激。