编码源我必须将这些Blob(图像)放在我的数据库中
Bitmap image15 = BitmapFactory.decodeResource(getResources(),R.drawable.wolverineklein);
// convert bitmap to byte
ByteArrayOutputStream stream = new ByteArrayOutputStream();
image15.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte imageInByte1[] = stream.toByteArray();
这是从SQLite数据库中恢复图像的代码
DatabaseHandler db = new DatabaseHandler(camera.this);
List<Database> contacts = db.getAllContacts();
for (Database contact : contacts) {
BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options();
bmpFactoryOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
//bmpFactoryOptions.inScaled = false;
// decodes the blob back into a bitmap
byte[] blob = contact.getMP();
ByteArrayInputStream inputStream = new ByteArrayInputStream(blob);
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
Bitmap scalen = Bitmap.createScaledBitmap(bitmap, 320, 240, false);
代码工作正常,但图像的输出质量较低(差异不是很大,但我用它来进行特征匹配,因此它会对结果产生影响。右输出图像比较模糊)
正如您所看到的,右图是输出,它更像位(检查上胸区并将其与左输入图像进行比较)然后原始+大小更大。是否有可能使质量更好,我现在就拥有它?