Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

filling an overlay

Is it possible to fill an overlay with a custom color? I know you can set the pen color for the boundary pixels, but I'm curious if it's possible to set all the pixels within the boundary to a color like green or blue.
0 Kudos
Message 1 of 2
(3,185 Views)
I finally figured this out! I hope it makes sense.



CCWIMAQViewer m_cImageControl; //Imaq Viewer control variable (ActiveX control)
CCWIMAQVision m_cVisionLib;//Imaq Vision control variable (ActiveX control)

CWIMAQProfileReportItem item;

LPDISPATCH regionsDisp = m_cImageControl.GetRegions();//Get user drawn image
regionsDisp->AddRef();
_CWIMAQRegions regions(regionsDisp);

//Get a profile of the user drawn regions from the image viewer window
m_cVisionLib.RegionsProfile(m_cImageControl.GetImage(), m_cImageControl.GetRegions(), profileReport);


item = profileReport.Item(COleVariant((long)1));

//Get the coordinates of each point along the user defined region
LPDISPATCH coordinatesDispatch = m_cVisionLib.CreateCWIMAQPoints();
coordinatesDispatch = item.GetCoordinates();

//Create a image and initialize it to the image in the current image view window
LPDISPATCH imageDisp = m_cImageControl.GetImage();
imageDisp->AddRef();
_CWIMAQImage displayedImage(imageDisp);

//get the overlays on the current image
LPDISPATCH overlaysDisp = displayedImage.GetOverlays();
overlaysDisp->AddRef();
CWIMAQOverlays overlays(overlaysDisp);

LPDISPATCH overlayDisp = overlays.Item(COleVariant((long)1));
overlayDisp->AddRef();
CWIMAQOverlay overlay(overlayDisp);


//draw the region of interest points on the overlay, filling in the region of interest with a specific region color
overlay.DrawConnectedPoints(coordinatesDispatch,1,COleVariant((long)16711680));
0 Kudos
Message 2 of 2
(3,162 Views)