Пример #1
0
            by, bx = (mat1 * mat2).nonzero()
            binImage[by, bx, bin] = 1
            for binRange in range(-numSigma, numSigma + 1):
                curBin = bin + binRange
                # Check boundary conditions
                if curBin < 0 or curBin >= numBins:
                    continue
                upthresh = stepSize * (curBin + 1)
                lowthresh = stepSize * (curBin)
                # Calculate cumulative distribution
                # Using center of stepsize
                xVal = lowthresh + (float(upthresh - lowthresh) / 2)
                outmat = (normpdf(xVal, image, stepSize)) * binImage[:, :, bin]
                depthMat[:, :, curBin] += outmat[:, :]
        # Normalize with max as 1
        # depthMat = depthMat / normVal
        # Normalize with mean/std
        matMean = np.mean(depthMat)
        matStd = np.std(depthMat)
        depthMat = (depthMat - matMean) * (targetStd / matStd) + targetMean
        # Write data for frame
        writeData(outMatFile, depthMat, frameIdx)
    outMatFile.close()

# y, x, z = depthMat.nonzero()
#
# fig = plt.figure()
# ax = Axes3D(fig)
# ax.scatter(x, z, -y, zdir = 'z', color = 'r')
# plt.show()
Пример #2
0
        curBin = bin + binRange
        if curBin < 0 or curBin >= numBins:
            continue
        upthresh = stepSize * (curBin + 1)
        lowthresh = stepSize * (curBin)
        #Calculate cumulative distribution
        #Using center of stepsize
        xVal = lowthresh + (float(upthresh - lowthresh)/2)
        outmat = (normpdf(xVal, idxMat, stepSize)) * binMat[:,:,bin]
        posMat[:, :, curBin] += outmat[:,:]
        #Normalize with mean/std
        matMean = np.mean(posMat)
        matStd = np.std(posMat)
        posMat = (posMat - matMean) * (targetStd/matStd) + targetMean
writeHeaderFile(outMatFile, (Y, X, numBins), 1)
writeData(outMatFile, posMat, 1)
outMatFile.close()





#y, x, z = posMat.nonzero()
#
#fig = plt.figure()
#ax = Axes3D(fig)
#ax.scatter(x, z, -y, zdir = 'z', color = 'r')
#plt.show()


Пример #3
0
        curBin = bin + binRange
        if curBin < 0 or curBin >= numBins:
            continue
        upthresh = stepSize * (curBin + 1)
        lowthresh = stepSize * (curBin)
        #Calculate cumulative distribution
        #Using center of stepsize
        xVal = lowthresh + (float(upthresh - lowthresh) / 2)
        outmat = (normpdf(xVal, idxMat, stepSize)) * binMat[:, :, bin]
        posMat[:, :, curBin] += outmat[:, :]
        #Normalize with mean/std
        matMean = np.mean(posMat)
        matStd = np.std(posMat)
        posMat = (posMat - matMean) * (targetStd / matStd) + targetMean
writeHeaderFile(outMatFile, (Y, X, numBins), 1)
writeData(outMatFile, posMat, 1)
outMatFile.close()

#y, x, z = posMat.nonzero()
#
#fig = plt.figure()
#ax = Axes3D(fig)
#ax.scatter(x, z, -y, zdir = 'z', color = 'r')
#plt.show()

#Write out header
#only 1 frame
#   writeHeaderFile(outMatFile, (Y, X, numBins), 1)

#for bin in range(numBins):
#    binupthresh = stepSize * (bin + 1)
Пример #4
0
            by, bx = (mat1 * mat2).nonzero()
            binImage[by, bx, bin] = 1
            for binRange in range(-numSigma, numSigma + 1):
                curBin = bin + binRange
                #Check boundary conditions
                if curBin < 0 or curBin >= numBins:
                    continue
                upthresh = stepSize * (curBin + 1)
                lowthresh = stepSize * (curBin)
                #Calculate cumulative distribution
                #Using center of stepsize
                xVal = lowthresh + (float(upthresh - lowthresh) / 2)
                outmat = (normpdf(xVal, image, stepSize)) * binImage[:, :, bin]
                depthMat[:, :, curBin] += outmat[:, :]
        #Normalize with max as 1
        #depthMat = depthMat / normVal
        #Normalize with mean/std
        matMean = np.mean(depthMat)
        matStd = np.std(depthMat)
        depthMat = (depthMat - matMean) * (targetStd / matStd) + targetMean
        #Write data for frame
        writeData(outMatFile, depthMat, frameIdx)
    outMatFile.close()

#y, x, z = depthMat.nonzero()
#
#fig = plt.figure()
#ax = Axes3D(fig)
#ax.scatter(x, z, -y, zdir = 'z', color = 'r')
#plt.show()