-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
65 lines (45 loc) · 1.61 KB
/
main.cpp
File metadata and controls
65 lines (45 loc) · 1.61 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
#include "PectoralMuscleSegmentationClass.h"
#include <QApplication>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
PectoralMuscleSegmentationClass w;
Mat visual_results; // mask images
Mat image;
Mat mask;
Mat truth;
string dataset_path = "../dataset/";
int test = 1;
/**
* if test=1, it will test on a single image specified below
* if test!=1, on the whole dataset found on the dataset_path directory above
*/
if (test != 1)
w.performanceEval(dataset_path);
else{
bool isExist = w.dirExists(dataset_path);
if (isExist)
cout<<"Path exists..."<<endl;
else{
cout<<"Not valid image path for images"<<endl;
return -1;
}
image = imread("../dataset/images/15.png",CV_LOAD_IMAGE_UNCHANGED);
truth = imread("../dataset/groundtruth/15.png", CV_LOAD_IMAGE_GRAYSCALE);
mask = imread("../dataset/mask/15.png", CV_LOAD_IMAGE_GRAYSCALE);
double sigma = 54.0;
w.lowThreshold = 2.2;
w.TP = 0.0;
w.TN = 0.0;
w.N = 0.0;
int rightCorner = w.breastUpperRightedge(mask);
Mat imageROI = w.extractROI(image,rightCorner);
Mat cannyim;
cannyim = w.muscleBorderDetector(imageROI,sigma);
Mat Im2, ImOut;
Im2 = w.TriangularFilter(cannyim);
ImOut = w.Segmentation(Im2, image);
w.calculateAccuracy(ImOut,truth, mask, visual_results);
cout<<"Accuracy "<< (double) (w.TP + w.TN) / w.N;
waitKey(0);
}
}