Elitecho https://passport2.21ic.com/?862546 [收藏] [复制] [RSS]

日志

LabVIEW-VDM图像格式转换VI中16位转8位注意点

已有 2062 次阅读2013-2-23 00:10 |个人分类:无线通信|系统分类:兴趣爱好| LabVIEW, 图像处理


LabVIEW中


IMAQ Cast Image VI


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.


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)