Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Error using Taucs

Subject: CGAL users discussion list

List archive

[cgal-discuss] Error using Taucs


Chronological Thread 
  • From: Mario Ynocente Castro <>
  • To:
  • Subject: [cgal-discuss] Error using Taucs
  • Date: Wed, 14 Sep 2011 12:39:04 -0500

Hi everyone, i'm testing a method for Poisson Image Editing. However I'm getting the following error : taucs_ccs_ops.c:185: taucs_dccs_permute_symmetrically: Assertion `A->flags & 8 || A->flags & 16' failed.

I've tested  the same method in Visual Studio (seems like it uses a previous version of taucs though), everything seems to
be working in the same way, except for Lmatrix->get_taucs_matrix(), in that version it takes totalpixel as a parameter.

void PoissonImageEditing(float* Fdx, float* Fdy, float* result, int width, int height){
int x,y,index;
int totalpixel = width*height;

//No mask, compute the image from gradient
TaucsMatrix* Lmatrix = new TaucsMatrix(totalpixel, totalpixel, false);
double* Bvector = new double[totalpixel];
memset(Bvector, 0, totalpixel*sizeof(double));

for(y = 0, index = 0; y < height; y++){
for(x = 0; x < width; x++, index++){
//This is second derivative equation
int c = 0;
if( x > 0 ){
Lmatrix->set_coef(index, index-1, -1);
Bvector[index] += Fdx[index];
c++;
}
if( x < width-1 ){
Lmatrix->set_coef(index, index+1, -1);
Bvector[index] -= Fdx[index+1];
c++;
}
if( y > 0 ){
Lmatrix->set_coef(index, index-width, -1);
Bvector[index] += Fdy[index];
c++;
}
if( y < height-1 ){
Lmatrix->set_coef(index, index+width, -1);
Bvector[index] -= Fdy[index+width];
c++;
}

if(c > 0){
Lmatrix->set_coef(index, index, c);
}
}
}

char* solve [] = {"taucs.factor.LU=true", NULL};
int error_code;
    
double* tempResult = new double[totalpixel];
memset(tempResult, 0, totalpixel*sizeof(double));

taucs_ccs_matrix* tm = (taucs_ccs_matrix*)Lmatrix->get_taucs_matrix();

printf("Solve Matrix: %d\n", totalpixel);
error_code = taucs_linsolve( tm, NULL, 1, tempResult, Bvector, solve, NULL);
if(error_code != TAUCS_SUCCESS){
printf("Solver Failed\n");
}

for(index = 0; index < totalpixel; index++){
tempResult[index] += 0.5f;
if(tempResult[index] < 0) tempResult[index] = 0;
if(tempResult[index] > 1) tempResult[index] = 1;

result[index] = (float)(tempResult[index]);
}

delete Lmatrix;
delete [] Bvector;
delete [] tempResult;
}

--
Mario Ynocente Castro
Undergraduate Student of System Engineering
National University of Engineering, Peru



Archive powered by MHonArc 2.6.16.

Top of Page