src/textord/textlineprojection.cpp
void TextlineProjection::ProjectBlobs(BLOBNBOX_LIST *blobs, const FCOORD &rotation,
                                      const TBOX &nontext_map_box, Image nontext_map) {
  BLOBNBOX_IT blob_it(blobs);
  for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
    BLOBNBOX *blob = blob_it.data();
    TBOX bbox = blob->bounding_box();
    ICOORD middle((bbox.left() + bbox.right()) / 2, (bbox.bottom() + bbox.top()) / 2);
    bool spreading_horizontally = PadBlobBox(blob, &bbox);
    // Rotate to match the nontext_map.
    bbox.rotate(rotation);
    middle.rotate(rotation);
    if (rotation.x() == 0.0f) {
      spreading_horizontally = !spreading_horizontally;
    }
    // Clip to the image before applying the increments.
    bbox &= nontext_map_box; // This is in-place box intersection.
    // Check for image pixels before spreading.
    TruncateBoxToMissNonText(middle.x(), middle.y(), spreading_horizontally, nontext_map, &bbox);
    if (bbox.area() > 0) {
      IncrementRectangle8Bit(bbox);
    }
  }
}
// Inserts a list of blobs into the projection.
// Rotation is a multiple of 90 degrees to get from blob coords to
// nontext_map coords, nontext_map_box is the bounds of the nontext_map.
// Blobs are spread horizontally or vertically according to their internal
// flags, but the spreading is truncated by set pixels in the nontext_map
// and also by the horizontal rule line limits on the blobs.
Inserts a list of blobs into the projection.
Rotation is a multiple of 90 degrees to get from blob coords to
nontext_map coords, nontext_map_box is the bounds of the nontext_map.
Blobs are spread horizontally or vertically according to their internal
flags, but the spreading is truncated by set pixels in the nontext_map
and also by the horizontal rule line limits on the blobs.
Inserts a list of blobs into the projection . Rotation is a multiple of 90 degrees to get from blob coords to nontext_map coords nontext_map_box is the bounds of the nontext_map . Blobs are spread horizontally or vertically according to their internal flags but the spreading is truncated by set pixels in the nontext_map and also by the horizontal rule line limits on the blobs .
void TextlineProjection::ProjectBlobs(BLOBNBOX_LIST *blobs, const FCOORD &rotation,
                                      const TBOX &nontext_map_box, Image nontext_map) {
  BLOBNBOX_IT blob_it(blobs);
  for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
    BLOBNBOX *blob = blob_it.data();
    TBOX bbox = blob->bounding_box();
    ICOORD middle((bbox.left() + bbox.right()) / 2, (bbox.bottom() + bbox.top()) / 2);
    bool spreading_horizontally = PadBlobBox(blob, &bbox);
    bbox.rotate(rotation);
    middle.rotate(rotation);
    if (rotation.x() == 0.0f) {
      spreading_horizontally = !spreading_horizontally;
    }
    bbox &= nontext_map_box; 
    TruncateBoxToMissNonText(middle.x(), middle.y(), spreading_horizontally, nontext_map, &bbox);
    if (bbox.area() > 0) {
      IncrementRectangle8Bit(bbox);
    }
  }
}
void TextlineProjection :: ProjectBlobs ( BLOBNBOX_LIST * blobs , const FCOORD & rotation , const TBOX & nontext_map_box , Image nontext_map ) { BLOBNBOX_IT blob_it ( blobs ) ; for ( blob_it . mark_cycle_pt ( ) ; ! blob_it . cycled_list ( ) ; blob_it . forward ( ) ) { BLOBNBOX * blob = blob_it . data ( ) ; TBOX bbox = blob -> bounding_box ( ) ; ICOORD middle ( ( bbox . left ( ) + bbox . right ( ) ) / 2 , ( bbox . bottom ( ) + bbox . top ( ) ) / 2 ) ; bool spreading_horizontally = PadBlobBox ( blob , & bbox ) ; bbox . rotate ( rotation ) ; middle . rotate ( rotation ) ; if ( rotation . x ( ) == 0.0f ) { spreading_horizontally = ! spreading_horizontally ; } bbox &= nontext_map_box ; TruncateBoxToMissNonText ( middle . x ( ) , middle . y ( ) , spreading_horizontally , nontext_map , & bbox ) ; if ( bbox . area ( ) > 0 ) { IncrementRectangle8Bit ( bbox ) ; } } }
Inserts a list of blobs into the projection.
Inserts a list of blobs into the projection .
// Rotate to match the nontext_map. // Clip to the image before applying the increments. // This is in-place box intersection. // Check for image pixels before spreading.