I want to create a Python equivalent of a Matlab code that creates a filtering mask. In the Matlab version, I have a variable position that maintains xy values for a polygon which I am creating the mask from. Here is the Matlab version:
...
xlim([0 50])
ylim([0 1000])
h=gca;
position = [0 0; ...
2.5 0; ...
10.01 75; ...
10.01 125; ...
0 25];
pol= impoly(h, position);
mask= createMask(pol);
I did not find an equivalent 'createMask' function in Python, and I want the mask to mimic the Matlab one.