Exemplo n.º 1
0
Arquivo: main.py Projeto: Laink67/hack
def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    tmp = (10, 20)

    box_points = [
        Car(Point(290, 48), Point(350, 92)),
        Car(Point(325, 49), Point(387, 88)),
        Car(Point(167, 63), Point(231, 114)),
        Car(Point(47, 70), Point(102, 124)),
        Car(Point(400, 97), Point(468, 140)),
        Car(Point(335, 114), Point(403, 159)),
        Car(Point(373, 107), Point(445, 150)),
        Car(Point(292, 127), Point(368, 175)),
        Car(Point(201, 133), Point(275, 192)),
        Car(Point(248, 133), Point(323, 182)),
        Car(Point(145, 148), Point(217, 202)),
        Car(Point(28, 161), Point(94, 241)),
        Car(Point(94, 163), Point(170, 228)),
        Car(Point(383, 17), Point(416, 34)),
        Car(Point(218, 60), Point(265, 100))
    ]

    parking = Parking(id=1, img_path="parking.jpg", rows=2, columns=9)
    parking.draw_transformed_img()
    print(f'Occupied slots: {parking.get_slots_occupied(box_points)}'
          )  # Press Ctrl+F8 to toggle the breakpoint.
Exemplo n.º 2
0
def get_parkings():
    try:
        parkList = Parking()
    except RuntimeError as exc:
        mensaje, codigo = exc.args
        response = {codigo: mensaje}
        return Response(json.dumps(response),
                        mimetype='application/json',
                        status=codigo)
    return Response(json.dumps(parkList.get_parkings()),
                    mimetype='application/json',
                    status=200)
Exemplo n.º 3
0
def find_parking_by_ogc_fid(id):
    try:
        parkList = Parking()
    except RuntimeError as exc:
        mensaje, codigo = exc.args
        response = {codigo: mensaje}
        return Response(json.dumps(response),
                        mimetype='application/json',
                        status=codigo)
    try:
        parking = parkList.find_by_ogc_fid(id)
    except ValueError:
        response = {'404': 'Bici Parking id \'{}\' not found'.format(id)}
        return Response(json.dumps(response),
                        mimetype='application/json',
                        status=404)
    return Response(json.dumps(parking),
                    mimetype='application/json',
                    status=200)
Exemplo n.º 4
0
def get_parking_description(id):
    try:
        parkList = Parking()
    except RuntimeError as exc:
        mensaje, codigo = exc.args
        response = {codigo: mensaje}
        return Response(json.dumps(response),
                        mimetype='application/json',
                        status=codigo)
    try:
        parking = parkList.get_description(id)
    except ValueError:
        response = {'404': 'Bici parking ogc-fid {} not found'.format(id)}
        return Response(json.dumps(response),
                        mimetype='application/json',
                        status=404)
    return Response(json.dumps(parking),
                    mimetype='application/json',
                    status=200)
Exemplo n.º 5
0
def menu():
    print("-----------------------------------")
    print("1- Trouver un vélo")
    print("2- Trouver une place de parking")
    print("3- Voir les stations HS")
    print("4- Accéder à la liste des stations de votre ville")
    print("5- Voir les tarifs")
    print("6- Quitter\n")

    ActionUtilisateur1 = int(
        input(
            "Merci de bien vouloir entrez le chiffre du programme que vous-voulez lancer, ex : 1"
        ))
    print("-----------------------------------")

    if ActionUtilisateur1 == 1:
        TrouverVeloProximite()
        input("Veuiller appuyer sur une touche pour revenir au menu")
        menu()
    if ActionUtilisateur1 == 2:
        Parking()
        input("Veuiller appuyer sur une touche pour revenir au menu")
        menu()
    if ActionUtilisateur1 == 3:
        StationsHS()
        input("Veuiller appuyer sur une touche pour revenir au menu")
        menu()
    if ActionUtilisateur1 == 4:
        VeloParVille()
        input("Veuiller appuyer sur une touche pour revenir au menu")
        menu()
    if ActionUtilisateur1 == 5:
        Forfait()
        input("Veuiller appuyer sur une touche pour revenir au menu")
        menu()
    if ActionUtilisateur1 == 6:
        print("Le programme va se quitter")
        exit()
    else:
        print("\nCette fonctionalité n'existe pas !")
        print("Retour au menu principal")
        menu()
Exemplo n.º 6
0
def img_test(test_images, final_spot_dict, model, class_dictionary):
    for i in range(len(test_images)):
        predicted_images = park.predict_on_image(test_images[i],
                                                 final_spot_dict, model,
                                                 class_dictionary)


def video_test(video_name, final_spot_dict, model, class_dictionary):
    name = video_name
    cap = cv2.VideoCapture(name)
    park.predict_on_video(name,
                          final_spot_dict,
                          model,
                          class_dictionary,
                          ret=True)


if __name__ == '__main__':
    test_images = [plt.imread(path) for path in glob.glob('test_images/*.jpg')]
    weights_path = 'car1.h5'
    video_name = 'parking_video.mp4'
    class_dictionary = {}
    class_dictionary[0] = 'empty'
    class_dictionary[1] = 'occupied'
    park = Parking()
    park.show_images(test_images)
    final_spot_dict = img_process(test_images, park)
    model = keras_model(weights_path)
    img_test(test_images, final_spot_dict, model, class_dictionary)
    video_test(video_name, final_spot_dict, model, class_dictionary)
Exemplo n.º 7
0
import matplotlib.pyplot as plt
import simpy

from Car import Car
from Constants import Constants
from Parking import Parking

env = simpy.Environment()

parking = Parking(env)
env.process(parking.run(Constants.a_seed))
env.run(until=Constants.max_time)

plt.figure(figsize=(5.5, 4))
plt.plot(*zip(*Car.data))
plt.xlabel('Time')
plt.ylabel('Number of cars')
plt.xlim(0, 24)
plt.show()
Exemplo n.º 8
0
     WallSprite((610, 150), 4, 100),
     WallSprite((580, 200), 60, 4),
     WallSprite((730, 100), 240, 4),
     WallSprite((850, 400), 4, 600),
     WallSprite((700, 500), 4, 600),
     WallSprite((775, 200), 150, 4),
     WallSprite((150, 460), 4, 720),
     WallSprite((300, 340), 4, 720),
     WallSprite((500, 800), 1000, 4),
     WallSprite((500, 0), 1000, 4),
     WallSprite((0, 400), 4, 800),
     WallSprite((1000, 400), 4, 800),
 ],
 [TrophySprite((745, 230))],
 [
     Parking((450, 500), 60, 100),
     Parking((550, 100), 60, 100),
 ],
 [
     Crosswalk((75, 300), 150, 4, interval=random.randint(20, 40), phase=0),
     Crosswalk((225, 500), 150, 4, interval=random.randint(20, 40),
               phase=8),
     Crosswalk((800, 50), 4, 100, interval=random.randint(20, 40),
               phase=16),
     Crosswalk((925, 150),
               150,
               4,
               interval=random.randint(20, 40),
               phase=24),
     Crosswalk((925, 400),
               150,
Exemplo n.º 9
0
 def __init__(self, db):
     self.db = db
     self.line = Line(db=db)
     self.parking = Parking(db=db)
     self.obstacle = Obstacle(db=db, gpu=False)
Exemplo n.º 10
0
        WallSprite((590, 400), 60, 4),
        WallSprite((440, 460), 4, 720),
        WallSprite((320, 100), 4, 200),
        WallSprite((320, 100), 4, 200),
        WallSprite((320, 680), 4, 240),
        WallSprite((320, 340), 4, 160),
        WallSprite((220, 230), 4, 60),
        WallSprite((270, 200), 100, 4),
        WallSprite((270, 260), 100, 4),
        WallSprite((220, 490), 4, 140),
        WallSprite((270, 420), 100, 4),
        WallSprite((270, 560), 100, 4),
    ],
    [TrophySprite((350, 720))],
    [
        Parking((220, 200), 100, 60),
        Parking((220, 500), 100, 60),
        Parking((560, 300), 60, 100),
    ],
    [],
    [],
    CarSprite('images/car.png', (500, 760)),
)

Map4 = (
    [
        WallSprite((500, 0), 1000, 4),
        WallSprite((500, 800), 1000, 4),
        WallSprite((0, 400), 4, 800),
        WallSprite((1000, 400), 4, 800),
        WallSprite((560, 750), 4, 100),