herrDeng網內搜尋

自訂搜尋

Ads

2017年12月27日 星期三

Ex13 隱藏資訊或加密

20 則留言:

b10533011 江道逸 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; x<W0 ; x++)
for (int y = 0 ; y < H0 ; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; x<W; x++)
for (int y = 0; y < H; y++) {
Color p0 = im->GetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

B10533010蕭凱維 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(WO, HO);
for(intx=0;xGetPixel(x, y);
colorp1 = im1->GetPixel(x, y);

RGB pp = 4 * (RGB(p0) / 4) + RGB(p1) / 64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for(int x=0;xGetPixel(x, y);
RGB pp = 64 * (RGB(p0)% 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

b10533018 陳郁傑 大大大 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; x<W0 ; x++)
for (int y = 0 ; y < H0 ; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; x<W; x++)
for (int y = 0; y < H; y++) {
Color p0 = im->GetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

B10533132許敏茹 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
intW0 = im0->Width, H0 = im0->Height;
intW1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖檔大小不合。\n";
return;
}
Bitmap im2(W0, H0);
Color Black = Color::FromArgb(0, 0, 0);
for (int y = 0; y < H0; y++)
{
color p0 = im0->GetPixel(x, y);
color p1 = im1->GetPixel(x, y);
RGB pp = RGB(p0) + RGB(p1);
color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
int main()
{
Bitmap^im0 = gcnew Bitmap("lena.jpg")
Bitmap^im1 = gcnew Bitmap("lena.jpg")
image_hide(im0, im1);
cout << "資料隱藏\n";
system("pause")
return 0;
}

RGB pp = 64 * (RGB(p0) % 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
cout << "show.png圖檔產生\n;
}

B10533062 洪尚郁 提到...

void image_hide(Bitmap^ im0, Bitmap^ im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x < W0; x++)
for (int y = 0; y < H0; y++) {
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4)+RGB(p1)/64);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}

void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for(int x=0;x<W;x++)
for (int y = 0; y < H; y++) {
Color p0 = im->GetPixel(x, y);

RGB pp = 64 * (RGB(p0) % 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

b10533017古峻衛 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; x<W0 ; x++)
for (int y = 0 ; y < H0 ; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; x<W; x++)
for (int y = 0; y < H; y++) {
Color p0 = im->GetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

b10333093徐子軒 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
intW0=im0->Width, H0 = im0->Height;
intW1=im1->Width, H1 = im1->Height;
if(W1!=W0||H1!=H0){
return RGB(r, g, b);
}

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(WO, HO);
for(intx=0;x<W0;x++)
for (inty = 0; y < H0; y++)
{
colorp0 = im0->GetPixel(x, y);
colorp1 = im1->GetPixel(x, y);

RGB pp = 4 * (RGB(p0) / 4) + RGB(p1) / 64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for(int x=0;x<W;x++)
for (int y = 0; y < H; y++)
{
Color p0 = im->GetPixel(x, y);
RGB pp = 64 * (RGB(p0)% 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

B10433065劉勝威 提到...

//藏圖方法
void image_hide(Bitmap^ im0, Bitmap^ im1) {
//宣告H0,H1,W0,W1 來得到兩張圖的長 跟 寬
int H0 = im0->Height, W0 = im0->Width;
int H1 = im1->Height, W1 = im1->Width;
// 判斷如果兩張圖大小不一樣就跳出程式
if (H0 != H1 || W0 != W1) {
cout << "兩圖大小不合。\n";
return;
}
//宣告物件Bitmap im2 來存藏圖的結果 成為另一張圖 hide.png
Bitmap im2(W0, H0);
Color Black = Color::FromArgb(0, 0, 0);
//兩層迴圈來得到 第一張圖 跟第二張圖-->(要成為藏圖的圖) 的每個Pixel
for (int x = 0; x < W0; x++) {
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);
//藏圖公式 要用多少位元(2的N次)*(rgb(im0)/(2的N次))+rgb(im1)/(A*(2的N次)要=256;
RGB pp = 8*(RGB(p0)/8) + RGB(p1)/32;
//公式算好後 存在一個新宣告物件的顏色 pixel2
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
//pp.R pp.G pp.B 是 藏圖公式計算後的顏色
//再來設定im2每個點(x,y)的顏色(pixel2)
im2.SetPixel(x, y, pixel2);
}
}
//迴圈計算好後另存一個圖檔
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
//藏圖還原方法
void image_showsecret(Bitmap^ im) {
//宣告int W(寬度) H(高度) 為 圖片物件im的 寬度 跟 高度
int W = im->Width, H = im->Height;
//另外宣告一個圖片物件 寬度、高度為要還原的圖片的 寬度 跟 高度
Bitmap im2(W, H);
//雙迴圈來取每一個像素的顏色、並設計還原公式
for (int x = 0; x < W; x++) {
for (int y = 0; y < H; y++) {
//讀取顏色
Color p0 = im->GetPixel(x, y);
//還原公式
RGB pp = 32 * (RGB(p0) % 8);
//每次計算好後將顏色資訊丟給 pixel2
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
//設定im2(還原結果)的每個像素的顏色
im2.SetPixel(x, y, pixel2);
}
}
//存檔
im2.Save("ShowSecret.png");
cout << "ShowSecret.png圖檔產生\n";
}

B10533088葉俊江 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(WO, HO);
for(intx=0;xGetPixel(x, y);
colorp1 = im1->GetPixel(x, y);

RGB pp = 4 * (RGB(p0) / 4) + RGB(p1) / 64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for(int x=0;xGetPixel(x, y);
RGB pp = 64 * (RGB(p0)% 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

B10537208楊蕊筑 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(WO, HO);
for(intx=0;xGetPixel(x, y);
colorp1 = im1->GetPixel(x, y);

RGB pp = 4 * (RGB(p0) / 4) + RGB(p1) / 64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for(int x=0;xGetPixel(x, y);
RGB pp = 64 * (RGB(p0)% 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

B10533071徐琮淇 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(WO, HO);
for(intx=0;xGetPixel(x, y);
colorp1 = im1->GetPixel(x, y);

RGB pp = 4 * (RGB(p0) / 4) + RGB(p1) / 64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for(int x=0;xGetPixel(x, y);
RGB pp = 64 * (RGB(p0)% 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

b10433072廖翊翔 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(WO, HO);
for(intx=0;xGetPixel(x, y);
colorp1 = im1->GetPixel(x, y);

RGB pp = 4 * (RGB(p0) / 4) + RGB(p1) / 64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for(int x=0;xGetPixel(x, y);
RGB pp = 64 * (RGB(p0)% 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

B10533082 洪承楓 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(WO, HO);
for(intx=0;xGetPixel(x, y);
colorp1 = im1->GetPixel(x, y);

RGB pp = 4 * (RGB(p0) / 4) + RGB(p1) / 64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for(int x=0;xGetPixel(x, y);
RGB pp = 64 * (RGB(p0)% 4);
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

B10533006 劉純賓 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; x<W0 ; x++)
for (int y = 0 ; y < H0 ; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; x<W; x++)
for (int y = 0; y < H; y++) {
Color p0 = im->GetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

B10533007 魏辰熾 大帥哥 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; x<W0 ; x++)
for (int y = 0 ; y < H0 ; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; x<W; x++)
for (int y = 0; y < H; y++) {
Color p0 = im->GetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

B10533008 張士晟 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; x<W0 ; x++)
for (int y = 0 ; y < H0 ; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; x<W; x++)
for (int y = 0; y < H; y++) {
Color p0 = im->GetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

B10533007 張仲威 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; x<W0 ; x++)
for (int y = 0 ; y < H0 ; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; x<W; x++)
for (int y = 0; y < H; y++) {
Color p0 = im->GetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; x<W0; x++)
for (int y = 0; y < H0; y++)
{
Color p0 = im0->GetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

B10533093許永炎 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; xGetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

b10533063陳廣制 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; xGetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

b10533063陳廣制 提到...

void image_hide(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x=0 ; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = 4*(RGB(p0)/4) + RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R,pp.G,pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("hide.png");
cout << "hide.png圖檔產生\n";
}
void show_secret(Bitmap^im) {
int W = im->Width, H = im->Height;
Bitmap im2(W, H);
for (int x = 0; xGetPixel(x, y);

RGB pp = 64 *(RGB(p0) % 4);
Color pixel2= Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("show.png");
cout << "show.png圖檔產生\n";
}

void image_encrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0)^RGB(p1)/64;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("cipher.png");
cout << "cipher.png圖檔產生\n";
}
void image_decrypt(Bitmap^im0, Bitmap^im1) {
int W0 = im0->Width, H0 = im0->Height;
int W1 = im1->Width, H1 = im1->Height;
if (W1 != W0 || H1 != H0) {
cout << "圖大小不合。\n";
return;
}
Bitmap im2(W0, H0);
for (int x = 0; xGetPixel(x, y);
Color p1 = im1->GetPixel(x, y);

RGB pp = RGB(p0) ^ RGB(p1);
pp = 64 * pp;
Color pixel2 = Color::FromArgb(pp.R, pp.G, pp.B);
im2.SetPixel(x, y, pixel2);
}
im2.Save("recover.png");
cout << "recover.png圖檔產生\n";
}

Related Posts Plugin for WordPress, Blogger...

熱門文章