def create_detector_drawer_chessboard(): rows = 7 cols = 6 square_size = 0.108 #108 mmc pattern_type = CHESSBOARD return (PatternDetector(rows=rows, cols=cols, pattern_type=pattern_type, square_size=square_size), PatternDrawer(rows=rows, cols=cols))
def create_detector_drawer_circles(): rows = 5 cols = 3 square_size = 0.04 #4 cm pattern_type = ASYMMETRIC_CIRCLES_GRID return (PatternDetector(rows=rows, cols=cols, pattern_type=pattern_type, square_size=square_size), PatternDrawer(rows=rows, cols=cols))
parser = argparse.ArgumentParser(description='Pose from a list of files.') parser.add_argument('--images', nargs='+', help='A list of images.') parser.add_argument('--camera', help='The camera file.') args = parser.parse_args() image_reader = ImageReader(file_list=ecto.list_of_strings(args.images)) rows = 4 cols = 5 square_size = 0.025 #2.5 cm pattern_type = CHESSBOARD rgb2gray = cvtColor(flag=Conversion.RGB2GRAY) detector = PatternDetector(rows=rows, cols=cols, pattern_type=pattern_type, square_size=square_size) pattern_drawer = PatternDrawer(rows=rows, cols=cols) camera_intrinsics = CameraIntrinsics(camera_file=args.camera) poser = FiducialPoseFinder() pose_drawer = PoseDrawer() plasm = ecto.Plasm() plasm.connect( image_reader['image'] >> (pattern_drawer['input'], rgb2gray['image']), rgb2gray['image'] >> detector['input'], detector['ideal', 'out', 'found'] >> poser['ideal', 'points', 'found'], camera_intrinsics['K'] >> poser['K'], detector['out', 'found'] >> pattern_drawer['points', 'found'], poser['R', 'T'] >> pose_drawer['R', 'T'], poser['R'] >> MatPrinter(name='R')['mat'],
im2mat_rgb = ecto_ros.Image2Mat() im2mat_depth = ecto_ros.Image2Mat() im2info = ecto_ros.CameraInfo2Cv() offset_x = -0.3095 #TODO: FIXME hard coded offset_y = -0.1005 rows = 5 cols = 3 square_size = 0.1 #2.5 cm pattern_type = ASYMMETRIC_CIRCLES_GRID cd_bw = PatternDetector('Dot Detector, B/W', rows=rows, cols=cols, pattern_type=pattern_type, square_size=square_size, offset_x=offset_x, offset_y=offset_y) offset_x = 0.1505 cd_wb = PatternDetector('Dot Detector, W/B', rows=rows, cols=cols, pattern_type=pattern_type, square_size=square_size, offset_x=offset_x, offset_y=offset_y) circle_drawer = PatternDrawer(rows=rows, cols=cols) circle_drawer2 = PatternDrawer(rows=rows, cols=cols) gather = calib.GatherPoints("gather", N=2)
height = 0.216 offset_x = -(width / 2 - 0.06) offset_y = -(height / 2 - 0.020) print "ox", offset_x, "oy", offset_y simulator = PlanarSim(image_name=board, width=width, height=height) square_size = 0.02 # in meters, 2 cm pattern_type = ASYMMETRIC_CIRCLES_GRID pattern_show = imshow('Display', name='pattern') rgb2gray = cvtColor('RGB -> Gray', flag=Conversion.RGB2GRAY) circle_detector = PatternDetector(rows=rows, cols=cols, pattern_type=pattern_type, square_size=square_size, offset_x=offset_x, offset_y=offset_y) circle_drawer = PatternDrawer(rows=rows, cols=cols) poser = FiducialPoseFinder() pose_drawer = PoseDrawer() gt_drawer = PoseDrawer() plasm = ecto.Plasm() plasm.connect( simulator['image'] >> (rgb2gray['image'], circle_drawer['input']), rgb2gray['image'] >> circle_detector['input'], circle_detector['out', 'found'] >> circle_drawer['points', 'found'], simulator['K'] >> poser['K'], circle_detector['out', 'ideal', 'found'] >> poser['points', 'ideal', 'found'],