// Copyright 2024 SquareBlock Inc. All Rights Reserved.
// Author: tianlei.richard@qq.com (tianlei.richard)

#pragma once

#include <opencv2/core/core.hpp>

template <typename T> T lerp(const float t, const T &a, const T &b) {
  return t * static_cast<float>(b) + (1 - t) * static_cast<float>(a);
}

template <typename T>
T bilerp(const float t_h, const float t_v, const T &a, const T &b, const T &c,
         const T &d) {
  return lerp(t_v, lerp(t_h, a, b), lerp(t_h, c, d));
}

template <>
cv::Vec3b lerp(const float t, const cv::Vec3b &a, const cv::Vec3b &b);

// template <>
// cv::Vec3b bilerp(const float t_h, const float t_v, const cv::Vec3b &a,
//                  const cv::Vec3b &b, const cv::Vec3b &c, const cv::Vec3b &d);
