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

Function read_image

tools/compute_mean/uniform_mean.cpp:41–51  ·  view source on GitHub ↗

* Load an image from a file of the given name and return a cv:Mat object. * The image file can either be in a standard format handled by OpenCV, * or be in a proprietary format (a binary dump of a cv::Mat). */

Source from the content-addressed store, hash-verified

39 * or be in a proprietary format (a binary dump of a cv::Mat).
40 */
41cv::Mat read_image(const std::string image_file_name) {
42 cv::Mat image;
43 std::string ext = lbann::get_ext_name(image_file_name);
44 std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
45 if (ext == "bin") { // load the binary dump of cv::Mat data
46 image = lbann::cv_subtractor::read_binary_image_file(image_file_name);
47 } else { // let OpenCV handle
48 image = cv::imread(image_file_name);
49 }
50 return image;
51}
52
53
54/// Return the Channel-wise mean (the mean pixel value) of an image

Callers 1

mainFunction · 0.85

Calls 4

get_ext_nameFunction · 0.85
transformClass · 0.85
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected