LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a rotated rectangle ROI ?

When I use imaqSetEventCallback(..), the callback protype is:

void IMAQ_CALLBACK MyCallback(WindowEventType type, int windowNumber, Tool tool, Rect rect);
1)for WindowEventType it will be:IMAQ_CLICK_EVENT;IMAQ_DRAW_EVENT etc.;
2)Tool will be one of:IMAQ_LINE_TOOL, IMAQ_ROTATED_RECT_TOOL etc.;
 
Now I want to create a rotated rectangle ROI in my callback. 
 
void IMAQ_CALLBACK visionWindowCallback(WindowEventType event, int windowNumber, Tool tool, Rect rect)  
{
        switch (event)
        {
                  case IMAQ_DRAW_EVENT:   //The user drew an ROI in a window
                        userRect = rect;
               
                        /* Clear overlay associated with the current image */
                        imaqClearOverlay (mainImage, NULL);
 
                        /* Get region of interest from image UI */
                        imaqRemoveContour (myRoi, IMAQ_ALL_CONTOURS);
                        imaqAddRectContour(myRoi,userRect);
                       
                        break;
        }
 
}
Rotated Rectangle structure has below info:top,left,width, height, angle.
To get a rotated rectangle ROI I need use imaqAddRotatedRectContour to replace imaqAddRectContour in above code。
 
My problem is how I can get angle info in above code, or any other method to do this? 
Thank you.
0 Kudos
Message 1 of 1
(4,294 Views)