Ejemplo n.º 1
0
  def test_sql_checkplate_valid1(self):
    test_sql = gen_database() #initialising a different database cursor to avoid any problems with the database class
    no_plate = plate_gen() #initialising plate generating algorithm
    sqlite = database() #initialising database class

    plate = no_plate.gen_uk() #generating random uk plate
    test_sql.ecx.execute("SELECT MAX(p_id) FROM plates;") #finding the current hightest p_id (plate id)
    max_index = test_sql.ecx.fetchone()[0] + 1 #get max id then add 1

    result0 = sqlite.add_plate(plate) #adding new plate and returning p_index
    self.assertEqual(max_index, result0) #result should match the hightest p_index from before
Ejemplo n.º 2
0
    def test_sql_checkplate_valid1(self):
        test_sql = gen_database(
        )  #initialising a different database cursor to avoid any problems with the database class
        no_plate = plate_gen()  #initialising plate generating algorithm
        sqlite = database()  #initialising database class

        plate = no_plate.gen_uk()  #generating random uk plate
        test_sql.ecx.execute("SELECT MAX(p_id) FROM plates;"
                             )  #finding the current hightest p_id (plate id)
        max_index = test_sql.ecx.fetchone()[0] + 1  #get max id then add 1

        result0 = sqlite.add_plate(
            plate)  #adding new plate and returning p_index
        self.assertEqual(
            max_index,
            result0)  #result should match the hightest p_index from before
Ejemplo n.º 3
0
from plate_gen import plate_gen
import requests
import json
import urllib3
import uuid
from database import database
gen = plate_gen()
http = urllib3.PoolManager()
url = 'http://localhost:7000/api/camera'
road = 1
#plate = "HT57 GHU"
headers = {'Content-Type': 'application/json'}

def make_payload(cam_id, plate, time, s_id):
  cam_uuid = str(uuid.uuid4())
  data = {"version":2,
          "data_type":"alpr_results",
          "epoch_time":time,
          "site_id":s_id,
          "camera_id":cam_id,
          "uuid":cam_uuid,
          "img_width":480,"img_height":640,
          "processing_time_ms":160.482773,
          "regions_of_interest":[],
          "results":[
      {"plate":plate,
       "confidence":87.164879,
       "matches_template":0,
       "plate_index":0,
       "region":"",
       "region_confidence":0,
Ejemplo n.º 4
0
from plate_gen import plate_gen
import requests
import json
import urllib3
import uuid
from database import database
gen = plate_gen()
http = urllib3.PoolManager()
url = 'http://localhost:7000/api/camera'
road = 1
#plate = "HT57 GHU"
headers = {'Content-Type': 'application/json'}


def make_payload(cam_id, plate, time, s_id):
    cam_uuid = str(uuid.uuid4())
    data = {
        "version":
        2,
        "data_type":
        "alpr_results",
        "epoch_time":
        time,
        "site_id":
        s_id,
        "camera_id":
        cam_id,
        "uuid":
        cam_uuid,
        "img_width":
        480,