Matlab bitshift函数用于移位HSV图像中的位

Matlab bitshift函数用于移位HSV图像中的位,matlab,Matlab,我想运行下面的代码 img =imread(file_name); imgH=rgb2hsv(img); MSB3 = bitshift(imgH,-5); 但我有错误 Error using bitshift Double inputs must have integer values in the range of ASSUMEDTYPE. Error in Encoding (line 41) MSB3 = bitshift(imgH,-5); 这是因

我想运行下面的代码

img =imread(file_name);  
imgH=rgb2hsv(img);  
MSB3 = bitshift(imgH,-5); 
但我有错误

Error using bitshift  
Double inputs must have integer values in the range of ASSUMEDTYPE.  
Error in Encoding (line 41)  
    MSB3 = bitshift(imgH,-5);  

这是因为当使用
rgb2hsv
时,会使图像
imgH
为双精度类型(IEEE 754双精度)。在双精度数据类型上使用
bitshift
时,文档指出:

If A is a double array, then all elements must be non-negative integers
less than or equal to intmax('uint64'), and bitshift 
drops any bits overflowing 64 bits.

给出了这样的理解:<代码> RGB2HSV 将图像转换成位移不太好的格式,我想您必须重新考虑使用HSPV图像的BITSHIFT的策略,或者考虑潜在地截断HSV图像中的值,如帮助文本所指示的一样。

help bitshift