Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ROI

hi~
 
i have a question for how can i get the informations of ROI axis value from "NationalInstruments.CWIMAQControls.AxCWIMAQViewer" control.
 
i can acquire a image from an image graber by using "axCWIMAQ1.Start()" method.
and also can set the ROI by using "AxCWIMAQViewer" Control.
but i can't find how to get the location value of the selected ROI. (actually i can see the location value by checking "Show Tool Info" check box which is located in "AxCWIMAQViewer's properties", but i want to use that information in C# code.)
 
i need your help~~
 
 
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        private void button1_Click(object sender, EventArgs e)
        {
            axCWIMAQViewer1.Image.Type = NationalInstruments.CWIMAQControls.CWIMAQImageTypes.cwimaqImageTypeU8;
            axCWIMAQ1.IMAQError += new NationalInstruments.CWIMAQControls._AxDCWIMAQEvents_IMAQErrorEventHandler(VisionError);
            axCWIMAQ1.Interface = "img0";
            axCWIMAQ1.Channel = 0;
            axCWIMAQ1.AcquiredImageEnabled = true;
           
            axCWIMAQViewer1.Attach(axCWIMAQ1.Images.Item(1));
            axCWIMAQ1.AcquisitionType = NationalInstruments.CWIMAQControls.CWIMAQAcquisitionTypes.cwimaqAcquisitionContinuous;

            axCWIMAQ1.Start();

        }
        private void RegionsChanged(object sender, _DCWIMAQViewerEvents_RegionsChangedEvent e)
        {
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //how can i get the location of changed or selected region????????????
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        }
 
0 Kudos
Message 1 of 2
(3,215 Views)

Hey TEEM_ME,

Thanks for contacting NI.  I've been experimenting with your problem.  In LabVIEW you can do it with a simple invoke node on the image display.  In C#, it's a little trickier.  I believe the function you are looking for is:

ax

CWIMAQViewer1.Regions.GetBoundingRectangle(Rectangle r); 

This function sets the rectangle r to point to the 2 xy coordinates of the corners of the rectangle of the ROI.  Also, I found this forum to be of help.  I hope this helps you out.  Let me know if I can answer any more questions.

Thanks,

Evan D.
Installer R&D
National Instruments
0 Kudos
Message 2 of 2
(3,186 Views)