OpenCV Python GPU support ? or faster variance convolution

asked 2017-07-11 06:53:18 -0500

TimWebPhoenix gravatar image

updated 2017-07-13 05:14:45 -0500


I was wondering if the current OpenCV Python had GPU support yet ?

OR is there a faster way to calculate convolved variance ?

MaxFrom3DArray = numpy.amax(imgArray, axis=0)    # where imgArray is a 3D array
Back2ImMax = Image.fromarray(MaxFrom3DArray, 'P'), filename), "TIFF") 

    ForVariance = cv2.imread((MaxFromMulti + filename), cv2.IMREAD_UNCHANGED)
wlen = 40
def winVar(img, wlen):
    wmean, wsqrmean = (cv2.boxFilter(x, -1, (wlen, wlen),
    borderType=cv2.BORDER_REFLECT) for x in (img, img*img))
    return wsqrmean - wmean*wmean
windowVar = winVar(ForVariance, wlen)
print windowVar

This takes hours in Python, and ages using python multi-threading, with CPU cores maxed out. It takes a fraction of a second and hardly any cpu usage when serialised in c sharp. Doesn't something seem a bit off about that ?

Thanks in advance TWP

edit retag flag offensive close merge delete