我们在做工程应用时,经常少不了鼠标的交互,这篇博客就是关于在图像上使用鼠标选取感兴趣区域
#include <opencv2/core/core.hpp>
Rect selection;
Point origin;
Mat frame;
bool trackObject = false;
bool selectObject;
void onMouse(int event, int x, int y, int, void*)
{
if (selectObject)
{
selection.x = MIN(x, origin.x);
selection.y = MIN(y, origin.y);
selection.width = std::abs(x - origin.x);
selection.height = std::