Divide an image into 16x128x128 tiles each

2 ビュー (過去 30 日間)
Warid Islam
Warid Islam 2022 年 4 月 5 日
コメント済み: Warid Islam 2022 年 4 月 6 日
I have an image which I want to divide into several blocks as defined in sample.png. This image file is just a demo image like whom I want to divide my original image CCffdmdatabase1.png. I want to divide my oroginal image file into the same way as shown in sample.png. I am planning to analyze each block separately later. I tried the following line of code. My final image is shown in result.png. This file is different from the sample.png file. Any suggestions would be appreciated.
rgbImage = imread('CCffdmdatabase1.png');
% For demo purposes, let's resize it to be 64 by 64;
rgbImage = imresize(rgbImage, [64 64]);
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows columns numberOfColorBands] = size(rgbImage)
ca = mat2cell(rgbImage,8*ones(1,size(rgbImage,1)/8),8*ones(1,size(rgbImage,2)/8),3);
plotIndex = 1;
for c = 1 : size(ca, 2)
for r = 1 : size(ca, 1)
fprintf('c=%d, r=%d\n', c, r);
plotIndex = plotIndex + 1
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
  2 件のコメント
Warid Islam
Warid Islam 2022 年 4 月 6 日
Hi @DGM,
I want to apply the attention based multiple instance learning to analyze those images. This process requries to divide each images into several instances and put them in a bag.
The link above explains the process further.


回答 (0 件)




Community Treasure Hunt

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

Start Hunting!

Translated by