def declare_io(self, p, i, o): self.gray_image = ecto.Passthrough('gray Input') self.rgb_image = ecto.Passthrough('rgb Input') self.camera_info = ecto.Passthrough('K') self.gather = calib.GatherPoints("gather", N=2) #TODO parameterize the quantizer #abuse saturated Arithmetics http://opencv.itseez.com/modules/core/doc/intro.html?highlight=saturated. self.quantizer = imgproc.Quantize('Quantizer', alpha=1, beta=0) self.invert = imgproc.BitwiseNot() self.debug = p.debug offset_x = -.3095 #TODO: FIXME hard coded offset_y = -.1005 self.cd_bw = calib.PatternDetector( 'Dot Detector, B/W', rows=p.rows, cols=p.cols, pattern_type=p.pattern_type, square_size=p.square_size, offset_x=offset_x, offset_y=offset_y, ) offset_x = .1505 #TODO: FIXME hard coded self.cd_wb = calib.PatternDetector( 'Dot Detector, W/B', rows=p.rows, cols=p.cols, pattern_type=p.pattern_type, square_size=p.square_size, offset_x=offset_x, offset_y=offset_y, ) self.pose_calc = calib.FiducialPoseFinder('Pose Calc') self.circle_drawer = calib.PatternDrawer('Circle Draw', rows=p.rows, cols=p.cols) self.circle_drawer2 = calib.PatternDrawer('Circle Draw', rows=p.rows, cols=p.cols) self.pose_draw = calib.PoseDrawer('Pose Draw') self.fps = highgui.FPSDrawer() #inputs i.declare('image', self.gray_image.inputs.at('in')) i.declare('color_image', self.rgb_image.inputs.at('in')) i.declare('K', self.camera_info.inputs.at('in')) #outputs o.declare('R', self.pose_calc.outputs.at('R')) o.declare('T', self.pose_calc.outputs.at('T')) o.declare('found', self.gather.outputs.at('found')) o.declare('debug_image', self.fps.outputs.at('image'))
def declare_cells(p): #TODO parameterize the quantizer #abuse saturated Arithmetics http://opencv.itseez.com/modules/core/doc/intro.html?highlight=saturated. cells = { 'gray_image': ecto.Passthrough('gray Input'), 'rgb_image': ecto.Passthrough('rgb Input'), 'camera_info': ecto.Passthrough('K_image'), 'gather': calib.GatherPoints("gather", N=2), 'quantizer': imgproc.Quantize('Quantizer', alpha=1, beta=0), 'invert': imgproc.BitwiseNot() } offset_x = -.3095 #TODO: FIXME hard coded offset_y = -.1005 cells['cd_bw'] = calib.PatternDetector( 'Dot Detector, B/W', rows=p.rows, cols=p.cols, pattern_type=p.pattern_type, square_size=p.square_size, offset_x=offset_x, offset_y=offset_y, ) offset_x = .1505 #TODO: FIXME hard coded cells['cd_wb'] = calib.PatternDetector( 'Dot Detector, W/B', rows=p.rows, cols=p.cols, pattern_type=p.pattern_type, square_size=p.square_size, offset_x=offset_x, offset_y=offset_y, ) cells['pose_calc'] = calib.FiducialPoseFinder('Pose Calc') cells['circle_drawer'] = calib.PatternDrawer('Circle Draw', rows=p.rows, cols=p.cols) cells['circle_drawer2'] = calib.PatternDrawer('Circle Draw', rows=p.rows, cols=p.cols) cells['fps'] = highgui.FPSDrawer() return cells
def __init__(self, plasm, rows, cols, pattern_type, square_size, debug=True): ecto.BlackBox.__init__(self, plasm) self.gray_image = ecto.Passthrough('gray Input') self.rgb_image = ecto.Passthrough('rgb Input') self.camera_info = ecto.Passthrough('K') self.gather = calib.GatherPoints("gather", N=2) self.invert = imgproc.BitwiseNot() offset_x = -.310 offset_y = -.101099 self.cd_bw = calib.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 = .150 self.cd_wb = calib.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, ) self.pose_calc = calib.FiducialPoseFinder('Pose Calc') self.circle_drawer = calib.PatternDrawer('Circle Draw', rows=rows, cols=cols) self.pose_draw = calib.PoseDrawer('Pose Draw')
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) quantizer = imgproc.Quantize('Quantizer', alpha=1, beta=0) rgb2gray = cvtColor(flag=Conversion.RGB2GRAY) invert =imgproc.BitwiseNot() poser = FiducialPoseFinder() pose_drawer = PoseDrawer() fps = highgui.FPSDrawer() ''' graph = [ sub_rgb["output"]>>im2mat_rgb["image"], im2mat_rgb['image'] >> (circle_drawer['input'], rgb2gray['image']), rgb2gray['image'] >> quantizer[:], rgb2gray['image'] >> cd_bw ['input'], cd_bw [ 'ideal', 'out', 'found'] >> poser['ideal', 'points', 'found'], sub_rgb_info["output"] >> im2info["camera_info"], im2info['K'] >> poser['K'],