I'm having a strange problem trying to do some image processing. I've developed a script in Eclipse that does some processing with an image and returns a list of values about color comparing between fixed pixels of the image. In the processing I do these actions in the following order:
- Resizing
- Contours detection
- Warp transformation
- Conversion from BGR to Lab
- Fixed pixels value comparison using Delta
I've implemented the exact same code in Android.
In Android I take a photo with the native camera, save it in the gallery, and pass the path of the photo in an intent, like this:
Intent intent = new Intent(this, ElaborationActivity.class);
intent.setData(Uri.parse(mCurrentPhotoPath));
startActivity(intent);
Then, in the new activity (the one that does the elaboration), I load the image and start the processing doing so:
String photoPath = getIntent().getData().toString();
Bitmap intentPhoto = BitmapFactory.decodeFile(photoPath);
Mat imgOr = new Mat();
Utils.bitmapToMat(intentPhoto, imgOr);
Elaboration ImElab = new Elaboration(imgOr.height(), imgOr.width());
In Eclipse I start the processing in this way:
Mat imgOr = Imgcodecs.imread(fileName);
ImageElaboration ImElab = new ImageElaboration(imgOr.height(), imgOr.width());
The rest of the code is exactly the same. The problem is that the elaboration done in Eclipse is way more precise and if I load in Eclipse the photo captured with the phone - photo that has been saved in .jpg in the gallery - and I try to use it to launch the script, the output I get in Eclipse is different from what I've got in Android.
Does anyone know why I get different results with the same photo? Could it be because in Android the photo is decoded in bitmap and in Eclipse I use the jpeg version? If so I'd like to know if there's a way to load in Android the jpeg version stored in the gallery.
Thanks