Hello, I would like to load the data of multiple .hdr extension files using Cimg library. I know how to load and display when there's is only one file. But I have more than 30 files to load and get the image dimensions.
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream>
#include "CImg.h"
usingnamespace std;
usingnamespace cimg_library;
int main() {
CImg<int32_t> im("c_vm1451.fre.hdr");
// Get image dimensions
int width = im.width();
int height = im.height();
int depth = im.depth()
return 0;
}
Any time you want to repeat the same procedure over and over again, you should be thinking of using a loop.
My recommendation:
- put the names of the files into a container (array, std::vector, whatever works best for you)
- using a loop, iterate over those names, reading each file and getting the data you need from it