MATLAB: After using mat2tiles, how can I mark a patch image on the original image

mat2tilespatch

I used 'mat2tiles' function to divide an image into different patches. Now I want to Mark (the border of the patch in red) a patch on the original image. For example, the interested patch is in the first row and the 39th column, I can get the patch image by 'imagesc(splitImage{1,39})'. But how can I get the coordinate information for this patch and marked it on the original image?

Best Answer

block_row_number = 1; block_column_number = 39;
block_height = 32; block_width = 40; %for 32 x 40 blocks
y_start = (block_row_number - 1) * block_height + 1;
x_start = (block_column_number - 1) * block_width + 1;
rectangle('Position', [x_start, y_start, block_width, block_height])