Skip to content

Commit

Permalink
[Fix] Fix random color for Palette (#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
irexyc authored Aug 16, 2023
1 parent 8b3346c commit b2c8703
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions demo/csrc/cpp/utils/palette.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ inline Palette Palette::get(int n) {
std::vector<cv::Point3f> centers(n);
cv::Mat c_mat(centers, false);
cv::Mat s_mat(samples, false);
c_mat = c_mat.reshape(1, {n, 3}); // CV_32FC3 -> CV_32FC1 for cv::kmeans output
cv::kmeans(s_mat, n, indices, cv::TermCriteria(cv::TermCriteria::Type::COUNT, 10, 0), 1,
cv::KMEANS_PP_CENTERS, c_mat);
Palette p;
Expand Down

0 comments on commit b2c8703

Please sign in to comment.