diff options
| author | Comment <tim@gray.(none)> | 2013-08-31 19:44:31 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-08-31 19:44:31 +0100 |
| commit | 443992effaf9e1c8e6bf7db938ad3b86bc2ffe64 (patch) | |
| tree | 347853065012ee9b9d4105856fc496f047a27aaf | |
| parent | c5085b5a31c1e25bf83ae910710996863531f8b2 (diff) | |
making mipmaps for Rotor::cvimage
| -rw-r--r-- | rotord/src/nodes_audio_analysis.h | 4 | ||||
| -rw-r--r-- | rotord/src/nodes_transform.h | 34 |
2 files changed, 28 insertions, 10 deletions
diff --git a/rotord/src/nodes_audio_analysis.h b/rotord/src/nodes_audio_analysis.h index fba4bcc..619b60a 100644 --- a/rotord/src/nodes_audio_analysis.h +++ b/rotord/src/nodes_audio_analysis.h @@ -49,11 +49,11 @@ namespace Rotor { if (i->second.values.size()) v1=i->second.values[0]; switch (attributes["mode"]->intVal){ case VAMPHOST_Timeline: - return (((time.time-lk)/(uk-lk))+ln); + return ((time.time-lk)+ln); case VAMPHOST_Timesteps: return (float)ln; case VAMPHOST_Valueline: - return (((time.time-lk)/(v2-v1))+v1); + return (((time.time-lk)*(v2-v1))+v1); case VAMPHOST_Values: return v1; } diff --git a/rotord/src/nodes_transform.h b/rotord/src/nodes_transform.h index fd6b7be..32d9cef 100644 --- a/rotord/src/nodes_transform.h +++ b/rotord/src/nodes_transform.h @@ -62,23 +62,32 @@ namespace Rotor { cv::Point2f srcTri[3], dstTri[3]; cv::Mat rot_mat(2,3,CV_32FC1); cv::Mat trans_mat(2,3,CV_32FC1); + cv::Mat out_mat(3,3,CV_32FC1); - Image inter; - inter.setup(in->w,in->h); + + cv::Mat inter; + if (s<1){ + if (s<.01) s=.01; + float scalefac=((float)image.w/in->w)*s; + 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; + // Compute matrix by creating triangle and transforming //is there a better way - combine the 2? Just a bit of geometry srcTri[0].x=0; srcTri[0].y=0; - srcTri[1].x=in->w-1; + srcTri[1].x=image.w-1; srcTri[1].y=0; srcTri[2].x=0; - srcTri[2].y=in->h-1; + srcTri[2].y=image.h-1; for (int i=0;i<3;i++){ - dstTri[i].x=srcTri[i].x+(tX*in->w); - dstTri[i].y=srcTri[i].y+(tY*in->h); + dstTri[i].x=srcTri[i].x+(tX*image.w); + dstTri[i].y=srcTri[i].y+(tY*image.w); //use w for equiv coords } trans_mat=getAffineTransform( srcTri, dstTri ); - warpAffine( in->rgb, inter.rgb, trans_mat, inter.rgb.size(), filtmode, cv::BORDER_WRAP); + //warpAffine( in->rgb, inter.rgb, trans_mat, inter.rgb.size(), filtmode, cv::BORDER_WRAP); // Compute rotation matrix // @@ -88,9 +97,18 @@ namespace Rotor { // Do the transformation // - warpAffine( inter.rgb, image.rgb, rot_mat, image.rgb.size(), filtmode, cv::BORDER_WRAP); + //warpAffine( inter.rgb, image.rgb, rot_mat, image.rgb.size(), filtmode, cv::BORDER_WRAP); //BORDER_WRAP + //trans_mat.resize(3); + //rot_mat.resize(3); + //trans_mat.data[8]=1.0f; + //rot_mat.data[8]=1.0f; + //out_mat=rot_mat*trans_mat; + //out_mat.resize(2); + + warpAffine( inter, image.rgb, rot_mat, image.rgb.size(), filtmode, cv::BORDER_WRAP); + return ℑ } return nullptr; |
