Function Index
BlockProcessing
BlockProcessing[
f
,
img
,
{
n
1
,
...
}]
partitions
img
into non-overlapping blocks of size {n
1
, ...} and applies function
f
to each block.
BlockProcessing[
f
,
img
,
{
n
1
,
...
},
{
d
1
,
...
}]
partitions
img
into blocks of size {n
1
, ...} with offset {d
1
, ...} and applies function
f
to each block.
BlockProcessing
will return a result of the same dimensions as
img
if function
f
returns a scalar.
If
img
is an
ImageData
expression,
BlockProcessing
will return an
ImageData
object only if the operation f returns a raw data structure that is
ImageData
compatible (see Equations (
2.2.1
), (
2.3.1
), (
2.3.2
)).
The option
PaddingMethod
may be used to select the type of border extension used during calculation. Default setting is
PaddingMethod
→
FixedPad
. Any of the supported padding methods may be used (
ConstantPad
,
FixedPad
,
PeriodicPad
,
ReflectPad
,
ZeroPad
). The setting
PaddingMethod
→
None
may be used to compute the result without extending the border.
The option
Centered
may be used to extend the border symmetrically or only at the end of a list. Default setting is
Centered
→
False
.
The argument
img
may be an array or
ImageData
expression.
See also User's Guide
5.4
.
Modified in Version 2.
Examples
This loads the package.
In[1]:=
Here are some simple usage examples.
In[2]:=
This wraps function
f
around each 2 × 2 block of array
tmp
.
In[3]:=
Out[3]//MatrixForm=
This is an example of block processing with a sliding window.
In[4]:=
Out[4]//MatrixForm=
This disables border extension.
In[5]:=
Out[5]//MatrixForm=
Here we make function
f
return its argument by using the pure function
#&
.
In[6]:=
Out[6]//MatrixForm=
This joins the elements of all the submatrices.
In[7]:=
Out[7]//MatrixForm=
Here we use
BlockProcessing
to return the variance within 8×8 partially overlapping blocks in an example image.
In[8]:=
This shows the result.
In[9]:=
© 2008 Wolfram Research, Inc.
•
Terms of Use
•
Privacy Policy
Sign up for our newsletter: