diff --git a/exp/annotations.py b/exp/annotations.py --- a/exp/annotations.py +++ b/exp/annotations.py @@ -10,12 +10,22 @@ from analyzer.corners import Corners class Board: + labels=["UNSET","CLEAR","GOOD","POOR"] + UNSET=0 + CLEAR=1 + GOOD=2 + POOR=3 + def __init__(self,**kwargs): self.board=Corners(kwargs.get("board") or []) self.grid=Corners(kwargs.get("grid") or []) + self.grade=kwargs.get("grade") or Board.UNSET def isEmpty(self): - return len(self.board)==0 and len(self.grid)==0 + return len(self.board)==0 and len(self.grid)==0 and self.grade==Board.UNSET + + def setGrade(self,g): + self.grade=g class DataFile(MutableMapping): @@ -36,7 +46,7 @@ class DataFile(MutableMapping): if isinstance(obj,EPoint): return {"type": "EPoint", "val": [obj.x,obj.y]} elif isinstance(obj,Board): - return {"type": "Board", "val": {"board": list(obj.board), "grid": list(obj.grid)}} + return {"type": "Board", "val": {"board": list(obj.board), "grid": list(obj.grid), "grade": obj.grade}} raise TypeError(obj) def deserialize(self,obj):