segmenting an image into number of equal size images
Afficher commentaires plus anciens
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 commentaires
Image Analyst
le 1 Avr 2012
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
le 16 Juil 2012
yes i think must add this to FAQ.
Jeff Dozier
le 9 Août 2013
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).
Réponse acceptée
Plus de réponses (1)
Aaditya Kalsi
le 1 Avr 2012
0 votes
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.
Catégories
En savoir plus sur Color Segmentation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!