-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Closed
Labels
Milestone
Description
OpenCV has some support for the Eigen library. Specifically the conversion utilities for Eigen::Matrix. Based on my testing, these conversion functions are limited to grayscale (single channel) images. It would be possible to overcome the limitation if OpenCV had support for Eigen::Tensor.
System information (version)
OpenCV => 4.3
Operating System / Platform => Ubuntu 18.04
Compiler => GCC 9.3.0
Detailed description
// this will work
float gray_data[] = {0, 1, 2, 3, 4, 5};
cv::Mat gray_mat(2, 3, CV_32FC1, gray_data);
Eigen::MatrixXf gray_matrix;
cv::cv2eigen(gray_mat, gray_matrix);
cout << gray_matrix << endl;// will not work
float color_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
cv::Mat color_mat(2, 3, CV_32FC3, color_data);
Eigen::MatrixXf color_matrix;
cv::cv2eigen(color_mat, color_matrix);
cout << color_matrix << endl;I've written some generic code to perform Eigen::Tensor conversions for both cv2eigen and eigen2cv directions, modeled after the current conversion code. I've tested conversions for Eigen::Tensor in row major order (column major is still causing some issues).
I can submit a PR, but my first question is would OpenCV maintainers allow support for an unofficial Eigen module?
Reactions are currently unavailable