#include "include/main.hpp" using namespace std; using namespace cv; int main(int argc, char** argv) { // Check for invalid invocation. if (argc != 2) { printf("%s IMAGE\n", argv[0]); return -1; } // Read in image. cv::Mat img = img_get(argv[1]); // Check the image actually exists. if (img.empty()) { std::cout << "File not found: " << argv[1] << std::endl; return -1; } // Threshold the image (in case it's not already binary). cv::Mat binimg = preprocess_threshold(img); vector> contours = bound_contours(binimg); vector boxes = bound_boxes(contours); for (size_t i = 0; i < contours.size(); i++) { rectangle(img, boxes[i], Scalar(255, 255, 255), 1); drawContours(img, contours, (int)i, Scalar(255, 255, 255), 1, LINE_8); } std::string label_fname = reext(argv[1]); yolo_write_labels(label_fname, boxes); // Show image with bounding boxes. // imshow("Bounding Boxes", img); // waitKey(0); return 0; }