Darken Image by Using Array Processing Subsystem Block
This example shows how to darken an image by using an Array Processing Subsystem block. The Array Processing Subsystem block applies an algorithm to each element of an input matrix, similarly to a For Each Subsystem block, but is optimized for large input data such as images and video, similar to a Neighborhood Processing Subsystem block.
Inspect Model
Open the model.
model = 'DarkenImageArrayProcessing';
open_system(model);
The model imports an image by using an Image From File (Computer Vision Toolbox) block from Computer Vision Toolbox™. The model uses an Array Processing Subsystem block to darken the image. The Array Processing Subsystem block iterates over each channel for each pixel in the input image. At each iteration step, the Array Processing Subsystem block receives a pixel channel value as a scalar input and processes it to produce a scalar output value. The subsystem outputs an image with the same dimensions as the input image, where each pixel channel value is the result of processing the corresponding pixel channel value in the input image.
The model displays the original and darkened images by using Video Viewer (Computer Vision Toolbox) blocks from Computer Vision Toolbox.
Open the Array Processing Subsystem block.
The subsystem uses a Gain block to multiply the input value by 0.5
. By applying this algorithm to each channel value for each pixel in the input image, the subsystem halves the brightness of each pixel in the input image.
Simulate Model and View Results
Simulate the model.
sim(model);
The Array Processing Subsystem block produces a darkened version of the input image.