tools/haar2c: Align features arrays.

To support loading pointers from ROM.
This commit is contained in:
iabdalkader 2024-12-29 19:15:47 +01:00
parent 9de1220d87
commit 5f369df045

View File

@ -170,6 +170,10 @@ def cascade_binary(path, n_stages, name):
for s in stages:
fout.write(struct.pack('B', s)) # uint8_t
padding = (4 - ((12 + len(stages)) % 4)) % 4
if padding:
fout.write(b"\x00"*padding)
# write stages thresholds
for t in stage_threshold:
fout.write(struct.pack('h', int(float(t.childNodes[0].nodeValue)*256))) #int16_t
@ -266,6 +270,10 @@ def cascade_binary_old(path, n_stages, name):
for s in stages:
fout.write(struct.pack('B', s)) # uint8_t
padding = (4 - ((12 + len(stages)) % 4)) % 4
if padding:
fout.write(b"\x00"*padding)
# write stages thresholds
for t in stage_threshold:
fout.write(struct.pack('h', int(float(t.childNodes[0].nodeValue)*256))) #int16_t