marionmaiden
marionmaiden

Reputation: 3350

Java image with double value pixel

Actually I'm working with BufferedImages, that provide me pixel values in int type.

Do you know a Java object to represent an image that the pixel value in double or float type?

Upvotes: 0

Views: 2167

Answers (3)

Ricardo
Ricardo

Reputation: 11

You can use Java Advanced Imaging API (JAI).

JAI introduces two new data classes, which extend the Java 2D DataBuffer image data class: DataBufferFloat and DataBufferDouble.

http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/J2D-concepts.doc.html#52401

Upvotes: 1

Seth
Seth

Reputation: 5738

I'm not sure exactly what your end goal is, but you could look into java.awt.image.ColorModel . Either that or you could do your processing on a float[][]/double[][] and then round if you need to do something with your BufferedImage.

Upvotes: 1

user166390
user166390

Reputation:

I do know of an implementation off the top of my head, but you can use the SampleModel/WritableRaster to access bands independently and create your own backing however you like. It likely won't be much fun though. Although, I'd question the "access component (??) as a double/float" requirement (unless you're doing something fun like OpenGL 8-bit floats ... which don't map to Java floats anyway :-)

Upvotes: 1

Related Questions