I am using the C++ version of OpenCV 2.3 and am struggling to do a basic task. What I would like to do is create a window and move it to a specific location on the screen using for example:
cv::namedWindow("My Window", 1);
cv::MoveWindow("My Window", 10, 10);
However, it appears that the MoveWindow() function is not available. From the OpenCV 2.3 documentation (link) there appears to be C and Python implementations, but no C++. Does this mean there is a better way to be doing this?
From the relevant section of the documentation:
MoveWindow
==========
Moves window to the specified position
--------------------------------------
C: void cvMoveWindow(const char* name, int x, int y)
Python: cv.MoveWindow(name, x, y) → None
Parameters:
- name – Window name
- x – The new x-coordinate of the window
- y – The new y-coordinate of the window
RESOLVED: As of the latest version of OpenCV, there is now a cv::MoveWindow("const string& winname, int x, int y)
function. Reference here.
You are supposed to use the C function for this:
cvMoveWindow(const char* name, int x, int y);
You can verify this info by downloading OpenCV 2.3 for *nix, and under the C++ samples directory OpenCV-2.3.0/samples/cpp/tutorial_code/Basic/
search for a file named Drawing_1.cpp. It uses the C++ interface for everything.. except, moving the window.
Looks like the C++ interface doesn't have a method for this task.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With