Hi. I want to compare two images. One image is on the android client and another image is on the server (with Tomcat, JDK). I need also to calculate two histograms - one for each image - and to compare they
The problem is: getPixel (x, y) (on Android) and getRGB (x, y) (JDK) return different rgb color numbers for the point with the same coordinates (x, y). The images are here identical (JPG, Size: 3x3). Why are the results different? And what to do? I've been looking for the answer everywhere, but... *************************************** Pseudocode for Androids Activity *************************************** BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inPreferredConfig = Bitmap.Config.ARGB_8888; mBitmap = BitmapFactory.decodeFile(imageSource, opt); int intColor = 0; for (int x = 0; x < mBitmap.getWidth(); x++) { for (int y = 0; y < mBitmap.getHeight(); y++) { intColor = mBitmap.getPixel(x, y); System.out.print(" ("+ x + ","+ y +") c:" + intColor); } }System.out.println(); Result for example image 3x3: (0,0)c:-7882802 (0,1)c:-9859138 (0,2)c:-6507579 (1,0)c:-12883825 (1,1)c:-6574388 (1,2)c:-7948604 (2,0)c:-7489593 (2,1)c:-10579009 (2,2)c:-6573359 ************************ Pseudocode for JDK ************************ BufferedImage img = ImageIO.read( file ); int intColor = 0; for ( int x = 0; x < img.getWidth(); x++ ) { for ( int y = 0; y < img.getHeight(); y++ ) { intColor = img.getRGB( x, y ); System.out.print(" ("+ x + ","+ y +") c:" + intColor); } }System.out.println(); Result for the same image: (0,0)c:-7883056 (0,1)c:-9728065 (0,2)c:-6507579 (1,0)c:-12818030 (1,1)c:-6377523 (1,2)c:-7883323 (2,0)c:-7424055 (2,1)c:-10513470 (2,2)c:-6573358 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en