Skip to content

Commit cbcf425

Browse files
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
1 parent 223443e commit cbcf425

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

com.unity.perception/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,14 @@ Moved the various forms of ground truth from PerceptionCamera into various subcl
1313
Renamed SimulationManager to DatasetCapture.
1414
Changed Semantic Segmentation to take a SemanticSegmentationLabelConfig, which maps labels to color pixel values.
1515

16+
### Deprecated
17+
18+
### Removed
19+
20+
### Fixed
21+
Fixed bug that prevented RGB captures to be written out to disk
22+
23+
### Security
24+
1625
## [0.1.0] - 2020-06-24
1726
### This is the first release of the _Perception_ package

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

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ void CaptureRgbData(Camera cam)
171171
using (s_WriteFrame.Auto())
172172
{
173173
var dataColorBuffer = (byte[])r.data.colorBuffer;
174-
if (flipY)
175-
FlipImageY(dataColorBuffer, height);
176-
174+
177175
byte[] encodedData;
178176
using (s_EncodeAndSave.Auto())
179177
{
@@ -184,7 +182,7 @@ void CaptureRgbData(Camera cam)
184182
}
185183
};
186184

187-
CaptureCamera.Capture(cam, colorFunctor);
185+
CaptureCamera.Capture(cam, colorFunctor, flipY: flipY);
188186

189187
Profiler.EndSample();
190188
}
@@ -205,28 +203,6 @@ bool ShouldFlipY(Camera camera)
205203
#endif
206204
}
207205

208-
static unsafe void FlipImageY(byte[] dataColorBuffer, int height)
209-
{
210-
using (s_FlipY.Auto())
211-
{
212-
var stride = dataColorBuffer.Length / height;
213-
var buffer = new NativeArray<byte>(stride, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
214-
fixed(byte* colorBufferPtr = &dataColorBuffer[0])
215-
{
216-
var unsafePtr = (byte*)buffer.GetUnsafePtr();
217-
for (var row = 0; row < height / 2; row++)
218-
{
219-
var nearRowStartPtr = colorBufferPtr + stride * row;
220-
var oppositeRowStartPtr = colorBufferPtr + stride * (height - row - 1);
221-
UnsafeUtility.MemCpy(unsafePtr, oppositeRowStartPtr, stride);
222-
UnsafeUtility.MemCpy(oppositeRowStartPtr, nearRowStartPtr, stride);
223-
UnsafeUtility.MemCpy(nearRowStartPtr, unsafePtr, stride);
224-
}
225-
}
226-
buffer.Dispose();
227-
}
228-
}
229-
230206
void OnSimulationEnding()
231207
{
232208
CleanUpInstanceSegmentation();

0 commit comments

Comments
 (0)