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


Python SimpleCV.Image类代码示例

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


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

示例1: encuentraYFiltraBlobs

	def encuentraYFiltraBlobs(self,areaMin, areaMax, 
								   toleranciaWH, desviacionD,
								   toleranciaLP, tipoDibujo):
		
		imagenBlobs = Image(self.rutaImagenTratada_Fase2).copy()
		blobs = imagenBlobs.findBlobs()
		self.todosLosCandidatos = blobs
		
		if blobs:	
			
			blobs.image = imagenBlobs
			
			self.areaBlobs = blobs.area()
			blobs = self.filtroPorArea(blobs, areaMin, areaMax)
			self.numBlobsCandidatosPorArea = len(blobs)
			
			# Busca los blobs de forma circular , los blobs que pasan el filtro
			# se guardan en la lista self.articulaciones
			blobs = self.filtroPorForma(blobs, toleranciaWH, desviacionD, toleranciaLP)
			
			if tipoDibujo == 'blobs':
				self.dibujaBlobs(blobs)
			elif tipoDibujo == 'estructura':
				self.dibujaEstructura(imagenBlobs)
		
		# La imagen tratada tiene que ser guardada porque sino no funciona
		# la integracion con Tkinter
		imagenBlobs.save(self.rutaImagenBlobs)
		return Image(self.rutaImagenBlobs)
开发者ID:vencejo,项目名称:GUI-para-el-tratamiento-de-imagenes,代码行数:29,代码来源:tratamientoImagen.py

示例2: take_raw_image

def take_raw_image():
    log("take_raw_image()")
    if DEBUG:
        img = Image(TEMP_FOLDER_PATH + STATIC_IMAGE_NAME_PATTERN % randint(0, 8))
    else:
        img = capture_camera_image()
    return img.toRGB()
开发者ID:jonahgroup,项目名称:SnackWatcher,代码行数:7,代码来源:utils.py

示例3: connectToServerAndHandleConnection

def connectToServerAndHandleConnection():
    
    HOST = 'localhost'
    PORT = 9898
    
    while True:
        try:
            
            sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
            sock.connect((HOST,PORT))
        
            img_str = sock.recv(100000)
            
            nparr = np.fromstring(img_str, np.uint8)
            img_np = cv2.imdecode(nparr, cv2.CV_LOAD_IMAGE_COLOR) # cv2.IMREAD_COLOR in OpenCV 3.1
            
            img_ipl = cv.CreateImageHeader((img_np.shape[1], img_np.shape[0]), cv.IPL_DEPTH_8U, 3)
            cv.SetData(img_ipl, img_np.tostring(), img_np.dtype.itemsize * 3 * img_np.shape[1])
            
            image = Image(img_ipl)
            barcodes = image.findBarcode()
            stringOut = '[]\n'
            if barcodes != None:
                stringOut = ''
                for barcode in barcodes:
                    stringOut += str([barcode.x,barcode.y,int(barcode.length()), int(barcode.width()), barcode.data]) + ';'
                stringOut = stringOut[:-1]
                stringOut += '\n'
            sock.send(stringOut)
            
        except:
            continue
开发者ID:xmachinacc,项目名称:ArmMark1ServerSide,代码行数:32,代码来源:BarcodeFinder.py

示例4: rotate

	def rotate(self, img_path, shoe_measurements):
		img = Image(img_path)
		new_file_path = self.nfn('rotated')
		img = img.rotate(shoe_measurements.toe_heel_angle(), point=shoe_measurements.cleat_length_intersection())
		self.transformations.append(new_file_path)
		img.save(new_file_path)
		return new_file_path
开发者ID:jenglert,项目名称:cleat-align,代码行数:7,代码来源:shoe.py

示例5: scale

	def scale(self, img_path, scale):
		new_file_path = self.nfn('resized')
		img = Image(img_path)
		img = img.scale(scale)
		img.save(new_file_path)
		self.transformations.append(new_file_path)
		return new_file_path
开发者ID:jenglert,项目名称:cleat-align,代码行数:7,代码来源:shoe.py

示例6: getConvolvedImage

    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,代码行数:7,代码来源:ds325.py

示例7: _findGalaxyBulgeBlobs

    def _findGalaxyBulgeBlobs(galaxy):
        img = galaxy.imageWithoutBackground
        graynp = img.getGrayNumpy()

        stretched = np.array(graynp, dtype=np.float32)*(255.0/graynp.max())
        stretched = Image(stretched)
        return stretched.threshold(220).binarize().invert().findBlobs(minsize=4)
开发者ID:rmclaren,项目名称:Kaggle-GalaxyZoo,代码行数:7,代码来源:Galaxy.py

示例8: send_email

def send_email(percentage):
            import smtplib
	    from email.MIMEMultipart import MIMEMultipart
	    from email.MIMEImage import MIMEImage
	    from email.MIMEText import MIMEText
		

            # Prepare actual message
	    msg = MIMEMultipart()
	    msg['From'] = "[email protected]" # change to your mail
	    msg['To'] = "[email protected]" # change to your mail
	    msg['Subject'] = "RPi Camera Alarm!"

	    imgcv = Image("image.jpg")
	    imgcv.save("imagesend.jpg", quality=50) # reducing quality of the image for smaller size

	    img1 = MIMEImage(open("imagesend.jpg","rb").read(), _subtype="jpg")
	    img1.add_header('Content-Disposition', 'attachment; filename="image.jpg"')
	    msg.attach(img1)

	    part = MIMEText('text', "plain")
	    part.set_payload(("Raspberry Pi camera alarm activated with level {:f}").format(percentage))
	    msg.attach(part)

            try:
                server = smtplib.SMTP("mail.htnet.hr", 25) #change to your SMTP provider
		server.ehlo()
                server.starttls()
                server.sendmail(msg['From'], msg['To'], msg.as_string())
                server.quit()
                print 'Successfully sent the mail'
            except smtplib.SMTPException as e:
    		print(e)
开发者ID:akesegic,项目名称:raspberry_pi_camera_alarm,代码行数:33,代码来源:camera_alarm.py

示例9: capture

    def capture(self):
        count = 0
        currentframes = []
        self.framecount = self.framecount + 1

        for c in self.cameras:
            img = ""
            if c.__class__.__name__ == "Kinect" and c._usedepth == 1: 
                img = c.getDepth()
            elif c.__class__.__name__ == "Kinect" and c._usematrix == 1:
                mat = c.getDepthMatrix().transpose()
                img = Image(np.clip(mat - np.min(mat), 0, 255))
            else:
                img = c.getImage()
            if self.config.cameras[0].has_key('crop'):
                img = img.crop(*self.config.cameras[0]['crop'])
            frame = M.Frame(capturetime = datetime.utcnow(), 
                camera= self.config.cameras[count]['name'])
            frame.image = img
            currentframes.append(frame)
            
            while len(self.lastframes) > self.config.max_frames:
                self.lastframes.pop(0)
            # log.info('framecount is %s', len(self.lastframes))
                            
#            Session().redis.set("framecount", self.framecount)
            count = count + 1
            
                    
        self.lastframes.append(currentframes)            
            
        return currentframes
开发者ID:ravikg,项目名称:SimpleSeer,代码行数:32,代码来源:SimpleSeer.py

示例10: crop

def crop():
    #Begin Processing image
    print ('Begin processing image...')
    fullImage = Image('test/image/expected/fullImage.jpg')
    hundreds = fullImage.crop(602, 239, 28, 63)
    hundreds = hundreds.binarize(65).invert()
    hundreds.save('test/image/actual/hundredsImage.jpg')
    print ('Hundreds place cropped, binarized, and saved')
开发者ID:nthrockmorton,项目名称:wmr,代码行数:8,代码来源:wmr.py

示例11: addText

def addText(fileName, text):
    image = Image(fileName)
    draw = DrawingLayer((IMAGE_WIDTH, IMAGE_HEIGHT))
    draw.rectangle((8, 8), (121, 18), filled=True, color=Color.YELLOW)
    draw.setFontSize(20)
    draw.text(text, (10, 9), color=Color.BLUE)
    image.addDrawingLayer(draw)
    image.save(fileName)
开发者ID:moonrise,项目名称:raspberrywater,代码行数:8,代码来源:hydroid_device.py

示例12: trataImagen

	def trataImagen(self):
		
		img = Image(self.rutaImagenReducida)
		result = img.colorDistance((self.ajustes.r, self.ajustes.g, self.ajustes.b))
		result.save(self.rutaImagenTratada_Fase1) 
		result = result.invert()
		result = result.binarize(float(self.ajustes.umbralBinarizado)).invert()
		result.save(self.rutaImagenTratada_Fase2) 
开发者ID:vencejo,项目名称:GUI-para-el-control-visual-de-brazo-robotico,代码行数:8,代码来源:tratamientoImagen.py

示例13: getDepth

    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,代码行数:9,代码来源:ds325.py

示例14: correct_alignment

def correct_alignment(si, image_path):
	new_file_path = step_file_path(si, 'correct-alignment')
	img = Image(image_path)
	if (img.width > img.height):
		img.rotate(-90, fixed=False).save(new_file_path)
	else:
		img.save(new_file_path)
	si.step_outputs.append(new_file_path)
	return new_file_path
开发者ID:jenglert,项目名称:cleat-align,代码行数:9,代码来源:align.py

示例15: __init__

 def __init__(self, image_url, mask_url):
     self.position = (10, 10)
     self.last_position = (0, 0)
     self.draw_position = (0, 0)
     self.direction = "left"
     self.orig_image = Image(image_url)
     self.orig_mask = Image(mask_url).invert()
     self.draw_image = self.orig_image.copy()
     self.draw_mask = self.orig_mask.copy()
开发者ID:mcteo,项目名称:interactive-fish-tank,代码行数:9,代码来源:fish_tank.py


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