so if have 100 binary images type .bmp wondering if there library can use save single file later read in file , iterate through each image in python.
if there no library planning on reading of 100 binary images save them array in python save array file 100_images.format
.
i wondering in format can save file make small possible? since images binary 32 32 pixels how can efficiently?
i thinking save 100 images array so:
array index 0 0 or 1 if image 1 pixel @ (0, 0) white(0) or black(1) 1 0 or 1 if image 1 pixel @ (0, 1) white(0) or black(1) ... 1023 0 or 1 if image 1 pixel @ (31, 31) white(0) or black(1) 1024 0 or 1 if image 2 pixel @ (0, 0) white(0) or black(1) ...
then write file in python. don't know type of file should make it. in code reads through 100 binary images want work like:
binary_images_manager = new binaryimagesmanager('100_images.format') in range(number_of_images_to_see): int[][] binary_image = binary_images_manager.readimage(i)
i run length encoding: https://en.wikipedia.org/wiki/run-length_encoding
you can use 1 of implementation python: https://www.rosettacode.org/wiki/run-length_encoding#python
encoding:
- for each image matrix flatten using np.flatten
- run length encode image
- add code list
- after images encoded pickle list
decoding:
- unpickle list
- for each item in list decode run length code
- reshape resulted vector desired matrix shape
Comments
Post a Comment