-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
23 lines (20 loc) · 820 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "Awb.h"
#include <filesystem>
#include <fstream>
int main() {
auto projectPath = std::filesystem::current_path().parent_path();
auto modelPath = projectPath / "models" / "awb.onnx";
auto exPath = projectPath / "example_images";
auto resPath = projectPath / "results";
Awb m(modelPath.string());
for(const auto& entry : std::filesystem::directory_iterator(exPath)) {
auto imgPath = entry.path().string();
auto fileName = entry.path().filename();
std::cout << "process " << fileName << std::endl;
auto img = cv::imread(imgPath);
auto balancedImg = m.predict(img).clone();
cv::imwrite((resPath / fileName).string(), balancedImg, {cv::IMWRITE_JPEG_QUALITY, 85});
std::cout << fileName << " done" << std::endl;
}
return 0;
}