opencv - how to show my image in array or matrix in python? -


i have array like:

{(0, 27): 0.0, (0, 20): 0.0, (0, 14): 0.0, (0, 7): 0.0, (0, 16): 0.0, (0, 10): 0.0, (0, 3): 0.0, (0, 28): 0.0, (0, 21): 0.0, (0, 15): 0.0, (0, 24): 0.0, (0, 17): 0.0, (0, 11): 0.0, (0, 4): 0.0, (0, 29): 0.0, (0, 22): 0.0, (0, 0): 0.0, (0, 25): 0.0, (0, 18): 0.0, (0, 12): 0.0, (0, 5): 0.0, (0, 30): 0.0, (0, 8): 0.0, (0, 23): 0.0, (0, 1): 0.0, (0, 26): 0.0, (0, 19): 0.0, (0, 13): 0.0, (0, 6): 0.0, (0, 31): 0.0, (0, 9): 0.0, (0, 2): 0.0} 

and image , want draw it. first how should draw in python opencv? know should use

cv2.imshow('m',m ) cv2.waitkey() 

but error is:

ypeerror: mat not numpy array, neither scalar 

and when change matrix by:

zas = np.asmatrix(m)   [[ {(0, 27): 0.0, (0, 20): 0.0, (0, 14): 0.0, (0, 7): 0.0, (0, 16): 0.0, (0, 10): 0.0, (0, 3): 0.0, (0, 28): 0.0, (0, 21): 0.0, (0, 15): 0.0, (0, 24): 0.0, (0, 17): 0.0, (0, 11): 0.0, (0, 4): 0.0, (0, 29): 0.0, (0, 22): 0.0, (0, 0): 0.0, (0, 25): 0.0, (0, 18): 0.0, (0, 12): 0.0, (0, 5): 0.0, (0, 30): 0.0, (0, 8): 0.0, (0, 23): 0.0, (0, 1): 0.0, (0, 26): 0.0, (0, 19): 0.0, (0, 13): 0.0, (0, 6): 0.0, (0, 31): 0.0, (0, 9): 0.0, (0, 2): 0.0}]] 

the error is:

typeerror: mat data type = 17 not supported 

would please tell me mistake making?

if try looking values in dictionary draw image. it's simple.it hold 32 values , hope it's size of image 1 32. can plot this. considered a dictionary.

a = {(0, 27): 0.0, (0, 20): 0.0, (0, 14): 0.0, (0, 7): 0.0, (0, 16): 0.0, (0, 10): 0.0, (0, 3): 0.0, (0, 28): 0.0, (0, 21): 0.0, (0, 15): 0.0, (0, 24): 0.0, (0, 17): 0.0, (0, 11): 0.0, (0, 4): 0.0, (0, 29): 0.0, (0, 22): 0.0, (0, 0): 0.0, (0, 25): 0.0, (0, 18): 0.0, (0, 12): 0.0, (0, 5): 0.0, (0, 30): 0.0, (0, 8): 0.0, (0, 23): 0.0, (0, 1): 0.0, (0, 26): 0.0, (0, 19): 0.0, (0, 13): 0.0, (0, 6): 0.0, (0, 31): 0.0, (0, 9): 0.0, (0, 2): 0.0} in [20]: zas = np.asmatrix(a.values()) in [24]: cv2.imshow('m',zas) in [25]: cv2.waitkey() 

but it's not method store image dictionary. try maintain numpy array.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -