load nearby pixels using mouse
Suppose i have an image and i am at a particular pixel with my mouse [say 0] and i want to take N*N of pixels around it like this:
'0' 1 2
3 4 5
6 7 8
I am trying to cycle through all pixels and am attempting to access 0,1,2, 3,5 6,7,8 and i want to store their values on new array
and if i move with my mouse to a new pixel for example pixel [1] the block will be :
'1' 2 3
4 5 6
7 8 9
and so on
and again i will store the new pixel and it's nearby pixels on the array .. could any one Plz help me how to do this with C++ openCV..