| 415 | } |
| 416 | |
| 417 | int main(int argc, char** argv) { |
| 418 | cv::CommandLineParser parser(argc, argv, keys); |
| 419 | if (argc < 3) { |
| 420 | help(argv); |
| 421 | return -1; |
| 422 | } |
| 423 | const std::string model_path = parser.get<cv::String>("@model"); |
| 424 | std::string image_filename = cv::samples::findFile(parser.get<cv::String>("input")); |
| 425 | std::string outout_filename = parser.get<cv::String>("output"); |
| 426 | |
| 427 | cv::Mat img = cv::imread(image_filename); |
| 428 | if (img.empty()) { |
| 429 | std::cout << "Couldn't open the image " << image_filename |
| 430 | << ". Usage: inpaint <image_name>\n" |
| 431 | << std::endl; |
| 432 | return 0; |
| 433 | } |
| 434 | std::vector<float> input(3 * 640 * 640, 0); |
| 435 | preprocess(img, input.data()); |
| 436 | std::vector<float> output_data = inference(model_path.c_str(), input); |
| 437 | float* predict_ptr = output_data.data(); |
| 438 | int img_w = img.cols; |
| 439 | int img_h = img.rows; |
| 440 | float scale = std::min(INPUT_W / (img.cols * 1.0), INPUT_H / (img.rows * 1.0)); |
| 441 | std::vector<OutputInfo> output_infos; |
| 442 | |
| 443 | postpreprocess(predict_ptr, output_infos, scale, img_w, img_h); |
| 444 | draw_output_infos(img, output_infos, outout_filename); |
| 445 | return 0; |
| 446 | } |
nothing calls this directly
no test coverage detected