Skip to content

Commit f2c1277

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 8e708de according to the output from Autopep8. Details: https://app.deepsource.com/gh/avinashkranjan/Amazing-Python-Scripts/transform/ebdde98e-9d1c-496c-b538-e36e7d428071/
1 parent 8e708de commit f2c1277

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Circle_Detect_HoughCircle/HoughCircle.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@
55
import tkinter as tk
66

77
photo = askopenfilename()
8-
img = cv2.imread(photo,cv2.IMREAD_GRAYSCALE)
9-
blurred = cv2.medianBlur(img,5)
10-
edges = cv2.Canny(blurred,50,150,apertureSize=3)
8+
img = cv2.imread(photo, cv2.IMREAD_GRAYSCALE)
9+
blurred = cv2.medianBlur(img, 5)
10+
edges = cv2.Canny(blurred, 50, 150, apertureSize=3)
1111
# the image read in grayscale format is blurred and edges are detected in it
12-
circles = cv2.HoughCircles(edges,cv2.HOUGH_GRADIENT,1,30,param1=50,param2=31,minRadius=0,maxRadius=0)
12+
circles = cv2.HoughCircles(edges, cv2.HOUGH_GRADIENT,
13+
1, 30, param1=50, param2=31, minRadius=0, maxRadius=0)
1314
# the parameters in the above function needs to be adjusted for each image accordingly.
1415
circles = np.uint16(np.around(circles))
1516

16-
colorImg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)
17-
for i in circles[0,:]:
18-
cv2.circle(colorImg,(i[0],i[1]),i[2],(0,255,0),2)
17+
colorImg = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
18+
for i in circles[0, :]:
19+
cv2.circle(colorImg, (i[0], i[1]), i[2], (0, 255, 0), 2)
1920
# drawing the circle
20-
cv2.circle(colorImg,(i[0],i[1]),2,(0,0,255),3)
21+
cv2.circle(colorImg, (i[0], i[1]), 2, (0, 0, 255), 3)
2122
# drawing its center
2223

23-
cv2.imwrite('output.jpg',colorImg)
24-
cv2.imshow('output',colorImg)
24+
cv2.imwrite('output.jpg', colorImg)
25+
cv2.imshow('output', colorImg)
2526
cv2.waitKey(2000)
26-
cv2.destroyAllWindows()
27+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)