Beispiel #1
0
def responce(p):
    if p == 'start':
        text = 'ルームオペレーティングシステム,ロズビー,起動しました.'
        jtalk(text)

    elif p == 'responce':
        text = 'はい,お呼びでしょうか.'
        jtalk(text)

    elif p == 'light_on':
        text = '電気をつけますね.'
        jtalk(text)

    elif p == 'light_off':
        text = '電気を消しますね.'
        jtalk(text)

    elif p == 'camera':
        text = 'カメラの映像を表示します.'
        jtalk(text)
        cam.cam()

    elif p == 'errer':
        text = 'ごめんなさい,聞き取れませんでした.'
        jtalk(text)
 def myISR(self, ev=None):
     flag = 0
     fire = "Active Fire"
     gas = "No"
     life = "No"
     temp = "No"
     self.flag = GPIO.input(self.FlamePin)
     print(GPIO.input(self.FlamePin))
     self.sensorStatus = "fire" + str(GPIO.input(self.FlamePin))
     if self.sensorStatus == "fire1":
         self.setstatus()
         print("Flame is detected !")
         led.led().ledOff(33)
         led.led().ledOn(31)
         buzzer.buzzer().controllRunOn(7)
         print(str(datetime.datetime.now()))
     print("\nReading TEMPRATURE of affected area")
     temprature()
     time.sleep(2)
     print("\nDetecting Life in affected area")
     if motion(22, 40, 38).flag == 1:
         life = "Presence of life in the affected area"
     time.sleep(2)
     time.sleep(2)
     flag = flag + 1
     cam.cam("fire")
     if flag != 0:
         email().emailSend("fire.png", "/home/pi/project/fire.png", temp,
                           life, fire)
         print("Mail Sended")
         sms.sms("Number to send")
         flag = 0
     print("Detecting LPG lekage in area")
     gasT.gas(38).grun()
     buzzer.buzzer().controllRunOff(7)
Beispiel #3
0
def check(text):
    if text.get() == "":
        return
        #print ("error! 404!")
    else:
        cam.cam(text.get())
        text.delete(0, 'end')
        done()
Beispiel #4
0
def main():
    print ("test")
    #inialize
    ldr = LightSensor(4) ;
    var = 1
    value = 1
    #have the  program loop forever or until the user close the file
    while var != 0:
        var = 1
        if ldr.value != 0:
            toaddr = "*****@*****.**"  #email address to send email to
            now = datetime.datetime.now()           #time and date that the laser is tripped
            filename = str(now) + ".JPG"                   #name of picture file to send
            #take a picture
            newcam = cam(filename)
            newcam.takePic()
            #send the notification that the wire is tripped with the photo
            newEmail = Email(toaddr, filename)
            newEmail.SendEmail()
            #update the html
            up = update(filename)
            up.updateHTML()
            #upload the file to update the website
            upload = FTPClass()
            upload.UploadFile(filename)
            upload.UploadFile("index.html")
        #won't anymore picture to be taken until the laser hit the sensor
	    while ldr.value !=0:
		    print('0')
	else:
	    print('X')
Beispiel #5
0
 def __init__(self):
     GPIO.cleanup()
     GPIO.setmode(GPIO.BCM)
     self.cam = cam.cam("/var/smbshare/motionimage/")
     
     self.motion_sensor = 17;
     GPIO.setup(self.motion_sensor, GPIO.IN)
Beispiel #6
0
def cam_action():
    message = request.get_json(force=True)
    image = get_image_from_message(message, model_vgg16.name)
    # processed_image = preprocess_image(image, target_size=(224, 224))
    start_time = time.time()
    f_name = 'cam.' + str(time.time_ns()) + '.jpg'
    cam(image, f_name=f_name)
    execution_time = time.time() - start_time
    with open(f_name, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read())

    os.remove(f_name)
    response = {
        'ret_img_base64': encoded_string.decode('utf-8'),
        'execution_time': execution_time
    }
    return jsonify(response)
Beispiel #7
0
    def camSpec(self):
        
        

        import cam
        sender=self.sender()
        #sender.
        #app = QtGui.QApplication(sys.argv)
        self.nextUI = cam.cam()
        self.nextUI.show()
        
        #sys.exit(app.exec_())
        self.hide()
Beispiel #8
0
        x = (((int(len)/2)*10)+50)
        y =160
        #distance netween both of the points to adjust the speed of both joints 
        disx = x - x1 
        disy = y - y1 
        if (disx > disy):
            SpDif = disy/disx # speed difference will be multiplide with the speed of one of the motors 
            Mot = 1 # the change of speed will bein the first motor 
        if (disx < disy):
            SpDif = disx/disy # speed difference will be multiplide with the speed of one of the motors 
            Mot = 2 # the change of speed will bein the Seconde motor 

        s9 = '1'
        ss1 = '1'
        inverseKinematics(-x,y)
        cam(counter)
        counter += 1
        time.sleep(4)
        ########################################################################################################################################
        
        en = input("put the object in the seconde place and press Enter to continue")
        zP=int(hi) + 90 #the higth of the camera 

        #from here the second move starts 
        ss5 = '90'# I want the servo to look down this time
        x = ((int(len)/2)*10)-(((int(len)/2)*10)*5/100)
        y = (((int(wid)/2)*10)*5/100)+ 80
        s9 = '1'
        ss1 = '1'
        #distance netween both of the points to adjust the speed of both joints 
        if (disx < disy):
Beispiel #9
0
    checkpoint = torch.load(os.path.join(config.proj_dir, 'checkpoints', 'densenet_024.ckpt'))  # must before cuda
    net.load_state_dict(checkpoint['state_dict'])
    net = net.cuda()
    cudnn.benchmark = True
    net = DataParallel(net).cuda()

    test_generator = DataGenerator(config, test_data, phase='test')
    test_loader = DataLoader(test_generator,
                             batch_size=batch_size,
                             shuffle=False,
                             num_workers=workers,
                             pin_memory=True)

    net.eval()
    with torch.no_grad():
        target_lst = []
        output_lst = []
        for idx, data, target in tqdm(test_loader):
            data = data.cuda(async=True)
            target = target.cuda(async=True)
            output, fm = net(data)
            heatmaps = cam(fm, list(net.parameters())[-2])
            target_lst.append(target.data.cpu().numpy())
            output_lst.append((output.data.cpu().numpy()))
        target_lst = np.concatenate(target_lst, axis=0)
        output_lst = np.concatenate(output_lst, axis=0)
    aucs = compute_AUCs(output_lst, target_lst)
    for i, auc in enumerate(aucs):
        label = test_data.labels[i]
        print('{}: {:.4} ({})'.format(label, auc, config.benchmark[label]))
    print('AVG %.4f' % (sum(aucs) / float(len(aucs))))
Beispiel #10
0
height = 700
data.center = [width/2, height/2]


style = tkinter.ttk.Style()
style.theme_use('clam')
style.configure("green.Horizontal.TProgressbar", background='green')
style.configure("blue.Horizontal.TProgressbar",  background='blue')




#canvas.create_oval(data.center[0],data.center[1],data.center[0]+10,data.center[1]+10,fill='green')

ui = UI(root)
camra = cam(ui)
_map = map(root,width,height, camra, ui)
FP = FileProc(_map, ui)
data.go = FP.readNextLine()
try:
    while 1:
        root.update_idletasks()
        root.update()
        if(data.go):
            data.go = FP.readNextLine()
        _map.resetMove()
        ui.update()
            # next.mainloop()
        time.sleep(data.playSpeed)

except tk.TclError:
Beispiel #11
0
def main():
  start = cam(request.json)
  return json.dumps({'error': False})
Beispiel #12
0
from paint import Painter
import numpy as np
from copy import copy
from kivy.app import App
from kivy.clock import Clock
from functools import partial
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.animation import Animation
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy.properties import NumericProperty, ListProperty, ObjectProperty, DictProperty

camera = cam.cam(0)
Window.fullscreen = 'auto'
'''Window.borderless=1
Window.left=100
Window.top=100
Window.hieght=200
'''
KV = '''
#:import pi math.pi
#:import cos math.cos
#:import sin math.sin
#:import V kivy.vector.Vector
<ModernMenu>:
    canvas.before:
        Color:
            rgba: 0, 0, .9, .2
from cam import cam
from image import image
from trainning import trainning

cam = cam(0)
cam.cam_recognizer()

#image = image("img/img.jpg")
#image.img_recognizer()

#trainning = trainning("img/photos")
#trainning.train()
Beispiel #14
0
 def axis23(self):
     #code here
     x = self.joy.get_axis(0)
     y = self.joy.get_axis(1)
     cam(y)
from cam import cam
from TargetMaker import TargetMaker
from TargetProcessor import TargetProcessor
import cv2

maker = TargetMaker()
processor = TargetProcessor()
cam = cam()
c = cam.declareCam(0)

while (cv2.waitKey(10) != 27):
    frame = cam.getFrame(c)
    threshedImg, hsv = maker.thresher(frame)
    width, height, xOffset, yOffset = maker.contour(threshedImg, frame, hsv)
    distance, azimuth, altitude = processor.imageProcess(
        width, height, xOffset, yOffset)
    print(distance)
    print(azimuth)
    print(altitude)
Beispiel #16
0
def main():
    start = cam(request.json)
    return json.dumps({'error': False})