Esempio n. 1
0
    def detect_area_line(self, line):
        x1, y1, x2, y2 = line[0]
        xa = (x2 - x1)
        ya = (y2 - y1)

        # 画面サイズを取得
        height, width, channels = MyImage.get_size(self.color_image)

        # 長すぎる直線を除く
        if xa > (width / 2):
            return "false"
        # 上部の直線を除く
        if y1 < self.detect_area[0] or y2 < self.detect_area[0]:
            return "false"
        # 右部の直線を除く
        if x1 > self.detect_area[1] or x2 > self.detect_area[1]:
            return "false"
        # 下部の直線を除く
        if y1 > self.detect_area[2] or y2 > self.detect_area[2]:
            return "false"
        # 左部の直線を除く
        if x1 < self.detect_area[3] or x2 < self.detect_area[3]:
            return "false"
        # x方向に短すぎる直線を除く
        if xa < 50:
            return "false"
        return "true"