本文介绍了如何从MATLAB中的图像创建子图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给出这样的图像i,取四点
Given image, i, by taking four points like this
x=[p1,p2,p3,p4]
y=[p5,p6,p7,p8]
并将这些点连接到一个矩形中,如何显示该矩形包围的图像子集?
and by joining these points into a rectangle, how do I show the subset of the image enclosed by this rectangle?
推荐答案
im = magic(100)
subIm = im(p1:p3,p5:p6,:)
imshow(subIm)
假设p1 == p2,p3 == p4,p5 == p7和p6 == p8
This assumes that p1 == p2, p3 == p4, p5 == p7 and p6 == p8
基本上,您正在获取矩阵的一个子集.根据您p1..p8的设置方式,您会在此主题上有所不同.
Basically, you are taking a subset of the matrix. Depending on how your p1..p8 are set up, you will have a variation on this theme.
这篇关于如何从MATLAB中的图像创建子图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!