开发者

pixel difference

I'm a beginner in Java programming. I have to submit project of server- client and I am stuc开发者_如何学编程k in pixel comparison. .acc to code It accepts BufferedImage and compares pixels. How to store the pixel difference in the 2nd image itself and return it?


Take a look at BufferedImage's getRGB(int x, int y) method. This will provide an approximate RGB value for the given (x, y) location as an int, which can then be compared to the corresponding location in the other image.

If you wish to perform a more detailed comparison you'll need to iterate over each image band separately, comparing the samples for that band with the corresponding band for the other image. (For example, an RGBA encoded image has four individual bands to compare, whereas a greyscale image has just one.)

Obviously you could start by comparing the image dimensions to ensure they are equal before proceding to the more detailed comparison.

Also, you should not expect people to paste detailed code solutions; That's not the way Stack Overflow works - People will be far more willing to help with specific problems so you should try coding the solution and post a code snippet if you get stuck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜