| Video and Image Processing Blockset™ | ![]() |
Utilities

The Block Processing block extracts submatrices of a user-specified size from each input matrix. It sends each submatrix to a subsystem for processing, and then reassembles each subsystem output into the output matrix.

Note Because you modify the Block Processing block's subsystem, the link between this block and the block library is broken when you click-and-drag a Block Processing block into your model. As a result, this block will not be automatically updated if you upgrade to a newer version of the Video and Image Processing Blockset software. If you right-click on the block and select Look under mask, you can delete blocks from this subsystem without triggering a warning. Lastly, if you search for library blocks in a model, this block will not be part of the results. |
The blocks inside the subsystem dictate the frame status of the input and output signals, whether single channel or multichannel signals are supported, and which data types are supported by this block.
Use the Number of inputs and Number of outputs parameters to specify the number of input and output ports on the Block Processing block.
Use the Block size parameter to specify the size of each submatrix in cell array format. Each vector in the cell array corresponds to one input; the block uses the vectors in the order you enter them. If you have one input port, enter one vector. If you have more than one input port, you can enter one vector that is used for all inputs or you can specify a different vector for each input. For example, if you want each submatrix to be 2-by-3, enter {[2 3]}.
Use the Overlap parameter to specify the overlap of each submatrix in cell array format. Each vector in the cell array corresponds to the overlap of one input; the block uses the vectors in the order they are specified. If you enter one vector, each overlap is the same size. For example, if you want each 3-by-3 submatrix to overlap by 1 row and 2 columns, enter {[1 2]}.
The Traverse order parameter determines how the block extracts submatrices from the input matrix. If you select Row-wise, the block extracts submatrices by moving across the rows. If you select Column-wise, the block extracts submatrices by moving down the columns.
Click the Open Subsystem button to open the block's subsystem. Click-and-drag blocks into this subsystem to define the processing operation(s) the block performs on the submatrices. The input to this subsystem are the submatrices whose size is determined by the Block size parameter.
Note When you place an Assignment block inside a Block Processing block's subsystem, the Assignment block behaves as though it is inside a For Iterator block. For a description of this behavior, see the "Iterated Assignment" section of the Assignment block reference page. To achieve the normal behavior of the Assignment block, use an Overwrite Values block inside the Block Processing block's subsystem. |
In this example, you multiply each element of three input matrices by two and add the results using the Block Processing block. Suppose you have the following model:

Use the Block Processing block to perform the multiplication and addition on submatrices of the three input matrices. Set the block parameters as shown in the following figure.
Number of inputs = 3
Number of outputs = 1
Block size = {[2 2]}

For each iteration, the block sends a 2-by-2 submatrix from each input matrix to the Block Processing blocks' subsystem to be processed. The block calculates its total number of iterations using the dimensions of the matrix connected to the top input port. In this case, the first input is a 4-by-4 matrix. Since the block can extract four 2-by-2 submatrices from this input matrix, the block iterates four times.
The block's subsystem opens.

Click and drag the following blocks into the subsystem:
Block | Library | Quantity |
|---|---|---|
Gain | Simulink / Math Operations | 3 |
Sum | Simulink / Math Operations | 1 |
Use the Gain blocks to multiply the elements of each submatrix by two. Set the Gain parameter to 2.
Use the Sum block to add the values. Set the Icon shape parameter to rectangular and the List of signs parameter to +++.
Connect the blocks as shown in the following figure.


The Block Processing block operates on the submatrices and assembles the results into an output matrix that is displayed using the Display block.
The Block Processing dialog box appears as shown in the following figure.

Enter the number of input ports on the Block Processing block.
Enter the number of output ports on the Block Processing block.
Specify the size of each submatrix in cell array format. Each vector in the cell array corresponds to one input.
Specify the overlap of each submatrix in cell array format. Each vector in the cell array corresponds to the overlap of one input.
Determines how the block extracts submatrices from the input matrix. If you select Row-wise, the block extracts submatrices by moving across the rows. If you select Column-wise, the block extracts submatrices by moving down the columns.
Click this button to open the block's subsystem. Click-and-drag blocks into this subsystem to define the processing operation(s) the block performs on the submatrices.
Simulink | |
Image Processing Toolbox |
![]() | Block Matching | Bottom-hat | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |