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


Python Image.blit方法代码示例

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


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

示例1: reconstruct

# 需要导入模块: from SimpleCV.ImageClass import Image [as 别名]
# 或者: from SimpleCV.ImageClass.Image import blit [as 别名]
 def reconstruct(self,img):
     """
     This is a "just for fun" method as a sanity check for the BOF codeook.
     The method takes in an image, extracts each codebook code, and replaces
     the image at the position with the code. 
     """
     retVal = cv.CreateImage((img.width,img.height), cv.IPL_DEPTH_8U, 1)
     data = self._getPatches(img)
     p = spsd.cdist(data,self.mCodebook)
     foo = p.shape[0]
     codes = np.argmin(p,axis=1)   
     count = 0
     wsteps = img.width/self.mPatchSize[0]
     hsteps = img.height/self.mPatchSize[1]
     w=self.mPatchSize[0]
     h=self.mPatchSize[1]
     length = w*h
     retVal = Image(retVal)
     for widx in range(wsteps):
         for hidx in range(hsteps):
             x = (widx*self.mPatchSize[0])
             y = (hidx*self.mPatchSize[1])
             p = codes[count]
             temp = Image(self.mCodebook[p,:].reshape(self.mPatchSize[0],self.mPatchSize[1]))    
             retVal.blit(temp,pos=(x,y))
             count = count + 1
     return retVal
开发者ID:blackball,项目名称:SimpleCV,代码行数:29,代码来源:BOFFeatureExtractor.py

示例2: _codebook2Img

# 需要导入模块: from SimpleCV.ImageClass import Image [as 别名]
# 或者: from SimpleCV.ImageClass.Image import blit [as 别名]
 def _codebook2Img(self, cb, patchsize, count, patch_arrangement, spacersz):
     """
     cb = the codebook
     patchsize = the patch size (ususally 11x11)
     count = total codes
     patch_arrangement = how are the patches grided in the image (eg 128 = (8x16) 256=(16x16) )
     spacersz = the number of pixels between patches
     """
     w = (patchsize[0]*patch_arrangement[0])+((patch_arrangement[0]+1)*spacersz)
     h = (patchsize[1]*patch_arrangement[1])+((patch_arrangement[1]+1)*spacersz)
     bm = np.zeros((h, w), np.uint8)
     img = Image(bm)
     count = 0
     for widx in range(patch_arrangement[0]):
         for hidx in range(patch_arrangement[1]):
             x = (widx*patchsize[0])+((widx+1)*spacersz)
             y = (hidx*patchsize[1])+((hidx+1)*spacersz)
             temp = Image(cb[count,:].reshape(patchsize[0],patchsize[1]))
             img.blit(temp,pos=(x,y))
             count = count + 1
     return img
开发者ID:Betrezen,项目名称:SimpleCV2,代码行数:23,代码来源:BOFFeatureExtractor.py


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