aboutsummaryrefslogtreecommitdiff
path: root/pix_opencv_warpperspective.cc
diff options
context:
space:
mode:
Diffstat (limited to 'pix_opencv_warpperspective.cc')
-rw-r--r--pix_opencv_warpperspective.cc30
1 files changed, 2 insertions, 28 deletions
diff --git a/pix_opencv_warpperspective.cc b/pix_opencv_warpperspective.cc
index de020e6..e0f0eba 100644
--- a/pix_opencv_warpperspective.cc
+++ b/pix_opencv_warpperspective.cc
@@ -73,7 +73,6 @@ pix_opencv_warpperspective :: pix_opencv_warpperspective()
flags = CV_WARP_FILL_OUTLIERS; // TODO add a set method
findmethod = 0; // TODO add a set method
- //~ printf("build on %s at %s\n", __DATE__, __TIME__);
post("pix_opencv_warpperspective by Antoine Villeret");
post("build on %s at %s", __DATE__, __TIME__);
@@ -203,21 +202,17 @@ void pix_opencv_warpperspective :: mapMatrixMess (int argc, t_atom *argv)
void pix_opencv_warpperspective :: srcMatrixMess (int argc, t_atom *argv)
{
- //~ printf("set srcMatrix\n");
int i,j;
float a;
- //~ printf("check parity\n");
if ( argc % 2 ) {
error("src is should be a list of couple x/y values");
return;
}
- //~ printf("check size\n");
if ( argc != dstMatrix->rows * dstMatrix->cols )
{
error("src matrix should have the same size as dst matrix (which is %d x %d)", dstMatrix->cols, dstMatrix->rows);
return;
}
- //~ printf("check type\n");
for ( i = 0; i < argc ; i++) {
if (argv[i].a_type != A_FLOAT) {
error("src matrix should be float");
@@ -226,7 +221,6 @@ void pix_opencv_warpperspective :: srcMatrixMess (int argc, t_atom *argv)
}
// fillin the srcMatrix
- //~ printf("fillin srcMatrix\n");
for ( i = 0 ; i < dstMatrix->rows ; i++ )
{
CV_MAT_ELEM( *srcMatrix, float, i, 0 ) = argv[i*2].a_w.w_float;
@@ -237,21 +231,17 @@ void pix_opencv_warpperspective :: srcMatrixMess (int argc, t_atom *argv)
void pix_opencv_warpperspective :: dstMatrixMess (int argc, t_atom *argv)
{
- //~ printf("set dstMatrix\n");
int i,j;
- //~ printf("check parity\n");
if ( argc % 2 ){
error("dstMatrix is should be a list of x/y pairs");
return;
}
- //~ printf("check type\n");
for ( i = 0; i < argc ; i++) {
if (argv[i].a_type != A_FLOAT) {
error("dstMatrix should be float");
return;
}
}
- //~ printf("dstMatrix-cols = %d,\t argc = %d\n", dstMatrix->rows, argc);
if ( dstMatrix->rows != argc/2 ) {
// delete and recreate matrix if needed
cvReleaseMat(&dstMatrix);
@@ -272,35 +262,19 @@ void pix_opencv_warpperspective :: dstMatrixMess (int argc, t_atom *argv)
void pix_opencv_warpperspective :: findhomography( )
{
int i,j;
- //~ printf("find homography\n");
if ( srcMatrix->cols != dstMatrix->cols || srcMatrix->rows != dstMatrix->rows ) {
error("srcMatrix and dstMatrix should have the same size to compute homography !");
return;
}
- /*
- printf("--- srcMatrix ---");
- for ( i = 0 ; i < srcMatrix->rows ; i++ ){
- printf("%.2f\t", CV_MAT_ELEM( *srcMatrix, float, i, 0));
- printf("%.2f\n", CV_MAT_ELEM( *srcMatrix, float, i, 1));
- }
- printf("--- dstMatrix ---");
- for ( i = 0 ; i < dstMatrix->rows ; i++ ){
- printf("%.2f\t", CV_MAT_ELEM( *dstMatrix, float, i, 0));
- printf("%.2f\n", CV_MAT_ELEM( *dstMatrix, float, i, 1));
- }
- */
cvFindHomography(srcMatrix, dstMatrix, mapMatrix, findmethod, 0, NULL);
- /*
- printf("---mapMatrix---\n");
+
for ( j = 0 ; j < 3 ; j++ ){
for( i=0 ; i<3 ; i++){
SETFLOAT(&mapMatrixList[i+j*3], CV_MAT_ELEM( *mapMatrix, float, i, j));
- printf("%.2f,\t", CV_MAT_ELEM( *mapMatrix, float, i, j));
}
- printf("\n");
}
- */
+
// send out mapMatrix
outlet_list( m_dataout, 0, 9, mapMatrixList);
}