比较提交

...
此合并请求有变更与目标分支冲突。
/com.unity.perception/CHANGELOG.md
/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs

2 次代码提交

共有 2 个文件被更改,包括 3 次插入26 次删除
  1. 28
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
  2. 1
      com.unity.perception/CHANGELOG.md

28
com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs


using (s_WriteFrame.Auto())
{
var dataColorBuffer = (byte[])r.data.colorBuffer;
if (flipY)
FlipImageY(dataColorBuffer, height);
byte[] encodedData;
using (s_EncodeAndSave.Auto())
{

}
};
CaptureCamera.Capture(cam, colorFunctor);
CaptureCamera.Capture(cam, colorFunctor, flipY: flipY);
Profiler.EndSample();
}

#else
return false;
#endif
}
static unsafe void FlipImageY(byte[] dataColorBuffer, int height)
{
using (s_FlipY.Auto())
{
var stride = dataColorBuffer.Length / height;
var buffer = new NativeArray<byte>(stride, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
fixed(byte* colorBufferPtr = &dataColorBuffer[0])
{
var unsafePtr = (byte*)buffer.GetUnsafePtr();
for (var row = 0; row < height / 2; row++)
{
var nearRowStartPtr = colorBufferPtr + stride * row;
var oppositeRowStartPtr = colorBufferPtr + stride * (height - row - 1);
UnsafeUtility.MemCpy(unsafePtr, oppositeRowStartPtr, stride);
UnsafeUtility.MemCpy(oppositeRowStartPtr, nearRowStartPtr, stride);
UnsafeUtility.MemCpy(nearRowStartPtr, unsafePtr, stride);
}
}
buffer.Dispose();
}
}
void OnSimulationEnding()

1
com.unity.perception/CHANGELOG.md


### Removed
### Fixed
Fixed bug that prevented RGB captures to be written out to disk
### Security
正在加载...
取消
保存