Matlab:如何在边界框中找到一个点 [英] Matlab: How to find a point in a bounding box
本文介绍了Matlab:如何在边界框中找到一个点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
BoundingBox = [BB1,BB2,BB3,BB4];
Array = [x1,y1; x2,y2; x3,y3; x4,y4; x5,y5; x6,y6];
我曾尝试
ismember([BB1,BB2,BB3,BB4],阵列);
和
ismember(矩形( '位置',[BB1,BB2,BB3,BB4]),阵列);
但是没有任何功能可用
解决方案
$ b
数组元素是set数组的元素
所以,这个检查是关于set操作的。 p>
相反,您应该使用 inpolygon()
检查点是否在多边形内。
I have an array of points or locations that are scattered throughout a big matrix, and I have a small bounding box inside the matrix. I need a way to check if the points in the array are within the bounding box. Thanks for your suggestions.
BoundingBox = [BB1,BB2,BB3,BB4];
Array = [x1,y1;x2,y2;x3,y3;x4,y4;x5,y5;x6,y6];
I have tried
ismember([BB1,BB2,BB3,BB4],Array);
and
ismember(rectangle('Position',[BB1,BB2,BB3,BB4]),Array);
but nothing is working
解决方案
You should read ismember()
's documentation more carefully:
Array elements that are members of set array
So, this check is related to set operations.
Instead, you should use inpolygon()
to check whether points are inside a polygon.
这篇关于Matlab:如何在边界框中找到一个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文