# Can I undo Interp2 function?

6 visualizzazioni (ultimi 30 giorni)
bkshn il 2 Dic 2013
Risposto: Matt J il 12 Dic 2013
I use code bellow to resample my Image
for i=1:z
nimg(:,:,i) = interp2(Ox,Oy,img(:,:,i),Nx,Ny,intmethod);
end
Can I undo interpolating to receive first Image?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (3)

Matt J il 2 Dic 2013
Modificato: Matt J il 2 Dic 2013
Approximately, yes, depending somewhat on what the transformation is and whether it is invertible. For example imrotate(Img, theta) does a specialized form of the resampling you've shown. The inverse rotation imrotate(img,-theta) would return an approximation of your original image.
##### 2 CommentiMostra NessunoNascondi Nessuno
bkshn il 4 Dic 2013
How can I find that my transformation is invertible? I use interp2, is it invertible?
Matt J il 4 Dic 2013
Modificato: Matt J il 4 Dic 2013
The specific transformation you are performing with interp2 has to be analyzed for invertibility on mathematical grounds. In general, if the Jacobian determinant of your transformation is non-zero through the image, the transformation is invertible.
Common kinds of invertible transformations are rotations, translations, certain affine transformations, etc... See documentation for tformfwd() and tforminv() for additional common kinds of invertible transformations.
Instead of interp2, you might even consider using maketform(), imtransform() and tforminv(), since they make transform inversion simpler.

Accedi per commentare.

Walter Roberson il 2 Dic 2013
Take a 20 KHz sine wave. Resample it 5000 times per second. Lots of resolution! Now resample those 5000 samples per second back to 20000 KHz. Plot it out, and you'll see a good approximation of the original signal. Oh, wait, the plot is flat ?!? Better resample it 10000 times per second for better accuracy ?!?
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
bkshn il 4 Dic 2013
I want to resample an image not a Wave, I don't know is it your solution good for me?

Accedi per commentare.

Matt J il 12 Dic 2013
If you were hoping to invert not just the continuous space transform approximated by interp2, but in fact the whole discrete image transformation it performs, you could try FUNC2MAT.
Basically, you can convert the transformation W=interp2(V,XI,YI) to a matrix equation
W(:)=A*V(:)
where the matrix A is obtained by
A=func2mat(@(z)interp2(z,XI,YI), zeros(size(V)));
You can then attempt linear algebraic pseudo-inversion
V_recovered=reshape(A\W(:), size(V))
However, the invertability of A would depend greatly on XI, YI and in an unclear way.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Pulse width modulation (PWM) in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by