def getCircles(): from SimpleCV import Image, Color import os os.system("fswebcam -r 640x480 --save capture.png") img = Image("capture.png") #canny is the sensitivity of the circle finding - adjust downward to find more #default 100 #Thresh is the sensitivity of the edge finder. default 350 #Distance adjusts how far concentric circle must be apart to be considered #as distinct circles. #returns a list of vectors <x,y,radius> circles = img.findCircle(canny=150, thresh=145, distance=15) if not circles: print "no circles found" return None return circles[0][0], circles[0][1]
#!/usr/bin/python import subprocess from SimpleCV import Color, Image import time img = Image("/dev/shm/lastsnap.jpg") img.save("p1.png") circles =img.findCircle(canny=200,thresh=250,distance=15) circles = circles.sortArea() #circles.draw(width=4) #circles[0].draw(color=Color.RED, width=4) #img_with_circles = img.applyLayers() #edges_in_image = img.edges(t2=200) img.save("p2.png") #final =img.sideBySide(edges_in_image.sideBySide(img_with_circles)).scale(0.5) #img.save("p3.png")
from SimpleCV import Color, Image import time img = Image("sportsballs.jpg") circles = img.findCircle(canny=200, thresh=250, distance=15) circles.sortArea() circles.draw(width=4) circles[0].draw(color=Color.RED, width=4) img_with_circles = img.applyLayers() edges_in_image = img.edges(t2=200) final = img.sideBySide(edges_in_image.sideBySide(img_with_circles)).scale(0.5) final.show() time.sleep(15)
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")