In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
C++ how to use OpenCV to achieve mouse response to events, for this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
Code implementation
Let's create a new project named opencv--Grabcut, follow the configuration properties (VS2017 configure OpenCV generic properties), and then write # include and main methods in the source file.
In the picture above, we have directly written the callback events of the mouse. This is not the point, but our mouse events.
Let's start with the focus of the mouse event:
Define basic parameters and methods
The title of the display we defined in the above figure is src, which will not be discussed, and then two Mat, a rectangular rect, are defined. There is also a showimage () method at the bottom, which is how to display the image.
The most important method is onMouse (int event, int x drawing int y, int flags, void* param), which is used to handle mouse operations.
Operation logic of mouse
The mouse writes three events when the left button is pressed, when the left button is pressed and when the mouse is moved, and when the left button is released.
Image display method
This is the answer to the question about how to use OpenCV to respond to events in C++. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.