vectorizing a for loop
Show older comments
Hell all - I know that this question has been asked many times before but I feel like my problem is slightly different and is bigger (computationally). So here it goes. Any help would be much appreciated. Thank you - Mutlu..
I have an image with segments. The image size is 7000 x 7000 and contains roughly 1 million segments. Multiple pixels make up segments of various sizes and the image contains the unique segment IDs for each segment. I also have a look up table that associates each segment ID to a specific code (it is a two column matrix Segment ID and code). Using this look up table, I would like to assign each segment its appropriate code from the table. I tried doing this in a for loop where I would go through each segment ID, find the pixels that belong to that segment and assign the code from the look up table. Unfortunately, this is painfully slow for this large image. Are there easier - vectorized - ways of doing this? Of course there may be built in tools in the image processing toolbox (which I have) that may be helpful as well but I am not familiar with that toolbox.
1 Comment
Andrew Newell
on 30 May 2011
It would be easier to answer this question if you showed us your code.
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!