Open
Conversation
Reviewer's GuideAdds recording of an overlay video alongside raw video when record_raw is enabled, changes overlay rendering to focus on tracker center and matched detector/EKF faces, introduces optional drawing of full model-completed faces, and records detailed candidate selection items to a new TSV for auditability. Sequence diagram for frame processing and overlay video recordingsequenceDiagram
participant Camera
participant VisionPreview
participant RawVideoWriter as RawVideo
participant OverlayVideoWriter as OverlayVideo
participant PreviewWindow as Preview
Camera->>VisionPreview: OnImage(bgr, snapshot)
alt RecordEnabled
VisionPreview->>VisionPreview: WriteRawVideo(bgr)
VisionPreview->>RawVideoWriter: write(raw.avi)
end
VisionPreview->>VisionPreview: RecordEnabled()
VisionPreview->>VisionPreview: OverlayEnabled()
alt !realtime_preview_enabled and not(RecordEnabled and OverlayEnabled)
VisionPreview-->>Camera: return (no overlay, no preview)
else proceed
VisionPreview->>VisionPreview: DrawDetector(canvas, snapshot.detector, snapshot.candidate)
VisionPreview->>VisionPreview: DrawTracker(canvas, snapshot.ekf, snapshot.detector, snapshot.candidate)
VisionPreview->>VisionPreview: DrawStatus(canvas, timestamp_us, snapshot)
alt RecordEnabled and OverlayEnabled
VisionPreview->>VisionPreview: WriteOverlayVideo(canvas)
VisionPreview->>OverlayVideoWriter: write(overlay.avi)
end
alt !realtime_preview_enabled
VisionPreview-->>Camera: return (recording only)
else preview_enabled
VisionPreview->>VisionPreview: scale canvas if preview_scale != 1.0
VisionPreview->>PreviewWindow: imshow(preview_window_name)
PreviewWindow->>VisionPreview: waitKey(preview_wait_key_ms)
end
end
Class diagram for updated VisionPreview overlay recording and candidate loggingclassDiagram
class VisionPreview {
+bool RecordEnabled()
+bool OverlayEnabled()
+void RegisterCallbacks()
+void DrawDetector(cv::Mat& canvas, DetectorMessage& detector, CandidateDebugMessage* candidate)
+void DrawTracker(cv::Mat& canvas, EkfPointsMessage& ekf, DetectorMessage* detector, CandidateDebugMessage* candidate)
+void DrawMatchedEkfFaces(cv::Mat& canvas, EkfPointsMessage& ekf, DetectorMessage* detector, CandidateDebugMessage* candidate)
+bool ProjectPoint(cv::Mat& canvas, LibXR::Position~double~& point, cv::Point2d& uv)
+std::array~int, kMaxDetections~ MatchedFaces(CandidateDebugMessage* candidate)
+void InitRecordFiles()
+void WriteRawVideo(cv::Mat& bgr)
+void WriteOverlayVideo(cv::Mat& bgr)
+void WriteRecords(vector~DetectorMessage~& detector_records, vector~DetectorMetrics~& metrics_records, vector~TargetMessage~& target_records, vector~EkfPointsMessage~& ekf_records, vector~CandidateDebugMessage~& candidate_records)
+void FlushRecordFiles()
-std::string image_topic_name_
-std::string output_dir_
-std::string raw_video_name_
-std::string overlay_video_name_
-std::string preview_window_name_
-std::ofstream detector_file_
-std::ofstream metrics_file_
-std::ofstream target_file_
-std::ofstream ekf_file_
-std::ofstream candidate_file_
-std::ofstream candidate_items_file_
-cv::VideoWriter raw_writer_
-cv::VideoWriter overlay_writer_
-bool raw_writer_ready_
-bool overlay_writer_ready_
-bool record_ready_
}
class OverlayConfig {
+bool detector
+bool tracker
+bool candidate_debug
+bool model_faces
}
class RuntimeParam {
+OverlayConfig overlay
+std::string_view output_dir
+std::string_view raw_video_name
+std::string_view overlay_video_name
+std::string_view preview_window_name
+double preview_scale
+int preview_wait_key_ms
+bool enabled
+bool record_raw
+bool realtime_preview
+int record_fps
}
class CandidateDebugMessage {
<<struct>>
+static uint8_t kMaxDetections
+static uint8_t kMaxItems
+uint64_t image_timestamp_us
+uint8_t count
+uint8_t selected_index
+uint8_t matched
+uint8_t detection_count
+uint8_t tracked_armors_num
+CandidateItem items[kMaxItems]
}
class CandidateItem {
<<struct>>
+uint8_t armor_index
+int8_t face_index
+bool same_number
+int32_t image_track_id
+bool image_track_confirmed
+uint8_t number
+uint8_t type
+float score
+float position_diff
+float yaw_diff
+float center_x
+float center_y
+float predicted_yaw
+float measured_yaw
}
class EkfPointsMessage {
<<struct>>
+uint8_t count
+bool valid[5]
+LibXR::Position~double~ center_cam
+LibXR::Position~double~ armors_cam[4]
}
class DetectorMessage {
<<struct>>
+vector~ArmorDetection~ results
}
class ArmorDetection {
<<struct>>
+int color
+std::array~cv::Point,4~ points
+cv::Rect box
+cv::Point2f center
+int number
+float confidence
}
VisionPreview --> OverlayConfig : uses overlay
VisionPreview --> RuntimeParam : constructed_from
VisionPreview --> CandidateDebugMessage : reads_for_debug
CandidateDebugMessage --> CandidateItem : aggregates
VisionPreview --> EkfPointsMessage : visualizes_tracker
VisionPreview --> DetectorMessage : visualizes_detector
DetectorMessage --> ArmorDetection : contains
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
overlay.avialongsideraw.aviwhenrecord_rawis enabledoverlay.model_facesfor explicit model-face debug renderingcandidate_items.tsvso tracker-selected detector observations can be audited quantitativelyValidation
Artifacts:
/root/codex/runs/visionpreview_matchedface_validate_20260430T0516Zand/root/codex/runs/visionpreview_hik_build_20260430T0520ZSummary by Sourcery
Record a tracker overlay video alongside raw video and enrich tracker/detector visualization and logging for better debugging and quantitative analysis.
New Features:
Enhancements:
Documentation: