当前位置: 首页>>代码示例>>Python>>正文


Python Image.getGrayNumpyCv2方法代码示例

本文整理汇总了Python中SimpleCV.Image.getGrayNumpyCv2方法的典型用法代码示例。如果您正苦于以下问题:Python Image.getGrayNumpyCv2方法的具体用法?Python Image.getGrayNumpyCv2怎么用?Python Image.getGrayNumpyCv2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleCV.Image的用法示例。


在下文中一共展示了Image.getGrayNumpyCv2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: range

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import getGrayNumpyCv2 [as 别名]
    p3 = integral[y+1,x2+1]
    p2 = integral[y+1,x1-1]
    p1 = integral[y,x2+1]
    p0 = integral[y,x1-1]
    val = p3-p2-p1+p0
    return val
    
# roughly how far we scan horizontally
window = 2*80 #int(img.width/repeats)
repeats = np.floor(img.width/window)
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]
开发者ID:Tesseract3D,项目名称:visionstuff,代码行数:33,代码来源:deMagiceye.py


注:本文中的SimpleCV.Image.getGrayNumpyCv2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。