| 683 | } |
| 684 | |
| 685 | image_channels_t |
| 686 | gray2rgb(const image_channel_t &A, |
| 687 | const std::vector<std::vector<double>> &colormap) { |
| 688 | image_channels_t img( |
| 689 | 3, image_channel_t(A.size(), image_row_t(A[0].size()))); |
| 690 | for (size_t i = 0; i < A.size(); ++i) { |
| 691 | for (size_t j = 0; j < A[i].size(); ++j) { |
| 692 | color_array c = |
| 693 | colormap_interpolation(A[i][j], 0, 255, colormap); |
| 694 | img[0][i][j] = static_cast<unsigned char>(round(c[1] * 255)); |
| 695 | img[1][i][j] = static_cast<unsigned char>(round(c[2] * 255)); |
| 696 | img[2][i][j] = static_cast<unsigned char>(round(c[3] * 255)); |
| 697 | } |
| 698 | } |
| 699 | return img; |
| 700 | } |
| 701 | |
| 702 | image_channels_t gray2rgb(const image_channel_t &A) { |
| 703 | static std::vector<std::vector<double>> map = {{0, 0, 0}, {1, 1, 1}}; |
no test coverage detected