【发布时间】:2014-05-07 01:16:21
【问题描述】:
我正在使用 Python 2.7.5 和 OpenCV。我有一个测试图像,我想在一组图像中找到它最相似的图像。我已经使用 OpenCV 编写了一个函数,它将给出相似点的总数。我的点越相似,图像就越相似。不幸的是,这是一个相当耗时的函数,所以我想并行化我的代码以使其更快。
#img is the image that I am trying to find the most number of similar pointswith
maxSimilarPts = 0;
#testImages is a list of testImages
for testImage in testImages:
#getNumSimilarPts returns the number of similar points between two images
similarPts = getNumSimilarPts(img, testImage)
if similarPts > maxSimilarPts:
maxSimilarPts = similarPts
如何与 python 并行执行此操作?任何帮助将不胜感激。
【问题讨论】:
-
你可能想看看this post。它与 OpenCV 无关。但是它有很多关于使用python进行多线程的讨论。
标签: python multithreading python-2.7 opencv multiprocessing