Skip to content

Commit

Permalink
fixed masking issue if no mask has yet been detected
Browse files Browse the repository at this point in the history
  • Loading branch information
cansik committed Nov 1, 2024
1 parent 107b4de commit 8020da0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spacestream/SpaceStreamGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ def _process(self):
self.recorder.close()
self.recorder = None

segmentations: Optional[List[vg.InstanceSegmentationResult]] = None
if self.config.masking.value:
segmentations: List[vg.InstanceSegmentationResult] = self.segmentation_network.process(frame)
segmentations = self.segmentation_network.process(frame)
for segment in segmentations:
frame = self.mask_image(frame, segment.mask)

Expand Down Expand Up @@ -277,8 +278,9 @@ def _process(self):
depth_map = cv2.resize(depth_map, (w, h), interpolation=cv2.INTER_AREA)

if self.config.masking.value:
for segment in segmentations:
depth_map = self.mask_image(depth_map, segment.mask)
if segmentations is not None:
for segment in segmentations:
depth_map = self.mask_image(depth_map, segment.mask)

rgbd = np.hstack((depth_map, frame))
else:
Expand Down

0 comments on commit 8020da0

Please sign in to comment.