获取与OpenCV交叉的图像坐标 [英] Get coordinates of images intersection with OpenCV

查看:215
本文介绍了获取与OpenCV交叉的图像坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个答案中描述了如何从两个图像中获取图像,因此交叉(它们的共同部分)将被涂成黑色 - https:/ /stackoverflow.com/a/31258083/4767232

In this answer described how to get picture from two images so intersection (common part of them) will be coloured black — https://stackoverflow.com/a/31258083/4767232

我怎样才能将此结果视为图片而作为矩形(例如,左= 100,上= 50,下= 200,右= 300)?

How can I get this result not as picture but as a rect (e.g. left=100, top=50, bottom=200, right=300)?

推荐答案

可以获得交叉点的位置通过 H 矩阵转换零点。

The position of intersection can be obtained by transforming zero point by the H matrix.

val p0 = MatOfPoint2f(org.opencv.core.Point(0.0, 0.0))
val result = Mat()
Core.transform(p0, result, H)

(并且获得矩形的大小是微不足道的)

(and getting size of the rect is trivial)

这篇关于获取与OpenCV交叉的图像坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆