Esempio n. 1
0
 def converter_callback(imgData):
     width = imgData["width"]
     height = imgData["height"]
     data = imgData["data"]
     data_bytes = hex_to_bytearray(data)
     array1d = np.array(data_bytes, dtype=np.ubyte)
     bytes_per_pixel = 4
     image_array = array1d.reshape((height, width, bytes_per_pixel))
     callback(image_array)
Esempio n. 2
0
 def pixels_array(self):
     import numpy as np
     from jp_proxy_widget.hex_codec import hex_to_bytearray
     imgData = self.element.chart_info.get_pixels().sync_value()
     data_hex = imgData["data"]
     width = imgData["width"]
     height = imgData["height"]
     data_bytes = hex_to_bytearray(data_hex)
     bytes_per_pixel = 4
     array1d = np.array(data_bytes, dtype=np.ubyte)
     img_array = array1d.reshape((height, width, bytes_per_pixel))
     return img_array
Esempio n. 3
0
 def test_to_bytes(self):
     b = hex_codec.hex_to_bytearray(hexstr)
     self.assertEqual(b, bytestr)
Esempio n. 4
0
 def combine_chunks(self, chunk_list):
     all_hex_content = "".join(chunk_list)
     #return b"".join(from_hex_iterator(all_hex_content))
     ba = hex_codec.hex_to_bytearray(all_hex_content)
     return bytes(ba)