How to crop multiples part in an image and store in cell without using loop/ faster way compare to loop

1 view (last 30 days)
Hi,
As mention as above, i need to crop several section in an image and store in a cell using different bounding box, without a loop because this will increase the speed (speed is an important factor for me).
So i had try traditional way,
for i = length_bounding_box
cropped_image{i} = imcrop(I,bounding_box{i})
end
It work but took up some time, and i look through the web and found this code,
crop_image = cellfun(@(I) imcrop(I,bounding_box),I,'UniformOutput',false )
but it only work for I is a cell with several images and the bounding box used is fixed, so is there anyway to modify the code to do the opposite? which is crop different bounding box on same image instead of crop same bounding box on different images?
Any help would be greatly appreciated. Thanks in advance.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!