|||
LabVIEW中
Owning Palette: Image Management
Requires: NI Vision Development Module
在8位转16位时没有问题,但反之,当从16位转8位时候,就涉及舍去8位的情况.如果对该VI的#shift不连线,默认值为0,则是将16位数据右移八位,然后截去高位,从而得到8位数据.可想而知,当16位图中每个像素点灰度低于255时,如此操作最后得到的全是0.
所以本例中,我使用了-8赋给#shift,将16位数据先右移-8位(即左移8位),然后该VI自动又将数据右移8位,相当于没有移位,然后截去高位,得到原来16位数据低8位的值.
参考:
# Shifts specifies the number of right shifts by which each pixel value in the input image is shifted. This is valid only when converting from a 16-bit image to an 8-bit image. The VI executes this conversion by shifting the 16-bit pixel values to the right by the specified number of shift operations, up to a maximum of 8 shift operations, and then truncating to get an 8-bit value. Enter a value of –1 to ignore the bit depth and shift 0. Enter a value of 0 to use the bit depth to cast the image. Refer to the IMAQ Image Bit Depth VI for information about bit depth.