I took over development work on an augmented reality game, currently running on windows 10, that has extensive use of OpenCV throughout; including vision (tracking) functions, image processing (blob detection and removal), and creation of the user interface via highgui. The game also allows for the usage of button-controllers to assist with play; the buttons are custom wired to a usb mouse, windows recognizes the button controllers as generic HIDs. A “control” namedwindow with trackbars was created to allow adjustment of game parameters during runtime; setmousecallback() was assigned to this control window. I will include segments of the code below; I am trying to release the mouse-control from the window while the game functions, so the cursor does not have to be located over the control window. Currently, the window must have mouse control with the cursor on a portion of the window, or the two button-controllers will not work. The windows api includes the ReleaseCapture() function, which appears to perform the task I am looking to implement. However, there appears to be no equivalent function in OpenCV. I am seeking advice about how to do this for the “control” namedwindow. My perception is the only way this can happen is to reprogram the button-controllers so they are seen as raw input devices, rather than a HID usb mouse.
The callback function simply returns the appropriate boolean value if a button-controller is pressed or released.
the UI code:
cv::Mat lmouse_img = imread(“mouse.png”);
namedWindow(“control”, WINDOW_NORMAL);
moveWindow(“control”, 1000, 0);
resizeWindow(“control”, 400, 1000);
imshow(“control”, lmouse_img);
setMouseCallback("control", CallBack_mouse, NULL);
//parameter window
cv::createTrackbar("goalSize1", "control", &theField.goalSize_p1, 200);
cv::createTrackbar("goalSize2", "control", &theField.goalSize_p2, 200);