Main Content

getWorkingSet

Class: hdl.WorkingSet
Namespace: hdl

Get working set from the input image at specified position

Since R2023a

Description

example

getWorkingSet(x, y) returns a working set corresponding to the pixel at position (x, y) from the input image.

Input Arguments

expand all

Row subscript of the input image, specified as a positive integer.

Example: 7

Column subscript of the input image, specified as a positive integer.

Example: 9

Examples

expand all

In the following MATLAB® code, the line_buffer_average function takes working set as the input and maps it to the line buffer interface in Cadence® Stratus HLS using coder.hdl.interface pragma.

function out = line_buffer_average(in1)
    coder.hdl.interface(in1, "Line Buffer", [20, 20], FillMethod = 'Nearest');
    sum = 0;
    for i = 1:size(in1,1)
        for j = 1:size(in1,2)
            sum = sum + in1(i,j);
        end
    end
    out = sum / numel(in1);
end

The MATLAB test bench demonstrates the usage of the hdl.WorkingSet class and getWorkingSet method. It generates the working sets for each pixel of the input image.

image = rand(20, 20);
ws = hdl.WorkingSet(image, [3 3], FillMethod='Nearest');
for x = 1:20
    for y = 1:20
        workingSet = ws.getWorkingSet(x, y);
        out = line_buffer_average(workingSet);
    end
end

Note

hdl.WorkingSet class and getWorkingSet method must be used inside the MATLAB test bench.

Version History

Introduced in R2023a