megafacade.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:facade-segmentation 作者: jfemiani 项目源码 文件源码
def _cut_windows_horizontally(self, s, win_strip):
        win_horizontal_scores = []
        if len(self.heights) > 0:
            win_horizontal_scores = np.percentile(win_strip[self.top:self.bottom], 85, axis=0)
            runs, starts, values = run_length_encode(win_horizontal_scores > 0.5)
            starts += s
            win_widths = runs[np.atleast_1d(values)]
            win_widths = np.atleast_1d(win_widths)
            win_lefts = np.atleast_1d(starts[values])
            if len(win_widths) > 0:
                win_left = win_lefts[0]
                win_right = win_lefts[-1] + win_widths[-1]
                win_horizontal_spacing = np.diff(win_lefts).mean() if len(win_lefts) > 1 else 0
                # win_width = win_widths.mean()
            else:
                win_left = win_right = win_horizontal_spacing = -1  # win_width = -1
        else:
            win_widths = win_lefts = []
            win_left = win_right = win_horizontal_spacing = -1

        self.horizontal_spacing = int(win_horizontal_spacing)
        self.left = int(win_left)
        self.right = int(win_right)
        self.horizontal_scores = win_horizontal_scores
        self.lefts = np.array(win_lefts)
        self.widths = np.array(win_widths)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号