Trovata la soluzione
Im = imread('immagine.estensione');
[r c] = size(Im);
figure,
imshow(Im),
hold on
for k=1:32:r
x = [1 c];
y = [k k];
plot(x,y,'Color','r','LineStyle','-')
end
for k=1:32:c
x = [k k];
y = [1 r];
plot(x,y,'Color','r','LineStyle','-')
end
x = [1 c];
y = [r r];
plot(x,y,'Color','r','LineStyle','-')
x = [c c];
y = [1 r];
plot(x,y,'Color','r','LineStyle','-')
hold off