Project ground control point to image error
bugracoskun opened this issue · 1 comments
Hello, actually it is similar to https://community.opendronemap.org/t/project-ground-control-point-to-image/12088
I am trying to project gcp to image. Here is my code:
import sys
sys.path.insert(0,'..')
import math
from opensfm import dataset,geo
base_path = "data_path"
# load
data = dataset.DataSet(base_path)
rec = data.load_reconstruction()[0]
# run the projections
imgName = "image_name"
shot = rec.shots[imgName]
# project
im = data.load_image(imgName)
h, w, _ = im.shape
cam = shot.camera
# reference lla
refLLA = [lat,lon,0]
poi = [gcp_lat,gcp_lon, gcp_alt]
reference = geo.TopocentricConverter(refLLA[0], refLLA[1], refLLA[2])
pt3D= reference.to_topocentric(float(poi[0]), float(poi[1]),float(poi[2]))
pt2D = shot.project(pt3D)
pt2D_px = cam.normalized_to_pixel_coordinates(pt2D)
x = pt2D_px[0]
y = pt2D_px[1]
print("x:",x, "y:",y)
I am using the reconstruction.json file in opensfm folder. But there is also another reconstruction files. reconstruction.topocentric.json and undistorted/reconstruction.json but, I am using in the main folder in opensfm.
Some images projects are really good but some of them are really bad. I need a stable solution. What should i do ?
Here is the process options:
{
name: "matcher-neighbors",
value: "2",
},
{
name: "radiometric-calibration",
value: "camera",
},
{
name: "pc-geometric",
value: "false",
},
{
name: "dem-resolution",
value: "5",
},
{
name: "orthophoto-resolution",
value: "5",
},
{
name: "min-num-features",
value: "30000",
},
{
name: "skip-orthophoto",
value: "false",
},
{
name: "skip-3dmodel",
value: "true",
},
{
name: "dsm",
value: "false",
},
{
name: "dtm",
value: "false",
},
{
name: "skip-report",
value: "false",
}
Could we move this conversation over to the forum at https://community.opendronemap.org? 🙏 The forum is the right place to ask questions (we try to keep the GitHub issue tracker for feature requests and bugs only). Thank you! 👍