MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / gray2rgb

Function gray2rgb

source/matplot/util/common.cpp:685–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}};

Callers 2

imwriteFunction · 0.85
imvignetteFunction · 0.85

Calls 2

colormap_interpolationFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected