blob: ba45f03a502642b470e3167c89cf7404b41e6705 [file] [log] [blame]
Tai-Hsu Lin63e1a732012-03-03 19:20:26 +08001# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import numpy as np
6
7# Dimension padding/unpadding function for converting points matrices to
8# the OpenCV format (channel-based).
9def Pad(x):
10 return np.expand_dims(x, axis=0)
11
12
13def Unpad(x):
14 return np.squeeze(x)
15
16
17class Pod(object):
18 '''A POD (plain-old-data) object containing arbitrary fields.'''
19 def __init__(self, **args):
20 self.__dict__.update(args)
21
22 def __repr__(self):
23 '''Returns a representation of the object, including its properties.'''
24 return (self.__class__.__name__ + '(' +
25 ', '.join('%s=%s' % (k, v) for k, v in sorted(self.__dict__.items())
26 if not k.startswith('_')) + ')')