@@ -171,7 +171,7 @@ def convertToGray(self, img):
171171 return CV .cvtColor (img , CV .COLOR_BGR2GRAY )
172172
173173 def blur (self , img , B = 7 ):
174- return CV .GaussingBlur (img , (b , b ), CV .BORDER_DEFAULT )
174+ return CV .GaussingBlur (img , (B , B ), CV .BORDER_DEFAULT )
175175
176176 def canny (self , img , x = 125 , y = 175 ):
177177 return CV .Canny (img , x , y )
@@ -212,12 +212,12 @@ def zoom(self, frame, scale):
212212 return frame [ch - coh :ch + coh , cw - cow :cw + cow ]
213213
214214 # draw a circle around small holes
215- #
215+ #
216216 def findCircles (self ,frame ):
217217 # Our operations on the frame come here
218218 gray = CV .cvtColor (frame , CV .COLOR_BGR2GRAY )
219219 # Display the resulting frame
220-
220+
221221 circles = CV .HoughCircles (gray ,CV .cv .CV_HOUGH_GRADIENT ,1 ,20 ,param1 = 50 ,param2 = 30 ,minRadius = 10 ,maxRadius = 15 )
222222 # print circles
223223 if circles is not None :
@@ -235,27 +235,27 @@ def blobInit(self):
235235 # Setup BlobDetector
236236 detector = CV .SimpleBlobDetector ()
237237 params = CV .SimpleBlobDetector_Params ()
238-
238+
239239 # Filter by Area.
240240 params .filterByArea = True
241241 params .minArea = 20000
242242 params .maxArea = 40000
243-
243+
244244 # Filter by Circularity
245245 params .filterByCircularity = True
246246 params .minCircularity = 0.5
247-
247+
248248 # Filter by Convexity
249249 params .filterByConvexity = False
250250 #params.minConvexity = 0.87
251-
251+
252252 # Filter by Inertia
253253 params .filterByInertia = True
254254 params .minInertiaRatio = 0.8
255255
256256 # Distance Between Blobs
257257 params .minDistBetweenBlobs = 200
258-
258+
259259 # Create a detector with the parameters
260260 self .detector = CV .SimpleBlobDetector (params )
261261
@@ -266,9 +266,9 @@ def findBlob(self, image):
266266
267267 keypoints = self .detector .detect (image )
268268 for k in keypoints :
269- CV .circle (overlay , (int (k .pt [0 ]), int (k .pt [1 ])), int (k .size / 2 ), (0 , 0 , 255 ), - 1 )
270- CV .line (overlay , (int (k .pt [0 ])- 20 , int (k .pt [1 ])), (int (k .pt [0 ])+ 20 , int (k .pt [1 ])), (0 ,0 ,0 ), 3 )
271- CV .line (overlay , (int (k .pt [0 ]), int (k .pt [1 ])- 20 ), (int (k .pt [0 ]), int (k .pt [1 ])+ 20 ), (0 ,0 ,0 ), 3 )
269+ CV .circle (overlay , (int (k .pt [0 ]), int (k .pt [1 ])), int (k .size / 2 ), (0 , 0 , 255 ), - 1 )
270+ CV .line (overlay , (int (k .pt [0 ])- 20 , int (k .pt [1 ])), (int (k .pt [0 ])+ 20 , int (k .pt [1 ])), (0 ,0 ,0 ), 3 )
271+ CV .line (overlay , (int (k .pt [0 ]), int (k .pt [1 ])- 20 ), (int (k .pt [0 ]), int (k .pt [1 ])+ 20 ), (0 ,0 ,0 ), 3 )
272272
273273 opacity = 0.5
274274 CV .addWeighted (overlay , opacity , image , 1 - opacity , 0 , image )
@@ -444,7 +444,7 @@ def list_ports(self):
444444 dev_port = 0
445445 working_ports = []
446446 available_ports = []
447- while len (non_working_ports ) < 6 : # if there are more than 5 non working ports stop the testing.
447+ while len (non_working_ports ) < 6 : # if there are more than 5 non working ports stop the testing.
448448 camera = CV .VideoCapture (dev_port )
449449 if not camera .isOpened ():
450450 non_working_ports .append (dev_port )
0 commit comments