forked from kalxas/mseg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobia-class-export-svm.cpp
46 lines (36 loc) · 1.67 KB
/
obia-class-export-svm.cpp
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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* mainsvmclass.cpp *
* Version: 0.9.0 build 500 *
* Last revised: 12/06/2006 *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* MSEG algorithm by Angelos Tzotsos (a.k.a. Kalxas) *
* GCpp Lab. March 2009 *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//Usage :svm2class <level raster> <class attribute file> <svm training file> <svm prediction file> <classification.ers> <class raster>
#include "msegcore.h"
using namespace std;
int main (int argc, char *argv[]){
if(argc != 7){//TODO: Add to Error Handling
cout << "Error in arguments:" << endl << endl
<< "Usage :svm2class <level raster> <class attribute file> <svm training file> <svm prediction file> <classification.ers> <class raster>"
<< endl;
system("Pause");
exit(1);
}
//read arguments
string arg1(argv[1]);
string arg2(argv[2]);
string arg3(argv[3]);
string arg4(argv[4]);
string arg5(argv[5]);
string arg6(argv[6]);
Level pass;
ClassAttribute tmp;
pass.LoadRaster(arg1);
pass.LoadAttributes(arg2);
pass.SVM2ClassificationMap(arg3, arg4);
pass.SaveClassificationAsERS(arg5);
pass.SaveClassificationMap(arg6);
pass.clear();
}//main end