Hello,
Is it intended or a bug? Changing it to RGB to render the color map is proving to be very expensive.
Hi ashish,
This bug (which is only in C++ API) will be fixed in the next release.
Hi Olga,
Do we have any timeline to the next release ?
Westa
private void ColorSensor_OnUpdateEvent(ColorFrame frame)
{
if (frame != null)
{
if (frame.Timestamp != previousTimestamp)
{
previousTimestamp = frame.Timestamp;
if (texture == null)
{
texture = new Texture2D(frame.Cols, frame.Rows, TextureFormat.RGB24, false);
colorData = new byte[frame.Cols * frame.Rows * 3];
cameraPreview.texture = texture;
}
int index = 0;
for (int i = 0; i < frame.Rows; i++)
{
for (int j = 0; j < frame.Cols; j++)
{
Color3 color = frame.GetAt(i, j);
colorData[index + 0] = (byte)(color.Red);
colorData[index + 1] = (byte)(color.Green);
colorData[index + 2] = (byte)(color.Blue);
index += 3;
}
}
texture.LoadRawTextureData(colorData);
texture.Apply();
}
}
}