# Is it possible to display an matrix with an Bitdepth of 16 Bit (Colormap)

**URL:** <https://forum.opencv.org/t/is-it-possible-to-display-an-matrix-with-an-bitdepth-of-16-bit-colormap/2676>\
**Category:** C++\
**Tags:** mat, imgproc, core\
**Created:** [April 8, 2021, 10:50pm UTC](https://forum.opencv.org/t/is-it-possible-to-display-an-matrix-with-an-bitdepth-of-16-bit-colormap/2676 "2021-04-08T22:50:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.opencv.org/u/tim5)\
**Post date:** [April 8, 2021, 10:50pm UTC](https://forum.opencv.org/t/is-it-possible-to-display-an-matrix-with-an-bitdepth-of-16-bit-colormap/2676/1 "2021-04-08T22:50:18Z")

</div>

Hello,

I would like to display an one channel Matrix with a bitdepth of more then 8 Bit because I have integers up to 3000.

I found out that with Colormap it is only possible with CV\_8UC1. So it is only possible to display integers from 0 to 255.

[https://docs.opencv.org/master/d3/d50/group\_\_imgproc\_\_colormap.html](https://docs.opencv.org/master/d3/d50/group __imgproc__ colormap.html)

Do I have to scale the bigger integers down do 255 because in opencv it is only possible to plot a matrix with different color for each value with colormap. Or is there a different method where I can display Integers with a bit depth of 16 Bit.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [April 9, 2021, 7:03am UTC](https://forum.opencv.org/t/is-it-possible-to-display-an-matrix-with-an-bitdepth-of-16-bit-colormap/2676/2 "2021-04-09T07:03:41Z")

</div>

Hi,  
Unfortunately there is no such function. You have to manage yourself such palette

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [April 9, 2021, 3:56pm UTC](https://forum.opencv.org/t/is-it-possible-to-display-an-matrix-with-an-bitdepth-of-16-bit-colormap/2676/3 "2021-04-09T15:56:41Z")

</div>

you would use [convertTo](https://docs.opencv.org/master/d3/d63/classcv_1_1Mat.html#adf88c60c5b4980e05bb556080916978b) to map your value range of 0…3000 to 0…255. set `alpha = 255.0/3000.0` and `rtype = CV_8U`

then you could apply a color map to these values.
