浏览代码

updated code to use capture camera flipy and removed perception flip … (#35)

* updated code to use capture camera flipy and removed perception flip y code

* updated changelog for bug fix
/0.2.0-staging
GitHub 4 年前
当前提交
33a18d6c
共有 2 个文件被更改,包括 11 次插入26 次删除
  1. 9
      com.unity.perception/CHANGELOG.md
  2. 28
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs

9
com.unity.perception/CHANGELOG.md


Renamed SimulationManager to DatasetCapture.
Changed Semantic Segmentation to take a SemanticSegmentationLabelConfig, which maps labels to color pixel values.
### Deprecated
### Removed
### Fixed
Fixed bug that prevented RGB captures to be written out to disk
### Security
## [0.1.0] - 2020-06-24
### This is the first release of the _Perception_ package

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()

正在加载...
取消
保存