Problem when using the dwt2 function in Visual C++ using the MATLAB Engine API. The output image is warped for some of the transforms.
Mostrar comentarios más antiguos
When I use the dwt2 function with the haar wavelet, the output is rendered properly in both the MATLAB command window that opens with the engOpen command, as well as when I render it from my C code.
But if I use the 'sym2' parameter instead of 'haar', the image rendered from C is not correct, although the same image rendered from the MATLAB command window using 'imshow' is displayed properly.
The problem that I am facing is that the pixels which should be rendered in first row of the image are being rendered in the major diagonal, and all the rows follow suit.
Here is an excerpt of the relevant code:
X = mxCreateDoubleMatrix (height, width, mxREAL);
memcpy (mxGetPr (X), imagetemp, height*width*sizeof(double));
engPutVariable (ep, "gray", X);
engEvalString (ep, "gray = uint8 (gray);");
engEvalString (ep, "[A V H D] = dwt2 (gray, 'sym2');");
engEvalString (ep, "A = uint8(A); H = uint8(H); V = uint8(V); D = uint8(D);");
A = engGetVariable (ep, "A");
vara = mxGetData (A);
H = engGetVariable (ep, "H");
varh = mxGetData (H);
V = engGetVariable (ep, "V");
varv = mxGetData (V);
D = engGetVariable (ep, "D");
vard = mxGetData (D);
for (i=0; i<height/2; i++)
{
for (j=0; j<width/2; j++)
{
LL [i][j] = vara[(height*j/2) + i];
LH [i][j] = varh[(height*j/2) + i];
HL [i][j] = varv[(height*j/2) + i];
HH [i][j] = vard[(height*j/2) + i];
}
}
Thanks in advance..
1 comentario
James Tursa
el 11 de Mzo. de 2012
What is imagetemp?
Respuestas (0)
Categorías
Más información sobre Watermarking en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!