1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-20 21:22:05 +00:00

further refine color detection

This commit is contained in:
Alex Xu
2025-10-26 14:11:13 -07:00
parent 4dfd2ea942
commit f96b7cb22b

View File

@@ -336,8 +336,8 @@ class ComicPage:
cb_spread = cb_nonzero[-1] - cb_nonzero[0] cb_spread = cb_nonzero[-1] - cb_nonzero[0]
cr_spread = cr_nonzero[-1] - cr_nonzero[0] cr_spread = cr_nonzero[-1] - cr_nonzero[0]
# bias adjustment # bias adjustment, don't go lower than 7
SPREAD_THRESHOLD = 5 SPREAD_THRESHOLD = 7
if self.opt.forcecolor: if self.opt.forcecolor:
if any([ if any([
cb_nonzero[0] > 128, cb_nonzero[0] > 128,
@@ -366,8 +366,8 @@ class ComicPage:
cb_hist_original = cb.histogram() cb_hist_original = cb.histogram()
cr_hist_original = cr.histogram() cr_hist_original = cr.histogram()
# you can increase 22 but don't touch 10 and 3 thresholds # you can increase 22 but don't increase 10. 4 maybe can go higher
for cutoff, diff_threshold in [((0, 0), 22), ((.2, .2), 10), ((3, 3), 3)]: for cutoff, diff_threshold in [((0, 0), 22), ((.2, .2), 10), ((3, 3), 4)]:
done, decision = self.color_precision(cb_hist_original, cr_hist_original, cutoff, diff_threshold) done, decision = self.color_precision(cb_hist_original, cr_hist_original, cutoff, diff_threshold)
if done: if done:
return decision return decision