I have got an error :
Gtk-WARNING **: cannot open display:
Below is the simple image display program in opencv using C++ and in raspberry pi 3 Model B
I understood " Imshow " function which create a window to display image in GUI will not work in terminal
- I am using headless connection (with LAN connection - SSH through Putty, raaspberry pi desktop access through VNC )
Code:
#include<opencv2/highgui/highgui.hpp>
using namespace cv ;
int main() {
Mat img = imread("/home/USER/Pictures/python.jpg",CV_LOAD_IMAGE_COLOR);
imshow("opencvtest",img);
waitKey(0);
return 0;
}
Getting the error:
$ g++ -ggdb pkg-config --cflags opencv -o basename opencvtest.cpp .cpp opencvtest.cpp pkg-config --libs opencv
$ ./opencvtest
" (opencvtest:1927): Gtk-WARNING **: cannot open display"
Just help me running a simple program and let me know how can i achieve this . I am newbie to raspberry pi .
Thanks Atila