From 10a475fe33fc645e3623c2bf4b176194bf45675b Mon Sep 17 00:00:00 2001 From: Comment Date: Mon, 2 Sep 2013 13:10:02 +0100 Subject: scaling position in transform --- rotord/src/nodes_transform.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'rotord/src') diff --git a/rotord/src/nodes_transform.h b/rotord/src/nodes_transform.h index 32d9cef..8baf1fa 100644 --- a/rotord/src/nodes_transform.h +++ b/rotord/src/nodes_transform.h @@ -64,7 +64,9 @@ namespace Rotor { cv::Mat trans_mat(2,3,CV_32FC1); cv::Mat out_mat(3,3,CV_32FC1); - + //normally a scale of 1 will place the image on screen at pixel size + //it should be that a scale of 1 places it at width w + //how to scale around the centre cv::Mat inter; if (s<1){ if (s<.01) s=.01; @@ -72,7 +74,10 @@ namespace Rotor { cv::resize(in->rgb,inter,cv::Size(in->w*scalefac,in->h*scalefac),s,s); //double fx=0, double fy=0, int interpolation=INTER_LINEAR )ΒΆ s=1.0f; } - else inter=in->rgb; + else { + inter=in->rgb; + s=((float)image.w/in->w)*s; + } // Compute matrix by creating triangle and transforming //is there a better way - combine the 2? Just a bit of geometry -- cgit v1.2.3