添加中枢识别在klc和笔

This commit is contained in:
Porter
2026-04-05 11:43:30 +08:00
parent ea317fb6f9
commit 6a6d24f601
9 changed files with 89 additions and 44 deletions
+36 -29
View File
@@ -91,41 +91,44 @@ class ChanSEG():
zs_list = []
if len(self.bi_list) > 3:
last_zs = None
zs_count = 0
if self.dir == Chan_SEG_DIR.UP:
for index in range(1, len(self.bi_list)):
bi = self.bi_list[index]
if bi.next == None or bi.next.next == None:
continue
bi2 = bi.next
bi3 = bi.next.next
if len(zs_list) == 0 or (last_zs and last_zs.is_sure):
if bi.next and bi.next.next and bi.next.next.is_sure and bi.next.next.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.DOWN:
zg = min(bi.high, bi.next.high, bi.next.next.high)
zd = max(bi.low, bi.next.low, bi.next.next.low)
gg = max(bi.high, bi.next.high, bi.next.next.high)
dd = min(bi.low, bi.next.low, bi.next.next.low)
if bi3.is_sure and bi3.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.DOWN:
zg = min(bi.high, bi2.high, bi3.high)
zd = max(bi.low, bi2.low, bi3.low)
gg = max(bi.high, bi2.high, bi3.high)
dd = min(bi.low, bi2.low, bi3.low)
zs = ChanBIZS(bi, len(zs_list), Chan_ZS_DIR.UP)
zs.set_zg(zg)
zs.set_zd(zd)
zs.set_gg(gg)
zs.set_dd(dd)
zs.add_bi(bi.next)
zs.add_bi(bi.next.next)
zs.add_bi(bi2)
zs.add_bi(bi3)
zs_list.append(zs)
last_zs = zs
else:
if bi.index > last_zs.bi_list[-1].index and bi.dir == Chan_BI_DIR.DOWN and bi.is_sure:
if bi.low > last_zs.zg or bi.high < last_zs.zd:
last_zs.set_end_bi(last_zs.bi_list[-1], last_zs.bi_list[-1].sure_time)
if bi.next and bi.next.next and bi.next.next.is_sure and bi.next.next.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.DOWN:
zg = min(bi.high, bi.next.high, bi.next.next.high)
zd = max(bi.low, bi.next.low, bi.next.next.low)
gg = max(bi.high, bi.next.high, bi.next.next.high)
dd = min(bi.low, bi.next.low, bi.next.next.low)
if bi3.is_sure and bi3.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.DOWN:
zg = min(bi.high, bi2.high, bi3.high)
zd = max(bi.low, bi2.low, bi3.low)
gg = max(bi.high, bi2.high, bi3.high)
dd = min(bi.low, bi2.low, bi3.low)
zs = ChanBIZS(bi, len(zs_list), Chan_ZS_DIR.UP)
zs.set_zg(zg)
zs.set_zd(zd)
zs.set_gg(gg)
zs.set_dd(dd)
zs.add_bi(bi.next)
zs.add_bi(bi.next.next)
zs.add_bi(bi2)
zs.add_bi(bi3)
zs_list.append(zs)
last_zs = zs
else:
@@ -137,37 +140,41 @@ class ChanSEG():
else:
for index in range(1, len(self.bi_list)):
bi = self.bi_list[index]
if bi.next == None or bi.next.next == None:
continue
bi2 = bi.next
bi3 = bi.next.next
if len(zs_list) == 0 or (last_zs and last_zs.is_sure):
if bi.next and bi.next.next and bi.next.next.is_sure and bi.next.next.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.UP:
zg = min(bi.high, bi.next.high, bi.next.next.high)
zd = max(bi.low, bi.next.low, bi.next.next.low)
gg = max(bi.high, bi.next.high, bi.next.next.high)
dd = min(bi.low, bi.next.low, bi.next.next.low)
if bi3.is_sure and bi3.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.UP:
zg = min(bi.high, bi2.high, bi3.high)
zd = max(bi.low, bi2.low, bi3.low)
gg = max(bi.high, bi2.high, bi3.high)
dd = min(bi.low, bi2.low, bi3.low)
zs = ChanBIZS(bi, len(zs_list), Chan_ZS_DIR.DOWN)
zs.set_zg(zg)
zs.set_zd(zd)
zs.set_gg(gg)
zs.set_dd(dd)
zs.add_bi(bi.next)
zs.add_bi(bi.next.next)
zs.add_bi(bi2)
zs.add_bi(bi3)
zs_list.append(zs)
last_zs = zs
else:
if bi.index > last_zs.bi_list[-1].index and bi.dir == Chan_BI_DIR.UP and bi.is_sure:
if bi.low > last_zs.zg or bi.high < last_zs.zd:
last_zs.set_end_bi(last_zs.bi_list[-1], last_zs.bi_list[-1].sure_time)
if bi.next and bi.next.next and bi.next.next.is_sure and bi.next.next.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.UP:
zg = min(bi.high, bi.next.high, bi.next.next.high)
zd = max(bi.low, bi.next.low, bi.next.next.low)
gg = max(bi.high, bi.next.high, bi.next.next.high)
dd = min(bi.low, bi.next.low, bi.next.next.low)
if bi3.is_sure and bi3.index <= self.bi_list[-1].index and bi.check_bi_zs_overlap() and bi.dir == Chan_BI_DIR.UP:
zg = min(bi.high, bi2.high, bi3.high)
zd = max(bi.low, bi2.low, bi3.low)
gg = max(bi.high, bi2.high, bi3.high)
dd = min(bi.low, bi2.low, bi3.low)
zs = ChanBIZS(bi, len(zs_list), Chan_ZS_DIR.DOWN)
zs.set_zg(zg)
zs.set_zd(zd)
zs.set_gg(gg)
zs.set_dd(dd)
zs.add_bi(bi.next)
zs.add_bi(bi.next.next)
zs.add_bi(bi2)
zs.add_bi(bi3)
zs_list.append(zs)
last_zs = zs
else: