opencv_tutorials_t2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
opencv_tutorials_t2 [2016/06/06 15:25] – joaomatos | opencv_tutorials_t2 [2017/05/13 17:04] (current) – [Understanding the Code] acater | ||
---|---|---|---|
Line 7: | Line 7: | ||
{{:: | {{:: | ||
- | {{ : | + | |
---- | ---- | ||
- | ===== Code ===== | + | ===== Pixel Operations |
+ | {{ : | ||
< | < | ||
Line 25: | Line 26: | ||
Mat image; | Mat image; | ||
- | //function to get the pixel RGB value at the given y row and x column. | + | //function to get the pixel RGB value at the given y column |
static void onMouse(int event, int x, int y, int f, void*) { | static void onMouse(int event, int x, int y, int f, void*) { | ||
Line 50: | Line 51: | ||
imshow(" | imshow(" | ||
- | //use function setMouseCallback with our onMouse function to get the piexel | + | //use function setMouseCallback with our onMouse function to get the pixel properties |
//on the mouse pointer location | //on the mouse pointer location | ||
setMouseCallback(" | setMouseCallback(" | ||
Line 67: | Line 68: | ||
< | < | ||
- | //function to get the pixel RGB value at the given y row and x column. | + | //function to get the pixel RGB value at the given y column |
static void onMouse(int event, int x, int y, int f, void*) { | static void onMouse(int event, int x, int y, int f, void*) { | ||
Line 81: | Line 82: | ||
</ | </ | ||
- | We can define a function to be called on the main program to get the RGB values (On OpenCV we always read BGR ) and the pixel' | + | We can define a function to be called on the main program to get the RGB values (On OpenCV we always read BGR ) and the pixel' |
Line 94: | Line 95: | ||
On the main program we call our onMouse function using the setMouseCallback . It will set the mouse handler for the first argument window (which we opened using the imread function ). On this case we don't set any event (just call if a certain mouse button is pressed ). If you want to call the function just in specific cases , you can find an example [[http:// | On the main program we call our onMouse function using the setMouseCallback . It will set the mouse handler for the first argument window (which we opened using the imread function ). On this case we don't set any event (just call if a certain mouse button is pressed ). If you want to call the function just in specific cases , you can find an example [[http:// | ||
+ | \\ | ||
+ | \\ | ||
+ | The video below will demonstrate the program in real time. | ||
+ | {{youtube> |
opencv_tutorials_t2.1465251945.txt.gz · Last modified: by joaomatos