Changing structure name MyTable -> TessTable and using tesseract namespace

This commit is contained in:
Stefan Brechtken 2021-03-17 11:07:04 +01:00
parent 14408861ea
commit ec8d7dd6bb
4 changed files with 15 additions and 12 deletions

View File

@ -1297,12 +1297,12 @@ char *TessBaseAPI::GetUTF8Text() {
size_t TessBaseAPI::GetNumberOfTables()
{
return constUniqueInstance<std::vector<MyTable>>().size();
return constUniqueInstance<std::vector<TessTable>>().size();
}
std::tuple<int,int,int,int> TessBaseAPI::GetTableBoundingBox(unsigned i)
{
const std::vector<MyTable>& t = constUniqueInstance<std::vector<MyTable>>();
const std::vector<TessTable>& t = constUniqueInstance<std::vector<TessTable>>();
if(i >= t.size())
return std::tuple<int,int,int,int>(0, 0, 0, 0);
@ -1317,7 +1317,7 @@ std::tuple<int,int,int,int> TessBaseAPI::GetTableBoundingBox(unsigned i)
std::vector<std::tuple<int,int,int,int>> TessBaseAPI::GetTableRows(unsigned i)
{
const std::vector<MyTable>& t = constUniqueInstance<std::vector<MyTable>>();
const std::vector<TessTable>& t = constUniqueInstance<std::vector<TessTable>>();
if(i >= t.size())
return std::vector<std::tuple<int,int,int,int>>();
@ -1335,7 +1335,7 @@ std::vector<std::tuple<int,int,int,int>> TessBaseAPI::GetTableRows(unsigned i)
std::vector<std::tuple<int,int,int,int> > TessBaseAPI::GetTableCols(unsigned i)
{
const std::vector<MyTable>& t = constUniqueInstance<std::vector<MyTable>>();
const std::vector<TessTable>& t = constUniqueInstance<std::vector<TessTable>>();
if(i >= t.size())
return std::vector<std::tuple<int,int,int,int>>();
@ -2120,7 +2120,7 @@ void TessBaseAPI::ClearResults() {
paragraph_models_ = nullptr;
}
uniqueInstance<std::vector<MyTable>>().clear();
uniqueInstance<std::vector<TessTable>>().clear();
}
/**

View File

@ -1,9 +1,9 @@
/******************************************************************************
* File: tabletransfer.h
* Description: Infrastructure for the transfer of table detection results
* Author: Sintun
* Author: Stefan Brechtken
*
* (C) Copyright 2021, Sintun
* (C) Copyright 2021, Stefan Brechtken
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -22,9 +22,10 @@
#include <vector>
#include "rect.h"
namespace tesseract {
/// Structure for data transfer from table detector
struct MyTable {
struct TessTable {
tesseract::TBOX box;
std::vector<tesseract::TBOX> rows;
std::vector<tesseract::TBOX> cols;
@ -60,4 +61,6 @@ const T& constUniqueInstance(std::unique_ptr<T> new_instance = nullptr)
return uniqueInstance<T>(std::move(new_instance));
}
} // namespace tesseract
#endif // TESSERACT_CCSTRUCT_TABLETRANSFER_H_

View File

@ -1532,8 +1532,8 @@ void ColumnFinder::RotateAndReskewBlocks(bool input_is_rtl, TO_BLOCK_LIST *block
tprintf("Block median size = (%d, %d)\n", block->median_size().x(), block->median_size().y());
}
std::vector<MyTable>& tables = uniqueInstance<std::vector<MyTable>>();
for(MyTable& mt: tables)
std::vector<TessTable>& tables = uniqueInstance<std::vector<TessTable>>();
for(TessTable& mt: tables)
mt.box.rotate_large(reskew_);
}

View File

@ -2018,8 +2018,8 @@ void TableFinder::MakeTableBlocks(ColPartitionGrid *grid, ColPartitionSet **all_
}
#endif // GRAPHICS_DISABLED
std::vector<MyTable>& tables = uniqueInstance<std::vector<MyTable>>();
tables.push_back(MyTable{table_box, table_structure->getRows(),
std::vector<TessTable>& tables = uniqueInstance<std::vector<TessTable>>();
tables.push_back(TessTable{table_box, table_structure->getRows(),
table_structure->getCols()});
delete table_structure;