Setting up Blob detector and viewer code in y2022

Includes viewer with SIFT code stripped out, since we're not using it
in y2022.

Change-Id: Id56e9e5c868a1d730dcfb433d5e4868898a6f011
Signed-off-by: Jim Ostrowski <yimmy13@gmail.com>
diff --git a/y2022/vision/blob_detector.h b/y2022/vision/blob_detector.h
new file mode 100644
index 0000000..3da3d4b
--- /dev/null
+++ b/y2022/vision/blob_detector.h
@@ -0,0 +1,43 @@
+#ifndef Y2022_BLOB_DETECTOR_H_
+#define Y2022_BLOB_DETECTOR_H_
+
+#include <opencv2/imgproc.hpp>
+
+namespace y2022 {
+namespace vision {
+
+class BlobDetector {
+ public:
+  BlobDetector() {}
+  // Given an image, threshold it to find "green" pixels
+  // Input: Color image
+  // Output: Grayscale (binarized) image with green pixels set to 255
+  static cv::Mat ThresholdImage(cv::Mat rgb_image);
+
+  // Given binary image, extract blobs
+  static std::vector<std::vector<cv::Point>> FindBlobs(cv::Mat threshold_image);
+
+  // Filter blobs to get rid of noise, too large items, etc.
+  static std::vector<std::vector<cv::Point>> FilterBlobs(
+      std::vector<std::vector<cv::Point>> blobs);
+
+  // Draw Blobs on image
+  // Optionally draw all blobs and filtered blobs
+  static void DrawBlobs(cv::Mat view_image,
+                        std::vector<std::vector<cv::Point>> filtered_blobs,
+                        std::vector<std::vector<cv::Point>> unfiltered_blobs);
+
+  // Extract stats for each blob
+  static std::vector<std::vector<cv::Point>> ComputeStats(
+      std::vector<std::vector<cv::Point>>);
+
+  static void ExtractBlobs(
+      cv::Mat rgb_image, cv::Mat binarized_image, cv::Mat blob_image,
+      std::vector<std::vector<cv::Point>> &filtered_blobs,
+      std::vector<std::vector<cv::Point>> &unfiltered_blobs,
+      std::vector<std::vector<cv::Point>> &blob_stats);
+};
+}  // namespace vision
+}  // namespace y2022
+
+#endif  // Y2022_BLOB_DETECTOR_H_