herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
你會用C的算子sizeof?
-
XOR prefixsum CPP python解Leetcode 1829 Maximum XOR for Each Query 其實這裡考慮的是元素個數為2^maximumBit的交換群,運算子為XOR。 [Python code請進]
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
20 則留言:
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";
}
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";
}
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";
}
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;
}
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_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";
}
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";
}
//藏圖方法
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
張貼留言