Effacer les filtres
Effacer les filtres

How can i interpolate values to create image with desired number of pixels

1 vue (au cours des 30 derniers jours)
MaryD
MaryD le 12 Nov 2023
Commenté : Dyuman Joshi le 12 Nov 2023
I have log_env matrix which is 1407x50 set of data that i can display as an image. I want to interpolate data and result to be 512x512 pixels image. I try to achive that using interp2 as below. However what I'm getting is NaN through almost entire result matrix. Is there a problem with my approach or something must be wrong with data i try to interpolate?
[n,m]=size(log_env);
X=linspace(1,n,512);
Y=linspace(1,m,512);
[Xq,Yq]=meshgrid(X,Y);
new_env=interp2(log_env,Xq,Yq);

Réponse acceptée

Voss
Voss le 12 Nov 2023
You've got m and n swapped in the definitions of X and Y.
[n,m]=size(log_env);
X=linspace(1,m,512);
Y=linspace(1,n,512);
[Xq,Yq]=meshgrid(X,Y);
new_env=interp2(log_env,Xq,Yq);

Plus de réponses (0)

Catégories

En savoir plus sur Geometric Transformation and Image Registration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by