summaryrefslogtreecommitdiff
path: root/rotord/rotor.h
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/rotor.h')
-rwxr-xr-xrotord/rotor.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/rotord/rotor.h b/rotord/rotor.h
index 3f51d79..f630391 100755
--- a/rotord/rotor.h
+++ b/rotord/rotor.h
@@ -1178,6 +1178,16 @@ namespace Rotor {
};
~Transform(){
};
+ void link_params() {
+ for (auto p:parameter_inputs){
+ if (p->parameter=="scale") p->receiver=&s;
+ if (p->parameter=="rotation") p->receiver=&r;
+ if (p->parameter=="transformX") p->receiver=&tX;
+ if (p->parameter=="transformY") p->receiver=&tY;
+ if (p->parameter=="originX") p->receiver=&oX;
+ if (p->parameter=="originY") p->receiver=&oY;
+ }
+ };
Transform* clone(map<string,string> &_settings) { return new Transform(_settings);};
Image *output(const Frame_spec &frame){
if (image_inputs.size()) {
@@ -1190,7 +1200,7 @@ namespace Rotor {
cv::Mat rot_mat(2,3,CV_32FC1);
cv::Mat trans_mat(2,3,CV_32FC1);
- /*
+
Image inter;
inter.setup(other->w,other->h);
// Compute matrix by creating triangle and transforming
@@ -1206,8 +1216,8 @@ namespace Rotor {
dstTri[i].y=srcTri[i].y+(tY*other->h);
}
trans_mat=getAffineTransform( srcTri, dstTri );
- warpAffine( other->rgb, inter.rgb, trans_mat, inter.rgb.size() );
- */
+ warpAffine( other->rgb, inter.rgb, trans_mat, inter.rgb.size(), cv::INTER_LINEAR, cv::BORDER_WRAP);
+
// Compute rotation matrix
//
@@ -1216,7 +1226,14 @@ namespace Rotor {
rot_mat = getRotationMatrix2D( centre, r, s );
// Do the transformation
//
- warpAffine( other->rgb, image.rgb, rot_mat, image->rgb.size() );
+ warpAffine( inter.rgb, image.rgb, rot_mat, image.rgb.size(), cv::INTER_LINEAR, cv::BORDER_WRAP);
+ //BORDER_WRAP
+
+ //INTER_NEAREST - a nearest-neighbor interpolation
+ //INTER_LINEAR - a bilinear interpolation (used by default)
+ //INTER_AREA - resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method.
+ //INTER_CUBIC - a bicubic interpolation over 4x4 pixel neighborhood
+ //INTER_LANCZOS4 - a Lanczos interpolation over 8x8 pixel neighborhood
return &image;
}