summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rotord/src/nodes_audio_analysis.h4
-rw-r--r--rotord/src/nodes_transform.h39
2 files changed, 33 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..8baf1fa 100644
--- a/rotord/src/nodes_transform.h
+++ b/rotord/src/nodes_transform.h
@@ -62,23 +62,37 @@ 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);
+ //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;
+ 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;
+ 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
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 +102,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 &image;
}
return nullptr;