What do you mean by not the same?
load woman;
dwtmode('per');
[A,H,V,D] = dwt2(X,'db2');
Xrec = idwt2(A,H,V,D,'db2');
Y = Xrec-X;
max(Y(:))
This is on the order of 10^(-10) for the maximum difference between the two images. That is the same.
Are you changing the coefficients before you perform the inverse DWT?