def run_application(args): poc = ProofOfConcept(args) image = poc.get_image() plt.imshow(image) cameraparams = poc.cameraparams cameraparams_est, res, cme = poc.estimate() print("Cost (reduced data): " + str(res.cost)) print("Optimality, gradient value (reduced data): " + str(res.optimality)) inliers = np.array(cme._inliers) points = np.array(poc.mod.points) print("Inliers in percent: " + str(100.0 * inliers.shape[0] / points.shape[0])) print( array_string([ " ", "fx", "fy", "cx", "cy", "thetax", "thetay", "thetaz", "tx", "ty", "tz", "k1", "k2", "k3", "p1", "p2" ], 8)) print("shuld: " + cameraparams.get_string(8)) print("is: " + cameraparams_est.get_string(8)) dist = np.array(cameraparams.get_as_array()) - np.array( cameraparams_est.get_as_array()) print("diff: " + array_string(np.round(dist, 2), 8)) print("Tot. diff: {}".format(np.linalg.norm(dist))) cm_est = CameraModel(poc.resolution, cameraparams_est) cm_est.update_point_cloud(poc.mod.points) image_est = cm_est.get_image() image1 = np.zeros((poc.resolution[0], poc.resolution[1], 3)) image2 = np.zeros((poc.resolution[0], poc.resolution[1], 3)) image1[:, :, 2] = image_est image2[:, :, 1] = image kernel = np.ones((3, 3), np.uint8) diff_img = image1 + image2 diff_img = cv2.dilate(diff_img, kernel, iterations=1) cv2.imwrite("diff_img.png", diff_img * 255) plt.figure() plt.imshow(diff_img) plt.show()