【问题标题】:Single into UINT8 conversion in Matlab?在 Matlab 中单向 UINT8 转换?
【发布时间】:2014-05-10 23:46:38
【问题描述】:

Matrix 类型转换有问题。

所以,我想使用 VLFEAT 函数“vl_covdet”从图像中提取 SIFT 特征

详情如下:

 Input images = <141x142x3 uint8>

因为 vl_covdet 只能读取 1 个通道和单个类型的图像,我将输入图像的 R 通道提供给 vl_covdet:

 R_input_Images = Input images(:,:,1) <141x142 uint8>
 R_Single_Images= im2single(R_input_Images);


[frames, descrs,info] = vl_covdet(R_Single_Images,'Method','multiscalehessian','EstimateAffineShape', false,'EstimateOrientation', true, 'DoubleImage', false, 'Verbose');

现在,我有了功能

  descrs = <128x240 single> which values are ranging from 0 - 0.368

但要计算 BoW,我必须使用来自 VLFEAT ("vl_hikmeans") 的 K-Means 聚类,这需要 uint8 输入类型

  descrs must be of class UINT8.

然后我尝试再次将其转换为 uint8

   descrs=uint8(descrs);

现在

   descrs = <128x240 uint8> **AND ALL THE VALUES BECOME 0**.

我现在要做什么??

【问题讨论】:

    标签: matlab


    【解决方案1】:

    值的范围是 0 - 0.368

    好吧,如果你将它们四舍五入为整数,它们会变成零也就不足为奇了。

    由于浮点格式的图像范围为 0-1,uint8 格式的范围为 0-255,请尝试

    descrs = uint8(descrs * 255);
    

    【讨论】:

      猜你喜欢
      • 2017-03-11
      • 2017-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-03
      • 1970-01-01
      • 1970-01-01
      • 2015-09-02
      相关资源
      最近更新 更多