Commit b7b7bf7b83cc5e199791ca434ac08220ab3d4aae
1 parent
06bf8d6d
option to split on cols
Showing
1 changed file
with
9 additions
and
2 deletions
openbr/plugins/imgproc/split.cpp
| ... | ... | @@ -53,13 +53,20 @@ class SplitRowsTransform : public UntrainableTransform |
| 53 | 53 | { |
| 54 | 54 | Q_OBJECT |
| 55 | 55 | Q_PROPERTY(int step READ get_step WRITE set_step RESET reset_step STORED false) |
| 56 | + Q_PROPERTY(bool cols READ get_cols WRITE set_cols RESET reset_cols STORED false) | |
| 56 | 57 | BR_PROPERTY(int, step, 1) |
| 58 | + BR_PROPERTY(bool, cols, false) | |
| 57 | 59 | |
| 58 | 60 | void project(const Template &src, Template &dst) const |
| 59 | 61 | { |
| 60 | 62 | const Mat &m = src; |
| 61 | - for (int i=0; i<m.rows; i += step) | |
| 62 | - dst += m.rowRange(i, i + step); | |
| 63 | + if (cols) { | |
| 64 | + for (int i=0; i<m.cols; i += step) | |
| 65 | + dst += m.colRange(i, i + step); | |
| 66 | + } else { | |
| 67 | + for (int i=0; i<m.rows; i += step) | |
| 68 | + dst += m.rowRange(i, i + step); | |
| 69 | + } | |
| 63 | 70 | } |
| 64 | 71 | }; |
| 65 | 72 | ... | ... |