Commit d1023f9650a3a4fc54cf0bd6583d21961e0ba986

Authored by Josh Klontz
1 parent 02412840

added borderMode property to AffineTransform

openbr/plugins/imgproc/affine.cpp
@@ -34,6 +34,7 @@ class AffineTransform : public UntrainableTransform @@ -34,6 +34,7 @@ class AffineTransform : public UntrainableTransform
34 { 34 {
35 Q_OBJECT 35 Q_OBJECT
36 Q_ENUMS(Method) 36 Q_ENUMS(Method)
  37 + Q_ENUMS(BorderMode)
37 38
38 public: 39 public:
39 /*!< */ 40 /*!< */
@@ -41,7 +42,14 @@ public: @@ -41,7 +42,14 @@ public:
41 Area = INTER_AREA, 42 Area = INTER_AREA,
42 Bilin = INTER_LINEAR, 43 Bilin = INTER_LINEAR,
43 Cubic = INTER_CUBIC, 44 Cubic = INTER_CUBIC,
44 - Lanczo = INTER_LANCZOS4}; 45 + Lanczo = INTER_LANCZOS4 };
  46 + enum BorderMode { Replicate = BORDER_REPLICATE,
  47 + Constant = BORDER_CONSTANT,
  48 + Reflect = BORDER_REFLECT,
  49 + Wrap = BORDER_WRAP,
  50 + Reflect_101 = BORDER_REFLECT_101,
  51 + Transparent = BORDER_TRANSPARENT,
  52 + Isolated = BORDER_ISOLATED };
45 53
46 private: 54 private:
47 Q_PROPERTY(int width READ get_width WRITE set_width RESET reset_width STORED false) 55 Q_PROPERTY(int width READ get_width WRITE set_width RESET reset_width STORED false)
@@ -53,6 +61,7 @@ private: @@ -53,6 +61,7 @@ private:
53 Q_PROPERTY(float x3 READ get_x3 WRITE set_x3 RESET reset_x3 STORED false) 61 Q_PROPERTY(float x3 READ get_x3 WRITE set_x3 RESET reset_x3 STORED false)
54 Q_PROPERTY(float y3 READ get_y3 WRITE set_y3 RESET reset_y3 STORED false) 62 Q_PROPERTY(float y3 READ get_y3 WRITE set_y3 RESET reset_y3 STORED false)
55 Q_PROPERTY(Method method READ get_method WRITE set_method RESET reset_method STORED false) 63 Q_PROPERTY(Method method READ get_method WRITE set_method RESET reset_method STORED false)
  64 + Q_PROPERTY(BorderMode borderMode READ get_borderMode WRITE set_borderMode RESET reset_borderMode STORED false)
56 Q_PROPERTY(bool storeAffine READ get_storeAffine WRITE set_storeAffine RESET reset_storeAffine STORED false) 65 Q_PROPERTY(bool storeAffine READ get_storeAffine WRITE set_storeAffine RESET reset_storeAffine STORED false)
57 Q_PROPERTY(bool warpPoints READ get_warpPoints WRITE set_warpPoints RESET reset_warpPoints STORED false) 66 Q_PROPERTY(bool warpPoints READ get_warpPoints WRITE set_warpPoints RESET reset_warpPoints STORED false)
58 BR_PROPERTY(int, width, 64) 67 BR_PROPERTY(int, width, 64)
@@ -64,6 +73,7 @@ private: @@ -64,6 +73,7 @@ private:
64 BR_PROPERTY(float, x3, -1) 73 BR_PROPERTY(float, x3, -1)
65 BR_PROPERTY(float, y3, -1) 74 BR_PROPERTY(float, y3, -1)
66 BR_PROPERTY(Method, method, Bilin) 75 BR_PROPERTY(Method, method, Bilin)
  76 + BR_PROPERTY(BorderMode, borderMode, Constant)
67 BR_PROPERTY(bool, storeAffine, false) 77 BR_PROPERTY(bool, storeAffine, false)
68 BR_PROPERTY(bool, warpPoints, false) 78 BR_PROPERTY(bool, warpPoints, false)
69 79
@@ -106,7 +116,7 @@ private: @@ -106,7 +116,7 @@ private:
106 if (twoPoints) srcPoints[2] = getThirdAffinePoint(srcPoints[0], srcPoints[1]); 116 if (twoPoints) srcPoints[2] = getThirdAffinePoint(srcPoints[0], srcPoints[1]);
107 117
108 Mat affineTransform = getAffineTransform(srcPoints, dstPoints); 118 Mat affineTransform = getAffineTransform(srcPoints, dstPoints);
109 - warpAffine(src, dst, affineTransform, Size(width, height), method); 119 + warpAffine(src, dst, affineTransform, Size(width, height), method, borderMode);
110 120
111 if (warpPoints) { 121 if (warpPoints) {
112 QList<QPointF> points = src.file.points(); 122 QList<QPointF> points = src.file.points();