Commit 14ce2fa69715e53160a39626001a0b81a2c1bf8c
Merge pull request #316 from biometrics/blurTransform
Blur regions of interest
Showing
2 changed files
with
15 additions
and
2 deletions
openbr/plugins/filter.cpp
| ... | ... | @@ -61,11 +61,23 @@ class BlurTransform : public UntrainableTransform |
| 61 | 61 | { |
| 62 | 62 | Q_OBJECT |
| 63 | 63 | Q_PROPERTY(float sigma READ get_sigma WRITE set_sigma RESET reset_sigma STORED false) |
| 64 | + Q_PROPERTY(bool ROI READ get_ROI WRITE set_ROI RESET reset_ROI STORED false) | |
| 64 | 65 | BR_PROPERTY(float, sigma, 1) |
| 66 | + BR_PROPERTY(bool, ROI, false) | |
| 65 | 67 | |
| 66 | 68 | void project(const Template &src, Template &dst) const |
| 67 | 69 | { |
| 68 | - GaussianBlur(src, dst, Size(0,0), sigma); | |
| 70 | + if (!ROI) GaussianBlur(src, dst, Size(0,0), sigma); | |
| 71 | + else { | |
| 72 | + dst.m() = src.m(); | |
| 73 | + foreach (const QRectF &rect, src.file.rects()) { | |
| 74 | + Rect region(rect.x(), rect.y(), rect.width(), rect.height()); | |
| 75 | + Mat input = dst.m(); | |
| 76 | + Mat output = input.clone(); | |
| 77 | + GaussianBlur(input(region), output(region), Size(0,0), sigma); | |
| 78 | + dst.m() = output; | |
| 79 | + } | |
| 80 | + } | |
| 69 | 81 | } |
| 70 | 82 | }; |
| 71 | 83 | ... | ... |
openbr/plugins/gui.cpp