select all pixels from x,y by 20 pixels radially in matlab

To select all pixels from x,y by 20 pixels radially, you can use the circle function from the strel package to create a structuring element with a circular shape, and then use that structuring element to perform a morphological dilation operation on your image.

Here's some example code:

main.m
% define the center point and radius
x = 50;
y = 75;
r = 20;

% create a structuring element with a circular shape
se = strel('disk', r);

% create a binary mask with the selected pixels
bw = false(size(image)); % replace "image" with your actual image variable
bw(y,x) = true; % set the center pixel to true
bw = imdilate(bw, se); % perform a dilation operation

% apply the mask to your image
selected_pixels = image(bw);
424 chars
16 lines

This code creates a binary mask with the selected pixels using imdilate, and then applies that mask to your original image to select the pixels you want.

gistlibby LogSnag