当前位置: 首页 > news >正文

貴阳建设银行网站网页设计个人网页html代码

貴阳建设银行网站,网页设计个人网页html代码,我有一个网站怎么做外贸,学校网站风格ubuntu22.04laptop OpenCV Get Started: 012_mouse_and_trackbar 1. 源由2. mouse/trackbar应用Demo2.1 C应用Demo2.2 Python应用Demo 3. 鼠标位置跟踪注释3.1 注册回调函数3.2 回调操作3.3 效果 4. 使用轨迹栏调整图像大小4.1 初始化轨迹栏注册回调函数4.2 回调操作4.3 效… ubuntu22.04laptop OpenCV Get Started: 012_mouse_and_trackbar 1. 源由2. mouse/trackbar应用Demo2.1 C应用Demo2.2 Python应用Demo 3. 鼠标位置跟踪注释3.1 注册回调函数3.2 回调操作3.3 效果 4. 使用轨迹栏调整图像大小4.1 初始化轨迹栏注册回调函数4.2 回调操作4.3 效果 4. 总结5. 参考资料6. 补充 1. 源由 鼠标指针和轨迹条是图形用户界面GUI中的关键组件。 如果没有这些关键交互组件就无法真正考虑与GUI交互。 因此结合演示代码了解OpenCV中鼠标和轨迹条的内置功能对于程序交互来说至关重要。 2. mouse/trackbar应用Demo 012_mouse_and_trackbar是OpenCV通过鼠标指针和轨迹条与用户交互的示例。 2.1 C应用Demo C应用Demo工程结构 012_mouse_and_trackbar/CPP$ tree . . ├── Mouse │ ├── CMakeLists.txt │ └── mouse.cpp └── Trackbar├── CMakeLists.txt└── trackbar.cpp2 directories, 4 files确认OpenCV安装路径 $ find /home/daniel/ -name OpenCVConfig.cmake /home/daniel/OpenCV/installation/opencv-4.9.0/lib/cmake/opencv4/ /home/daniel/OpenCV/opencv/build/OpenCVConfig.cmake /home/daniel/OpenCV/opencv/build/unix-install/OpenCVConfig.cmake$ export OpenCV_DIR/home/daniel/OpenCV/installation/opencv-4.9.0/lib/cmake/opencv4/C应用Demo工程编译执行 $ cd Mouse $ mkdir build $ cd build $ cmake .. $ cmake --build . --config Release $ cd .. $ ./build/mouse$ cd Trackbar $ mkdir build $ cd build $ cmake .. $ cmake --build . --config Release $ cd .. $ ./build/trackbar2.2 Python应用Demo Python应用Demo工程结构 012_mouse_and_trackbar/Python$ tree . . ├── requirements.txt ├── mouse.py └── trackbar.py0 directories, 3 filesPython应用Demo工程执行 $ workoncv-4.9.0 $ python mouse.py $ python trackbar.py3. 鼠标位置跟踪注释 3.1 注册回调函数 OpenCV提供了鼠标事件检测功能用于检测各种鼠标操作。 代码上采用注册回调函数方式实现 C: // highgui function called when mouse events occur setMouseCallback(Window, drawRectangle);Python: # highgui function called when mouse events occur cv2.setMouseCallback(Window, drawRectangle)3.2 回调操作 当有鼠标操作时 EVENT_LBUTTONDOWN记录左上角坐标EVENT_LBUTTONUP记录右下角坐标并更新图像 实现对左上角和右下角的框选矩形框标注选择范围。 C: // Points to store the center of the circle and a point on the circumference Point top_left_corner, bottom_right_corner; // image image Mat image;// function which will be called on mouse input void drawRectangle(int action, int x, int y, int flags, void *userdata) {// Mark the center when left mouse button is pressedif( action EVENT_LBUTTONDOWN ){top_left_corner Point(x,y);}// When left mouse button is releasedelse if( action EVENT_LBUTTONUP){bottom_right_corner Point(x,y);// Draw rectanglerectangle(image, top_left_corner, bottom_right_corner, Scalar(0,255,0), 2, 8 );// Display imageimshow(Window, image);}}Python: # Lists to store the points top_left_corner[] bottom_right_corner[]# Define drawRectangle function def drawRectangle(action, x, y, flags, *userdata):# Referencing global variables global top_left_corner, bottom_right_corner# Action to be taken when left mouse button is pressedif action cv2.EVENT_LBUTTONDOWN:top_left_corner [(x,y)]# Action to be taken when left mouse button is releasedelif action cv2.EVENT_LBUTTONUP:bottom_right_corner [(x,y)] # Draw the rectanglecv2.rectangle(image, top_left_corner[0], bottom_right_corner[0], (0,255,0),2, 8)cv2.imshow(Window,image)3.3 效果 4. 使用轨迹栏调整图像大小 4.1 初始化轨迹栏注册回调函数 创建轨迹栏对象时代码上采用注册回调函数方式实现 C: int maxScaleUp 100; int scaleFactor 1;string windowName Resize Image; string trackbarValue Scale;// Create Trackbars and associate a callback function createTrackbar(trackbarValue, windowName, scaleFactor, maxScaleUp, scaleImage);Python: maxScaleUp 100 scaleFactor 1 windowName Resize Image trackbarValue Scale# Create trackbar cv2.createTrackbar(trackbarValue, windowName, scaleFactor, maxScaleUp, scaleImage)4.2 回调操作 当有拖动轨迹栏滑块时调用回调函数。根据滑块位置对图像进行比例缩放。 C: // Callback functions void scaleImage(int, void*) {// Read the imageMat image imread(../../Input/sample.jpg);// Get the Scale factor from the trackbardouble scaleFactorDouble 1 scaleFactor/100.0;// Set the factor to 1 if becomes 0if (scaleFactorDouble 0){scaleFactorDouble 1;}Mat scaledImage;// Resize the imageresize(image, scaledImage, Size(), scaleFactorDouble, scaleFactorDouble, INTER_LINEAR);// Display the imageimshow(windowName, scaledImage); }Python: # Callback functions def scaleImage(*args):# Get the scale factor from the trackbar scaleFactor 1 args[0]/100.0# Resize the imagescaledImage cv2.resize(image, None, fxscaleFactor, fy scaleFactor, interpolation cv2.INTER_LINEAR)cv2.imshow(windowName, scaledImage)4.3 效果 通过轨迹栏的拖动实现图像的放大缩小。 4. 总结 本文通过设置setMouseCallback和createTrackbar注册鼠标操作回调函数和轨迹栏空间回调函数实现对应的OpenCV图像操作。 setMouseCallback(winname, onMouse, userdata) winname Name of the window.onMouse Callback function for mouse events. See OpenCV samples on how to specify and use the callback.userdata The optional parameter passed to the callback. createTrackbar( trackbarName, windowName, value, count, onChange) trackbarname Name of the created trackbar.winname Name of the window that will be used as a parent of the created trackbar.value Optional pointer to an integer variable whose value reflects the position of the slider. Upon creation, the slider position is defined by this variable.count Maximal position of the slider. The minimal position is always 0.onChange Pointer to the function to be called every time the slider changes position. This function should be prototyped as void Foo(int,void*); , where the first parameter is the trackbar position and the second parameter is the user data (see the next parameter). If the callback is the NULL pointer, no callbacks are called, but only value is updated.userdata User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables. 5. 参考资料 【1】ubuntu22.04laptop OpenCV Get Started 【2】ubuntu22.04laptop OpenCV安装 【3】ubuntu22.04laptop OpenCV定制化安装 6. 补充 学习是一种过程对于前面章节学习讨论过的就不在文中重复了。 有兴趣了解更多的朋友请从《ubuntu22.04laptop OpenCV Get Started》开始一个章节一个章节的了解循序渐进。
http://www.hkea.cn/news/14449126/

相关文章:

  • 移动端的网站模板dw个人网站制作
  • 白云区专业网站建设外包项目网站
  • 网站名称注意事项荔枝fm入口
  • 海西州电子商务网站建设公司WordPress文章归档错误
  • 万网云服务器怎么上传网站邮箱购买自动发卡
  • 港闸网站建设网站建设与应用 教案
  • 宿迁网站建设SEO优化营销响水做网站的价格
  • 凡科免费建站台州自助建站公司
  • 岳溥庥网站建设用网站做自我介绍自己
  • 免费站长统计工具网站开发 技术架构
  • 网站建设拾金手指下拉二一腾讯小程序官网首页
  • 那里有做网站网站推广公司大家好
  • wordpress制作购物网站网站设计原型图怎么做
  • 如何做一份网站的数据分析深圳网页设计与制作工资多少钱
  • 网站开发要哪些免费领取手机网站
  • 网站建设 营业执照 经营范围做便民网站都需要哪些模块
  • 请详细说明网站开发流程及原则框架做网站指的是
  • 网站平台开发与应用面试上海自贸区注册公司流程和费用
  • 网站上的高清动态图怎么做的凌晨三点看的片韩国
  • 网站查备案密码手工制作网站
  • 贵阳网站定制开发佛山网站快照优化公司
  • wordpress站内链接电商网站的支付模块怎么做
  • 专业做网站咨询有哪些外贸公司网站做的比较好
  • 如何建设远程教育网站wordpress贵金属插件
  • 设计电子商务网站呼和浩特做网站公司
  • 含关键词的网站建设软件开发工程师招聘简章
  • liferay做网站好吗会员管理系统功能
  • 潍坊网站空间刷数据网站怎么推广
  • 旅游微网站分销wordpress+导入+媒体
  • 做链家房产的网站怎么做的商城网站建设 数商云