This repository was archived by the owner on Mar 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·107 lines (78 loc) · 2.87 KB
/
main.cpp
File metadata and controls
executable file
·107 lines (78 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include "Image/ImgIO.h"
#include "Image/ImgProcessGPU.h"
#include <boost/filesystem.hpp>
#include <stdio.h>
#include <vector>
#include <string>
#include <iostream>
using std::cout;
using std::endl;
using std::vector;
using namespace boost::filesystem;
struct recursive_directory_range
{
typedef recursive_directory_iterator iterator;
recursive_directory_range(path p) : p_(p) {}
iterator begin() { return recursive_directory_iterator(p_); }
iterator end() { return recursive_directory_iterator(); }
path p_;
};
int main(int argc, char *argv[])
{
// // std::string imgs_dir = std::string("../../data/clark/");
// // std::string weis_dir = std::string("../../data/clark_segnet_mask/");
// vector<std::string> img_paths;
// vector<std::string> wei_paths;
// for (auto it : recursive_directory_range(argv[1]))
// {
// img_paths.push_back(std::string(it.path().c_str()));
// }
// for (auto it : recursive_directory_range(argv[2]))
// {
// wei_paths.push_back(std::string(it.path().c_str()));
// }
// std::string out_dir(argv[3]);
// if (out_dir.back() == '/')
// {
// out_dir.pop_back();
// }
// ImgIO io;
// ImgProcessGPU proc;
// for (int i = 0; i < wei_paths.size(); ++i)
// //for (int i = 41; i < 42; ++i)
// {
// // printf("%s\n", img_paths[i].c_str());
// // printf("%s\n", wei_paths[i].c_str());
// BaseImgGPU<float> img, wei, out;
// io.loadImageGPU(img_paths[i].c_str(), img);
// io.loadImageGPU(wei_paths[i].c_str(), wei);
// double radius_factor = 0.02;
// //cout << wei.channel() << endl;
// for (int k = 0; k < 4; ++k)
// {
// radius_factor /= 2.0;
// int radius = radius_factor * wei.width();
// proc.jointBilateralFilterFloat(img, wei, out, radius, 0.005, 10.f/255 * 10.f/255, 0.25 * radius * radius);
// wei.copy_from(&out);
// proc.jointBilateralFilterFloat(img, wei, out, radius, 0.005, 10.f/255 * 10.f/255, 0.25 * radius * radius);
// wei.copy_from(&out);
// }
// cout << i << endl;
// char out_path[255];
// sprintf(out_path, "%s/clark.%04d.png", out_dir.c_str(), i+1);
// io.saveImageGPU(out_path, out);
// }
ImgIO io;
ImgProcessGPU proc;
BaseImgGPU<float> im1, im2, im3;
io.loadImageGPU("../../data/clark/clark.0001.png",im1);
proc.resizeImageFloat(im1,im2,2*im1.width(),2*im1.height(),1.f);
cv::Mat cvImg;
io.base_to_cv(im2, cvImg);
io.cv_to_base(cvImg, im3);
io.saveImageGPU("resized.jpg", im3);
cv::namedWindow( "resize image", CV_WINDOW_AUTOSIZE );
cv::imshow( "resize image", cvImg );
cv::waitKey(0);
return 0;
}