saveaspng.ipynb: Saves the dataset as individual .jpg files so that bad images can be more quickly seen using OS file previews dataset_viewer.ipynb: Let's you iterate through the individual images of a dataset. A less helpful version of what saveaspng and OS file previews would do image_viewer.ipynb: Nearly identical to dataset_viewer.ipynb manualrotationchecker.ipynb: First version of a manual (non-ML) autorotater/deskewer testcropper.ipynb: New version of a manual autocropper manualcropandrotate.ipynb: Combining manual cropping and rotating Also updated the training loop file and added a blacklist for when making the dataset from the original dataset. Finally, the dockerfile was updated to remove installation of some unused libraries and added a library for the manual autorotator. Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
44 lines
1020 B
C++
44 lines
1020 B
C++
#include <cropper.h>
|
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
// PLAN:
|
|
// Implement selective search
|
|
// Implement Canny edge detection and then find a good rectangle
|
|
// Do L2 loss with the corners of the rectangle and choose the selective search rectangle with the lowest loss
|
|
|
|
|
|
//for testing delete later
|
|
#include <iostream>
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
if (argc < 2) {
|
|
std::cerr << "BAD" << std::endl;
|
|
return -1;
|
|
}
|
|
|
|
cv::Mat imOut, result;
|
|
|
|
imOut = cv::imread(argv[1]);
|
|
if (imOut.empty()) {
|
|
std::cout << "Could not open or find the image!\n" << std::endl;
|
|
std::cout << "Usage: " << argv[0] << " <Input image>" << std::endl;
|
|
return -1;
|
|
}
|
|
|
|
crop(imOut, result, true, 1000);
|
|
|
|
|
|
int imageHeight = 800;
|
|
int newWidth = result.cols * imageHeight / result.rows;
|
|
cv::resize(result, result, cv::Size(newWidth, imageHeight));
|
|
|
|
cv::imshow("banana", result);
|
|
imwrite("../testing_space/cropped.jpg", result);
|
|
cv::waitKey();
|
|
return 0;
|
|
}
|
|
|
|
|