I want to divide my image into overlapping blocks and process those blocks individually and store the output of each matrix into a matrix.
I have tried using im2col but it is not at all practical. My code is:
kek = im2col(images_m{1}, [64 64], 'sliding');
for i = 1: size(kek, 2)
new = reshape(kek(:,i), [64 64]);
%Extract features from the new block and save it in a concatenating
%matrix
end
There are two problems with this, first there is no way to control the overlapping of blocks.
Second the process is very slow and very very memory hungry. I basically ran out of memory on my computer on the third image, even if I clear the previous images.
is there any efficient way to divide my images into overlapping blocks?
P.S. I cannot create a for image for every image as every image is of varying size :(
im2colandcol2imif it helps. Also, what sizes of images are you dealing with? Basically, that neighborhood matrix withim2colis huge in itself, so it would make more sense to perform the extraction of features locally and then saving rather than creating the neighborhood matrix and then processing for feature extraction. - Divakarim2col, I already have the image processing toolbox, also if I am to use that function, how would I control theslidingoverlap window? I agree with you regarding this being very inefficient. But I am trying to find alternatives here.blockprocwould be ideal here but the problem is with output ofblockprocwhich this question explains my problem exactly: stackoverflow.com/questions/29109241/… - ipunished