(image_jpg:4375): dbind-WARNING **: 07:21:13.220: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-yn8aXVkGWT: Connection refused

I was working on the openCV course. While running a program, i can across the following error in the web shell. I also want to mention that the program works exactly as intended. Has anyone else come across similar warnings?


(image_jpg:4375): dbind-WARNING **: 07:21:13.220: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-yn8aXVkGWT: Connection refused

So I understand you are getting this Warning message, but the program works properly anyways? Where are you getting it exactly?

I was working on unit 2, OpenCV course, and ran the below program when the error came up. The weird thing is, now, when I logged back in and ran the program again, it was error free.

#!/usr/bin/env python

import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import cv2

class ShowingImage(object):

    def __init__(self):

        self.image_sub = rospy.Subscriber("/camera/rgb/image_raw",Image,self.camera_callback)
        self.bridge_object = CvBridge()
        

    def camera_callback(self,data):
        try:
            # We select bgr8 because its the OpenCV encoding by default
            self.cv_image = self.bridge_object.imgmsg_to_cv2(data, desired_encoding="bgr8")
        except CvBridgeError as e:
            print(e)
        
        cv2.imshow('image',self.cv_image)
        # Take picture once 

        cv2.waitKey(1)
    def show_img(self):
        Image_jpg=cv2.imread('/home/user/catkin_ws/src/opencv_for_robotics_images/Unit_2/Course_images/test_image_1.jpg')
        cv2.imshow('image_jpg',Image_jpg)

    def take_picture(self):
        status=cv2.imwrite('drone_image.jpg',self.cv_image)




if __name__=="__main__":
    rospy.init_node("example1_node")
    ShowingImage_obj=ShowingImage()
    ShowingImage_obj.show_img()
    ShowingImage_obj.take_picture()
    rospy.spin()

I happened again, this time i was running the "- Solution for Exercise 2.5 - program, from Unit 2,OpenCV as below and error showed as follows:


(Original:2322): dbind-WARNING **: 10:59:25.996: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-pl0QUsUHXl: Connection refused

The program:

#!/usr/bin/env python

import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import cv2
import numpy as np


class ColorFilter(object):

    def __init__(self):
    
        self.image_sub = rospy.Subscriber("/camera/rgb/image_raw",Image,self.camera_callback)
        self.bridge_object = CvBridge()

    def camera_callback(self,data):
        try:
            # We select bgr8 because its the OpenCV encoding by default
            cv_image = self.bridge_object.imgmsg_to_cv2(data, desired_encoding="bgr8")
        except CvBridgeError as e:
            print(e)
        
            
        #image = cv2.imread(example_path)
        #I resized the image so it can be easier to work with
        image = cv2.resize(cv_image,(300,300))

        #Once we read the image we need to change the color space to HSV
        hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)

        #Hsv limits are defined
        #here is where you define the range of the color you are looking for
        #each value of the vector corresponds to the H,S & V values respectively
        min_green = np.array([40,50,50])
        max_green = np.array([60,255,255])

        min_red = np.array([0,45,142])
        max_red = np.array([10,255,255])

        min_blue = np.array([100,50,50])
        max_blue = np.array([120,255,255])


        #This is the actual color detection 
        #Here we will create a mask that contains only the colors defined in your limits
        #This mask has only one dimention, so its black and white }
        mask_g = cv2.inRange(hsv, min_green, max_green)
        mask_r = cv2.inRange(hsv, min_red, max_red)
        mask_b = cv2.inRange(hsv, min_blue, max_blue)

        #We use the mask with the original image to get the colored post-processed image
        res_b = cv2.bitwise_and(image, image, mask= mask_b)
        res_g = cv2.bitwise_and(image,image, mask= mask_g)
        res_r = cv2.bitwise_and(image,image, mask= mask_r)

        cv2.imshow('Original',image)
        cv2.imshow('Green',res_g)
        cv2.imshow('Red',res_r)
        cv2.imshow('Blue',res_b)
        cv2.waitKey(1)



def main():
    color_filter_object = ColorFilter()
    rospy.init_node('color_filter_node', anonymous=True)
    try:
        rospy.spin()
    except KeyboardInterrupt:
        print("Shutting down")
    cv2.destroyAllWindows()

if __name__ == '__main__':
    main()

If it’s not stopping your program from working properly, please ignore it.

This topic was automatically closed after 20 hours. New replies are no longer allowed.