Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Where can I find example of vbnet code to snap or grab images

Solved!
Go to solution

I find several examples for image capture ( Snap, Grab, etc) written for vb6 and c++, but not a single example using vbnet. Am I missing something?

0 Kudos
Message 1 of 4
(6,458 Views)

This code takes a full screen screenshot and saves it to a specified file location:

 

  Dim bmpSS As Bitmap
  Dim gfxSS As Graphics

        bmpSS = New Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
        gfxSS = Graphics.FromImage(bmpSS)
        gfxSS.CopyFromScreen(Screen.PrimaryScreen.WorkingArea.X, Screen.PrimaryScreen.WorkingArea.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy)

  bmpSS.Save("C:\sample.bmp", System.Drawing.Imaging.ImageFormat.Bmp)

 

0 Kudos
Message 2 of 4
(6,448 Views)

I guess I was not specific enough. I have Vision Development Module and SCA640 70 gm GigE camera using NI IMAQdx driver. I want to snap or grab an image from camera and then process image. Apparently Active X NIDAQ control only works with IMAQ but not IMAQdx driver required by GigE camera. NI has info on using capture software, but no info that I can  find on doing this in VB without using Active X controls. 

 

0 Kudos
Message 3 of 4
(6,437 Views)
Solution
Accepted by topic author philgo

.NET examples are shipped with our vision acquisition software, however you must specify that you would like the examples installed during installation.  Usually this option will automatically be selected if the installer can see you already have the development environment installed.  In order to install the NI-IMAQdx and other image acquisition driver examples you would need to perform a repair/install for the software and select the examples to be installed.  First you would need to go to Windows control panel->programs and features:

 

prms&features.JPG

 

Next select National Instrumenst Software the click 'Uninstall/change'.  The following window should pop up.

 

NatinoalInstrumentsSW.JPG

 

 

Select NI-IMAQdx and click MODIFY

 

dotNetExamples.JPG

 


Select to install the examples under .NET Languages support.  After the examples are installed they should be located under:

 

Start >>Programs>>Nationals Instruments>>Vision>>Text-based Examples>>NI-IMAQdx>>dotNET Examples

 

Regards,
Isaac S.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(6,428 Views)