save numpy files frame by frame (#37)

Co-authored-by: Bechir <bechir.brahem420@gmail.com>
This commit is contained in:
Bechir Braham
2024-04-02 11:35:58 +02:00
committed by GitHub
parent 643ea39670
commit 449c5119a4
23 changed files with 357 additions and 101 deletions

View File

@@ -0,0 +1,26 @@
// Your First C++ Program
#include "aare/File.hpp"
#include <iostream>
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
void test(File& f, int frame_number) {
std::cout << "frame number: " << frame_number << std::endl;
Frame frame = f.iread(frame_number);
std::cout << *((uint16_t *)frame.get(0, 0)) << std::endl;
std::cout << *((uint16_t *)frame.get(0, 1)) << std::endl;
std::cout << *((uint16_t *)frame.get(1, 0)) << std::endl;
std::cout << *((uint16_t *)frame.get(49, 49)) << std::endl;
}
int main() {
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "numpy" / "test_numpy_file.npy");
std::cout << fpath << std::endl;
File file(fpath,"r");
test(file, 0);
test(file, 2);
test(file, 24);
}