Is there any method in Opencv using which when we click on a particular location of an image, it gives pixel location as well as B,G,R values. Thank You!
Asked
Active
Viewed 131 times
-1
-
Sir I am new to opencv. Just started a few days back. So trying to learn these simple things. Please help. Thanks – Navdeep Jul 24 '14 at 15:51
-
Also I know how to access each pixel programmatically but once the image is displayed, how do we get these values on the displayed image by clicking on the image is not known to me. – Navdeep Jul 24 '14 at 15:52
-
http://docs.opencv.org/modules/highgui/doc/user_interface.html#setmousecallback – Bull Jul 24 '14 at 16:24
2 Answers
1
There is an answered similar post here.
Basically, you need to use setMouseCallback() and create your own callback function.

Community
- 1
- 1

Radford Parker
- 731
- 4
- 14
0
You can start from here to get the mouse location: http://www.wisegai.com/2012/10/29/using-mouse-callbacks-with-opencv-and-the-cvhighgui-module/ (I don't know in which coordinate system will be the click, i.e. of the window, of the image or of the screen)
And these might help for the second part.
How to read the screen pixels?
Screen Capture Specific Window
In term of coordinates it might have an impact the window frame, you'll have to try or google a little bit further.
-
Since links can go stale, it is best to provide in your answer a summary of what you have linked to – Bull Jul 24 '14 at 16:21