1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-28 14:53:03 +04:00

moving code from ICP+Scale

This commit is contained in:
Saratovtsev
2022-02-08 18:14:32 +03:00
committed by Rostislav Vasilikhin
parent b06544bd54
commit df490c6399
7 changed files with 433 additions and 204 deletions
+12 -5
View File
@@ -13,6 +13,7 @@ def main():
help="""DEPTH - works with depth,
RGB - works with images,
RGB_DEPTH - works with all,
SCALE - works with depth and calculate Rt with scale,
default - runs all algos""",
default="")
parser.add_argument(
@@ -34,7 +35,7 @@ def main():
args = parser.parse_args()
if args.algo == "RGB_DEPTH" or args.algo == "DEPTH" or args.algo == "":
if args.algo == "RGB_DEPTH" or args.algo == "DEPTH" or args.algo == "SCALE" or args.algo == "":
source_depth_frame = cv.samples.findFile(args.source_depth_frame)
destination_depth_frame = cv.samples.findFile(args.destination_depth_frame)
depth1 = cv.imread(source_depth_frame, cv.IMREAD_ANYDEPTH).astype(np.float32)
@@ -50,18 +51,24 @@ def main():
odometry = cv.Odometry(cv.DEPTH)
Rt = np.zeros((4, 4))
odometry.compute(depth1, depth2, Rt)
print(Rt)
print("Rt:\n {}".format(Rt))
if args.algo == "RGB" or args.algo == "":
odometry = cv.Odometry(cv.RGB)
Rt = np.zeros((4, 4))
odometry.compute(rgb1, rgb2, Rt)
print(Rt)
print("Rt:\n {}".format(Rt))
if args.algo == "RGB_DEPTH" or args.algo == "":
odometry = cv.Odometry(cv.RGB_DEPTH)
Rt = np.zeros((4, 4))
odometry.compute(depth1, rgb1, depth2, rgb2, Rt)
print(Rt)
print("Rt:\n {}".format(Rt))
if args.algo == "SCALE" or args.algo == "":
print(args.algo)
odometry = cv.Odometry()
Rt = np.zeros((4, 4))
scale = np.zeros((1, 1))
odometry.compute(depth1, depth2*1.05, Rt, scale)
print("Rt:\n {}\nScale: {}".format(Rt, scale))
if __name__ == '__main__':