当前位置:网站首页>BGR and RGB convert each other
BGR and RGB convert each other
2022-07-25 23:57:00 【perfectdisaster】
stay opencv The image in is represented by bgr Stored in form , But many scenarios default rgb Form of image , This leads to color confusion in practical applications , Here are bgr and rgb Mutual conversion functions :
def rgb_bgr(r_color):
r_color_list = list(r_color)
tmp = r_color_list[0]
r_color_list[0] = r_color_list[2]
r_color_list[2] = tmp
r_color = webcolors.IntegerRGB(r_color_list[0], r_color_list[1], r_color_list[2])
return r_color
or :
def BGR_to_RGB(cvimg):
pilimg = cvimg.copy()
pilimg[:, :, 0] = cvimg[:, :, 2]
pilimg[:, :, 2] = cvimg[:, :, 0]
return pilimg
In fact, the principle is to exchange the relative positions of the array storing image data
边栏推荐
- Promise resolve callback hell, async await modifier
- Array merge method: concat()
- Shardingsphere data slicing
- What is the difference between'1 and'b1 when assigning values
- redis-扩展数据类型(跳跃表/BitMaps/HyperLogLog/GeoSpatial)
- A brief introduction to OWASP
- Ratio of learning_ add,ratio_ subtract,ratio_ multiply,ratio_ Use of divide
- 什么是奇偶校验?如何用C语言实现?
- 什么叫做 inode ?带你理解 inode 和对于创建文件和删除文件时 inode 都提供了哪些帮助。
- After entering www.baidu.com in the address bar
猜你喜欢

栈与队列——239. 滑动窗口最大值
![[learning notes] solid works operation record](/img/f7/0535b473755643ce32996f00fa5554.png)
[learning notes] solid works operation record

行为型模式之责任链模式

ArcGIS cuts TIF images (grid data) according to the vector range, merges shp files in batches, cuts vectors in the region according to the vector range, outputs the geographic coordinate system, conve

Redis basic data type (string/list/set/hash/zset)

C language implementation of three chess

Redis extended data type (jump table /bitmaps/hyperloglog/geospatial)

二叉树——530.二叉搜索树的最小绝对差

What is the difference between'1 and'b1 when assigning values

程序环境和预处理
随机推荐
Read the field status of account in ABAP code (hidden, optional, required)
反射之类加载过程
Article 75: writing skills of academic papers
initializer_ List tool library learning
QT smart pointer error prone point
Getting started with Servlet
C language implementation of three chess
二叉树——700.二叉搜索树中的搜索
什么叫做 inode ?带你理解 inode 和对于创建文件和删除文件时 inode 都提供了哪些帮助。
Good news under the epidemic
行为型模式之迭代器模式
The GUI interface of yolov3 (simple, image detection)
二叉树——112. 路径总和
Leetcode107-二叉树的层序遍历II详解
Payment terms in SAP message No. vg202 IDoc e1edk18 have been transferred: check data
你还在用浏览器自带书签?这款书签插件超赞
结对编程实践心得
开放API生态系统面临的十个威胁
统计之歌 歌词
firewall 命令简单操作