ComputationalAgronomy / multi_threshold_gotsu_algo

Group Otsu algorithm with multiple thresholds
0 stars 0 forks source link

debugging #1

Open stevenhwu opened 2 months ago

stevenhwu commented 2 months ago

https://github.com/ComputationalAgronomy/multi_threshold_gotsu_algo/blob/cccb5390e8b7e6e77eda4520dca090da7d018f8b/gotsu_m.py#L59

    def calc_f(self, t1, t2, DEBUG=True):
        m_arr = self.mean_array(t1, t2)
        f = []
        if DEBUG:
            full_result = {}
        for i in range(len(m_arr)):
            n = self.cumul_n[i][t2] - self.cumul_n[i][t1]
            w = self.calc_w(i, n)
            v = self.calc_v(i, n, t1, t2, m_arr)
            results = w * v
            f.append(results)
            if DEBUG:
                   full_result[i] = (n, w, v)    
                   return full_result
        return f
stevenhwu commented 2 months ago
assert full_result[i] == (exp_n, exp_w, exp_v)