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

Function cimg2channels

source/matplot/util/common.cpp:580–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578 }
579
580 image_channels_t
581 cimg2channels(const cimg_library::CImg<unsigned char> &cimg_image) {
582 const int n_channels = cimg_image.spectrum();
583 const size_t height = cimg_image.height();
584 const size_t width = cimg_image.width();
585 image_channels_t img(n_channels,
586 image_channel_t(height, image_row_t(width, 0)));
587 for (int channel = 0; channel < n_channels; ++channel) {
588 for (int i = 0; i < cimg_image.height(); ++i) {
589 for (int j = 0; j < cimg_image.width(); ++j) {
590 img[channel][i][j] =
591 cimg_image.operator()(j, i, 0, channel);
592 }
593 }
594 }
595 return img;
596 }
597
598 cimg_library::CImg<unsigned char> channels2cimg(const image_channels_t &A) {
599 cimg_library::CImg<unsigned char> cimg_image(

Callers 2

imreadFunction · 0.85
imresizeFunction · 0.85

Calls 3

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

Tested by

no test coverage detected