switch to close enough matching

This commit is contained in:
Camryn Thomas 2025-02-01 15:40:01 -06:00
parent 00a5bceffb
commit 08a09e3b15
Signed by: cptlobster
GPG Key ID: 33D607425C830B4C

View File

@ -20,7 +20,7 @@ def breakdown_image_norm(frame, last_frame):
arr = frame[i:i + 16, j:j + 16] arr = frame[i:i + 16, j:j + 16]
last_arr = last_frame[i:i + 16, j:j + 16] last_arr = last_frame[i:i + 16, j:j + 16]
# only update if image segments are different # only update if image segments are different
if not np.array_equal(arr, last_arr): if not np.allclose(arr, last_arr):
pkt = StdPacket(uuid, j, i, arr) pkt = StdPacket(uuid, j, i, arr)
send_packet(sock, pkt.to_bytestr()) send_packet(sock, pkt.to_bytestr())
@ -33,7 +33,7 @@ def breakdown_image_interlaced(frame, last_frame):
# print("Sending frame segment (%d, %d)", i, j) # print("Sending frame segment (%d, %d)", i, j)
arr = frame[i:i + 32:2, j:j + 16] arr = frame[i:i + 32:2, j:j + 16]
last_arr = last_frame[i:i + 32:2, j:j + 16] last_arr = last_frame[i:i + 32:2, j:j + 16]
if not np.array_equal(arr, last_arr): if not np.allclose(arr, last_arr):
pkt = InterlacedPacket(uuid, j, i, False, arr) pkt = InterlacedPacket(uuid, j, i, False, arr)
send_packet(sock, pkt.to_bytestr()) send_packet(sock, pkt.to_bytestr())
@ -43,7 +43,7 @@ def breakdown_image_interlaced(frame, last_frame):
arr = frame[i + 1:i + 32:2, j:j + 16] arr = frame[i + 1:i + 32:2, j:j + 16]
last_arr = last_frame[i + 1:i + 32:2, j:j + 16] last_arr = last_frame[i + 1:i + 32:2, j:j + 16]
# only update if image segments are different # only update if image segments are different
if not np.array_equal(arr, last_arr): if not np.allclose(arr, last_arr):
pkt = InterlacedPacket(uuid, j, i, True, arr) pkt = InterlacedPacket(uuid, j, i, True, arr)
send_packet(sock, pkt.to_bytestr()) send_packet(sock, pkt.to_bytestr())
@ -62,7 +62,7 @@ def breakdown_image_dint(frame, last_frame):
arr = frame[i + i_even:i + 32:2, j + j_even:j + 32:2] arr = frame[i + i_even:i + 32:2, j + j_even:j + 32:2]
last_arr = last_frame[i + i_even:i + 32:2, j + j_even:j + 32:2] last_arr = last_frame[i + i_even:i + 32:2, j + j_even:j + 32:2]
# only update if image segments are different # only update if image segments are different
if not np.array_equal(arr, last_arr): if not np.allclose(arr, last_arr):
pkt = DoublyInterlacedPacket(uuid, j, i, j_even, i_even, arr) pkt = DoublyInterlacedPacket(uuid, j, i, j_even, i_even, arr)
send_packet(sock, pkt.to_bytestr()) send_packet(sock, pkt.to_bytestr())