MATLAB: Patch extraction from an image MATLABpatch extraction How to extract a number of patches from the image Best Answer 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 informationhttps://stackoverflow.com/questions/27733477/how-do-i-efficiently-extract-image-patches-at-specified-locations Related SolutionsMATLAB: Extract 80 by 80 patch from image by taking center point of each object in image. % Get the size of the image[rows, columns, numberOfColorChannels] = size(yourImage);% Determine starting and ending rows and columns.row1 = floor(rows/2 - 40);col1 = floor(columns/2-40);% Extract sub-image using imcrop():subImage = imcrop(yourImage, [col1, row1, 80, 80]); MATLAB: Open ROI file (table file) and reconstruct the image intro the boxes to save it. You can get the coordinates from the bounding boxes:row1 = boundingBox(2);row2 = row1 + boundingBox(4);col1 = boundingBox(1);col2 = col1 + boundingBox(3);subImage = yourImage(row1:row, col1:col2, :);imwrite(subImage, filename);or simply use imcrop():subImage = imcrop(yourImage, boundingBox);imwrite(subImage, filename); Related QuestionHow to crop image.What is per-pixel mean
Best Answer