-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreslice.cpp
More file actions
76 lines (48 loc) · 1.28 KB
/
reslice.cpp
File metadata and controls
76 lines (48 loc) · 1.28 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
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <fstream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
Mat& Average(Mat& I, int th);
int main( int argc, char* argv[]) {
if (argc < 2) {
cout << "Not enough parameters" << endl;
return -1;
}
Mat I;
Mat O(1005, 7707, CV_8UC3, Scalar(0,0,0));
ifstream file_names;
file_names.open (argv[1]);
string line;
int i = 0;
if (file_names.is_open()) {
while ( getline (file_names,line) ) {
I = imread("./T152_Full/"+line, IMREAD_COLOR);
if (!I.data) {
cout << "The image: " << "/T152_Full/"+line << " could not be loaded." << endl;
return -1;
}
// cout << I.cols << "\n";
// cout << O.cols << "\n";
I.row(1200).copyTo(O.row(i));
i++;
}
file_names.close();
imwrite("./slice/test.tif", O);
}
// int th = stoi(argv[1]);
// imwrite("./slice/"+string(argv[2]), O);
return 0;
}
/*
Iterates over binary image (0 or 255)
stops at any 255 pixel and begins search for neighbors
if number of neighbors is below a threhsold will set pixel to 0
*/
Mat& GenerateSlices(Mat& I, int th) {
}