This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for frame in camera.capture_continuous(rawCapture,format="bgr",use_video_port=True): | |
t1=time.time() | |
img=frame.array | |
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) | |
if stop_sign_detect(gray)==False: | |
lines,witdh=cizgi_bul(gray) | |
a=egim_bul(lines,witdh) | |
if a=='ileri': | |
mc.forwardDrive() | |
elif a=='sola': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def stop_sign_detect(gray): | |
gray=gray | |
stop=cascade_class.detectMultiScale(gray,1.1,5) | |
for (x,y,w,h) in stop: | |
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) | |
if len(stop)!=0: | |
return True | |
if len(stop)==0: | |
return False | |
cascade_class=cv2.CascadeClassifier('stop_sign.xml') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def egim_bul(lines,witdh): | |
lines=lines | |
witdh=witdh | |
a=0 | |
le=[] | |
re=[] | |
try: | |
for line in lines: | |
coords=line[0] | |
#ilk iki deger ustteki nokta,son iki alttaki nokta. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def roi(img,vertices): | |
mask=np.zeros_like(img) | |
cv2.fillPoly(mask,vertices,255) | |
masked=cv2.bitwise_and(img,mask) | |
return masked | |
def cizgi_bul(img): | |
img=img | |
dimensions=img.shape | |
print('height',img.shape[0],'width',img.shape[1]) | |
witdh=img.shape[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
camera=PiCamera() | |
camera.resolution=(640,480) | |
camera.framerate=32 | |
camera.rotation=180 | |
rawCapture=PiRGBArray(camera,size=(640,480)) | |
time.sleep(0.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from picamera.array import PiRGBArray | |
from picamera import PiCamera | |
import cv2 | |
import numpy as np | |
import time | |
import motorcontrol as mc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gpiozero import PWMOutputDevice | |
from time import sleep | |
#///////////////// Define Motor Driver GPIO Pins ///////////////// | |
# Motor A, Left Side GPIO CONSTANTS | |
PWM_FORWARD_LEFT_PIN = 26 # IN1 - Forward Drive | |
PWM_REVERSE_LEFT_PIN = 19 # IN2 - Reverse Drive | |
# Motor B, Right Side GPIO CONSTANTS | |
PWM_FORWARD_RIGHT_PIN = 13 # IN1 - Forward Drive | |
PWM_REVERSE_RIGHT_PIN = 6 # IN2 - Reverse Drive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x=int(input("x:")) | |
y=int(input("y:")) | |
import math | |
def oklit_alg(x,y): | |
if y>x: | |
return oklit_alg(y,x) | |
while y!=0: | |
print("{}={}.{}+{}".format(x,math.floor(x/y),y,x%y)) | |
(x,y)=(y,x%y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def brute_diyafont(a,b,c): | |
x=0 | |
y=(c-a*x)/b | |
while type(y)!=type(3.4): | |
x=x+1 | |
return (x,int(y)) | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@Euler29 on GitHub | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication2 | |
{ | |
class Fibonacci |