Merge branch 'new-picamera-compatibility' into 'master'
Handle memoryview in ndarray_to_json See merge request openflexure/openflexure-microscope-server!40
This commit is contained in:
commit
356ff3336b
1 changed files with 4 additions and 0 deletions
|
|
@ -23,6 +23,10 @@ def serialise_array_b64(npy_arr):
|
|||
|
||||
|
||||
def ndarray_to_json(arr: np.ndarray):
|
||||
if isinstance(arr, memoryview):
|
||||
# We can transparently convert memoryview objects to arrays
|
||||
# This comes in very handy for the lens shading table.
|
||||
arr = np.array(arr)
|
||||
b64_string, dtype, shape = serialise_array_b64(arr)
|
||||
return {
|
||||
"@type": "ndarray",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue