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

Function channels2cimg

source/matplot/util/common.cpp:598–614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596 }
597
598 cimg_library::CImg<unsigned char> channels2cimg(const image_channels_t &A) {
599 cimg_library::CImg<unsigned char> cimg_image(
600 static_cast<unsigned int>(A[0].size()),
601 static_cast<unsigned int>(A[0][0].size()), 1U,
602 static_cast<unsigned int>(A.size()));
603 const int n_channels = static_cast<int>(A.size());
604 // const size_t height = A[0].size();
605 // const size_t width = A[0][0].size();
606 for (int channel = 0; channel < n_channels; ++channel) {
607 for (int i = 0; i < cimg_image.height(); ++i) {
608 for (int j = 0; j < cimg_image.width(); ++j) {
609 cimg_image.operator()(j, i, 0, channel) = A[channel][i][j];
610 }
611 }
612 }
613 return cimg_image;
614 }
615
616 image_channels_t imread(const std::string &filename) {
617 try {

Callers 2

imresizeFunction · 0.85
imwriteFunction · 0.85

Calls 4

sizeMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45
operator()Method · 0.45

Tested by

no test coverage detected