I have divided one image into four smaller images (subimages). How can I show the subimages like the original image, close to each other and with a line or a few pixels between them. I have tried subplot but it didn´t work.
This implements suggestion #4 of Image Analyst.
I = imread('peppers.png'); I = im2double(I);
Nsubimages = [4 3]; Nsp = 10; % number of separating pixels
sz = size(I); sznew = [sz(1:2) + (Nsubimages - 1)*Nsp size(I, 3)]; Inew = repmat(1, sznew);
ind1 = round(linspace(1, sz(1), Nsubimages(1) + 1)); ind2 = round(linspace(1, sz(2), Nsubimages(2) + 1));
for i = 1:length(ind1)-1 for j = 1:length(ind2)-1 i1 = ind1(i):ind1(i+1); i2 = ind2(j):ind2(j+1); Inew(i1 + (i-1)*Nsp, i2 + (j-1)*Nsp, :) = I(i1, i2, :); end end
subplot(1,2,1), imshow(I) subplot(1,2,2), imshow(Inew)
You can either
Play games and win prizes!Learn more