07-23-2020 05:58 AM
Hello,
I would like to allow a user to select a rotated rectangle from an image acquired from a camera. The function imaqSelectRect looks to be exactly what I need (and is included in the help file). However the function seems to be missing from the actual ni_vision library. Any thoughts on where this function may have gone? For completeness I have copied the relevant "help" text on this function below.
In the absence of this function, how can I go about getting back a RotatedRect from an image control window? I can enable the rotated rectangle selection tool, but in my callback that I am using to capture events from this window (using the imaqSetEventCallback function) it seems like all that is passed is a standard Rect struct as opposed to a RotatedRect (even though the tool used is the rotate rectangle selection tool)
Any help is greatly appreciated.
Thanks,
Alex Corwin
int imaqSelectRect(const Image* image, RotatedRect* rect, const ConstructROIOptions* options, int* okay);
Displays the image in a modal window and allows the user to draw a rectangle on it. After the user draws the rectangle, the function hides the window.
IMAQ_IMAGE_U8, IMAQ_IMAGE_U16, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL, IMAQ_IMAGE_COMPLEX, IMAQ_IMAGE_RGB, IMAQ_IMAGE_HSL, IMAQ_IMAGE_RGB_U64
| Name |
Type |
Description |
|---|---|---|
| image | const Image* | The image from which the user selects a rectangle. |
| rect | RotatedRect* | On return, this parameter specifies the coordinates of the rectangle chosen by the user. If the user does not select a rectangle, the function sets all of the elements of rect to –1. This parameter is required and cannot be NULL. |
| options | const ConstructROIOptions* | Describes how a function presents the rectangle constructor window. |
| okay | int* | On return, this parameter is TRUE if the user pressed the OK button to end the selection of a rectangle. Otherwise, this parameter is FALSE. Set this parameter to NULL if you do not need this information. |
| Type |
Description |
|---|---|
| int | On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError(). |
options—Set options to NULL to use the default options, as follows:
| windowNumber | IMAQ_MODAL_DIALOG |
| windowTitle | "Select a Rectangle" |
| type | IMAQ_PALETTE_GRAY |
| palette | NULL |
| numColors | 0 |
07-30-2020 07:42 AM
Hello Alex,
I reviewed in LabWindows/CVI if I was able to see the function, but just like you, I couldn't find it. As you said, it is a function that is included in the help file (which I also read and found in the help files included in the installation of the software). I also reviewed all the files associated with vision in my computer and researched for a specific file with the name of the function, but I couldn't find it.
I discussed this with colleagues, and we were able to file a Bug Report on this case since there is no real indication of why the function is not available anymore. It will not be fixed immediately, but it will be considered for future releases.
Thank you for pointing this out to us!