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


Python Image.invert方法代码示例

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


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

示例1: adaptative_thresholding

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
def adaptative_thresholding(x):
    global thres, na, cons, maxValue, tipo, img, windoTitle
    if x == 0:
        thres = img
        maxValue = 255
        na = 11
        cons = 2;
        cv2.createTrackbar('Neighbourhood area (odds)', windowTitle, na, maxValue, fneighbourdhood_area)
        cv2.createTrackbar('Constant', windowTitle, -maxValue, maxValue, fConstant)
        cv2.createTrackbar('MaxValue', windowTitle, maxValue, maxValue, fMaxValue)
    elif x == 1:
        thres = cv2.adaptiveThreshold(img, maxValue,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY, na, cons)
    elif x == 2:
        thres = cv2.adaptiveThreshold(img, maxValue, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,na,cons)
    tipo = x
    blobImg = Image(thres)
    invImg = blobImg.invert()
    blobImg = blobImg.rotate90()
    invImg = blobImg.invert()
    blobs = invImg.findBlobs()
    for blob in blobs:
        #print blob.coordinates()
        invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
    blobImg.addDrawingLayer(invImg.dl())
    blobs.show(color=Color.GREEN,width=1)
    cv2.imshow(windowTitle, thres)
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: thresholding

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
def thresholding(x):
    global thres, value, maxValue, img, tipo
    imgO = img
    if (x == 0):
        thres = None
        filtro = img
        value = 0
        maxValue = 255
        cv2.createTrackbar('Value', windowTitle, value, maxValue, fValue)
        cv2.createTrackbar('MaxValue', windowTitle, maxValue, maxValue, fMaxValue)


    elif (x == 1):
        thres = cv2.THRESH_BINARY+cv2.THRESH_OTSU
    elif (x==2):
        thres = cv2.THRESH_BINARY+cv2.THRESH_OTSU
        img  = cv2.GaussianBlur(img,(5,5),0)
    if (x != 0):
        ret, filtro = cv2.threshold(img,value, maxValue, thres)
    tipo = x
    img = imgO
    blobImg = Image(filtro)
    invImg = blobImg.invert()
    blobImg = blobImg.rotate90()
    invImg = blobImg.invert()
    blobs = invImg.findBlobs()
    for blob in blobs:
        #print blob.coordinates()
        invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
    blobImg.addDrawingLayer(invImg.dl())
    blobs.show(color=Color.GREEN,width=1)
    cv2.imshow(windowTitle, filtro)
开发者ID:,项目名称:,代码行数:34,代码来源:

示例3: fneighbourdhood_area

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
def fneighbourdhood_area(x):
    global na, thres, windowTitle, tipo
    if x % 2 ==0:
        na = x+1
    else:
        na = x
    if na == 0 or na == 1:
        na = 3
    if tipo == 0:
        thres = img
    elif tipo == 1:
        thres = cv2.adaptiveThreshold(img, maxValue,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY, na, cons)
    elif tipo == 2:
        thres = cv2.adaptiveThreshold(img, maxValue, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,na,cons)
    blobImg = Image(thres)
    invImg = blobImg.invert()
    blobImg = blobImg.rotate90()
    invImg = blobImg.invert()
    blobs = invImg.findBlobs()
    for blob in blobs:
        #print blob.coordinates()
        invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
    blobImg.addDrawingLayer(invImg.dl())
    blobs.show(color=Color.GREEN,width=1)
    
    cv2.imshow(windowTitle, thres)
开发者ID:,项目名称:,代码行数:28,代码来源:

示例4: getConvolvedImage

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
    def getConvolvedImage(self, kern, rep, bias):
        ''' Return a simple cv compatiable 8bit greyscaled image that has had 
        the specified kernel applied rep times with bias supplied'''

        conv = ds.convolveColourMap(kern, rep, bias)
        iE = Image(conv.transpose())
        return iE.invert()
开发者ID:Snkz,项目名称:DepthSense-SimpleCV,代码行数:9,代码来源:ds325.py

示例5: getDepth

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
    def getDepth(self):
        ''' Return a simple cv compatiable 8bit depth image '''

        depth = ds.getDepthMap()
        np.clip(depth, 0, 2**10 - 1, depth)
        depth >>=2
        depth = depth.astype(np.uint8)
        iD = Image(depth.transpose())
        return iD.invert()
开发者ID:Snkz,项目名称:DepthSense-SimpleCV,代码行数:11,代码来源:ds325.py

示例6: fMaxValue

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
def fMaxValue(x):
    global maxValue, value, thres, img, filtro
    maxValue = x
    if (thres is None):
        filtro = img

    else:
        ret, filtro = cv2.threshold(img,value, maxValue, thres)
    blobImg = Image(filtro)
    invImg = blobImg.invert()
    blobImg = blobImg.rotate90()
    invImg = blobImg.invert()
    blobs = invImg.findBlobs()
    for blob in blobs:
        #print blob.coordinates()
        invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
    blobImg.addDrawingLayer(invImg.dl())
    blobs.show(color=Color.GREEN,width=1)
    cv2.imshow(windowTitle, filtro)
开发者ID:,项目名称:,代码行数:21,代码来源:

示例7: getConvolvedDepth

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
    def getConvolvedDepth(self, kern, rep, bias):
        ''' Return a simple cv compatiable 8bit depth map that has had 
        the specified kernel applied rep times '''

        conv = ds.convolveDepthMap(kern, rep, bias)
        np.clip(conv, 0, 2**10 - 1, conv)
        conv >>=2
        conv = conv.astype(np.uint8)
        iE = Image(conv.transpose())
        return iE.invert()
开发者ID:Snkz,项目名称:DepthSense-SimpleCV,代码行数:12,代码来源:ds325.py

示例8: fConstant

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
def fConstant(x):
    global cons, thres, windowTitle, tipo, maxValue, na, img
    # const positive to white, otherwise, to black
    cons = x
    if tipo == 0:
        thres = img
    elif tipo == 1:
        thres = cv2.adaptiveThreshold(img, maxValue,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY, na, cons)
    elif tipo == 2:
        thres = cv2.adaptiveThreshold(img, maxValue, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,na,cons)
    
    blobImg = Image(thres)
    invImg = blobImg.invert()
    blobImg = blobImg.rotate90()
    invImg = blobImg.invert()
    blobs = invImg.findBlobs()
    for blob in blobs:
        #print blob.coordinates()
        invImg.dl().circle(blob.coordinates(), 3, Color.RED, filled = True)
    blobImg.addDrawingLayer(invImg.dl())
    blobs.show(color=Color.GREEN,width=1)
    cv2.imshow(windowTitle, thres)
开发者ID:,项目名称:,代码行数:24,代码来源:

示例9: Camera

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
from SimpleCV import Camera, Image,Color
import time

'''exemplo que carrega uma imagem totalmente vermelha e substiui o fundo do rotate
que e sempre preto por vermelho'''

cam = Camera(1)
img = cam.getImage()
vermelho = Image('/home/administrador-x/vermelho.png').resize(img.width,img.height)
rotate = img.rotate(-65)


mask = rotate.hueDistance(color=Color.BLACK,minsaturation=1,minvalue=1).erode(3).binarize(254)


img2 = mask+vermelho.invert()
img3 = img2.invert()+rotate

img3.show()
time.sleep(5)
开发者ID:rodgomesc,项目名称:SlidesPython,代码行数:22,代码来源:substitui_fundo_rotate.py

示例10:

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import invert [as 别名]
# -*- coding: cp1252 -*-
from SimpleCV import Camera,Image,Display
from math import *
display=Display()
cam=Camera()
sung=Image("E:/sung2.png")
sung2=Image("E:/RAY-BAN-Mens-Unisex-Designer-Genuine-Sunglasses-Aviator-RayBan-RB-4180-RRP-£165-For-Sale-at-UsedLux.com-Preowned-Used-designer-clothing-in-London-3-182103112013w.jpg")
sung2=sung2.invert()
sungar=[sung,sung2]
i=0
img3=sungar[i]
while display.isNotDone:
    img=cam.getImage()
    faces=img.findHaarFeatures('face.xml')
    if faces is not None:
        faces=faces.sortArea()
        bigface=faces[-1]
        bigeye=img.findHaarFeatures('two_eyes_big.xml')
        if(bigeye is not None):
          bigeye=bigeye.sortArea()
          bigeye=bigeye[-1]
          print "yo"
        lefteye=img.findHaarFeatures('lefteye.xml')
        righteye=img.findHaarFeatures('right_eye.xml')
        if lefteye is not None and righteye is not None:
             if bigeye is not None:
               a=int((bigeye.width()))
               b=int((bigeye.height()))
               print a,b
               sungar[i]=sungar[i].resize(a+20,b+15)
             if bigeye is not None:
开发者ID:Himeshkuls,项目名称:lacche,代码行数:33,代码来源:faced.py


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