serizba / cppflow

Run TensorFlow models in C++ without installation and without Bazel
https://serizba.github.io/cppflow/
MIT License
774 stars 177 forks source link

Support for cv::Mat #215

Open serizba opened 1 year ago

serizba commented 1 year ago

Many people use cppflow for computer vision, and they usually work converting a cv::Mat into a std::vector, and then into a cppflow::tensor. We could directly provide a constructor and a get data function for this datatypes.

template<typename T>
  tensor(const cv::Mat<T>& m);

And probably:

template<typename T>
  cv::Mat<T> get_mat() const;

Probably both functions should be wrapped in a precompiler directive that only activates if a opencv installation is found, so non opencv users can still use the library.

This would help issues like #157

serizba commented 1 year ago

Also useful for #137

yochananscharf commented 1 year ago

Would like to try and contribute on this useful feature @serizba .