This commit is contained in:
2023-08-24 11:36:22 +00:00
parent 59f67a2495
commit afd482522d
36 changed files with 2194 additions and 291 deletions
+20 -4
View File
@@ -1,10 +1,26 @@
import tables as tb
class Frame:
def __init__(self, id: str, frame_nr: int, garment: str=''):
self.id: str = id
self.frame_nr: int = frame_nr
self.garment: str = garment
def __init__(self, id: str ='', frame_nr: int= 0, garment: str='', frame = None, frame_str: str = ''):
if frame is not None:
self.id: str = frame.id
self.frame_nr: int = frame.frame_nr
self.garment: str = frame.garment
assert id == '' and frame_nr == 0 and garment == '' and frame_str == ''
elif frame_str != '':
if ' ' in frame_str:
self.id: str = frame_str.split()[0]
self.frame_nr: int = int(frame_str.split()[1])
self.garment: str = frame_str.split()[2]
else:
self.id: str = frame_str.split('_')[0]
self.frame_nr: int = int(frame_str.split('_')[1])
self.garment: str = frame_str.split('_')[2]
assert id == '' and frame_nr == 0 and garment == '' and frame is None
else:
self.id: str = id
self.frame_nr: int = frame_nr
self.garment: str = garment
def __hash__(self):
return hash((self.id, self.frame_nr, self.garment))