im2double和double函数的区别

      针对数字图像处理,多数情况下,源图像的像素格式为unsigned char类型,当涉及到频域等处理时候,需要将字节型数据转换为double类型,matlab提供了2两个函数,im2double和double函数,均可使用,但是两者的区别则极其重要。

    在matlab的官方论坛上有这样几句话:But a simple test will show you that  when you use im2double, it will convert your uint8 image from the range of 0-255 into a double array in the range 0-1. In general, all Image Processing Toolbox functions that take floating point arrays want them in the range of 0 to 1. I find it kind of annoying but that's the way it is. That's basically what "rescaling" means. So this imdouble() function is there to help you get to what you might need for later calls to Image Processing Toolbox functions. If you use double() you would have to divide by 255 yourself if you needed to. If you're doing your own custom functions then you can leave it in the original range if you want。

    意思就是im2double 函数将所有像素数据转化为【0 1】区间之内,这也是数字图像处理工具箱的要求;但是double函数则仅仅提高数据精度,但是并未将数据量化到【0 1】区间之内。

   适应场合:当你需要做频域滤波处理,需要注意不要使用im2double函数,否则滤波之后,图像在傅里叶反变换之后,所有像素数据都是0,也就是说图像纯黑色。与此对应,当你使用数字图像处理工具箱的时候,建议使用im2double函数。

  • 8
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值