Added get_next_double_click() to the image_ex example.

This commit is contained in:
Davis King 2013-03-03 12:46:07 -05:00
parent 96b03e7065
commit a3b6df3ef3

View File

@ -69,9 +69,19 @@ int main(int argc, char** argv)
// also make a window to display the original image
image_window my_window2(img, "Original Image");
// Sometimes you want to get input from the user about which pixels are important
// for some task. You can do this easily by trapping user clicks as shown below.
// This loop executes every time the user double clicks on some image pixel and it
// will terminate once the user closes the window.
point p;
while (my_window.get_next_double_click(p))
{
cout << "User double clicked on pixel: " << p << endl;
cout << "edge pixel value at this location is: " << (int)edge_image[p.y()][p.x()] << endl;
}
// wait until the user closes the windows before we let the program
// terminate.
my_window.wait_until_closed();
win_hot.wait_until_closed();
my_window2.wait_until_closed();
}