I used opencv to read an image and save it to redis like this:
frame=cv2.imread('/path/to/image.png')
rd.set('frame', frame)
then,read it back a string representation like this:
[[[ 38 45 51]
[ 38 45 51]
[ 38 45 51]
...,
[235 217 222]]]
then I tried to get it back like this:
frameString=rd.get('frame')
mat=np.array(frameString)
but
print mat.shape
output
()
then I tried
mat=eval(frameString)
this gives me error:
exec exp in global_vars, local_vars
File "<console>", line 1, in <module>
File "<string>", line 1
[[[ 38 45 51]
^
SyntaxError: invalid syntax
question is
how to convert this string representation back to numpy array correctly?