Add a python-wrapped opencv, complete with SIFT support

Change-Id: I06cd05a8974670fb886123ef24e4c44c2a985362
diff --git a/WORKSPACE b/WORKSPACE
index ab7a70f..ba1b091 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -651,3 +651,13 @@
     strip_prefix = "halide/",
     url = "http://www.frc971.org/Build-Dependencies/halide-arm32-linux-32-trunk-65c26cba6a3eca2d08a0bccf113ca28746012cc3.tgz",
 )
+
+# Downloaded from:
+# https://files.pythonhosted.org/packages/05/23/7f9a896da9e7ce4170377a7a14bb804b460761f9dd66734e6ad8f001a76c/opencv_contrib_python_nonfree-4.1.1.1-cp35-cp35m-manylinux1_x86_64.whl
+http_archive(
+    name = "opencv_contrib_nonfree_amd64",
+    build_file = "@//debian:opencv_python.BUILD",
+    sha256 = "c10e7712ee1f19bf382c64fc29b5d24fa0b5bfd901eab69cef83604713e6a89e",
+    type = "zip",
+    url = "http://www.frc971.org/Build-Dependencies/opencv_contrib_python_nonfree-4.1.1.1-cp35-cp35m-manylinux1_x86_64.whl",
+)
diff --git a/build_tests/BUILD b/build_tests/BUILD
index a4c5829..0e3b8f7 100644
--- a/build_tests/BUILD
+++ b/build_tests/BUILD
@@ -115,3 +115,12 @@
     srcs = ["python_fbs.py"],
     deps = [":test_python_fbs"],
 )
+
+py_test(
+    name = "python3_opencv",
+    srcs = ["python_opencv.py"],
+    default_python_version = "PY3",
+    main = "python_opencv.py",
+    srcs_version = "PY2AND3",
+    deps = ["@opencv_contrib_nonfree_amd64//:python_opencv"],
+)
diff --git a/build_tests/python_opencv.py b/build_tests/python_opencv.py
new file mode 100644
index 0000000..c353c79
--- /dev/null
+++ b/build_tests/python_opencv.py
@@ -0,0 +1,6 @@
+#!/usr/bin/python3
+
+import cv2
+
+if __name__ == '__main__':
+  cv2.xfeatures2d.SIFT_create()
diff --git a/debian/opencv_python.BUILD b/debian/opencv_python.BUILD
new file mode 100644
index 0000000..5afa180
--- /dev/null
+++ b/debian/opencv_python.BUILD
@@ -0,0 +1,10 @@
+py_library(
+    name = "python_opencv",
+    srcs = glob(["**/*.py"]),
+    data = glob(
+        include = ["**/*"],
+        exclude = ["**/*.py"],
+    ),
+    imports = ["."],
+    visibility = ["//visibility:public"],
+)