sorry for late reply, my hardware wrecked due to sd card corruption and i was busy with that.
i succeeded to run the program, the problem solved when i ran it from command line(instead of clicking on it and choosing execute in terminal).
i added two more line to extract canny edges and that worked too. then i try to add trackbar to control canny parameters but i faced the same problem. it works nice in vs2010 in local computer but on the raspberry pi 2 i have this errors:
HIGHGUI ERROR: V4L: Property <unknown property string>(6) not supported by device
(lines:2929): GLib-GObject-WARNING **: Attempt to add property GtkSettings::gtk-label-select-on-focus after class was initialised
Segmentation fault