How display different blocks of the images in one figure?

2 views (last 30 days)
ANU
ANU on 29 Aug 2021
Commented: 图像分析师 on 30 Aug 2021
我将图像分成块。如何使用一个数字显示它?
3 Comments
DGM
DGM on 30 Aug 2021
通过串联或索引将块组装回一个图像。如果中央块不包含唯一数据,那么它是冗余的。除非您提供了一个具体的例子,否则您必须弄清楚自己的索引。并非所有图像几何形状都是整数可分开的2或4,所以无论您在隐形期间做的任何舍入都需要考虑。

Sign in to comment.

答案(2)

图像分析师
图像分析师 on 30 Aug 2021
首先裁剪您想要的图像的部分,然后使用子平台():
suplot (3, - 3, - 1);
imshow(upperLeftImage);
suplot(3, 3, 3);
imshow(upperRightImage);
suplot(3, 3, 5);
imshow(媒体);
Suplot(3,3,7);
imshow(lowerLeftImage);
suplot(3, 3, 9);
imshow(lowerRightImage);
Is that what you want?
2 Comments
图像分析师
图像分析师 on 30 Aug 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);
如果你想要一半的方法,你可以这样做:
youriginalimage = imread('peppers.png');
imshow(yourOriginalImage);
axis('on','图片');
[rows, columns, numberOfColorChannels] = size(yourOriginalImage)
Xline(列/ 2,'颜色','y','LineWidth', 3);
yline(rows/2,'颜色','y','LineWidth', 3);
pos = [columns/2 - columns/4, rows/2 - rows/4, columns/2, rows/2];
长方形('位置', pos,'EdgeColor','y','LineWidth', 3,'linestyle','--');
如果这不是你想要的,then show what you want with an actual image. Mock something up in Photoshop if you have to.

Sign in to comment.


DGM
DGM on 30 Aug 2021
If you want them tiled as shown, then you're going to have to reassemble them into one image.
A = imread('cameraman.tif');
%几何需要将以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];
%如果中心块是非唯一的,则不需要
%如果它是唯一的,则插入它
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.

下载188bet金宝搏

Community Treasure Hunt

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

开始狩猎!