How to speed this kind of for-loop?

Posted by wok on Stack Overflow See other posts from Stack Overflow or by wok
Published on 2011-06-24T15:00:45Z Indexed on 2011/06/24 16:22 UTC
Read the original article Hit count: 196

I would like to compute the maximum of translated images along the direction of a given axis. I know about ordfilt2, however I would like to avoid using the Image Processing Toolbox.

So here is the code I have so far:

imInput = imread('tire.tif');
n = 10;

imMax = imInput(:, n:end);
for i = 1:(n-1)
    imMax = max(imMax, imInput(:, i:end-(n-i)));
end

Is it possible to avoid using a for-loop in order to speed the computation up, and, if so, how?

© Stack Overflow or respective owner

Related posts about Performance

Related posts about matlab