Ask Your Question
0

display function (similar to cv2.imshow) in opencv that can display mat with data type =8 (i.e. np.uint32)

asked 2018-04-25 17:29:27 -0600

wlei gravatar image

updated 2018-04-27 13:08:36 -0600

Hello,

Does anybody know why np.frombuffer() does not work with np.unit32? Do you know any fix or workaround?

I am not able to update the title... but after investigation, np.frombuffer does work with int8, unint8, int16, uint16, int32... Only uint32 does not work...

Thanks

Update on the investigation : actually, np.frombuffer() with np.uint32 does work. The thing that is not working is cv2.imshow() - when I tried to show the image that I loaded from the buffer. I got the following error saying:

TypeError: mat data type = 8 is not supported

is there any display function in opencv that can display mat with data type =8 (i.e. np.uint32)?

edit retag flag offensive close merge delete

Comments

Correction: I think only np.unit32 does not work work with np.frombuffer(..), all the other datatype work (even np.int32)... not sure why this is happening. Does any body know?

wlei gravatar imagewlei ( 2018-04-27 12:20:32 -0600 )edit

btw, how is this related to opencv at all ?

berak gravatar imageberak ( 2018-04-27 12:26:48 -0600 )edit

since opencv use numpy :-) ... see my updated question... it is actually a question on the opencv side...

wlei gravatar imagewlei ( 2018-04-27 12:59:53 -0600 )edit

"I am not able to update the title" -- there's an edit button next to it.

berak gravatar imageberak ( 2018-04-27 13:02:23 -0600 )edit

thanks berak for pointing it out... I am very new to the forum :-)

wlei gravatar imagewlei ( 2018-04-27 13:09:04 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-04-27 15:16:10 -0600

berak gravatar image

oh, now you changed the context, there's a simple answer:

opencv does not have / support any uint32 pixel format

(it's not a python / numpy problem)

(int32 (signed) is supported, as well as any other formats you mentioned)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-04-25 17:29:27 -0600

Seen: 2,257 times

Last updated: Apr 27 '18