Skip to main content

associate_ocr_with_layout

Function associate_ocr_with_layout 

Source
pub fn associate_ocr_with_layout(
    ocr_boxes: &[BoundingBox],
    layout_regions: &[BoundingBox],
    flag_within: bool,
    threshold: f32,
) -> LayoutOCRAssociation
Expand description

Associate OCR results with layout regions.

This function filters OCR boxes based on whether they are within or outside the specified layout regions.

This follows standard region association implementation.

§Arguments

  • ocr_boxes - Slice of OCR bounding boxes
  • layout_regions - Slice of layout region bounding boxes
  • flag_within - If true, return boxes within regions; if false, return boxes outside regions
  • threshold - Minimum intersection dimension for overlap detection

§Returns

LayoutOCRAssociation containing matched and unmatched indices