Using blockproc() or other to get specific number of blocks from various image sizes
2 views (last 30 days)
Show older comments
I've been using blockproc()to process a dataset, using variable B to indicate the number of both vertical and horizontal blocks e.g. using B = 10 would divide the image in to 11 by 11 = 121 blocks, with 10 by 10 equal blocks and the rightmost column and bottom row being the remainders. After each block is processed the results are shaped into a 1,[] array of doubles, and they are all of the same length (depending on B. Here they would be 121 long).
This is fine when my images do not have a dimension exactly devisible by B, but now I've expanded the dataset I'm getting images that have dimensions that can divide by B, resulting in exactly 10 by 10 blocks, or even 10 by 11, or, 11 by 10.
This produces an output of varying lengths which causes problems with vertcat, and more importantly when comparing outputs.
Is there a way of partitioning images of differing sizes in to an equal number of blocks based on an input integer B? Blocks do not necesarilly need to be all of equal size, but they should be consistent ie, if there is a remainder row/column they should always be in the same position. The key for me is to get output arrays of equal lengths.
2 Comments
KALYAN ACHARJYA
on 7 Nov 2019
Edited: KALYAN ACHARJYA
on 7 Nov 2019
but now I've expanded the dataset I'm getting images that have dimensions that can divide by B, resulting in exactly 10 by 10 blocks, or even 10 by 11, or, 11 by 10.
Is zero padding or any other means allowable?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!