33from freenect import *
44from numpy import *
55from cv2 import *
6- from time import *
6+
77
88#Funcion de Adquisicion RGB kinect
99def frame_RGB ():
@@ -82,7 +82,7 @@ def dibuja_circulos(circuloX,img):
8282 if circuloX is not None :
8383 #Se convierten los valores (x,y,r) de circulo a enteros
8484 circuloX = circuloX .astype ("int" )
85- print (circuloX )
85+ # print(circuloX)
8686 x = circuloX [0 ,0 ,0 ]
8787 y = circuloX [0 ,0 ,1 ]
8888 r = circuloX [0 ,0 ,2 ]
@@ -97,7 +97,6 @@ def dibuja_circulos(circuloX,img):
9797
9898# loop principal
9999while True :
100- init = time ()
101100 frame = frame_RGB () #leo frame
102101 depth = frame_depth () #leo profundidad depth
103102 depth = resize (depth ,(0 ,0 ),fx = 0.5 , fy = 0.5 )
@@ -111,16 +110,9 @@ def dibuja_circulos(circuloX,img):
111110 frame = medianBlur (frame ,5 )
112111 #imwrite('frame.jpg',frame)
113112
114- color = time ()
115113 mascaraV = filtLAB_Verde (frame )
116114 mascaraN = filtLAB_Naranja (frame )
117- tc = time ()- color
118115
119- edge = time ()
120-
121- #Toma el valor absoluto -> convertScaleAbs( grad_y, abs_grad_y )
122- #explicación Sobel_x + Sobel_y (addWeighted, suma grad_x y grad_y)
123- #https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp
124116
125117 mascaraV = Laplacian (mascaraV ,CV_8U ) #Deteccion de bordes de la mascara
126118 mascaraN = Laplacian (mascaraN ,CV_8U )
@@ -131,10 +123,6 @@ def dibuja_circulos(circuloX,img):
131123
132124 mascaraV = dilate (mascaraV ,diler ,iterations = 1 ) #aplico dilatacion
133125 mascaraN = dilate (mascaraN ,diler ,iterations = 1 ) #aplico dilatacion
134-
135- te = time ()- edge
136- print ('EDGES' ,te )
137- print ('COLOR' ,tc )
138126
139127 #Hallo los círculos que estén en detección de bordes
140128
@@ -247,9 +235,6 @@ def dibuja_circulos(circuloX,img):
247235 if key == ord ("q" ):
248236 break
249237
250- t = time ()- init
251- print ('FIN' ,t )
252-
253238# detener y cerrar ventanas
254239sys .exit ()
255240destroyAllWindows ()
0 commit comments