コード例 #1
0
        private void ButtonEmbossFiltering_Click(object sender, EventArgs e)
        {
            if (PictureBoxMain.Image == null)
            {
                return;
            }
            // Photo Width,Height Setting
            int    w   = PictureBoxMain.Image.Width;
            int    h   = PictureBoxMain.Image.Height;
            Bitmap bmp = new Bitmap(PictureBoxMain.Image);

            byte[] col = Get3BytePixelDataFromBitmap(bmp, w, h);

            byte[] ret = new byte[w * h * 3];

            // EngineImageEmbossing Callback
            intPtr = GetProcAddress(m_hDLL, "EngineImageEmbossing");
            EngineImageProcessCS GetEmbossingImage =
                (EngineImageProcessCS)Marshal.GetDelegateForFunctionPointer(intPtr,
                                                                            typeof(EngineImageProcessCS));

            GetEmbossingImage(ret, col, w, h, 24);

            Display3BytePixelDataToPictureBox(ret, w, h, 24);

            Bitmap bmpret = Get32BitBitmapFrom24BitPixelData(ret, w, h, 24);

            bmpret.Save("E.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

            label_message.Text = "w= " + PictureBoxMain.Image.Width + " h= " + PictureBoxMain.Image.Height;
        }
コード例 #2
0
        private void ButtonHorMirroring_Click(object sender, EventArgs e)
        {
            if (PictureBoxMain.Image == null)
            {
                return;
            }

            int    w   = PictureBoxMain.Image.Width;
            int    h   = PictureBoxMain.Image.Height;
            Bitmap bmp = new Bitmap(PictureBoxMain.Image);

            byte[] col = Get3BytePixelDataFromBitmap(bmp, w, h); //원본영상 가져오기

            byte[] ret = new byte[w * h * 3];                    // 변환영상 가져오기

            // Dll함수 호출
            intPtr = GetProcAddress(m_hDLL, "EngineHorImageMirror");
            EngineImageProcessCS GetHorMirrorImage =
                (EngineImageProcessCS)Marshal.GetDelegateForFunctionPointer(intPtr,
                                                                            typeof(EngineImageProcessCS));

            GetHorMirrorImage(ret, col, w, h, 24);

            Display3BytePixelDataToPictureBox(ret, w, h, 24);

            Bitmap bmpret = Get32BitBitmapFrom24BitPixelData(ret, w, h, 24);

            bmpret.Save("M.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

            label_message.Text = "수평방향 대칭변환 이미지 !!";
        }