How to interpolate the pixel resolution
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to learn interpolation which I will use in my job. These are the code I was practising, but I have error at the end.. Please can someone help me through on how to debug to clear off the error.. Error: Error using griddedInterpolant The grid vectors do not define a grid of points that match the given values.
Error in interp2/makegriddedinterp (line 214)
F = griddedInterpolant(varargin{:});
Error in interp2 (line 127)
F = makegriddedinterp({X, Y}, V, method,extrap);
Error in ex_for_interpolation (line 21)
imagesc(interp2(x_axis,y_axis,A,new_x_axis,new_y_axis))
% The codes x_axis = 1:15; y_axis = 1:25;
A = x_axis'*y_axis;
subplot(2,2,1)
imagesc(A)
axis equal
subplot(2,2,2)
% show the same data, but interpolated, by adding one additional pixel to each gap:
imagesc(interp2(A))
axis equal
subplot(2,2,3)
% show the same data, interpolated to any axis of your choice:
new_x_axis = x_axis(1):0.1:x_axis(end);
new_y_axis = y_axis(1):0.2:y_axis(end);
imagesc(interp2(x_axis,y_axis,A,new_x_axis,new_y_axis))
0 comentarios
Respuesta aceptada
Jian Wei
el 29 de Jul. de 2014
Please try the following code after you create the new_x_axis and new_y_axis.
[x_mesh,y_mesh] = meshgrid(x_axis,y_axis);
[new_x_mesh,new_y_mesh] = meshgrid(new_x_axis,new_y_axis);
imagesc(interp2(x_mesh,y_mesh,A',new_x_mesh,new_y_mesh)')
Más respuestas (1)
Image Analyst
el 29 de Jul. de 2014
Why not just use imresize()? It would be so much simpler.
0 comentarios
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!