1 | initial version |
Here's the solution for Linux. You need to use the Xlib library:
#include <X11/Xlib.h>
int main(int argc, char *argv[])
{
bool hasgui=true;
Display *display;
display=XOpenDisplay(NULL);
if(!display)
hasgui=false;
else XCloseDisplay(display);
//... your code here...
if(hasgui) imshow("Yipee",myimage");
}
You need to install xlib11-xcb-dev package (on ubuntu/debian) and link your program to Xlib (-lxlib)
I don't know for Windows, if it can run without graphical interface (even if there is no screen attached).
2 | No.2 Revision |
Here's the solution for Linux. You need to use the Xlib library:
#include <X11/Xlib.h>
int main(int argc, char *argv[])
{
bool hasgui=true;
Display *display;
display=XOpenDisplay(NULL);
if(!display)
hasgui=false;
else XCloseDisplay(display);
//... your code here...
if(hasgui) imshow("Yipee",myimage");
else imwrite( "output.jpg", image );
return 0;
}
You need to install xlib11-xcb-dev package (on ubuntu/debian) and link your program to Xlib (-lxlib)
I don't know for Windows, if it can run without graphical interface (even if there is no screen attached).
3 | No.3 Revision |
Here's the solution for Linux. You need to use the Xlib library:
#include <X11/Xlib.h>
int main(int argc, char *argv[])
{
bool hasgui=true;
Display *display;
display=XOpenDisplay(NULL);
if(!display)
hasgui=false;
else XCloseDisplay(display);
//... your code here...
if(hasgui) imshow("Yipee",myimage");
imshow("Yipee", image");
else imwrite( "output.jpg", image );
return 0;
}
You need to install xlib11-xcb-dev package (on ubuntu/debian) and link your program to Xlib (-lxlib)
I don't know for Windows, if it can run without graphical interface (even if there is no screen attached).
4 | No.4 Revision |
Here's the solution for Linux. Linux. You need to use the Xlib Xlib library:
#include <X11/Xlib.h>
int main(int argc, char *argv[])
{
bool hasgui=true;
Display *display;
display=XOpenDisplay(NULL);
if(!display)
hasgui=false;
else XCloseDisplay(display);
//... your code here...
if(hasgui) imshow("Yipee", image");
else imwrite( "output.jpg", image );
return 0;
}
You need to install xlib11-xcb-dev xlib11-xcb-dev
package (on ubuntu/debian) and link your program to Xlib (-lxlib)libx11 (-lx11
)
I don't know for Windows, if it can run without graphical interface (even if there is no screen attached).
5 | No.5 Revision |
Here's the solution for Linux. You need to use the Xlib library:
#include <X11/Xlib.h>
int main(int argc, char *argv[])
{
bool hasgui=true;
Display *display;
display=XOpenDisplay(NULL);
if(!display)
hasgui=false;
else XCloseDisplay(display);
//... your code here...
if(hasgui) imshow("Yipee", image");
else imwrite( "output.jpg", image );
return 0;
}
You need to install xlib11-xcb-dev
package (on ubuntu/debian) and link your program to libx11 (-lx11
)
I don't know for Windows, if it can run without graphical interface (even if there is no screen attached).attached) - but probably there is no simple access to low-level features. Maybe you can try to query screen resolution or something similar to see if there's a screen.
6 | No.6 Revision |
Here's the solution for Linux. You need to use the Xlib library:
#include <X11/Xlib.h>
int main(int argc, char *argv[])
{
bool hasgui=true;
Display *display;
display=XOpenDisplay(NULL);
if(!display)
hasgui=false;
else XCloseDisplay(display);
//... your code here...
if(hasgui) imshow("Yipee", image");
else imwrite( "output.jpg", image );
return 0;
}
You need to install xlib11-xcb-dev
package (on ubuntu/debian) and link your program to libx11 (-lx11
)
I don't know for Windows, Windows, if it can run without graphical interface (even if there is no screen attached) - but probably there is no simple access to low-level features. Maybe you can try to query screen resolution or something similar to see if there's a screen.screen. I have no idea how to deal with this case.