昊虹AI笔记网

 找回密码
 立即注册
搜索
查看: 677|回复: 0
收起左侧

OpenCV的函数imshow()在显示图像前,对数据作了怎样的预处理?

[复制链接]

239

主题

241

帖子

928

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
928
昊虹君 发表于 2022-10-19 11:06 | 显示全部楼层 |阅读模式
OpenCV的函数imshow()在显示图像前,对数据作了怎样的预处理?

查阅函数imshow()的官方文档,发现有下面这段说明:
If the image is 8-bit unsigned, it is displayed as is.
If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the value range [0,255*256] is mapped to [0,255].
If the image is 32-bit floating-point, the pixel values are multiplied by 255. That is, the value range [0,1] is mapped to [0,255].


翻译如下:
  • 如果图像数据的类型为8位无符号型,即CV_8U型,则不进行数据预处理。
  • 如果图像数据的类型为16位无符号型(CV_16U)或者32位整型(CV_32S),则会把每个数除以256。
  • 如果图像数据的类型为32位的符点型,即CV_32F型,则会把每个数乘上255,所以,如果数据范围为[0,1],则将会被映射到 [0,255]。

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|昊虹AI笔记网 ( 蜀ICP备2022024117号-1 )

GMT+8, 2024-5-6 13:48 , Processed in 0.025675 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表