34 lines
917 B
C++
34 lines
917 B
C++
#include <math.hpp>
|
|
|
|
int main(int argc, char** argv) {
|
|
std::string imagename = "";
|
|
int threshold = 25;
|
|
std::string save_path = ".";
|
|
|
|
if (argc > 3) {
|
|
imagename = argv[1];
|
|
threshold = atoi(argv[2]);
|
|
save_path = argv[3];
|
|
} else {
|
|
std::cout << "Invalid number of arguments: test-descripteurs <path_to_image> [<threshold>]" << std::endl;
|
|
return 0;
|
|
}
|
|
|
|
cv::namedWindow("Image", CV_WINDOW_AUTOSIZE);
|
|
cv::namedWindow("Binary", CV_WINDOW_AUTOSIZE);
|
|
|
|
cv::Mat image = cv::imread(imagename, CV_LOAD_IMAGE_COLOR);
|
|
cv::Mat binary(image.rows, image.cols, CV_8UC1);
|
|
|
|
cv::GaussianBlur(image, image, cv::Size(7,7), 1.5, 1.5);
|
|
math::filter(image, binary, threshold);
|
|
|
|
cv::imshow("Image", image);
|
|
cv::imshow("Binary", binary);
|
|
|
|
cv::imwrite(save_path+"/raw_image.png", image);
|
|
cv::imwrite(save_path+"/binary_"+std::to_string(threshold)+".png", binary);
|
|
|
|
cv::waitKey(0);
|
|
return 0;
|
|
}
|