示例#1
0
文件: GUI2.py 项目: Rossila/Ninjabot
    def ImagePro(self,capture,orig,processed,storage,grid,squares):
        orig = cv.QueryFrame(capture)
        #cv.Normalize(orig)
        # filter for all yellow and blue - everything else is black
        processed = processor.colorFilterCombine(orig, "yellow", "blue" ,s)
        #robot = processor.colorFilterCombine(orig, "red", "green" ,s)
        
        # Some processing and smoothing for easier circle detection
        cv.Canny(processed, processed, 5, 70, 3)
        cv.Smooth(processed, processed, cv.CV_GAUSSIAN, 7, 7)
        #cv.Canny(robot, robot, 5, 70, 3)
        #cv.Smooth(robot, robot, cv.CV_GAUSSIAN, 7, 7)
        
        #cv.ShowImage('processed2', processed)
        
        # Find&Draw circles
        processor.find_circles(processed, storage, 100)

        #processor.find_circles(robot, storage2, 100)
        #if it is in the range of 1 to 9, we can try and recalibrate our filter
        #if 1 <= storage.rows < 10:
        #    s = autocalibrate(orig, storage)
            
        #print storage2

        combined = processor.robot_tracking(orig, squares)

        processor.draw_circles(storage, orig)
        #processor.draw_circles(storage2, orig)

        mask = cv.CreateImage((400,300), cv.IPL_DEPTH_8U, 3)
        cv.Resize(orig,mask)
        return mask
示例#2
0
文件: GUI2.py 项目: Rossila/Ninjabot
    def ImagePro(self,capture,orig,processed,storage,grid,squares):
        orig = cv.QueryFrame(capture)
        #cv.Normalize(orig)
        # filter for all yellow and blue - everything else is black
        processed = processor.colorFilterCombine(orig, "yellow", "blue" ,s)
        
        # Some processing and smoothing for easier circle detection
        cv.Canny(processed, processed, 5, 70, 3)
        cv.Smooth(processed, processed, cv.CV_GAUSSIAN, 7, 7)
        
        #cv.ShowImage('processed2', processed)
        
        # Find&Draw circles
        processor.find_circles(processed, storage, 100)

        #if it is in the range of 1 to 9, we can try and recalibrate our filter
        #if 1 <= storage.rows < 10:
        #    s = autocalibrate(orig, storage)
            

        combined = processor.robot_tracking(orig, squares)

        processor.draw_circles(storage, orig)

        #warp = processor.update_grid(storage, orig, grid)


        # Delete and recreate the storage so it has the correct width
        #del(storage)
        #storage = cv.CreateMat(orig.width, 1, cv.CV_32FC3)
        
        #cv.ShowImage('output', orig)

        #return processed
        #cv.ShowImage('grid', warp)

        #warp = perspective_transform(orig)
        #cv.ShowImage('warped', warp)
        #combined = processor.robot_tracking(orig, squares)

        mask = cv.CreateImage((400,300), cv.IPL_DEPTH_8U, 3)
        cv.Resize(orig,mask)
        return mask
示例#3
0
文件: GUI2.py 项目: garpan12/Ninjabot
    def ImagePro(self, capture, orig, processed, storage, grid):
        orig = cv.QueryFrame(capture)
        #cv.Normalize(orig)
        # filter for all yellow and blue - everything else is black
        processed = processor.colorFilterCombine(orig, "yellow", "blue", s)

        # Some processing and smoothing for easier circle detection
        cv.Canny(processed, processed, 5, 70, 3)
        cv.Smooth(processed, processed, cv.CV_GAUSSIAN, 7, 7)

        #cv.ShowImage('processed2', processed)

        # Find&Draw circles
        processor.find_circles(processed, storage, 100)

        #if it is in the range of 1 to 9, we can try and recalibrate our filter
        #if 1 <= storage.rows < 10:
        #    s = autocalibrate(orig, storage)

        processor.draw_circles(storage, orig)

        #warp = processor.update_grid(storage, orig, grid)

        # Delete and recreate the storage so it has the correct width
        #del(storage)
        #storage = cv.CreateMat(orig.width, 1, cv.CV_32FC3)

        #cv.ShowImage('output', orig)

        #return processed
        #cv.ShowImage('grid', warp)

        #warp = perspective_transform(orig)
        #cv.ShowImage('warped', warp)
        mask = cv.CreateImage((640, 480), cv.IPL_DEPTH_8U, 3)
        cv.Resize(orig, mask)
        return mask