Patch extraction from an image

 采纳的回答

if you want a patch of (size, size) :
% Get the size of the image
[rows, columns, numberOfColorChannels] = size(yourImage);
% Determine starting and ending rows and columns.
row1 = floor(rows/2 - size/2);
col1 = floor(columns/2- size/2);
% Extract sub-image using imcrop():
subImage = imcrop(yourImage, [col1, row1, size, size]);
you may also refer to this link for more information

更多回答(0 个)

类别

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by