Ejemplo n.º 1
0
        private void DCTBTN_Click(object sender, EventArgs e)
        {
            Bitmap Temp = new Bitmap(RDWTImage.Image);

            DCTTrans = new DCT(Temp);
            DCTTrans.DCT_Transform(Hostred);
            DCTTrans.DCT_Transform(Hostgreen);
            DCTTrans.DCT_Transform(Hostblue);
            generateImage(Hostred, Hostgreen, Hostblue, original.src);
            RDWTImage.Image = original.src;

            Temp     = new Bitmap(RDWTWatermark.Image);
            DCTTrans = new DCT(Temp);
            DCTTrans.DCT_Transform(Wmred);
            DCTTrans.DCT_Transform(Wmgreen);
            DCTTrans.DCT_Transform(Wmblue);
            generateImage(Wmred, Wmgreen, Wmblue, Watermark.src);
            RDWTWatermark.Image = Watermark.src;
        }
Ejemplo n.º 2
0
        public void extractedImage()
        {
            wm   = new Bitmap(RDWTWatermark.Image, new Size(RDWTWatermark.Width, RDWTWatermark.Height));
            host = new Bitmap(RDWTImage.Image, new Size(RDWTImage.Width, RDWTImage.Height));
            vtwm = new Bitmap(watermarkedImg.Image, new Size(watermarkedImg.Width, watermarkedImg.Height));

            extractedImg.Invoke((MethodInvoker)(() => extractedImg.Image = vtwm));
            Wmred   = new double[wm.Width, wm.Height];
            Wmgreen = new double[wm.Width, wm.Height];
            Wmblue  = new double[wm.Width, wm.Height];
            getValueColor(Wmred, Wmgreen, Wmblue, wm);

            Hostred   = new double[host.Width, host.Height];
            Hostgreen = new double[host.Width, host.Height];
            Hostblue  = new double[host.Width, host.Height];
            getValueColor(Hostred, Hostgreen, Hostblue, host);

            vtWmRed   = new double[vtwm.Width, vtwm.Height];
            vtWmGreen = new double[vtwm.Width, vtwm.Height];
            vtWmBlue  = new double[vtwm.Width, vtwm.Height];
            getValueColor(vtWmRed, vtWmGreen, vtWmBlue, vtwm);

            rdwt WmRdwt = new rdwt();

            WmRdwt.rdwtTransform(Wmred);
            WmRdwt.rdwtTransform(Wmgreen);
            WmRdwt.rdwtTransform(Wmblue);

            rdwt HostRdwt = new rdwt();

            HostRdwt.rdwtTransform(Hostred);
            HostRdwt.rdwtTransform(Hostgreen);
            HostRdwt.rdwtTransform(Hostblue);

            rdwt WRdwt = new rdwt();

            WRdwt.rdwtTransform(vtWmRed);
            WRdwt.rdwtTransform(vtWmGreen);
            WRdwt.rdwtTransform(vtWmBlue);

            generateImage(Wmred, Wmgreen, Wmblue, wm);
            generateImage(Hostred, Hostgreen, Hostblue, host);
            generateImage(vtWmRed, vtWmGreen, vtWmBlue, vtwm);

            extractedImg.Invoke((MethodInvoker)(() => extractedImg.Image = vtwm));
            //RDWTImage.Image = host;
            //RDWTWatermark.Image = wm;

            DCT WmDct   = new DCT(wm);
            DCT HostDct = new DCT(host);
            DCT VtWmDct = new DCT(vtwm);

            WmDct.DCT_Transform(Wmred);
            DCTTrans.DCT_Transform(Wmgreen);
            DCTTrans.DCT_Transform(Wmblue);
            generateImage(Wmred, Wmgreen, Wmblue, wm);

            HostDct.DCT_Transform(Hostred);
            HostDct.DCT_Transform(Hostgreen);
            HostDct.DCT_Transform(Hostblue);
            generateImage(Hostred, Hostgreen, Hostblue, host);

            VtWmDct.DCT_Transform(vtWmRed);
            VtWmDct.DCT_Transform(vtWmGreen);
            VtWmDct.DCT_Transform(vtWmBlue);
            generateImage(vtWmRed, vtWmGreen, vtWmBlue, vtwm);

            extractedImg.Invoke((MethodInvoker)(() => extractedImg.Image = vtwm));

            vtWmRed   = Extracted_pso_operation(Hostred, Wmred, vtWmRed, host, wm, vtwm, sWmRed);
            vtWmGreen = Extracted_pso_operation(Hostgreen, Wmgreen, vtWmGreen, host, wm, vtwm, swGreen);
            vtWmBlue  = Extracted_pso_operation(Hostblue, Wmblue, vtWmBlue, host, wm, vtwm, swBlue);
            generateImage(vtWmRed, vtWmGreen, vtWmBlue, vtwm);

            DCT vtIDCT = new DCT(vtwm);

            vtIDCT.InverseDCT(vtWmRed);
            vtIDCT.InverseDCT(vtWmGreen);
            vtIDCT.InverseDCT(vtWmBlue);
            generateImage(vtWmRed, vtWmGreen, vtWmBlue, vtwm);
            extractedImg.Invoke((MethodInvoker)(() => extractedImg.Image = vtwm));

            int row = vtWmRed.GetLength(0) >> 1;
            int col = vtWmRed.GetLength(1) >> 1;


            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < col; j++)
                {
                    Wmred[i, j]   = vtWmRed[i, j];
                    Wmgreen[i, j] = vtWmGreen[i, j];
                    Wmblue[i, j]  = vtWmGreen[i, j];
                }
            }
            rdwt irdwt = new rdwt();

            irdwt.InverseRDWT(Wmred);
            irdwt.InverseRDWT(Wmgreen);
            irdwt.InverseRDWT(Wmblue);
            generateImage(Wmred, Wmgreen, Wmblue, vtwm);
            extractedImg.Invoke((MethodInvoker)(() => extractedImg.Image = vtwm));
        }