| 35 | using namespace std; |
| 36 | |
| 37 | static int ReadEntireFile(const char* fname, vector<char>& buf) |
| 38 | { |
| 39 | ifstream fs(fname, ios::binary | ios::in); |
| 40 | if(!fs) |
| 41 | { |
| 42 | cout << fname << " does not exist" << endl; |
| 43 | return -1; |
| 44 | } |
| 45 | |
| 46 | fs.seekg(0, ios::end); |
| 47 | int fsize = fs.tellg(); |
| 48 | |
| 49 | fs.seekg(0, ios::beg); |
| 50 | buf.resize(fsize); |
| 51 | fs.read(buf.data(), fsize); |
| 52 | |
| 53 | fs.close(); |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | static float* ReadImageFile(const char* image_file, cv::Mat& img, const int input_height, const int input_width, |
| 58 | const float input_mean, const float input_std) |