Borrar filtros
Borrar filtros

Conversion Projected image to Original image

3 visualizaciones (últimos 30 días)
Jinwoo Jung
Jinwoo Jung el 27 de Feb. de 2017
Respondida: Sid Jhaveri el 1 de Mzo. de 2017
I need to convert Projected image to original image(before projection) Projected image is IPM(Inverse Perspective Mapping) image , and I wrote code, and it works, but too expensive.... This is the code that I wrote
function [img] = IPM2im(IPM, lin_ind_img, sizeImg)
% Set size of Original Image
sizeCol=sizeImg(1,1);
sizeRow=sizeImg(1,2);
% Set Original Image
img=zeros(sizeCol, sizeRow);
for i=1:size(lin_ind_img,1)
for j=1:size(lin_ind_img, 2)
if IPM(i,j) ~= 1
[r,c]=ind2sub([sizeCol sizeRow], lin_ind_img(i,j));
img(r,c)=IPM(i,j);
end
end
end
end
can I make it faster??

Respuestas (1)

Sid Jhaveri
Sid Jhaveri el 1 de Mzo. de 2017
Hi Jinwoo,
Instead of using two for-loops, try using logical indexing and vectorization. This might make the code run faster.
Regards,
Sid

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by