What is the best method to use for interpolating RGB true colour images?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
cui,xingxing
am 21 Sep. 2022
Kommentiert: cui,xingxing
am 14 Okt. 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 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Import, Export, and Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!