本文整理汇总了Python中SimpleCV.Image.edges方法的典型用法代码示例。如果您正苦于以下问题:Python Image.edges方法的具体用法?Python Image.edges怎么用?Python Image.edges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.Image
的用法示例。
在下文中一共展示了Image.edges方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import edges [as 别名]
def on_image(self, data):
print 'Image Received'
imgstr = re.search(r'base64,(.*)', data).group(1) #This is a hack to clean up the encoding.
tempimg = StringIO.StringIO(imgstr.decode('base64'))
pilimg = PILImage.open(tempimg)
img = Image(pilimg)
img = img.edges()
pimg = img.getPIL()
output = StringIO.StringIO()
pimg.save(output, format='JPEG')
sendstr = 'data:image/jpeg;base64,' + output.getvalue().encode('base64')
self.emit('update', sendstr)
示例2: edgify
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import edges [as 别名]
def edgify(in_full_path):
(root, ext) = os.path.splitext(in_full_path)
out_full_path = root + '_edgified' + ext
img = Image(in_full_path)
# create an edge image using the Canny edge detector
# set the first threshold to 160
output = img.edges(t1=50, t2=50)
# invert white on black image
output = output.invert()
# save the output images.
output.save(out_full_path)
return out_full_path
示例3:
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import edges [as 别名]
from SimpleCV import Image, Camera, Display, Image, Color
import time
import matplotlib.pyplot as plt
import numpy as np
imagen=Image('/home/pi/lunar_con_pelos.png')
#imagen.show()
#se prueba distintos metodos para ver si detecta los bellos en la piel
ed=imagen.edges()
edg=imagen+ed
edg.save('bordes_edge.png')
grad = imagen.morphGradient()
grd = imagen+grad
grd.save('bordes_gradiente.png')
lineas=imagen.findLines()
lineas.draw(Color.RED,width=3)
#imagen.show()
imagen.save("linbeas.png")
resu = imagen.resize(320,240) #se redefine la imagen para que tenga un menor tiempo
#de procesamiento
gray=resu.grayscale()
inv=gray.invert()
sumimg=resu+inv
res=(resu*1.5)-(gray/2)
res.save('muestras/imagen_tratada.png')
示例4: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import edges [as 别名]
logger.debug("Serial initialised to port: %s \n" % (port,))
# The main loop
while True:
try:
width = 0
if PI_CAM:
# cam.capture(stream,'jpeg', use_video_port=True)
with parray.PiRGBArray(cam) as output:
cam.capture(output, 'rgb', use_video_port=True)
img = Image(output.array).rotate(angle = 90, fixed=False).toGray()
else:
img = cam.getImage()
#edge detect
output = img.edges(t1=pixel_threshold, t2=4*pixel_threshold)
#split screen
result = halfsies(img,output)
#find the edges
upper_edge = []
lower_edge = []
for x in range(0,img.width):
xSection = output.getVertScanlineGray(x)
edge_data = getEdges(xSection)
if edge_data[0] and edge_data[1]:
upper_edge.append(edge_data[0])
lower_edge.append(edge_data[1])
示例5: int
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import edges [as 别名]
gr3 = int(input("Ingrese parametro t3 (inicial) a utilizar: "))
gr4 = int(input("Ingrese parametro t4 (final) a utilizar: "))
#Detectamos los bordes con la implementacion de SimpleCV
#[Recordar que los parametros para la funcion edges de SimpleCV
#los modificamos en funcion de los valores del histograma que tenemos anteriormente para cada canal]
ir = Image('Captura_rojo.png')
ig = Image('Captura_verde.png')
ib = Image('Captura_azul.png')
#(...)Para escala de grises
b_gr = igr.edges(gr1,gr2)
b_gr.save('Borde_gris.png')
#(...) y para canales RGB
b_r = ir.edges(r1,r2) #Rojo
b_r.save('Borde_rojo.png')
b_g1 = ig.edges(g1,g2) #Verde
b_g1.save('Borde_verde_1.png')
b_g2 = ig.edges(g3,g4)
b_g2.save('Borde_verde_2.png')
b_g = b_g1 + b_g2
b_g.save('Borde_verde_T.png')
b_b1 = ib.edges(b1,b2) #Azul
b_b1.save('Borde_azul_1.png')
b_b2 = ib.edges(b3,b4)
b_b2.save('Borde_azul_2.png')
b_b = b_b1 + b_b2
b_b.save('Borde_azul_T.png')
示例6: call
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import edges [as 别名]
from SimpleCV import Image
import time
#using opencv captured image, but purpose is make by video
call(“raspistill -n -t 0 -w %s -h %s -o image.bmp” % 640 480, shell=True)
img = Image(“image.bmp”)
img.show()
time.sleep(5)
#--------
cam = Camera()
img = cam.getImage()
#-----
img = img.edges()
img.show()
time.sleep(5)
img = img.binarize()
img.show()
time.sleep(5)
img = img.findBlobs()
for blob in blobs:
blob.draw()
img.show()
time.sleep(5)
#연속적인 이미지 촬영으로 영상을 만들면 속도가 너무 느리다 한방으로 가자
示例7: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import edges [as 别名]
#!/usr/bin/python
from SimpleCV import Camera, Display, Image
img = Image("img4.png")
imggray = img.grayscale().save("img4gray.png")
imggray = Image("img4gray.png")
(red, green, blue) = img.splitChannels(False)
# Edge detection with diferents algorithms on SCV.
# "Edges" Command.
imggray_edge = imggray.edges().save("img4gray_edges.png")
red_edge = red.edges().save("img4red_edges.png")
green_edge = green.edges().save("img4green_edges.png")
blue_edge = blue.edges().save("img4blue_edges.png")
# "morphGradient" Command
imggray_edge = imggray.morphGradient().save("img4gray_edges_morphGradient.png")
red_edge = red.morphGradient().save("img4red_edges_morphGradient.png")
green_edge = green.morphGradient().save("img4green_edges_morphGradient.png")
blue_edge = blue.morphGradient().save("img4blue_edges_morphGradient.png")
# "sobel" Command
imggray_edge = imggray.sobel().save("img4gray_edges_sobel.png")
red_edge = red.sobel().save("img4red_edges_sobel.png")
green_edge = green.sobel().save("img4green_edges_sobel.png")
blue_edge = blue.sobel().save("img4blue_edges_sobel.png")
示例8:
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import edges [as 别名]
invertidos=green.invert()#se invierte la imagen para obtener manchas negras en la foto
blob=invertidos.findBlobs()#se ve si se encuentrasn las mannchas en la foto invertida
blob.show(width=2)
pruebalunar.addDrawingLayer(invertidos.dl())
pruebalunar.show()
pruebalunar.save("porfavorguardate2.png") #guardamos la imagen
#enncontrar manchas por color especifico para el cual tenemos:
brown_distance=green.colorDistance(Color.BLACK).invert()##cmo buscamos de color negro , le pknemos black
blobs2_=brown_distance.findBlobs()
blobs2_.draw(color=Color.PUCE ,width=3)#se va hacer el mismo ejemplo de la guia
brown_distance.show()
green.addDrawingLayer(brown_distance.dl())
green.show()
green.save("Porfavorguaradte5.png")
#lineas=pruebalunar.findLines()
#lineas.draw(width=3)
#pruebalunar.show()
circles=pruebalunar.findCircle(canny=100,thresh=350,distance=15)
circles=circles.sortArea()
circles.draw(width=4)
img_with_circles= pruebalunar.applyLayers()
edges_in_image= pruebalunar.edges(t2=200)
final=pruebalunar.sideBySide(edges_in_image.sideBySide(img_with_circles)).scale(0.5)
final.show()
final.save("porfavorguardate.png")