Skip to content

Commit 0e2908e

Browse files
authored
Merge pull request #181 from Unity-Technologies/fix_intance_seg_capture
Fixed instance segmentation labeler capturing on every frame
2 parents 641c9c3 + a3ea228 commit 0e2908e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

com.unity.perception/Runtime/GroundTruth/Labelers/InstanceSegmentationLabeler.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,17 @@ void OnRenderedObjectInfosCalculated(int frame, NativeArray<RenderedObjectInfo>
117117
}
118118
}
119119

120-
void OnImageCaptured(int frame, NativeArray<Color32> data, RenderTexture renderTexture)
120+
void OnImageCaptured(int frameCount, NativeArray<Color32> data, RenderTexture renderTexture)
121121
{
122+
if (!m_AsyncAnnotations.ContainsKey(frameCount))
123+
return;
124+
122125
using (s_OnImageReceivedCallback.Auto())
123126
{
124127
m_CurrentTexture = renderTexture;
125128

126-
m_InstancePath = $"{k_Directory}/{k_FilePrefix}{frame}.png";
127-
var localPath = $"{Manager.Instance.GetDirectoryFor(k_Directory)}/{k_FilePrefix}{frame}.png";
129+
m_InstancePath = $"{k_Directory}/{k_FilePrefix}{frameCount}.png";
130+
var localPath = $"{Manager.Instance.GetDirectoryFor(k_Directory)}/{k_FilePrefix}{frameCount}.png";
128131

129132
var colors = new NativeArray<Color32>(data, Allocator.TempJob);
130133

0 commit comments

Comments
 (0)