vectorizing a for loop
显示 更早的评论
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 个评论
Andrew Newell
2011-5-30
It would be easier to answer this question if you showed us your code.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!