資源簡介
test.cpp
代碼片段和文件信息
#include
#include
#include
using?namespace?cv;
#include
#include
bool?drawing_box?=?false;
bool?gotBox?=?false;
Rect?box;
Point?downPoint;
/*----定義鼠標事件--畫矩形區域----*/
void?mouseRectHandler(int?event?int?x?int?y?int?flags?void?*param)
{
switch?(event)
{
case?CV_EVENT_MOUSEMOVE:
if?(drawing_box)
{
//鼠標的移動到downPoint的右下角
if?(x?>=?downPoint.x?&&?y?>=?downPoint.y)
{
box.x?=?downPoint.x;
box.y?=?downPoint.y;
box.width?=?x?-?downPoint.x;
box.height?=?y?-?downPoint.y;
}
//鼠標的移動到downPoint的右上角
if?(x?>=?downPoint.x?&&?y?<=?downPoint.y)
{
box.x?=?downPoint.x;
box.y?=?y;
box.width?=?x?-?downPoint.x;
box.height
- 上一篇:5G中文協議
- 下一篇:c6client.cpp
評論
共有 條評論