当前位置:网站首页>Color space conversion in video tonemapping (HDR to SDR) (bt2020 to bt709, YCbCr, YUV and RGB)
Color space conversion in video tonemapping (HDR to SDR) (bt2020 to bt709, YCbCr, YUV and RGB)
2022-06-30 00:02:00 【q274488181】
I press , Recently doing video TM Related work of , Specifically, given a HDR video (10bit Of YUV420 Format ), To do it TM, Wrote an algorithm, but there is always a very outrageous color difference , Especially the red and blue channels . After careful examination, it was found that it was obtained HDR The color space of the video is BT2020 Of , But after the conversion SDR The video is BT709 Of , You need to downgrade the color space before processing . Here's a record of the process .
First post two addresses
These are both ITU A standard programmatic document . The first document talks about how to BT709 go to 2020( But only RGB The signal ), The second one talks about how to BT2020 The switch to BT709( Include YUV、RGB How to deal with it ).
In the literature [2] in , A simple and crude diagram is given

E'RGB refer to “ Normalized nonlinearity RGB value ”, and E_RGB refer to “ Normalized linearity RGB value ”.
But in the algorithm , The data I got was 10bit Of YUV420 data , So we need to 10bitYUV420 Data conversion to E'RGB. How to turn ? Not mentioned in the literature . But the literature [1] How will 709 The switch to 2020 when , Give a picture

In addition to here E'RGB and E_RGB outside , We have the E'YCBCR and D'YCBCR. among E'YCBCR refer to “ The normalized YCBCR value ”, and D'YCBCR refer to “ Quantized YCBCR value ”
So I understand here , What I get at the input of the algorithm is called 10bitYUV420 data , It's actually this D'YCBCR value . So next , We combine two literatures , The corresponding process can be deduced .
Step 1. take D’YCbCr(2020) To E’YCbCr(2020)
In fact, it is the antiprocess of the following process

Simple deduction , have to
E_Y = ((D_Y / 4) - 16) / 219
E_Cb = ((D_Cb / 4) - 128) / 224
E_Cr = ((D_Cr / 4) - 128) / 224Step 2. take E’YCbCr(2020) To E’RGB(2020)
The literature [1] The inverse process is given in

So here we just do a simple matrix inversion ( Here the inverse is given directly )
It should be noted that , In the code given below E_YCbCr and E_RGB Such a variable , Their shapes are height x width x 3 Of , So here we do such a transformation of linear algebra . Use of is (AxB)T = BT x AT This is the nature of . This method is used in many places below , I won't explain it later .
m_YCbCr2020_to_RGB2020 = np.array([[1.00000000e+00, -7.82308321e-18, 1.47460000e+00],
[1.00000000e+00, -1.64553127e-01, -5.71353127e-01],
[1.00000000e+00, 1.88140000e+00, 2.38961873e-17]])
E_RGB = np.matmul(E_YCbCr, m_YCbCr2020_to_RGB2020.T)Step 3. take E’RGB(2020) To E RGB(2020)
E_RGB = np.power(E_RGB, 2)
# Another version is
# E_RGB = np.power(E_RGB, 2.4)Step 4. take E RGB(2020) To E RGB(709)
m_RGB2020_to_RGB709 = np.array([[1.66051121, -0.58771059, -0.07280062],
[-0.12456141, 1.13296051, -0.00839911],
[-0.01816769, -0.1005606, 1.11872828]])
E_RGB = np.matmul(E_RGB, m_RGB2020_to_RGB709.T)Step 5. take E RGB(709) To E’RGB(709)
E_RGB = np.power(E_RGB, 1/2)
# Another version is
# E_RGB = np.power(E_RGB, 1/2.4)Step 6. E’RGB(709) To D’RGB(709)
【 Here is to 10bit As an example of , If it is 8bit, Get rid of the back *4 that will do 】
D_RGB = ((E_RGB * 219 + 16) * 4).astype("uint16")After this conversion , There is no color deviation problem .
边栏推荐
- Basic operations such as MySQL startup under Windows platform
- The role of VMware virtual machine
- 一步步教你在Edge浏览器上安装网风笔记
- Digital collection of cultural relics, opening a new way of cultural inheritance
- 6.29 problem solving
- 云和恩墨盖国强,识别它、抓住它,在国产数据库沸腾以前
- LC: effective Sudoku + rotating image
- 大厂试水 HPE推出Arm CPU通用服务器产品
- 【微信小程序】认识小程序项目的基本组成结构
- Sword finger offer 15 Number of 1 in binary
猜你喜欢

雲和恩墨蓋國强,識別它、抓住它,在國產數據庫沸騰以前

开始“收割”!钉钉调整“钉钉Teambition”免费用人数上限,超十人将无法正常用

matlab习题 —— 程序控制流程练习

MySQL functions and constraints

QT learning 06 widgets and window types

打造一个 API 快速开发平台,牛逼!

云和恩墨盖国强,识别它、抓住它,在国产数据库沸腾以前
![Cloner un Graphe non recté [bfs accède à chaque bord et pas seulement aux noeuds]](/img/34/2a1b737b6095293f868ec6aec0ceeb.png)
Cloner un Graphe non recté [bfs accède à chaque bord et pas seulement aux noeuds]

Unity splashimage scaling problem

Andorid source build/envsetup.sh 该知道的细节
随机推荐
AI赋能新零售,「智」胜之道在于生态思维|数智夜话直播精选摘录
Yunhe enmo Guoqiang, identifiez - le, saisissez - le, avant l'ébullition de la base de données nationale
LC:有效的数独 + 旋转图像
请指教同花顺软件究竟是什么?究竟网上开户是否安全么?
6.29日刷题题解
The role of VMware virtual machine
小程序插件接入、开发与注意事项
雲和恩墨蓋國强,識別它、抓住它,在國產數據庫沸騰以前
请指教什么是在线开户?另外,手机开户安全么?
架构实战营模块5作业
New CorelDRAW technical suite2022 latest detailed function introduction
What is flush software? Is it safe to open an account online?
After crossing, she said that the multiverse really exists
MySQL:SQL概述及数据库系统介绍 | 黑马程序员
How about counting Berry Pie 4? What are the possible ways to play?
MySQL functions and constraints
Unity splashimage scaling problem
AI首席架构师9-胡晓光 《飞桨模型库与行业应用》
QT learning 07 coordinate system in QT
由GlideException: Failed DecodePath{DirectByteBuffer->GifDrawable->Drawable}引起的刨根问底