You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Contributions to the project are welcome! If you find any bugs or want to enhance the functionality, feel free to open an issue or submit a pull request.
46
+
47
+
- Fork the project (https://github.com/mstftmk/Circle-Detection/fork)
48
+
- Create your feature branch (git checkout -b feature/fooBar)
49
+
- Commit your changes (git commit -am 'Add some fooBar')
50
+
- Push to the branch (git push origin feature/fooBar)
image=cv2.imread(image_path, cv2.IMREAD_COLOR) # Path üzerinden görseli okuyoruz.
20
+
gray=cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Görseli Grayscale olarak convert ediyoruz.
21
+
edges=cv2.Canny(gray, threshold1=254, threshold2=255) # Edge Detection için Canny yöntemini kullanıyoruz. threshold1: kenar olarak kabul edilen zayıf piksel değerlerinin alt sınırı, threshold2: kenar olarak kabul edilen güçlü piksel değerlerinin üst sınırı.
22
+
23
+
# Morfolojik işlemler uygulayarak bir maskeye dönüştürüyoruz.
24
+
# kernel: morfolojik işlemler için kullanılan kernel, burada 5x5 boyutunda bir matris. Çünkü yüksek çözünürlüklü görseller için 5x5 matris kullanabiliriz. Yoksa 3x3 kullanmalıydık.
25
+
kernel=np.ones((5, 5), np.uint8)
26
+
closed_mask=cv2.morphologyEx(edges, cv2.MORPH_CLOSE, kernel, iterations=4) # cv2.MORPH_CLOSE, morfolojik kapanma işlemi olarak bilinir. Kenarların içerisindeki küçük boşlukları doldurur. iterations: işlemi kaç kez tekrarlayacağını belirler, burada 4 kez tekrarlıyoruz.
27
+
28
+
circles=cv2.HoughCircles( #Hough Dönüşümü ile daireleri algılıyoruz.
29
+
closed_mask,
30
+
cv2.HOUGH_GRADIENT,
31
+
dp=1,
32
+
minDist=200,
33
+
param1=255,
34
+
param2=20,
35
+
minRadius=50,
36
+
maxRadius=5000
37
+
)
38
+
39
+
ifcirclesisnotNone: # Eğer daireler algılandıysa, her bir daireyi çiziyoruz ve yarıçap bilgisini yazdırıyoruz.
0 commit comments