Hi! First off, thank you for this repo!
The gpsFromImage method seems to conflict with other python modules. I plan to pass in pixel location, but whenever I test your cameratransform module with the PyTorch yolov7 module, I get the belows results. For some reason, the gpsFromImage method returns truncated duplicate results.
Here is code:
import cameratransform.camera as ct
import yolov7
projection = ct.RectilinearProjection(image=(4608,3456),
focallength_x_px=7439.143084,
focallength_y_px=7439.143084,
center_x_px=2304,
center_y_px=1728,
sensor_width_mm=5.90,
sensor_height_mm=4.43)
orientation = ct.SpatialOrientation(elevation_m=9.8,
tilt_deg=0.0,
roll_deg=0.0,
heading_deg=180)
cam = ct.Camera(projection, orientation,)
cam.setGPSpos(lat=39.3166667, lon=-76.66775)
model = yolov7.load('best.pt')
model.conf = 0.25 # NMS confidence threshold
model.iou = 0.45 # NMS IoU threshold
model.classes = None # (optional list) filter by class
img = 'P0810234.JPG'
results = model(img, size=416, augment=True)
parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, y1, x2, y2
scores = predictions[:, 4]
categories = predictions[:, 5]
coords = cam.gpsFromImage([[2109., 1533., 2211., 1605.],
[1992., 1020., 2100., 1074.],
[2044., 3237., 2080., 3270.],
[1578., 1943., 1620., 1981.]])
print(coords)
results.show()
Any help is greatly appreciated.
Thank you.