| 175 | |
| 176 | template<typename T> |
| 177 | BitMatrix ToBitMatrix(const Matrix<T>& in, T trueValue = {true}) |
| 178 | { |
| 179 | BitMatrix out(in.width(), in.height()); |
| 180 | for (int y = 0; y < in.height(); ++y) |
| 181 | for (int x = 0; x < in.width(); ++x) |
| 182 | if (in.get(x, y) == trueValue) |
| 183 | out.set(x, y); |
| 184 | return out; |
| 185 | } |
| 186 | |
| 187 | template<typename T> |
| 188 | Matrix<T> ToMatrix(const BitMatrix& in, T black = 0, T white = ~0) |