32, 32, 3 : 불러온 image 크기

저장하기

vector<uint8_t> input_test(32 * 32 * 3);

memcpy(input_test.data(), img.data, 32 * 32 * 3);

ofstream ofs("PATH/FILENAME", ios::binary);
if (ofs.is_open())
ofs.write((const char*)input_test.data(), input_test.size() * sizeof(uint8_t));
ofs.close();

 

불러오기

vector<float> img(1*14*512);

ifstream ifs("PATH/FILENAME", ios::binary);
if (ifs.is_open()) {
	ifs.read((char*)img.data(), img.size() * sizeof(float));
}
else {
	printf("There are no file. hr \n");
}
ifs.close();

'Language > C++' 카테고리의 다른 글

시간 측정  (0) 2023.03.16
C++ 시간 재기  (0) 2022.03.14
opencv vector to Mat  (0) 2021.12.23
Image to Base64, Base64 to Image  (0) 2021.11.18
파일 랜덤 추출  (0) 2021.10.14

+ Recent posts