WOLFRAM
Products
Wolfram|One
Mathematica
Wolfram Notebook Assistant + LLM Kit
Wolfram|Alpha Notebook Edition
System Modeler
All Products
Consulting & Solutions
Wolfram Consulting
Industry Solutions
Solutions for Education
Learning & Support
Wolfram U Courses
Wolfram Language Resources
Wolfram Community
Support FAQs
Contact Support
Company
About Wolfram
Careers
Events
Educational Programs
All Sites and Resources
Wolfram|Alpha
Wolfram Cloud
Your Account
Your Account
User Portal
Search
Close
Enable JavaScript to interact with content and submit forms on Wolfram websites.
Learn how
Legacy Documentation
Digital Image Processing
(2000)
This is documentation for an obsolete product.
Current products and services
User's Guide
Area Operations
5.4 Block Processing
In a convolution operation, a finite size filter is scanned over a data array. At each position, a sum of the point-by-point products of the filter samples with the corresponding data samples is calculated. The operator neighborhood is defined by the geometry of the filter. Block processing is a generalization of convolution. The mathematical operators need not be multiplication and addition, and the neighborhoods do not need to overlap. The data operators that lend themselves to this kind of processing are typically called area operators. The processes that can be carried out by area operators include, in addition to convolution and correlation, data resampling, morphological operators, block transforms, noise filtering, and more.
BlockProcessing
[
f
,
img
,
{
n
r
,
n
c
}
]
partitions
img
into non-overlapping blocks of dimensions
{n
r
, n
c
}
and
applies function
f
to each block
BlockProcessing
[
f
,
img
,
{
n
r
,
n
c
}
,
{
d
r
,
d
c
}
]
partitions
img
{n
r
, n
c
}
with offsets
{d
r
, d
c
}
and applies function
f
to each block
BlockProcessing
function.
This loads the package.
In[1]:=
Here we create a small data array.
In[2]:=
Out[2]//MatrixForm=
Here we apply some arbitrary function
f
to each 2×2 non-overlapping block of array
arr
.
In[3]:=
Out[3]=
In practice, the dimensions of the original data array need not be an integer multiple of the block size. Therefore, as in convolution and correlation, padding is used to extend the original data array to ensure that all border samples are processed in exactly the same way as any interior samples. Padding is accomplished with option
PaddingMethod
, the values being the function names of any of the methods described in Section
4.4
.
Option
Default
PaddingMethod
FixedPad
method used to extend the border of the data array
Centered
False
selects one-sided padding of the data array
BlockProcessing
options.
This demonstrates the use of a sliding window and zero-padding.
In[4]:=
Out[4]=
Here we use
BlockProcessing
to return the median pixel value within a 3×3 sliding window using the example
books
image.
In[5]:=
In[6]:=
Out[6]=