-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Description
ubuntu:20.04
python:3.8
Mine is currently running
super().optimize(max_iterations)
The error is as follows
139 (interrupted by signal 11:SIGSEGV)
I would like to be able to implement global optimization under image stitching with g2o code
My related code is as follows
class BundleAdjustment(g2o.SparseOptimizer):
def init(self, ):
super().init()
solver = g2o.BlockSolverSE2(g2o.LinearSolverCholmodSE2())
solver = g2o.OptimizationAlgorithmLevenberg(solver)
super().set_algorithm(solver)
super().set_verbose(True) # 打印信息
def optimize(self, max_iterations=10):
super().initialize_optimization()
super().optimize(max_iterations)
def add_pose(self, pose_id, pose,fixed=False):
translation = pose[:2, 2]
rotation_matrix = pose[:2, :2]
theta = np.arctan2(rotation_matrix[1, 0], rotation_matrix[0, 0])
# 转化为SE2
se2_pose = g2o.SE2(translation[0], translation[1], theta)
v_se2 = g2o.VertexSE2()
v_se2.set_id(pose_id) # internal id
v_se2.set_estimate(se2_pose)
if pose_id == 0:
v_se2.set_fixed(True)
# print(f"Keyframe {vertex_id} set as fixed.")
else:
v_se2.set_fixed(False)
super().add_vertex(v_se2)
def add_point(self, point_id, point, fixed=False, marginalized=True):
keypoint = point
x, y = keypoint.pt
vertex_p = g2o.VertexPointXY()
vertex_p.set_id(point_id)
Point_estimate = np.array([x, y])
vertex_p.set_estimate(Point_estimate)
vertex_p.set_marginalized(True)
vertex_p.set_fixed(False)
super().add_vertex(vertex_p)
def add_edge(self, point_id, pose_id,measurement,information=np.identity(2),
robust_kernel=g2o.RobustKernelHuber(np.sqrt(5.991))): # 95% CI
edge = g2o.EdgePointXY()
edge.set_vertex(0, self.vertex(int(point_id)))
edge.set_vertex(1, self.vertex(pose_id))
measurement_edge=measurement.pt
edge.set_measurement(measurement_edge) # projection
edge.set_information(information)
if robust_kernel is not None:
edge.set_robust_kernel(robust_kernel)
# edge.set_parameter_id(0, 0)
super().add_edge(edge)
def get_pose(self, pose_id):
return self.vertex(pose_id).estimate()
def get_point(self, point_id):
return self.vertex(point_id).estimate()
class MapMerge():
def init(self):
self.ba = BundleAdjustment()
I reinstalled g2opy with reference 1 and , but it still reports the same error
Any suggestions?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels