Get coordinates of images intersection with OpenCV

≯℡__Kan透↙ 提交于 2019-12-13 04:03:24

问题


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

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


回答1:


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)



来源:https://stackoverflow.com/questions/50171415/get-coordinates-of-images-intersection-with-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!