MCPcopy Create free account
hub / github.com/LBANN/lbann / encode_image

Function encode_image

src/utils/image.cpp:262–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262std::string encode_image(const El::Matrix<uint8_t>& image,
263 const std::vector<size_t>& dims,
264 std::string const& img_format)
265{
266 cv::Mat Mat_img =
267 utils::get_opencv_mat(const_cast<El::Matrix<uint8_t>&>(image), dims);
268 std::vector<uint8_t> encoded_img;
269 // Default IMWRITE_JPEG_QUALITY is 95. Can lower if files are too large
270 cv::imencode(img_format, Mat_img, encoded_img);
271
272 return std::string{encoded_img.begin(), encoded_img.end()};
273}
274
275El::Matrix<uint8_t> get_uint8_t_image(const CPUMat& image,
276 const std::vector<size_t>& dims)

Callers 1

report_imageMethod · 0.85

Calls 3

get_opencv_matFunction · 0.85
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected