Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
sched = ecto.schedulers.Threadpool(plasm)

video_cap = highgui.VideoCapture(video_device=0)
fps = highgui.FPSDrawer()
rgb2gray = imgproc.cvtColor('rgb -> gray', flag=7)

display_strand = ecto.Strand()

checker_detector = calib.PatternDetector('Checker Detector',
                                         rows=5, cols=4,
                                         pattern_type="chessboard",
                                         square_size=0.03)
circle_detector = calib.PatternDetector('Dot Detector',
                                        rows=7, cols=3, pattern_type="acircles",
                                        square_size=0.03)
circle_drawer = calib.PatternDrawer('Circle Draw',
                                    rows=7, cols=3)
checker_drawer = calib.PatternDrawer('Checker Draw',
                                     rows=5, cols=4)
circle_display = highgui.imshow('Pattern show',
                                name='Pattern', waitKey= 2, maximize=True,
                                strand=display_strand)

plasm.connect(video_cap['image'] >> circle_drawer['input'],
               circle_drawer['out'] >> checker_drawer['input'],
               checker_drawer['out'] >> fps['image'],
               fps['image'] >> circle_display['input'],
               video_cap['image'] >> rgb2gray['input'],
               rgb2gray['out'] >> (circle_detector['input'], checker_detector['input']),
               circle_detector['out', 'found'] >> circle_drawer['points', 'found'],
               checker_detector['out', 'found'] >> checker_drawer['points', 'found'],
            )