* 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). */
| 39 | * or be in a proprietary format (a binary dump of a cv::Mat). |
| 40 | */ |
| 41 | cv::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 |
no test coverage detected