diff options
| author | Comment <tim@gray.(none)> | 2014-03-02 22:14:34 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2014-03-02 22:14:34 +0000 |
| commit | 1082e9eed74507b6eb5a3d0d7ab8a6cdecf40e19 (patch) | |
| tree | c9e21ac3e1c3434b30c8530497b1f678641038dc /glitcher/src/audioGlitcher.h | |
| parent | a2fe68dfed91e362404ea1171cc8f0b313956cc3 (diff) | |
working version for show
Diffstat (limited to 'glitcher/src/audioGlitcher.h')
| -rw-r--r-- | glitcher/src/audioGlitcher.h | 56 |
1 files changed, 49 insertions, 7 deletions
diff --git a/glitcher/src/audioGlitcher.h b/glitcher/src/audioGlitcher.h index 8f48288..356314b 100644 --- a/glitcher/src/audioGlitcher.h +++ b/glitcher/src/audioGlitcher.h @@ -57,18 +57,29 @@ class audioGlitcher { cv::Mat srcX(interp_x,interp_y,CV_32FC1); cv::Mat srcY(interp_x,interp_y,CV_32FC1); - float xFactor=renderFBO.getWidth()/srcX.cols; - float yFactor=renderFBO.getHeight()/srcX.rows; + //for a sanity check + //512-1 / 16-1 = 34.066666667 + //* 15= + + float* sx = (float*)srcX.data; + float* sy = (float*)srcY.data; + float* dx = (float*)dstX.data; + float* dy = (float*)dstY.data; + + float xFactor=(renderFBO.getWidth()-1)/(srcX.cols-1); + float yFactor=(renderFBO.getHeight()-1)/(srcX.rows-1); for (int i=0;i<srcX.cols;i++){ for (int j=0;j<srcX.rows;j++){ - srcX.at<float>(j,i)=i*xFactor; - srcY.at<float>(j,i)=j*yFactor; + //srcX.at<float>(j,i)=i*xFactor; + //srcY.at<float>(j,i)=j*yFactor; + sx[i,j]=i*xFactor; + sy[i,j]=j*yFactor; } } //transform the low res matrix - float tX=trans_x-.05; //fraction of image - float tY=trans_y-.04; //fraction of image + float tX=trans_x; //-.05; //fraction of image + float tY=trans_y; //-.08; //fraction of image float oX=origin_x; //fraction of image float oY=origin_y; //fraction of image float s=scale; @@ -117,10 +128,41 @@ class audioGlitcher { cv::resize(dstX,scaledstX, cv::Size(renderFBO.getWidth(),renderFBO.getHeight()), 0, 0, cv::INTER_LINEAR); cv::resize(dstY,scaledstY, cv::Size(renderFBO.getWidth(),renderFBO.getHeight()), 0, 0, cv::INTER_LINEAR); + + + + + + for (int i=0;i<srcX.cols;i++){ + for (int j=0;j<srcX.rows;j++){ + dx[i,j]=i*xFactor; + dy[i,j]=j*yFactor; + + } + } + + for (int i=0;i<scaledstX.cols;i++) { + for (int j=0;j<scaledstX.rows;j++) { + //scaledstX.at<float>(j,i)=i; + //scaledstY.at<float>(j,i)=j; + } + } + + float* psx = (float*)scaledstX.data; + float* psy = (float*)scaledstY.data; + + cerr<<"src: <0,0> "<<sx[0]<<","<<sy[0]<<endl; + cerr<<"src: <7,5> "<<sx[7*16+5]<<","<<sy[7*16+5]<<endl; + cerr<<"src: <8,6> "<<sx[6*16+8]<<","<<sy[6*16+8]<<endl; + cerr<<"src: <15,11> "<<sx[11*15+11]<<","<<sy[11*15+11]<<endl; + cerr<<"dest: <7,5> "<<dx[7*16+5]<<","<<dy[7*16+5]<<endl; + cerr<<"dest: <8,6> "<<dx[6*16+8]<<","<<dy[6*16+8]<<endl; + cerr<<"Map at <256,192> "<<psx[192*512+256]<<","<<psy[192*512+256]<<endl; + cv::Mat buf = buffer.getCvImage(); cv::Mat dstbuf; - cv::remap(buf,dstbuf,scaledstX,scaledstY, cv::INTER_NEAREST, cv::BORDER_WRAP); //, cv::Scalar(0,0, 0) ); + cv::remap(buf,dstbuf,scaledstX,scaledstY, cv::INTER_LINEAR, cv::BORDER_WRAP); //, cv::Scalar(0,0, 0) ); tmp = IplImage(dstbuf); //buffer=tmp; |
