Forum

Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - akoumis

#1
Please ignore this for now, I believe I have implemented a similar method based on this formula: http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html, here is my code:


def _pick_point(points, cam_center, cam_direction):

    min_dist = float('inf')
    min_point = None

    x1 = cam_center
    x2 = cam_center + cam_direction

    for point in points:

        x0 = PhotoScan.Vector([point.coord[0], point.coord[1], point.coord[2]])

        numerator = (PhotoScan.Vector.cross(x0 - x1, x0 - x2)).norm()
        denominator = (x2 - x1).norm()
        distance = numerator / denominator

        if distance < min_dist:
            min_dist = distance
            min_point = point

    return min_point
#2
Hi, I have tried the following variations but can't get accurate values, any ideas?


T = chunk.transform.matrix
scale = chunk.transform.scale
pt = chunk.point_cloud.points[0]
crs = chunk.crs

distance = (T.mulv(cam.center - pt.coord[:3]) * scale).norm()
distance = (crs.project(T.mulp(cam.center)) - crs.project(T.mulp(pt.coord[:3]))).norm()


Thank you!
#3
Hello, I am working in an environment where we cannot upgrade our PhotoScan version beyond 1.2.6. I tested a script that uses PointCloud.pickPoint successfully with a newer version (1.4.2) and would like to develop a version of pickPoint() that is compatible with 1.2.6. Does anyone have an implementation of pickPoint() they have created that they can share?

Thank you!