ENH: consider colors with de < 5 as the same

1. Use cie de2000 as color distance
2.Consider colors with de < 5 as the same color  when calculating
flush

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I4b451910a21c9db3471c63c270f1f120e3c5d160
(cherry picked from commit 72bc6f44cfab9145aecdb843ac4a03a9338a8cc6)
This commit is contained in:
xun.zhang
2024-09-27 19:07:52 +08:00
committed by Noisyfox
parent 179eab1355
commit b71d14b526
4 changed files with 278 additions and 42 deletions

View File

@@ -49,7 +49,9 @@ int FlushVolCalculator::calc_flush_vol_rgb(unsigned char src_r, unsigned char sr
{
auto& pd = FlushVolPredictor::get_instance();
float ret_flush_volume = 0;
bool success = pd.predict(src_r, src_g, src_b, dst_r, dst_g, dst_b, ret_flush_volume);
FlushPredict::RGBColor src(src_r, src_g, src_b);
FlushPredict::RGBColor dst(dst_r, dst_g, dst_b);
bool success = pd.predict(src, dst, ret_flush_volume);
// if we could find the color pair from dataset, we need to recalculate
if (!success) {
float src_r_f, src_g_f, src_b_f, dst_r_f, dst_g_f, dst_b_f;