Wednesday, April 18, 2012

matlab: read subsection of an image

I have a sequence of large images I would like to load into matlab and then apply some processing too. Due to the images size, reading them in takes a long time, and fills the computer memory very fast.



However, I am only interested in the middle section of the images, a region of about 100 by 100 pixels or so.



Is there a way to only read in that section of the image, therefore saving time, and memory?



Currently I am using:



ROIx = 450:550;
ROIy = 650:750;
image = double( imread( filename ) );
image = image(ROIx, ROIy);


However, imread() loads the whole image, and this takes a long time. Is there a way only to read the part I am interested in?



(One procedure would be to go through and crop each image into a smaller one and resave it. But I would prefer not to crop the images).



Thanks,
labjunky





No comments:

Post a Comment