7 changed files with 102 additions and 74 deletions
@ -0,0 +1,33 @@ |
|||||
|
#include <iostream> |
||||
|
#include <math.hpp> |
||||
|
#include <file.hpp> |
||||
|
#include <knn.hpp> |
||||
|
|
||||
|
int main(int argc, char** argv) { |
||||
|
int k = 20; |
||||
|
std::string filename; |
||||
|
std::string sample_name; |
||||
|
int cmax = 10; |
||||
|
int threshold = 20; |
||||
|
int n = 2; |
||||
|
|
||||
|
if (argc > 3) { |
||||
|
filename = argv[1]; |
||||
|
k = atoi(argv[2]); |
||||
|
sample_name = argv[3]; |
||||
|
} else { |
||||
|
std::cout << "Invalid number of arguments" << std::endl; |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
math::dataset references = load_csv(filename, 2*cmax+1); |
||||
|
|
||||
|
if (references.size() == 0) { |
||||
|
std::cout << "Invalid file" << std::endl; |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
sample_name = random_image(sample_name); |
||||
|
math::csignal sample = math::img2desc(sample_name, cmax, threshold); |
||||
|
std::cout << predict(sample, references, k, n) << std::endl; |
||||
|
}; |
||||
@ -1,8 +1,8 @@ |
|||||
add_executable(traitement traitement.cpp) |
add_executable(traitement traitement.cpp) |
||||
target_link_libraries(traitement ${OpenCV_LIBS}) |
target_link_libraries(traitement ${OpenCV_LIBS}) |
||||
|
|
||||
add_executable(knn knn.cpp) |
add_executable(save-dataset save-dataset.cpp) |
||||
target_link_libraries(knn ${OpenCV_LIBS} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) |
target_link_libraries(save-dataset ${OpenCV_LIBS} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) |
||||
|
|
||||
add_executable(neural_network neural_network.cpp) |
add_executable(neural_network neural_network.cpp) |
||||
target_link_libraries(neural_network ${OpenCV_LIBS} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}) |
target_link_libraries(neural_network ${OpenCV_LIBS} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}) |
||||
|
|||||
@ -0,0 +1,23 @@ |
|||||
|
#include "file.hpp" |
||||
|
#include "math.hpp" |
||||
|
|
||||
|
int main(int argc, char** argv) { |
||||
|
std::string path; |
||||
|
int cmax; |
||||
|
int threshold; |
||||
|
int size; |
||||
|
|
||||
|
if (argc > 4) { |
||||
|
path = argv[1]; |
||||
|
cmax = atoi(argv[2]); |
||||
|
threshold = atoi(argv[3]); |
||||
|
size = atoi(argv[4]); |
||||
|
} else { |
||||
|
std::cout << "Invalid number of arguments" << std::endl; |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
math::dataset dataset = get_data(path, size, cmax, threshold); |
||||
|
save_as_csv(dataset, path+"/../descripteurs/dataset"+std::to_string(size)+".csv"); |
||||
|
return 0; |
||||
|
} |
||||
Loading…
Reference in new issue