segmenting an image into number of equal size images
显示 更早的评论
can anybody give me an algorithm for segmenting an image into certain number of equal size image and also for calculating properties for each segmented images?
3 个评论
Image Analyst
2012-4-1
We should really add this to the FAQ. This "how do I divide an image into blocks/subimages" question is getting almost as common as the "how do I save a figure" questions.
M@lik Ali
2012-7-16
yes i think must add this to FAQ.
Jeff Dozier
2013-8-9
Check the function bestblk([M N],maxsiz). It finds dimensions <= maxsiz that are divisors of M & N. If it can't find a divisor > M/10, then it minimizes the amount of padding (and then does the same for N).
采纳的回答
更多回答(1 个)
Aaditya Kalsi
2012-4-1
0 个投票
One way to do this is to decide on a metric to segment the image into. Also, the method I am writing is general and the resulting segments will not completely reconstruct the image, rather extract out N important segments.
Easy Algorithm:
1. Assume a 5x5 (you may choose a different size) block. Select this iteratively and move through the entire image. If you have the Image Processing Toolbox, you may do this by BLOCKPROC.
2. Calculate Variance for each block. You may do this by using VAR() on the block's elements listed out like a vector. Assuming your block is B, then B(:) will list out its elements as a vector.
3. Keep the blocks with the M highest variance values.
Variance is a good starting guess for interesting regions. This however highly depends on your application.
类别
在 帮助中心 和 File Exchange 中查找有关 Color Segmentation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!