简体   繁体   English

从8位灰度图像中抓取像素

[英]Grabbing pixels from 8bit greyscale image

I have 8 bit greyscale image. 我有8位灰度图像。 I need to grab pixels from it, to byte array. 我需要从中获取像素到字节数组。 So one pixel=1byte in array, but grabber always grabs pixel as integer(4bytes). 因此,数组中一个像素= 1个字节,但是抓取器始终将像素抓取为整数(4个字节)。 Do you kknow how to tell him to grab one pixel as one byte ? 您知道如何告诉他将1个像素作为1个字节抓取吗?

Perhaps this question requires more clarification, but a 4-byte grayscale pixel will always be in the form 0x00ABABAB. 也许这个问题需要更多的说明,但是一个4字节的灰度像素将始终采用0x00ABABAB的形式。 Since AB are the same in the last 3 bytes, you can simply right shift off the bits that you need. 由于AB的后3个字节相同,因此您只需右移所需的位即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM