Ejemplo n.º 1
0
 // Show image in image viewer
 static void ShowImageInViewer(DaVinciAPI.ImageInfo image)
 {
     if (imageViewer != null && imageViewer.ImageBox != null)
     {
         if (imageViewer.ImageBox.InvokeRequired && !imageViewer.ImageBox.IsDisposed)
         {
             if (Interlocked.CompareExchange(ref displayCapturedImageLock, 1, 0) == 0)
             {
                 imageViewer.ImageBox.BeginInvoke((Action <DaVinciAPI.ImageInfo>)ShowImageInViewer, image);
             }
             else
             {
                 DaVinciAPI.NativeMethods.ReleaseImage(ref image);
             }
         }
         else
         {
             if (imageViewer.ImageBox.IsDisposed == false)
             {
                 imageViewer.ImageBox.Image = image;
             }
             Interlocked.Exchange(ref displayCapturedImageLock, 0);
         }
     }
 }
Ejemplo n.º 2
0
 private void ShowImage(DaVinciAPI.ImageInfo img)
 {
     if (CreateTestSelect.fpsForm != null)
     {
         var form = CreateTestSelect.fpsForm;
         if (form.launchTimeImageBox != null &&
             form.launchTimeImageBox.InvokeRequired &&
             !form.launchTimeImageBox.IsDisposed)
         {
             if (Interlocked.CompareExchange(ref displayVideoImageLock, 1, 0) == 0)
             {
                 form.launchTimeImageBox.BeginInvoke((Action <DaVinciAPI.ImageInfo>)ShowImage, img);
             }
             else
             {
                 DaVinciAPI.NativeMethods.ReleaseImage(ref img);
             }
         }
         else
         {
             if (form.launchTimeImageBox != null && form.launchTimeImageBox.IsDisposed == false)
             {
                 form.launchTimeImageBox.Image = img;
             }
             Interlocked.Exchange(ref displayVideoImageLock, 0);
         }
     }
 }
        private void launchTimeImageBox_MouseUp(object sender, MouseEventArgs e)
        {
            //Cursor.Clip = Rectangle.Empty;
            this.isMouseDown = false;
            if (this.isCuttingPicture)
            {
                DrawRectangleOnImageBox();

                // Save the picture.
                if ((this.launchTimeImageBox.Image.iplImage) != null && (this.launchTimeImageBox.Image.mat != null))
                {
                    DaVinciAPI.ImageInfo current = getCurrentFrame();
                    if (current.iplImage == null || current.mat == null)
                    {
                        return;
                    }

                    picFileName = GetPictureShotFileName();
                    if (current.iplImage != IntPtr.Zero)
                    {
                        Bitmap imgSave = DaVinciCommon.ConvertToBitmap(current.iplImage);
                        imgSave.Save(picFileName, ImageFormat.Png);
                        MessageBox.Show(picFileName + " has been saved!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                mouseRect             = Rectangle.Empty;
                this.isCuttingPicture = false;
                this.Cursor           = Cursors.Default;
            }
        }
Ejemplo n.º 4
0
 static void DisplayImage(ref DaVinciAPI.ImageInfo image)
 {
     // console mode
     if (consoleMode)
     {
         ShowImageInViewer(image);
     }
     else
     {
         mainWindowInst.ShowImgInMainWindow(image);
     }
 }
Ejemplo n.º 5
0
 private void DisplayImgLaunchTimeVideo(ref DaVinciAPI.ImageInfo img)
 {
     DaVinciAPI.ImageInfo showImg;
     if (isImgBoxVertical)
     {
         showImg = DaVinciAPI.NativeMethods.RotateImage(ref img, 90);
         DaVinciAPI.NativeMethods.ReleaseImage(ref img);
     }
     else
     {
         showImg = img;
     }
     ShowImage(showImg);
 }
 private void GetImgData(ref DaVinciAPI.ImageInfo img)
 {
     queryFrame = img;
 }