1 module dcv.example.plot; 2 3 /** 4 * Image plotting example using dcv library. 5 */ 6 7 import std.stdio; 8 9 import dcv.core; 10 import dcv.io; 11 import dcv.imgproc; 12 import dcv.plot.figure; 13 14 void main(string[] args) 15 { 16 string path = (args.length == 2) ? args[1] : "../data/lena.png"; 17 18 Image image = imread(path); 19 20 if (image is null) 21 { 22 writeln("Failed reading image at path: ", path); 23 return; 24 } 25 26 immutable winStr = "DCV image"; 27 28 image.imshow(winStr).setCursorCallback((Figure figure, double x, double y) { 29 writeln("Mouse moved to: ", [x, y]); 30 }).setMouseCallback((Figure figure, int button, int scancode, int mods) { 31 writeln("Mouse clicked: ", [button, scancode, mods]); 32 }); 33 34 int c = waitKey(); 35 36 if (c) 37 writeln("Character input: ", cast(char)c); 38 }