google / mediapy

This Python library makes it easy to display images and videos in a notebook.
https://pypi.org/project/mediapy/
Apache License 2.0
389 stars 18 forks source link

Will support transform BGR to RGB for 3-channel images? #1

Closed zhiqwang closed 3 years ago

zhiqwang commented 3 years ago

Hi mediapy team!

Thanks for sharing this awesome tool. It seems that the color map only support grey to RGB currently. Because opencv uses BGR by default and it's also widely used. I want to know if there are some plans to support this channel mode, and if this mode is already supported, could you give me some hints where this interface is?

hhoppe commented 3 years ago

Could you please give an example? The function to_rgb() returns a numpy array with RGB channels, so to_rgb()[..., ::-1] would give BGR channels.

Given a BGR image array, one can operate on it as an RGB image using array[..., ::-1]. Hope that helps.

zhiqwang commented 3 years ago

Hi @hhoppe

Thanks for your quickly reply, it sounds reasonable to me! Use array[..., ::-1] instead can solve this problem.

My initial thought was through a parameter to address this situation automatically like following

media.show_image(array, border=True, cmap='rgb', height=400)