本文整理汇总了Python中SimpleCV.Image.medianFilter方法的典型用法代码示例。如果您正苦于以下问题:Python Image.medianFilter方法的具体用法?Python Image.medianFilter怎么用?Python Image.medianFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.Image
的用法示例。
在下文中一共展示了Image.medianFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import medianFilter [as 别名]
print "window: {0}".format(window)
# how big of a signal we convolve
samplesz = window / 10
print "sample: {0}".format(samplesz)
dmap = np.zeros([img.width-window,img.height],dtype='int32')
integral = cv2.integral(img.getGrayNumpyCv2())
# we'll do this with iteration first to test
# proof of concept.
print (img.width,img.height)
# need to double check these bounds with the integral image
# really wish I could get rid of this iteration
for vidx in range(1,img.height-1): # for each row
print "row {0}".format(vidx)
for hidx in range(1,img.width-window-1): #for each pixel in the row
# get the sum of a horz chunk
sample = idxToSum(hidx,hidx+samplesz,vidx,integral)
# try and grok this, go thru a search window, calc the abs diff of sums
# between or sample and the test window, toss in a list
vals = [np.abs(sample-idxToSum(hidx+sidx,hidx+sidx+samplesz,vidx,integral)) for sidx in range((window/2)-samplesz,window-samplesz) ]
# find the minimum match
best = np.where(np.array(vals)==np.min(vals))[0]
# offset is the hidx of the current window
dmap[hidx][vidx] = best[-1] # if we get > 1 use the furthest one
# create the raw out
result = Image(dmap)
result.save('outputRAW.png')
# create the cleaned up output
result = result.medianFilter().equalize().invert().blur(window=(5,5))
result.save('outputEqualize.png')
sbs = img.sideBySide(result)
sbs.save('result.png')