Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MoveWindow() missing in C++ OpenCV 2.3

Tags:

c++

python

c

opencv

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.

like image 815
Chris Avatar asked Jul 04 '11 10:07

Chris


1 Answers

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.

like image 195
karlphillip Avatar answered Nov 08 '22 21:11

karlphillip