rewrite
This commit is contained in:
1
data/.venv/bin/python
Symbolic link
1
data/.venv/bin/python
Symbolic link
@ -0,0 +1 @@
|
||||
python3
|
1
data/.venv/bin/python3
Symbolic link
1
data/.venv/bin/python3
Symbolic link
@ -0,0 +1 @@
|
||||
/usr/bin/python3
|
1
data/.venv/bin/python3.12
Symbolic link
1
data/.venv/bin/python3.12
Symbolic link
@ -0,0 +1 @@
|
||||
python3
|
1
data/.venv/lib64
Symbolic link
1
data/.venv/lib64
Symbolic link
@ -0,0 +1 @@
|
||||
lib
|
5
data/.venv/pyvenv.cfg
Normal file
5
data/.venv/pyvenv.cfg
Normal file
@ -0,0 +1,5 @@
|
||||
home = /usr/bin
|
||||
include-system-site-packages = false
|
||||
version = 3.12.3
|
||||
executable = /usr/bin/python3.12
|
||||
command = /usr/bin/python3 -m venv /home/maks_gejn/Arduino/ESP82_PANEL/data/.venv
|
BIN
data/kit128 (copy).bmp
Normal file
BIN
data/kit128 (copy).bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
data/kit128.bmp
Normal file
BIN
data/kit128.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
5
data/kitleft.h
Normal file
5
data/kitleft.h
Normal file
File diff suppressed because one or more lines are too long
39
data/main.py
Normal file
39
data/main.py
Normal file
@ -0,0 +1,39 @@
|
||||
import argparse
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--input", required=True, help="input image path")
|
||||
parser.add_argument("--output", required=False, default='output.h', help="path to output file")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
image = cv2.imread(args.input, cv2.IMREAD_GRAYSCALE)
|
||||
if image is None:
|
||||
print(
|
||||
f"Could not read image {args.input}. "
|
||||
f"Please, check that you passed the correct path"
|
||||
)
|
||||
exit()
|
||||
|
||||
image = cv2.resize(image, (128, 48))
|
||||
image[image > 0] = 1
|
||||
image = 1 - image
|
||||
image = list(np.ravel(image))
|
||||
image_text = ''
|
||||
for i, pixel_data in enumerate(image):
|
||||
image_text += str(pixel_data)
|
||||
if i != len(image) - 1:
|
||||
image_text += ', '
|
||||
text = f"#ifndef _OUTPUT_\n#define _OUTPUT_\nbyte output[128*64] = {{ {image_text} }};\n\n#endif"
|
||||
|
||||
with open(args.output, 'w') as f:
|
||||
f.write(text)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
5
data/output.h
Normal file
5
data/output.h
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user