LSB 알고리즘을 사용하는 스테 가노 그래피 프로젝트에서 일하고 있는데, 숨길 수있는 데이터에 의존하는 다른 비트로 모든 픽셀에서 최소 2 비트를 변경하지만 int 배열을 비트 맵으로 변환 할 때 픽셀을 얻을 수 없습니다. 나는 시도 했 ...이 코드입니다 .. 감사안드로이드에서 int 배열을 비트 맵으로 변환하는 방법?
EditText text = (EditText) findViewById(R.id.message);
String msg = text.getText().toString();
int msg_size=msg.length();
if(msg_size!=0)
{
ImageView imageView = (ImageView) findViewById(R.id.imgView);
Bitmap bmap = Bitmap.createBitmap(imageView.getWidth(),imageView.getHeight(),Bitmap.Config.ARGB_8888);//i is imageview whch u want to convert in bitmap
Canvas canvas = new Canvas(bmap);
imageView.draw(canvas);
int width = bmap.getWidth();
int height = bmap.getHeight();
int[] oneD = new int[width * height];
bmap.getPixels(oneD, 0, width, 0, 0, width, height);
int[] byteImage = Encode.encodeMessage(oneD, width, height, msg);
byteImage[0]=(byte)msg_size;
Bitmap destBitmap = Bitmap.createBitmap(width, height,
Config.ARGB_8888);
destBitmap = destBitmap.copy(Bitmap.Config.ARGB_8888, true);
for(int x = 0; x < oneD.length; ++x)
{
oneD[x]=byteImage[x];
}
Bitmap mImage = bmap.copy(bmap.getConfig(), bmap.isMutable());
Bitmap newImage = Bitmap.createBitmap(width, height, mImage.getConfig());
newImage.setPixels(oneD, 0, width, 0, 0, width, height);
// newImage.getPixels(byteImage, 0, width, 0, 0, width, height);
//saving the image in the device
String fileName = String.valueOf(Calendar.getInstance().getTimeInMillis());
// generate the image path
String imagePath = Environment.getExternalStorageDirectory().toString() + File.separator + fileName + ".jpg";
try {
// save the image as jpg
FileOutputStream out = new FileOutputStream(imagePath);
// compress the image to jpg and pass it to the output stream
newImage.compress(Bitmap.CompressFormat.JPEG, 90, out);
// save the image
out.flush();
out.close();
}
catch (Exception error)
{
Log.e("Error saving image", error.getMessage());
}
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("file://" + Environment.getExternalStorageDirectory())));
return 100;
}// end if
그래서 여전히 문제를 얻을? – Piyush
예 @Piyush Gupta – Shatha
그래서 @Antigona에 어떤 것을 권유하지 않습니까? – Piyush