确定探测器系统中旋转方块的重叠
我正在解决一个问题,需要我计算两个正方形的重叠面积。 这是程序的一部分,该程序将由多个方形探测器单元/像素(阵列)组成的旋转探测器放置在由多个(较小的)方形像素组成的输入图的顶部,并确定探测器检测到的每个输入像素的光百分比像素。 我尝试过几何方法,但需要考虑的可能变化实在太多。
与另一个方块相比,一个方块可以旋转随机角度,并且两个方块的大小可以不同。给出的参数是输入地图上检测器像素的中心坐标、检测器像素的大小(默认情况下输入像素等于1)和旋转角度。
编辑:添加了一个草图来澄清
所以我想做的是计算每个输入像素(黑色方块)位于给定探测器像素(红色方块)内,可以是 0 到 1 之间的任意值。 然后可以将其与输入像素的值相乘并对所有输入像素求和以计算探测器像素收集的总光。
我尝试使用的几何方法是计算探测器像素边缘的斜率,并使用与输入像素边缘的相交来计算总重叠。
I'm working on a problem which requires me to calculate the overlapping area of two squares.
This is part of a program which places a rotated detector consisting of several square detector cells/pixels (array) on top of an input map consisting of several (smaller) square pixels and determining the percentage of light from each input pixel detected by the detector pixels.
I've tried a geometric approach, but there's just so many possible variations to account for.
One square can be rotated over a random angle compared to the other, and both squares can be of different sizes. The parameters given are the center coordinates of the detector pixels on the input map, the size of the detector pixels (that of the input pixels is equal to 1 by default) and the rotation angle.
Edit: added a sketch to clarify
So what I'm trying to do is calculate the part of each input pixel (black squares) which lies within a given detector pixel (red square), which can be anywhere between 0 and 1.
This can then be multiplied with the input pixel's value and summed over all of the input pixels to calculate the total light collected by the detector pixel.
The geometrical approach I've tried using, was calculating the slopes of the detector pixel edges and using the intersect with the input pixel edges to calculate the total overlap.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我理解正确的话,你所做的相当于尝试在灰度位图上找到重叠的正方形?如果是这样,您可以进行角点检测,并尝试从检测到的角点制作正方形,然后计算检测到的正方形的重叠吗?这个 opencv 示例可能是一个很好的起点: https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/python/squares.py?rev=907
提前道歉,如果我误解了这个问题(例如,我对旋转角度感到困惑)。
If I understand you correctly what you're doing is equivalent to trying to find overlapping squares on a grayscale bitmap? If so can you do corner detection, and try to make squares from the detected corners, and then calculates the overlap on the detected squares? This opencv sample might be a good starting point: https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/python/squares.py?rev=907
Apologies in advance if I've misunderstood the question (I am confused by the rotation angle, for instance).
以下是我将用来执行此操作的步骤。
要旋转点,您将使用如下函数:
Here are the steps I would use to do this.
To rotate the points, you'll use a function something like this: