add stuff true streaming
This commit is contained in:
@@ -102,14 +102,15 @@ class VR180StreamingProcessor:
|
||||
self.initialize()
|
||||
self.start_time = time.time()
|
||||
|
||||
# Initialize SAM2 states for both eyes
|
||||
# Initialize SAM2 states for both eyes (streaming mode - no video loading)
|
||||
print("🎯 Initializing SAM2 streaming states...")
|
||||
video_info = self.frame_reader.get_video_info()
|
||||
left_state = self.sam2_processor.init_state(
|
||||
self.config.input.video_path,
|
||||
video_info,
|
||||
eye='left'
|
||||
)
|
||||
right_state = self.sam2_processor.init_state(
|
||||
self.config.input.video_path,
|
||||
video_info,
|
||||
eye='right'
|
||||
)
|
||||
|
||||
@@ -158,19 +159,19 @@ class VR180StreamingProcessor:
|
||||
|
||||
print(f" Detected {len(detections)} person(s) in first frame")
|
||||
|
||||
# Add detections to both eyes
|
||||
self.sam2_processor.add_detections(left_state, detections, frame_idx=0)
|
||||
# Add detections to both eyes (streaming - pass frame data)
|
||||
self.sam2_processor.add_detections(left_state, left_eye, detections, frame_idx=0)
|
||||
|
||||
# Transfer detections to slave eye
|
||||
transferred_detections = self.stereo_manager.transfer_detections(
|
||||
detections,
|
||||
'left_to_right' if self.stereo_manager.master_eye == 'left' else 'right_to_left'
|
||||
)
|
||||
self.sam2_processor.add_detections(right_state, transferred_detections, frame_idx=0)
|
||||
self.sam2_processor.add_detections(right_state, right_eye, transferred_detections, frame_idx=0)
|
||||
|
||||
# Process and write first frame
|
||||
left_masks = self.sam2_processor._propagate_single_frame(left_state, left_eye, 0)
|
||||
right_masks = self.sam2_processor._propagate_single_frame(right_state, right_eye, 0)
|
||||
left_masks = self.sam2_processor.propagate_single_frame(left_state, left_eye, 0)
|
||||
right_masks = self.sam2_processor.propagate_single_frame(right_state, right_eye, 0)
|
||||
|
||||
# Apply masks and write
|
||||
processed_frame = self._apply_masks_to_frame(first_frame, left_masks, right_masks)
|
||||
@@ -195,10 +196,9 @@ class VR180StreamingProcessor:
|
||||
# Split into eyes
|
||||
left_eye, right_eye = self.stereo_manager.split_frame(frame)
|
||||
|
||||
# Propagate masks for both eyes
|
||||
left_masks, right_masks = self.sam2_processor.propagate_frame_pair(
|
||||
left_state, right_state, left_eye, right_eye, frame_idx
|
||||
)
|
||||
# Propagate masks for both eyes (streaming approach)
|
||||
left_masks = self.sam2_processor.propagate_single_frame(left_state, left_eye, frame_idx)
|
||||
right_masks = self.sam2_processor.propagate_single_frame(right_state, right_eye, frame_idx)
|
||||
|
||||
# Validate stereo consistency
|
||||
right_masks = self.stereo_manager.validate_masks(
|
||||
|
||||
Reference in New Issue
Block a user