Makes a TO_ROW matching this and moves all the blobs to it, transferring ownership to to returned TO_ROW.
| 1711 | // Makes a TO_ROW matching this and moves all the blobs to it, transferring |
| 1712 | // ownership to to returned TO_ROW. |
| 1713 | TO_ROW* ColPartition::MakeToRow() { |
| 1714 | BLOBNBOX_C_IT blob_it(&boxes_); |
| 1715 | TO_ROW* row = NULL; |
| 1716 | int line_size = IsVerticalType() ? median_width_ : median_size_; |
| 1717 | // Add all the blobs to a single TO_ROW. |
| 1718 | for (; !blob_it.empty(); blob_it.forward()) { |
| 1719 | BLOBNBOX* blob = blob_it.extract(); |
| 1720 | // blob->compute_bounding_box(); |
| 1721 | int top = blob->bounding_box().top(); |
| 1722 | int bottom = blob->bounding_box().bottom(); |
| 1723 | if (row == NULL) { |
| 1724 | row = new TO_ROW(blob, static_cast<float>(top), |
| 1725 | static_cast<float>(bottom), |
| 1726 | static_cast<float>(line_size)); |
| 1727 | } else { |
| 1728 | row->add_blob(blob, static_cast<float>(top), |
| 1729 | static_cast<float>(bottom), |
| 1730 | static_cast<float>(line_size)); |
| 1731 | } |
| 1732 | } |
| 1733 | return row; |
| 1734 | } |
| 1735 | |
| 1736 | // Returns a copy of everything except the list of boxes. The resulting |
| 1737 | // ColPartition is only suitable for keeping in a column candidate list. |
no test coverage detected