How display different blocks of the images in one figure?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have divided image into blocks. How to display it using one figure only?
3 comentarios
DGM
el 30 de Ag. de 2021
Editada: DGM
el 30 de Ag. de 2021
Assemble the blocks back into one image by concatenation or indexing. If the central block contains no unique data, then it's redundant. Unless you provide a concrete example of what you did, you'll have to figure out the indexing yourself. Not all image geometries are integer-divisible by 2 or 4, so whatever rounding you did during detiling will need to be taken into account.
Respuestas (2)
Image Analyst
el 30 de Ag. de 2021
First crop out the portions of the image you want then use subplot():
suplot(3, 3, 1);
imshow(upperLeftImage);
suplot(3, 3, 3);
imshow(upperRightImage);
suplot(3, 3, 5);
imshow(middleImage);
suplot(3, 3, 7);
imshow(lowerLeftImage);
suplot(3, 3, 9);
imshow(lowerRightImage);
Is that what you want?
2 comentarios
Image Analyst
el 30 de Ag. de 2021
You are showing the quadrants of the image stitched together. Thus that just gives the original image. So you can just simply do
imshow(yourOriginalImage);
If you want lines half way across you can do this:
yourOriginalImage = imread('peppers.png');
imshow(yourOriginalImage);
axis('on', 'image');
[rows, columns, numberOfColorChannels] = size(yourOriginalImage)
xline(columns/2, 'Color', 'y', 'LineWidth', 3);
yline(rows/2, 'Color', 'y', 'LineWidth', 3);
pos = [columns/2 - columns/4, rows/2 - rows/4, columns/2, rows/2];
rectangle('Position', pos, 'EdgeColor', 'y', 'LineWidth', 3, 'LineStyle', '--');
If that's not what you want, then show what you want with an actual image. Mock something up in Photoshop if you have to.
DGM
el 30 de Ag. de 2021
If you want them tiled as shown, then you're going to have to reassemble them into one image.
A = imread('cameraman.tif');
% geometry needs to be integer-divisible by 4
bksz = floor([size(A,1) size(A,2)]/4)
% split image
nw = A(1:2*bksz(1),1:2*bksz(2));
ne = A(1:2*bksz(1),2*bksz(2)+1:4*bksz(2));
sw = A(2*bksz(1)+1:4*bksz(1),1:2*bksz(2));
se = A(2*bksz(1)+1:4*bksz(1),2*bksz(2)+1:4*bksz(2));
md = A(bksz(1)+1:3*bksz(1),bksz(2)+1:3*bksz(2));
% reassemble image
B = [nw ne; sw se];
% if center block is nonunique, it's not needed
% if it is unique, then insert it
B(bksz(1)+1:3*bksz(1),bksz(2)+1:3*bksz(2)) = md;
immse(A,B)
imshow(B)
What I said about being integer-divisible by 4 still applies. If the source image geometry is not integer-divisible by 4, then reconstruction has to take into account how you detiled the image. The above code simply discards excess edge vectors. In the case of an improperly-sized source image, B will be smaller than A, though their NW corners will be aligned.
0 comentarios
Ver también
Categorías
Más información sobre Computer Vision with Simulink en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!