| 63 | } |
| 64 | |
| 65 | void ImageBase::write() |
| 66 | { |
| 67 | std::ofstream outfile(mPPM.filename, std::ofstream::binary); |
| 68 | if (!outfile.is_open()) |
| 69 | { |
| 70 | std::cerr << "ERROR: cannot open PPM image file: " << mPPM.filename << std::endl; |
| 71 | } |
| 72 | outfile << mPPM.magic << " " << mPPM.w << " " << mPPM.h << " " << mPPM.max << std::endl; |
| 73 | outfile.write(reinterpret_cast<char*>(mPPM.buffer.data()), volume()); |
| 74 | outfile.close(); |
| 75 | } |
| 76 | |
| 77 | RGBImageReader::RGBImageReader(const std::string& filename, const nvinfer1::Dims& dims, const std::vector<float>& mean, const std::vector<float>& std) |
| 78 | : ImageBase(filename, dims) |