From 96240f66770efa8349098f2308d52a016b93f5f2 Mon Sep 17 00:00:00 2001 From: Charles Mangin Date: Fri, 5 Mar 2021 09:16:41 -0500 Subject: [PATCH] added python script python script to convert image data to height/color data --- canyon.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 canyon.py diff --git a/canyon.py b/canyon.py new file mode 100644 index 0000000..af59308 --- /dev/null +++ b/canyon.py @@ -0,0 +1,27 @@ +import sys +import cv2 +import struct +import time +import shutil +import subprocess + +count = 0 + +height = open("canyon-120-px-4bit-height.hex","rb") +color = open("canyon-120-px-4bit-color.hex","rb") +file = open("CANYONDATA","wb") + +heightbyte = bytearray(height.read(1)) +colorbyte = bytearray(color.read(1)) + +while heightbyte: + byte = int(heightbyte[0]) + int(colorbyte[0]) + packedbyte = struct.pack("B", byte) + file.write(packedbyte) + + colorbyte = bytearray(color.read(1)) + heightbyte = bytearray(height.read(1)) + +height.close() +color.close() +file.close()