Commit 5032f4dbeafc767c73cc05d4f07c3bdfd6d01013
1 parent
2fb04e0d
implemented Mod transform
Showing
1 changed file
with
19 additions
and
0 deletions
openbr/plugins/crop.cpp
| ... | ... | @@ -90,6 +90,25 @@ BR_REGISTER(Transform, LimitSizeTransform) |
| 90 | 90 | |
| 91 | 91 | /*! |
| 92 | 92 | * \ingroup transforms |
| 93 | + * \brief Enforce a multiple of \em n columns. | |
| 94 | + * \author Josh Klontz \cite jklontz | |
| 95 | + */ | |
| 96 | +class ModTransform : public UntrainableTransform | |
| 97 | +{ | |
| 98 | + Q_OBJECT | |
| 99 | + Q_PROPERTY(int n READ get_n WRITE set_n RESET reset_n STORED false) | |
| 100 | + BR_PROPERTY(int, n, 1) | |
| 101 | + | |
| 102 | + void project(const Template &src, Template &dst) const | |
| 103 | + { | |
| 104 | + dst = Mat(src, Rect(0,0,n*(src.m().cols/n),src.m().rows)); | |
| 105 | + } | |
| 106 | +}; | |
| 107 | + | |
| 108 | +BR_REGISTER(Transform, ModTransform) | |
| 109 | + | |
| 110 | +/*! | |
| 111 | + * \ingroup transforms | |
| 93 | 112 | * \brief Crop out black borders |
| 94 | 113 | * \author Josh Klontz \cite jklontz |
| 95 | 114 | */ | ... | ... |