mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
tools/haar2c: Align features arrays.
To support loading pointers from ROM.
This commit is contained in:
parent
9de1220d87
commit
5f369df045
@ -170,6 +170,10 @@ def cascade_binary(path, n_stages, name):
|
|||||||
for s in stages:
|
for s in stages:
|
||||||
fout.write(struct.pack('B', s)) # uint8_t
|
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
|
# write stages thresholds
|
||||||
for t in stage_threshold:
|
for t in stage_threshold:
|
||||||
fout.write(struct.pack('h', int(float(t.childNodes[0].nodeValue)*256))) #int16_t
|
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:
|
for s in stages:
|
||||||
fout.write(struct.pack('B', s)) # uint8_t
|
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
|
# write stages thresholds
|
||||||
for t in stage_threshold:
|
for t in stage_threshold:
|
||||||
fout.write(struct.pack('h', int(float(t.childNodes[0].nodeValue)*256))) #int16_t
|
fout.write(struct.pack('h', int(float(t.childNodes[0].nodeValue)*256))) #int16_t
|
||||||
|
Loading…
Reference in New Issue
Block a user