How to add 2 org.opencv.core.Point objects in Android?

我的未来我决定 提交于 2019-12-01 10:58:49

The first thing to note is that the second and third parameters to Core.line must be points.

In your replacement, you removed the addition symbol (+). Hmm. I don't think you can do that if you are converting the code line for line.

The get method appears to return a Point, but you'll need to print the object out to make sure or just look at the variable definition for scene_corners. Use this to try printing it out:

System.out.println(scene_corners.get(0));

If it's a Point object, then you can add it to your point by taking each component of the Point and adding it to the corresponding component in the added to Point. Assume Point A and B with components 0 and 1.

P(A) + P(B) = P(A0+B0, A1+B1)

Here, I am assuming that scene_corners.get(0) has x and y properties:

line(
    img_matches,
    new Point(
        img_object.cols() + scene_corners.get(0).x,
        0 + scene_corners.get(0).y),
    new Point(
        img_object.cols() + scene_corners.get(1).x,
        0 + scene_corners.get(1).y),
    Scalar(0, 255, 0),
    4
);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!