Get a specific pixel coordinates where your mouse on (cc)

  1. #include <cv.h>
  2. #include <highgui.h>
  3. #include <stdio.h>
  4. IplImage* src=0;
  5. void on_mouse( int event, int x, int y, int flags, void* ustc)
  6. {
  7. CvFont font;
  8. cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 0.5, 0.5, 0, 1, CV_AA);
  9. if( event == CV_EVENT_LBUTTONDOWN )
  10. {
  11. CvPoint pt = cvPoint(x,y);
  12. char temp[16];
  13. sprintf(temp,"(%d,%d)",pt.x,pt.y);
  14. cvPutText(src,temp, pt, &font, cvScalar(255, 255, 255, 0));
  15. cvCircle( src, pt, 2,cvScalar(255,0,0,0) ,CV_FILLED, CV_AA, 0 );
  16. cvShowImage( "src", src );
  17. }
  18. }
  19. int main()
  20. {
  21. src=cvLoadImage("lena.jpg",1);
  22. cvNamedWindow("src",1);
  23. cvSetMouseCallback( "src", on_mouse, 0 );
  24. cvShowImage("src",src);
  25. cvWaitKey(0);
  26. cvDestroyAllWindows();
  27. cvReleaseImage(&src);
  28. return 0;
  29. }
时间: 2024-10-13 07:03:33

Get a specific pixel coordinates where your mouse on (cc)的相关文章

Getting the pixel coordinates of text or ticks in matplotlib

The exact pixel coordinates of title, labels, legends or ticks are important information for the training data of deep learning. import numpy as np import matplotlib.pyplot as plt plt.plot([1,2],label="first_image") plt.plot([2,1],label="se

Codeforces B. Mouse Hunt(强连通分解缩点)

题目描述: Mouse Hunt time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80%of applicants a

UnderStand Perspective Rasterization, SV_POSITION to Pixel, SV mean Systems Value

Shader "UnderStandPRR" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 100 Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "Un

In-cell触摸面板“Pixel Eyes”进入第2阶段

1. 前言 本文将介绍亚洲最大的显示器国际会议"22th International Display Workshops(IDW'15)"上关于触摸面板的最新主题.分别介绍支撑内置型(In-cell及On-cell)触摸面板与立体(3D)触摸面板,以及触摸面板的技术. 2. In-cell/On-cell触摸面板 2.1 进化的"Pixel Eyes" 日本显示器(JDI)以"Newly Developed 5.5-in. WQHD Display wit

【转】像素 Pixel (Picture Element)

原文链接:https://blog.csdn.net/zssureqh/article/details/78768942 1.像素Pixel 讲到概念,首选Wiki百科.当然我说的是英文版Pixel Wiki,中文版中的大多数词条真是不敢苟同.这里请允许我先摘录英文Wiki中对Pixel定义的原文: In digital imaging, a pixel, pel, dots, or picture element is a physical point in a raster image, o

Image Retrieval Using Customized Bag of Features

This example shows how to create a Content Based Image Retrieval (CBIR) system using a customized bag-of-features workflow. Introduction Content Based Image Retrieval (CBIR) systems are used to find images that are visually similar to a query image.

Document Object Model (DOM) Level 3 Events Specification

Document Object Model (DOM) Level 3 Events Specification W3C Working Draft 25 September 2014 This version: http://www.w3.org/TR/2014/WD-DOM-Level-3-Events-20140925/ Latest published version: http://www.w3.org/TR/DOM-Level-3-Events/ Latest editor's dr

《Temporal AA , SMAA and MSAA》

Temporal AA Temporal AA主要是为了修复场景帧率小于运动物体运动速度的锯齿问题,当帧率太低时候,运动的物体就会一卡一卡,为了避免这种造成的锯齿,原理上帧率刷新速度应该大于两倍运动速度才行.TXAA就是为了修复这种情况.比如高速旋转的轮子用这种AA就会有很好的效果. 伪代码: For each image frame: For each object in the frame: Calculate the temporal transformation function for

unity初探之黑暗之光(2)

unity初探之黑暗之光(2) 一.设置角色跟随鼠标点击移动 思路:使用charactercollider的SimpleMove方法来控制角色的移动.通过摄像机的射线投射到地面,通过屏幕上的一个点也就是鼠标单击的点.该射线与地面发生碰撞返回发生碰撞的点,然后让角色转向该点,开始移动.当移动到一定范围时停止移动. 使用到的方法: Camera.ScreenPointToRay 屏幕位置转射线 function ScreenPointToRay (position : Vector3) : Ray