栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

不能泡菜 :属性查找cv2.BRISK失败

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

不能泡菜 :属性查找cv2.BRISK失败

我设法解决了。感谢@Matt和@Yamaneko。基本上,我将读取图像的块移到了worker函数中。因此,如果 池大小= 6,
并且有六个边界框,则每个帧将被读取六次(在每个工作程序中)。那是我发现使其工作的唯一方法。

当前版本可以在这里找到。

import cv2 as cvimport multiprocessing as mpimport timedef worker(folder_path, list_name, top_left, bot_right, index):    frame_path = folder_path + '/' + list_name[0]    image_0 = cv.imread(frame_path)    gray_0 = cv.cvtColor(image_0, cv.COLOR_BGR2GRAY)    cmt = VARtracker.CMT()    cmt.initialise(gray_0, top_left, bot_right)    box_queue = mp.Queue()    for name in list_name:        frame_path = folder_path + '/' + name        image_now = cv.imread(frame_path)        gray_now = cv.cvtColor(image_now, cv.COLOR_BGR2GRAY)        cmt.process_frame(gray_now)        if cmt.has_result: print index, name, zip(cmt.tl, cmt.br) output.put((index, name, zip(cmt.tl, cmt.br)))    print 'Process {} finished'.format(index)def VARmethod(folder_path, final_frame, top_left, bot_right):    tic = time.time()    if len(top_left) == len(bot_right):        list_frame = [index for index in range(1, final_frame + 1)]        list_name = [str(index) + '.jpg' for index in list_frame]        pool = mp.Pool(5)        for index in range(0, len(top_left)): pool.apply_async(worker, args=(folder_path, list_name, top_left[index], bot_right[index], index))        pool.close()        pool.join()        print 'Finished with the script'    toc = time.time()    print output.qsize()    print (toc - tic)


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/662176.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号