Ubuntu: glib Error while creating new windows via OpenCV

asked 2015-08-31 06:31:25 -0500

Ravi gravatar image

I am trying to write a program to display an Image using OpenCV library. The code compiles fine. But when I execute the code it gives some error.

I have posted my code and the error message also. This error comes only on displaying any image on any new window. If I only read the Image and don't create any window then there is no error. Please suggest me ways to resolve this.

My Code Is:

#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

#include <iostream>

using namespace cv;
using namespace std;

int main(  )
   Mat img = imread("/home/ravi/Desktop/index.jpg", CV_LOAD_IMAGE_UNCHANGED); 
   namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); 
return 0;

Error Message:

(MyWindow:4496): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(MyWindow:4496): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(MyWindow:4496): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

System Information

root@ravi-LINUX:/home/ravi/Desktop/CV# uname -a 
Linux ravi-LINUX 3.13.0-62-generic #102-Ubuntu SMP Tue Aug 11 14:28:35 UTC 2015 i686 i686 i686 GNU/Linux

root@ravi-LINUX:/home/ravi/Desktop/CV# uname -r 


root@ravi-LINUX:/home/ravi/Desktop/CV# sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version.
edit retag flag offensive close merge delete


Interesting... in my case it is working. What linux? What openCV?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-08-31 07:23:05 -0500 )edit