Java create anaglyph (red/blue image)

六月ゝ 毕业季﹏ 提交于 2019-12-22 05:28:10

问题


I'm writing a Java game engine (http://victoryengine.org) and I've been experimenting with generating "3d" images with depth that you can see with those red/blue glasses. I'm using Java2D for graphics.

I've created something that works, but is very slow (by manually copying pixel values and stuff like that).

What I need to is take two BufferedImages (one for the left eye, one for the right) and combine them into one (either another buffer or directly to screen). For one I just want the red channel, and for the other one the green and blue ones. What's the fastest way to do this?


回答1:


Look ath the JAI BandMerge operation:

http://download.java.net/media/jai/javadoc/1.1.3/jai-apidocs/javax/media/jai/operator/BandMergeDescriptor.html

Create your stereoscopic pairs as greyscale images and use band merge to combine them as red and green channels in the final image.



来源:https://stackoverflow.com/questions/1017067/java-create-anaglyph-red-blue-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!