Commit d1023f9650a3a4fc54cf0bd6583d21961e0ba986
1 parent
02412840
added borderMode property to AffineTransform
Showing
1 changed file
with
12 additions
and
2 deletions
openbr/plugins/imgproc/affine.cpp
| ... | ... | @@ -34,6 +34,7 @@ class AffineTransform : public UntrainableTransform |
| 34 | 34 | { |
| 35 | 35 | Q_OBJECT |
| 36 | 36 | Q_ENUMS(Method) |
| 37 | + Q_ENUMS(BorderMode) | |
| 37 | 38 | |
| 38 | 39 | public: |
| 39 | 40 | /*!< */ |
| ... | ... | @@ -41,7 +42,14 @@ public: |
| 41 | 42 | Area = INTER_AREA, |
| 42 | 43 | Bilin = INTER_LINEAR, |
| 43 | 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 | 54 | private: |
| 47 | 55 | Q_PROPERTY(int width READ get_width WRITE set_width RESET reset_width STORED false) |
| ... | ... | @@ -53,6 +61,7 @@ private: |
| 53 | 61 | Q_PROPERTY(float x3 READ get_x3 WRITE set_x3 RESET reset_x3 STORED false) |
| 54 | 62 | Q_PROPERTY(float y3 READ get_y3 WRITE set_y3 RESET reset_y3 STORED false) |
| 55 | 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 | 65 | Q_PROPERTY(bool storeAffine READ get_storeAffine WRITE set_storeAffine RESET reset_storeAffine STORED false) |
| 57 | 66 | Q_PROPERTY(bool warpPoints READ get_warpPoints WRITE set_warpPoints RESET reset_warpPoints STORED false) |
| 58 | 67 | BR_PROPERTY(int, width, 64) |
| ... | ... | @@ -64,6 +73,7 @@ private: |
| 64 | 73 | BR_PROPERTY(float, x3, -1) |
| 65 | 74 | BR_PROPERTY(float, y3, -1) |
| 66 | 75 | BR_PROPERTY(Method, method, Bilin) |
| 76 | + BR_PROPERTY(BorderMode, borderMode, Constant) | |
| 67 | 77 | BR_PROPERTY(bool, storeAffine, false) |
| 68 | 78 | BR_PROPERTY(bool, warpPoints, false) |
| 69 | 79 | |
| ... | ... | @@ -106,7 +116,7 @@ private: |
| 106 | 116 | if (twoPoints) srcPoints[2] = getThirdAffinePoint(srcPoints[0], srcPoints[1]); |
| 107 | 117 | |
| 108 | 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 | 121 | if (warpPoints) { |
| 112 | 122 | QList<QPointF> points = src.file.points(); | ... | ... |