What is the best method to use for interpolating RGB true colour images?
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
cui,xingxing
el 21 de Sept. de 2022
Comentada: cui,xingxing
el 14 de Oct. de 2022
What is the best method to use for interpolating RGB true colour images? It seems that I am not using the following 4 methods very well, the first and the fourth are actually the same, and the second interp2 cannot interpolate the R,G,B channels at the same time? The third method only supports ndgrid grid points and cannot interpolate images?
%% test performance speed
load param.mat % required params
numTimes = 1000; % test times
%% method1
t1 = tic;
for i = 1:numTimes
dstImg = imwarp(src,tform,OutputView=outputView);
end
T1 = toc(t1)
imshow(dstImg)
%% method2
t1 = tic;
for i = 1:numTimes
birdsEyeImgR = interp2(src(:,:,1),mapX,mapY,"linear",0);
% birdsEyeImgG = interp2(src(:,:,2),mapX,mapY,"linear",0);
% birdsEyeImgB = interp2(src(:,:,3),mapX,mapY,"linear",0);
% birdsEyeImg = cat(3,birdsEyeImgR,birdsEyeImgG,birdsEyeImgB);
end
T2 = toc(t1)
imshow(birdsEyeImgR)
%% method3, not is my expected result image
t1 = tic;
[X,Y] = ndgrid(1:size(src,1),1:size(src,2));
F = griddedInterpolant(X,Y,src,'linear','nearest');
for i = 1:numTimes
birdsEyeImgF = F(mapX,mapY);
end
T3 = toc(t1)
imshow(birdsEyeImgF)
%% method4
t1 = tic;
for i = 1:numTimes
BEV = transformImage(birdsEye,src);
end
T4 = toc(t1)
imshow(BEV)
Any recommendations for a more efficient method? your answer would be greatly appreciate!
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Import, Export, and Conversion 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!