Vectorization of the forward mapping loop- affine transformation
Afficher commentaires plus anciens
Hi! I want to vectorize this fragment of code. So basically I want to transform the input image ( input ). The matrix is 3x3 matrix of affine 2D transformation (for example scaling [2 0 0; 0 2 0; 0 0 1]). After forward mapping I got indices of output image ( output ) and I put pixels of input image into output image.
for u=1:size(input,2)
for v=1:size(input,1)
indices=ceil((matrix)'*[u;v;1]);
output(indices(2),indices(1),:)=input(v,u,:);
end
end
The problem is probably simple, but I don't have any idea how to use vectorization here. This loop is working fine in my program, just want to optimize it.
Réponses (0)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!