# Create a new instance of a table
table = Table(rect[0], rect[1], rect[2], rect[3])
# Get an n-dimensional array of the coordinates of the table joints
joint_coords = []
for i in range(len(table_joints)):
joint_coords.append(table_joints[i][0][0])
joint_coords = np.asarray(joint_coords)
# Returns indices of coordinates in sorted order
# Sorts based on parameters (aka keys) starting from the last parameter, then second-to-last, etc
sorted_indices = np.lexsort((joint_coords[:, 0], joint_coords[:, 1]))
joint_coords = joint_coords[sorted_indices]
# Store joint coordinates in the table instance
table.set_joints(joint_coords)
tables.append(table)
import utils
tables = [] # list of tables
for i in range(len(contours)):
# Verify that region of interest is a table
(rect, table_joints) = utils.verify_table(contours[i], intersections)
if rect == None or table_joints == None:
continue