在xy平面中获取三角形ROI中的所有点 [英] Get all the points in triangular ROI in a xy plane
本文介绍了在xy平面中获取三角形ROI中的所有点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
输入:如下图所示,我在xy平面上有大约50000个点.
Input: I have some 50000 points in a xy plane as shown in the below picture.
现在,我需要获得三角形ROI中所有可能的点.如何获得它.它可以是opencv或Matlab.
Now, I need to get all the possible points in a triangular ROI. How to get it. It can can be opencv or Matlab.
下面是我需要获取三角形区域可能点的示例.
The below is the sample where I need to get the possible points of the triangular areas.
推荐答案
MATLAB有一个inpolygon
命令: inpolygon .
MATLAB has an inpolygon
command: inpolygon.
例如,此代码
xv = [0.1 0.4 0.15 0.1]; yv = [0 0.4 0.8 0];
x = rand(250,1); y = rand(250,1);
in = inpolygon(x,y,xv,yv);
plot(xv,yv,x(in),y(in),'r+',x(~in),y(~in),'bo')
生成这样的图片:
这篇关于在xy平面中获取三角形ROI中的所有点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文