Generate a sector mask within a big matrix
6 views (last 30 days)
Show older comments
Commented: Ankit Labh on 11 Dec 2019
A sector mask is defined by distance and angle. Please see the image for clarification on mask.
I want to generate a 100 by 100 matrix where all the matrix element inside the mask is 1 otherwise 0.
Looky on 11 Dec 2019
Edited: Looky on 11 Dec 2019
Solution could look like this:
% Generate example coordinates
% Parameters for sector
% Coordinates to polarcoordinates
% Generate mask
mask=rho>radiusOut & rho<radiusIn & phi>angle& phi<180-angle;
% Have a look at the mask
For your problem you should exchange the first part of generating the X and Y values for your own coordinates. Otherwise the mask might not be centered the way your data is.
More Answers (0)
Find more on Computer Vision With Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!