如何在缩小的图像中找到等效点?

编程入门 行业动态 更新时间:2024-10-25 02:29:49
本文介绍了如何在缩小的图像中找到等效点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在更大的图像中计算星星的角点或轮廓.为此,我将尺寸缩小到更小的尺寸 &我能清楚地得到这些点.现在如何在原始图像中映射这个点?我正在使用 opencv C++.

I would like to calculate the corner points or contours of the star in this in a Larger image. For that I'm scaling down the size to a smaller one & I'm able to get this points clearly. Now How to map this point in original image? I'm using opencv c++.

推荐答案

考虑一个简单的例子:图像大小正好减少了一半.

Consider a trivial example: the image size is reduced exactly by half.

所以,原始图像中的笛卡尔坐标(x, y)变成缩小图像中的坐标(x/2, y/2),缩小图像中的坐标(x', y')对应坐标(x*2, y*2) 在原始图像中.

So, the cartesian coordinate (x, y) in the original image becomes coordinate (x/2, y/2) in the reduced image, and coordinate (x', y') in the reduced image corresponds to coordinate (x*2, y*2) in the original image.

当然,在缩小比例的图像中,分数坐标通常会四舍五入,因此精确映射仅适用于本示例原始图像中的偶数坐标.

Of course, fractional coordinates get typically rounded off, in a reduced scale image, so the exact mapping is only possible for even-numbered coordinates in this example's original image.

概括这一点,如果图像的宽度在水平方向按 w 和 h 垂直缩放,则坐标 (x, y) 变为坐标 (x*w, y*h),四舍五入.在我给出的例子中,w 和 h 都是 1/2,或 .5

Generalizing this, if the image's width is scaled by a factor of w horizontally and h vertically, coordinate (x, y) becomes coordinate(x*w, y*h), rounded off. In the example I gave, both w and h are 1/2, or .5

你应该能够自己算出w和h的值,并且能够简单地映射坐标.当然,由于四舍五入,您将无法计算原始图像中的确切坐标.

You should be able to figure out the values of w and h yourself, and be able to map the coordinates trivially. Of course, due to rounding off, you will not be able to compute the exact coordinates in the original image.

更多推荐

如何在缩小的图像中找到等效点?

本文发布于:2023-07-27 23:14:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1225219.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   中找到   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!