from OMRnotes.scripts.classification.dist import Distance

class Dot():
    '''Detekce tecky u noty na zaklade tvaru a vzdalenosti
    '''
    dot = None

    def haveDot(self, imgseg, sf):
        distnot = Distance([self.seghead], imgseg)
        for j, item in enumerate(distnot.data[0]):
            if ((imgseg[j].width < (sf.staffspace_height * 1.5)) and (imgseg[j].height < (sf.staffspace_height * 1.5)) \
                        and (imgseg[j].width > (sf.staffspace_height * 0.2)) and (
                        imgseg[j].height > (sf.staffspace_height * 0.2)) \
                        and (item[1] > 45) and (item[1] < 135) and (item[0] < 40) \
                ):
                self.dot = imgseg[j]