Soru opencv çember oluşturma ve çember bulma işlemi nasıl olur??

  • Konuyu başlatan Konuyu başlatan boom166
  • Başlangıç tarihi Başlangıç tarihi

boom166

Öğrenci
Katılım
9 Ocak 2023
Mesajlar
5
Reaksiyon puanı
1
Puanları
3
Yaş
23
python opencvde çember buldurma ve çizdirme nasıl olur? Yardımcı olursanız sevinirim...
 

cumbullop

Öğrenci
Katılım
9 Ocak 2023
Mesajlar
3
Reaksiyon puanı
0
Puanları
1
Yaş
23
Python:
import sys
import PyQt5
from PyQt5.QtWidgets import *
class Pencere(QWidget):
    def __init__(self):
        super().__init__()
        self.init_ui()
    
    def init_ui(self):
        self.setWindowTitle("Hesap Makinesi")
        self.line=QLineEdit()
        g1 = QGridLayout()

        v1= QVBoxLayout()
        liste=[1,2,3,"/",4,5,6,"x",7,8,9,"+",".",0,"=","-"]
        y=0
        x=0
        for nm in liste:
            name=str(nm) 
            button = QPushButton(name)
            g1.addWidget(button, y, x)
            
            x=x+1
            if(x%4==0):
                y=y+1
                x=0
        v1.addWidget(self.line)       
        v1.addLayout(g1)
        self.setLayout(v1)       
        self.show()
app=QApplication(sys.argv)
pencere=Pencere()
app.exec_()
del app
 

boom166

Öğrenci
Katılım
9 Ocak 2023
Mesajlar
5
Reaksiyon puanı
1
Puanları
3
Yaş
23
Python:
import cv2
import numpy as np


image = cv2.imread('soru1.jpg')

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('detected circles', gray)
cv2.waitKey(0)

blur = cv2.medianBlur(gray, 5)
cv2.imshow('detected circles', blur)
cv2.waitKey(0)

ret,thresh1 = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY)
cv2.imshow('detected circles', thresh1)
cv2.waitKey(0)

circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 2, 20,minRadius=25,maxRadius=250)


for i in circles[0,:]:
    # draw the outer circle
    cv2.circle(image,(int(i[0]),int(i[1])), int(i[2]), (0, 0, 255), 2)
      

        
cv2.imshow('detected circles', image)
cv2.waitKey(0)

cv2.destroyAllWindows()
Mesaj otomatik birleştirildi:

top=0
for i in circles[0,:]:
if(i[2])>77 and(i[2])<80:
top+=100
elif(i[2])>45 and(i[2])<70:
top+=50
elif(i[2])>30 and(i[2])<40:
top+=25
print(top)
 

boom166

Öğrenci
Katılım
9 Ocak 2023
Mesajlar
5
Reaksiyon puanı
1
Puanları
3
Yaş
23
top=0
a=0
b=0
c=0
for i in circles[0,:]:
if(i[2])>77 and(i[2])<80:
top+=100
a+=1
elif(i[2])>45 and(i[2])<70:
top+=50
b=+1
elif(i[2])>30 and(i[2])<40:
top+=25
c+=1
print(str(a)+" 100 puanlık daire var")
print(str(b)+" 50 puanlık daire var")
print(str(c)+" 25 puanlık daire var")
print(top)
 

cumbullop

Öğrenci
Katılım
9 Ocak 2023
Mesajlar
3
Reaksiyon puanı
0
Puanları
1
Yaş
23
import cv2
import numpy as np


image = cv2.imread('images/para.jpeg')

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('detected circles', gray)
cv2.waitKey(0)

blur = cv2.medianBlur(gray, 5)
cv2.imshow('detected circles', blur)
cv2.waitKey(0)

ret,thresh1 = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY)
cv2.imshow('detected circles', thresh1)
cv2.waitKey(0)

circles = cv2.HoughCircles(blur, cv2.HOUGH_GRADIENT, 2, 90,minRadius=100,maxRadius=150)


for i in circles[0,:]:
if(i[2])>40: #70 ten büyük daireleri buldurup içini dolduruyoruz
cv2.circle(image,(int(i[0]), int(i[1])), int(i[2]), (255, 0,0), 2)
x[k]=int(i[0]),int(i[1])
k+=1
else:
cv2.circle(image,(int(i[0]), int(i[1])), int(i[2])+5, (255, 0, 0), -1)


print(circles)
cv2.imshow('detected circles', image)
cv2.waitKey(0)

cv2.destroyAllWindows()
 

Vartgalma

Öğrenci
Katılım
9 Ocak 2023
Mesajlar
4
Reaksiyon puanı
0
Puanları
1
Yaş
22
Python:
#para saydırma
import cv2
import numpy as np


image = cv2.imread('images/WhatsApp Image 2023-01-10 at 14.07.00.jpeg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('gray', gray)
cv2.waitKey(0)
ret,thresh = cv2.threshold(gray,160,255,cv2.THRESH_BINARY)
cv2.imshow('thresh', thresh)
cv2.waitKey(0)
blur = cv2.medianBlur(thresh, 21)
cv2.imshow('blur', blur)
cv2.waitKey(0)


circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, 200,minRadius=1,maxRadius=110)
#circles = cv2.HoughCircles(gray, cv.CV_HOUGH_GRADIENT, 2, 50,minRadius=30,maxRadius=70)
print(circles)

#circles = np.uint8(np.around(circles))
x=[0,0]
y=[0,0]
k=0

for i in circles[0,:]:
    
    if(i[2])>100: #70 ten büyük daireleri buldurup içini dolduruyoruz
        cv2.circle(image,(int(i[0]), int(i[1])), int(i[2]), (0, 0, 0), 2)       
        
    else:
        cv2.circle(image,(int(i[0]), int(i[1])), int(i[2])+5, (255, 0, 0), -1)
        
#cv2.line(image, (x[0]), (x[1]), (0,255,0), 5)
cv2.imshow('detected circles', image)
cv2.waitKey(0)
cv2.destroyAllWindows()
 

boom166

Öğrenci
Katılım
9 Ocak 2023
Mesajlar
5
Reaksiyon puanı
1
Puanları
3
Yaş
23
top=0
a=0
b=0
c=0
for i in circles[0,:]:
if(i[2])>77 and(i[2])<80:
top+=100
a+=1
elif(i[2])>45 and(i[2])<70:
top+=50
b+=1
elif(i[2])>30 and(i[2])<40:
top+=25
c+=1
print(str(a)+" 100 puanlık daire var")
print(str(b)+" 50 puanlık daire var")
print(str(c)+" 25 puanlık daire var")
print(top)
 
Üst