Commit 193c59840ea3b7dd22bfef97a9455b5c2df104b0

Authored by bhklein
1 parent 1d389f1d

blur each ROI in file's rects()

Showing 1 changed file with 13 additions and 1 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  
... ...