简体   繁体   English

像素的16位Integer UNSIGNED值

[英]16-bit Integer UNSIGNED value for a pixel

I'm trying to get the 16-bit integer unsigned value for a pixel in an image using JAVA. 我正在尝试使用JAVA获取图像中像素的16位整数无符号值。 I'm using: 我正在使用:

int d = img.getRGB(x, y);

I get numbers like this -16744032, I don't think that getRGB is the right method to use, along with that it is signed. 我得到像这样的数字-16744032,我认为getRGB是正确的使用方法,并且没有签名。

Note: I don't want to convert it to RGB. 注意:我不想将其转换为RGB。

all that I want is: 16-bit Integer unsigned value for a pixel. 我想要的是:一个像素的16位整数无符号值。

UPDATE: what I want is not a very complicated method that has nothing to do with colors at all. 更新:我想要的不是一种与颜色完全无关的非常复杂的方法。

I don't have experience with image manipulation in java, but from the javadoc you should be able to get a Raster object from the method getRaster(), then either getPixel(x,y,int[] arr) or getDataElements(x,y,object outData) may work. 我没有使用Java进行图像处理的经验,但是从javadoc中应该可以从方法getRaster()获取Raster对象,然后从getPixel(x,y,int [] arr)或getDataElements(x, y,对象outData)可能起作用。

That assumes that the image is in 16 bits format in the first place. 假设图像首先是16位格式。 If not you will need to convert the RGB value to 16 bits. 如果不是,则需要将RGB值转换为16位。 This question may be relevant in that case: How to convert between color models 在这种情况下,这个问题可能是相关的: 如何在颜色模型之间转换

Sources: https://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html#getRaster() https://docs.oracle.com/javase/7/docs/api/java/awt/image/Raster.html 来源: https : //docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html#getRaster() https://docs.oracle.com/javase/7/docs/api /java/awt/image/Raster.html

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

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