added nothing
This commit is contained in:
parent
0182968003
commit
2a7fa1722b
15
app.py
15
app.py
|
@ -35,6 +35,15 @@ async def get_db_connection():
|
||||||
loop=asyncio.get_running_loop()
|
loop=asyncio.get_running_loop()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def hitung_kepadatan_kendaraan(jumlah_kendaraan, panjang_jalan):
|
||||||
|
|
||||||
|
if panjang_jalan <= 0:
|
||||||
|
raise ValueError("Panjang jalan harus lebih besar dari nol.")
|
||||||
|
kepadatan = jumlah_kendaraan / panjang_jalan
|
||||||
|
return kepadatan
|
||||||
|
|
||||||
async def insert_data(nama, waktu,waktu_sekarang ,kenderaan_kiri, kenderaan_kanan,status):
|
async def insert_data(nama, waktu,waktu_sekarang ,kenderaan_kiri, kenderaan_kanan,status):
|
||||||
# get the datetime
|
# get the datetime
|
||||||
now = time.strftime("%Y-%m-%d %H:%M:%S")
|
now = time.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
@ -144,13 +153,16 @@ async def generate_frames2(video, threshold,stat):
|
||||||
# cv2.drawContours(image, hull, -1, (0, 255, 0), 3)
|
# cv2.drawContours(image, hull, -1, (0, 255, 0), 3)
|
||||||
|
|
||||||
# line created to stop counting contours, needed as cars in distance become one big contour
|
# line created to stop counting contours, needed as cars in distance become one big contour
|
||||||
lineypos = 100
|
lineypos = 90
|
||||||
# cv2.line(image, (0, lineypos), (width, lineypos), (255, 0, 0), 5)
|
# cv2.line(image, (0, lineypos), (width, lineypos), (255, 0, 0), 5)
|
||||||
|
|
||||||
# line y position created to count contours
|
# line y position created to count contours
|
||||||
lineypos2 = 150
|
lineypos2 = 150
|
||||||
cv2.line(image, (0, lineypos2), (width, lineypos2), (0, 255, 0), 5)
|
cv2.line(image, (0, lineypos2), (width, lineypos2), (0, 255, 0), 5)
|
||||||
|
|
||||||
|
cv2.line(image, (0, 225), (width, 225), (255, 255, 255), 2)
|
||||||
|
cv2.line(image, (0, lineypos), (width, lineypos), (255, 255, 255), 2)
|
||||||
|
|
||||||
# min area for contours in case a bunch of small noise contours are created
|
# min area for contours in case a bunch of small noise contours are created
|
||||||
minarea = 200
|
minarea = 200
|
||||||
|
|
||||||
|
@ -161,6 +173,7 @@ async def generate_frames2(video, threshold,stat):
|
||||||
cxx = np.zeros(len(contours))
|
cxx = np.zeros(len(contours))
|
||||||
cyy = np.zeros(len(contours))
|
cyy = np.zeros(len(contours))
|
||||||
|
|
||||||
|
|
||||||
for i in range(len(contours)): # cycles through all contours in current frame
|
for i in range(len(contours)): # cycles through all contours in current frame
|
||||||
|
|
||||||
if hierarchy[0, i, 3] == -1: # using hierarchy to only count parent contours (contours not within others)
|
if hierarchy[0, i, 3] == -1: # using hierarchy to only count parent contours (contours not within others)
|
||||||
|
|
|
@ -281,10 +281,11 @@
|
||||||
$("#minimal_kepadatan").val(minimal_kepadatan);
|
$("#minimal_kepadatan").val(minimal_kepadatan);
|
||||||
function olah_video() {
|
function olah_video() {
|
||||||
var video = document.getElementById('video').value;
|
var video = document.getElementById('video').value;
|
||||||
var minimal_kepadatan = document.getElementById('minimal_kepadatan').value;
|
// var minimal_kepadatan = document.getElementById('minimal_kepadatan').value;
|
||||||
// var threshold = document.getElementById('threshold').value;
|
// var threshold = document.getElementById('threshold').value;
|
||||||
var threshold = 450;
|
var threshold = 450;
|
||||||
window.location.href = '/?video=' + video + '&threshold=' + threshold + '&minimal_kepadatan=' + minimal_kepadatan;
|
// window.location.href = '/?video=' + video + '&threshold=' + threshold + '&minimal_kepadatan=' + minimal_kepadatan;
|
||||||
|
window.location.href = '/?video=' + video + '&threshold=' + threshold ;
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_jumlah_kenderaan() {
|
function check_jumlah_kenderaan() {
|
||||||
|
|
Loading…
Reference in New Issue