Often due to the limitation in memory, we want to divide an
image into mxn blocks and process those blocks. If your block processing outputs
an image then, you can use blockproc function in MATLAB. But, if processing
function outputs points then one can’t use block processing. For that, one has
to rely on image indexing to divide image into blocks. So here I will show you
how you can divide image into blocks and process those individual blocks for
any particular function using indexing. I am going to use block processing for
finding pivot irrigation fields detection that was featured in this post. The
trick is to apply matrix indexing to get chunk of block data and process them
in a sequential manner.
Here is the original image. We are going to divide it into mxn blocks. With the code you can specify any m or n value.
Original image |
Block processing sequential numbering |
With the following code, the block processing on individual
blocks are performed. Feel free to copy the code and adapt it to your liking. Everything in the code is self-explanatory, so just go through the code line by line and you will understand whats going on.
The output of block processing for original image is as follows:
Block processing of detecting circles |
.