Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

How Do I Merge an Overlay in C#?

Primary Software: Vision Development Module
Primary Software Version: 8.5
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I know how to create an overlay on an image within my C# project, but now I want to actually merge that overlay with the image data. How do I do that?

Solution:
Attached below is an example of using the merge overlay function within a C# project.  The line that performs the actual overlay has the following syntax:

CWIMAQViewer.Image.Overlays.Item(1).Merge(System.Type.Missing);

The parameter that is most often missed when calling this method is System.Type.Missing, and it will cause an error if omitted or void. To run the attached example, open the project included in the ZIP file and save the attached image, current.png, to your C drive. The resulting path should be C:\current.png. When executed, the program will create a new file called current1.png that will have a rectangle overlayed on it that has been merged with the example line of code.

Related Links:
KnowledgeBase 3FBELMKZ: Do NI-IMAQ and NI Vision Support Microsoft Visual Studio .NET?
Developer Zone Example: Snap and Grab with NI-IMAQ for IEEE 1394 Cameras in C#

Attachments:

current.png
MergeOverlay.zip






Report Date: 08/15/2008
Last Updated: 03/03/2009
Document ID: 4OEAM5DT

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit