Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame^] | 1 | load(":fast_gaussian.bzl", "fast_gaussian") |
| 2 | |
| 3 | cc_binary( |
| 4 | name = "fast_gaussian_generator", |
| 5 | srcs = [ |
| 6 | "fast_gaussian_generator.cc", |
| 7 | ], |
| 8 | restricted_to = [ |
| 9 | "//tools:k8", |
| 10 | "//tools:armhf-debian", |
| 11 | ], |
| 12 | deps = [ |
| 13 | "//third_party:halide", |
| 14 | "//third_party:halide_gengen", |
| 15 | "//third_party:opencv", |
| 16 | "@com_github_google_glog//:glog", |
| 17 | ], |
| 18 | ) |
| 19 | |
| 20 | py_binary( |
| 21 | name = "fast_gaussian_runner", |
| 22 | srcs = [ |
| 23 | "fast_gaussian_runner.py", |
| 24 | ], |
| 25 | data = [ |
| 26 | ":fast_gaussian_generator", |
| 27 | # TODO(Brian): Replace this with something more fine-grained from the |
| 28 | # configuration fragment or something. |
| 29 | "//tools/cpp:toolchain", |
| 30 | ], |
| 31 | default_python_version = "PY3", |
| 32 | main = "fast_gaussian_runner.py", |
| 33 | restricted_to = [ |
| 34 | "//tools:k8", |
| 35 | "//tools:armhf-debian", |
| 36 | ], |
| 37 | srcs_version = "PY2AND3", |
| 38 | deps = [ |
| 39 | "@bazel_tools//tools/python/runfiles", |
| 40 | ], |
| 41 | ) |
| 42 | |
| 43 | # Each element is [sigma, sigma_name, radius]. |
| 44 | # opencv's default width is calculated as: |
| 45 | # cvRound(sigma1 * (depth == CV_8U ? 3 : 4) * 2 + 1) | 1 |
| 46 | # Pulling that in helps a lot with making it faster (less data to read, and less |
| 47 | # math to do), but if you make it too narrow SIFT quickly freaks out. |
| 48 | sigmas = [ |
| 49 | [ |
| 50 | "1.2262734984654078", |
| 51 | "1p2", |
| 52 | "9", |
| 53 | ], |
| 54 | [ |
| 55 | "1.5450077936447955", |
| 56 | "1p5", |
| 57 | "11", |
| 58 | ], |
| 59 | [ |
| 60 | "1.9465878414647133", |
| 61 | "1p9", |
| 62 | "13", |
| 63 | ], |
| 64 | [ |
| 65 | "2.4525469969308156", |
| 66 | "2p4", |
| 67 | "15", |
| 68 | ], |
| 69 | [ |
| 70 | "3.0900155872895909", |
| 71 | "3p1", |
| 72 | "19", |
| 73 | ], |
| 74 | # TODO(Brian): We only need one of these two for 1280x720. Don't generate |
| 75 | # all the redundant versions for other sizes, and maybe stop doing the one |
| 76 | # we don't actually use. |
| 77 | [ |
| 78 | "1.2489997148513794", |
| 79 | "1p24", |
| 80 | "11", |
| 81 | ], |
| 82 | [ |
| 83 | "1.5198683738708496", |
| 84 | "1p52", |
| 85 | "15", |
| 86 | ], |
| 87 | ] |
| 88 | |
| 89 | sizes = [ |
| 90 | [ |
| 91 | 1280, |
| 92 | 720, |
| 93 | ], |
| 94 | [ |
| 95 | 640, |
| 96 | 360, |
| 97 | ], |
| 98 | [ |
| 99 | 320, |
| 100 | 180, |
| 101 | ], |
| 102 | [ |
| 103 | 160, |
| 104 | 90, |
| 105 | ], |
| 106 | [ |
| 107 | 80, |
| 108 | 45, |
| 109 | ], |
| 110 | ] |
| 111 | |
| 112 | fast_gaussian(sigmas, sizes) |
| 113 | |
Brian Silverman | f119612 | 2020-01-16 00:41:54 -0800 | [diff] [blame] | 114 | cc_library( |
| 115 | name = "sift971", |
| 116 | srcs = [ |
| 117 | "sift971.cc", |
| 118 | ], |
| 119 | hdrs = [ |
| 120 | "sift971.h", |
| 121 | ], |
| 122 | restricted_to = [ |
| 123 | "//tools:k8", |
| 124 | "//tools:armhf-debian", |
| 125 | ], |
| 126 | visibility = ["//visibility:public"], |
| 127 | deps = [ |
Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame^] | 128 | ":fast_gaussian", |
Brian Silverman | f119612 | 2020-01-16 00:41:54 -0800 | [diff] [blame] | 129 | "//third_party:opencv", |
Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame^] | 130 | "@com_github_google_glog//:glog", |
| 131 | ], |
| 132 | ) |
| 133 | |
| 134 | cc_library( |
| 135 | name = "fast_gaussian", |
| 136 | srcs = [ |
| 137 | "fast_gaussian.cc", |
| 138 | ], |
| 139 | hdrs = [ |
| 140 | "fast_gaussian.h", |
| 141 | ], |
| 142 | restricted_to = [ |
| 143 | "//tools:k8", |
| 144 | "//tools:armhf-debian", |
| 145 | ], |
| 146 | deps = [ |
| 147 | ":fast_gaussian_all", |
| 148 | "//third_party:halide_runtime", |
| 149 | "//third_party:opencv", |
| 150 | "@com_github_google_glog//:glog", |
| 151 | ], |
| 152 | ) |
| 153 | |
| 154 | cc_binary( |
| 155 | name = "testing_sift", |
| 156 | srcs = [ |
| 157 | "testing_sift.cc", |
| 158 | ], |
| 159 | restricted_to = [ |
| 160 | "//tools:k8", |
| 161 | "//tools:armhf-debian", |
| 162 | ], |
| 163 | deps = [ |
| 164 | ":fast_gaussian", |
| 165 | "//aos:init", |
| 166 | "//aos/time", |
| 167 | "//third_party:opencv", |
| 168 | "//y2020/vision/sift:sift971", |
| 169 | "@com_github_google_glog//:glog", |
Brian Silverman | f119612 | 2020-01-16 00:41:54 -0800 | [diff] [blame] | 170 | ], |
| 171 | ) |